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
This commit is contained in:
Kevin_Zheng
2016-12-23 14:54:00 +08:00
committed by Zhenyu Zheng
parent dad90b63fd
commit 59e13fd1f3

View File

@@ -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