From d3b17d14036c109e065cf112e98efea878874ff2 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 2 Oct 2015 16:05:06 -0700 Subject: [PATCH] Fix create_image_snapshot This method from novaclient returns an image id, not an object as was apparently assumed. Before returning, perform an image lookup so that we can return a Bunch() object of the image. Note that if the provider does not immediately make an image available for lookups, this will fail and the user will have no record of the image id. Notably, because it worked with the image_id until the image was built, nodepool was not suceptible to this problem. I am unsure whether there are any clouds that might behave in this way. However, this code matches what we do in shade with servers. Change-Id: Icaff5d8e66a2458817fcbced16014efbc5ff33b8 --- shade/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/shade/__init__.py b/shade/__init__.py index b5aab5dcc..3bd77cad3 100644 --- a/shade/__init__.py +++ b/shade/__init__.py @@ -1408,11 +1408,9 @@ class OpenStackCloud(object): return None def create_image_snapshot(self, name, server, **metadata): - image = self.manager.submitTask(_tasks.ImageSnapshotCreate( - image_name=name, server=server, metadata=metadata)) - if image: - return meta.obj_to_dict(image) - return None + image_id = str(self.manager.submitTask(_tasks.ImageSnapshotCreate( + image_name=name, server=server, metadata=metadata))) + return self.get_image(image_id) def delete_image(self, name_or_id, wait=False, timeout=3600): image = self.get_image(name_or_id)