diff options
Diffstat (limited to 'functest/utils/openstack_snapshot.py')
-rwxr-xr-x | functest/utils/openstack_snapshot.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py index 233c316a..f4ef751c 100755 --- a/functest/utils/openstack_snapshot.py +++ b/functest/utils/openstack_snapshot.py @@ -48,13 +48,13 @@ def get_instances(nova_client): return {'instances': dic_instances} -def get_images(nova_client): +def get_images(glance_client): logger.debug("Getting images...") dic_images = {} - images = os_utils.get_images(nova_client) - if not (images is None or len(images) == 0): - for image in images: - dic_images.update({getattr(image, 'id'): getattr(image, 'name')}) + images = os_utils.get_images(glance_client) + if images is None: + return -1 + dic_images.update({image.id: image.name for image in images}) return {'images': dic_images} @@ -98,13 +98,14 @@ def get_security_groups(neutron_client): return {'secgroups': dic_secgroups} -def get_floatinips(nova_client): +def get_floatingips(neutron_client): logger.debug("Getting Floating IPs...") dic_floatingips = {} - floatingips = os_utils.get_floating_ips(nova_client) + floatingips = os_utils.get_floating_ips(neutron_client) if not (floatingips is None or len(floatingips) == 0): for floatingip in floatingips: - dic_floatingips.update({floatingip.id: floatingip.ip}) + dic_floatingips.update({floatingip['id']: + floatingip['floating_ip_address']}) return {'floatingips': dic_floatingips} @@ -136,6 +137,7 @@ def main(): neutron_client = os_utils.get_neutron_client() keystone_client = os_utils.get_keystone_client() cinder_client = os_utils.get_cinder_client() + glance_client = os_utils.get_glance_client() if not os_utils.check_credentials(): logger.error("Please source the openrc credentials and run the" + @@ -144,12 +146,12 @@ def main(): snapshot = {} snapshot.update(get_instances(nova_client)) - snapshot.update(get_images(nova_client)) + snapshot.update(get_images(glance_client)) snapshot.update(get_volumes(cinder_client)) snapshot.update(get_networks(neutron_client)) snapshot.update(get_routers(neutron_client)) snapshot.update(get_security_groups(neutron_client)) - snapshot.update(get_floatinips(nova_client)) + snapshot.update(get_floatingips(neutron_client)) snapshot.update(get_users(keystone_client)) snapshot.update(get_tenants(keystone_client)) |