diff options
author | Jose Lausuch <jose.lausuch@ericsson.com> | 2017-06-26 10:06:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-06-26 10:06:41 +0000 |
commit | 4252d177e9ccb0e533b74751008d7f8d5ab57840 (patch) | |
tree | ef83382cc610dffb89bd8708b015983ca2c6b0c2 /functest/utils/openstack_snapshot.py | |
parent | c8d5216c01c42f0e090f9b441985f8ebc3eca0ed (diff) | |
parent | 5cfd8ce686f8b539d01a3e7e009e7d5a18b8228f (diff) |
Merge "Use glance to list images"
Diffstat (limited to 'functest/utils/openstack_snapshot.py')
-rwxr-xr-x | functest/utils/openstack_snapshot.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py index a03c5032..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} @@ -137,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" + @@ -145,7 +146,7 @@ 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)) |