From 59e13fd1f37b0d55a0e06c7dc3e40ddd138e83e3 Mon Sep 17 00:00:00 2001 From: Kevin_Zheng Date: Fri, 23 Dec 2016 14:54:00 +0800 Subject: [PATCH] Should use glanceclient to get images Getting images from Novaclient is refered as proxy API and was deprecated to use in nova. We should use Glanceclient to get images instead. Closes-bug: #1655516 Change-Id: Ie7d89e857d149e11b3c9b44c980b0be5cb0cc35f --- watcher/common/nova_helper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/watcher/common/nova_helper.py b/watcher/common/nova_helper.py index 792e150fb..860a9ff9a 100644 --- a/watcher/common/nova_helper.py +++ b/watcher/common/nova_helper.py @@ -23,6 +23,7 @@ import time from oslo_log import log import cinderclient.exceptions as ciexceptions +import glanceclient.exc as glexceptions import novaclient.exceptions as nvexceptions from watcher.common import clients @@ -142,7 +143,7 @@ class NovaHelper(object): # We'll use the same name for the new instance. imagedict = getattr(instance, "image") image_id = imagedict["id"] - image = self.nova.images.get(image_id) + image = self.glance.images.get(image_id) new_image_name = getattr(image, "name") instance_name = getattr(instance, "name") @@ -575,8 +576,8 @@ class NovaHelper(object): return try: - image = self.nova.images.get(image_id) - except nvexceptions.NotFound: + image = self.glance.images.get(image_id) + except glexceptions.NotFound: LOG.debug("Image '%s' not found " % image_id) return