From c75903ff422515d7370f5a83c8cabf2e5eaca69f Mon Sep 17 00:00:00 2001 From: Sean Chen Date: Wed, 23 Jan 2013 12:12:26 -0800 Subject: VMware Compute Driver Glance improvement blueprint vmware-compute-driver Glance change to fix image download to ESX The current glance code downloads files in a blocking/synchronous manner, the fix improves it to work with ESX glance file reader in a non-blocking manner. This allows ESX glance file reader to read items from the returned queue. Change-Id: I05ab7ac00878aeeea3bbcd7546b05398f2630dd3 --- nova/image/glance.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nova/image/glance.py b/nova/image/glance.py index 1a6bba62f..ba64efd9c 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -258,8 +258,8 @@ class GlanceImageService(object): return getattr(image_meta, 'direct_url', None) - def download(self, context, image_id, data): - """Calls out to Glance for metadata and data and writes data.""" + def download(self, context, image_id, data=None): + """Calls out to Glance for data and writes data.""" if 'file' in CONF.allowed_direct_url_schemes: location = self.get_location(context, image_id) o = urlparse.urlparse(location) @@ -277,8 +277,11 @@ class GlanceImageService(object): except Exception: _reraise_translated_image_exception(image_id) - for chunk in image_chunks: - data.write(chunk) + if data is None: + return image_chunks + else: + for chunk in image_chunks: + data.write(chunk) def create(self, context, image_meta, data=None): """Store the image data and return the new image object.""" -- cgit