summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Chen <xuchenx@gmail.com>2013-01-23 12:12:26 -0800
committerSean Chen <xuchenx@gmail.com>2013-01-24 11:58:02 -0800
commitc75903ff422515d7370f5a83c8cabf2e5eaca69f (patch)
tree028595c851d2bbf3f05c658362607a0bb475d784
parentfefea36baff5f65c56984ae27074e4ad95a3b511 (diff)
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
-rw-r--r--nova/image/glance.py11
1 files 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."""