Merge "Should use glanceclient to get images"

This commit is contained in:
Jenkins
2017-01-18 10:05:54 +00:00
committed by Gerrit Code Review

View File

@@ -23,6 +23,7 @@ import time
from oslo_log import log from oslo_log import log
import cinderclient.exceptions as ciexceptions import cinderclient.exceptions as ciexceptions
import glanceclient.exc as glexceptions
import novaclient.exceptions as nvexceptions import novaclient.exceptions as nvexceptions
from watcher.common import clients from watcher.common import clients
@@ -142,7 +143,7 @@ class NovaHelper(object):
# We'll use the same name for the new instance. # We'll use the same name for the new instance.
imagedict = getattr(instance, "image") imagedict = getattr(instance, "image")
image_id = imagedict["id"] image_id = imagedict["id"]
image = self.nova.images.get(image_id) image = self.glance.images.get(image_id)
new_image_name = getattr(image, "name") new_image_name = getattr(image, "name")
instance_name = getattr(instance, "name") instance_name = getattr(instance, "name")
@@ -575,8 +576,8 @@ class NovaHelper(object):
return return
try: try:
image = self.nova.images.get(image_id) image = self.glance.images.get(image_id)
except nvexceptions.NotFound: except glexceptions.NotFound:
LOG.debug("Image '%s' not found " % image_id) LOG.debug("Image '%s' not found " % image_id)
return return