From 5cfd8ce686f8b539d01a3e7e009e7d5a18b8228f Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Fri, 23 Jun 2017 05:11:31 +0000 Subject: Use glance to list images 1. Images list is not supported by novaclient 8.0.0 2. It moves images list out of nova and into glance Change-Id: I2a2d40a2ca3a0cf1ebfb55697b3c58af8748a805 Signed-off-by: Linda Wang --- functest/utils/openstack_snapshot.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'functest/utils/openstack_snapshot.py') diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py index 233c316a..c6c1615a 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} @@ -136,6 +136,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,7 +145,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)) -- cgit 1.2.3-korg