Merge "fix stale libvirt images on download failure. Bug 801412"

This commit is contained in:
Jenkins 2012-02-02 23:14:31 +00:00 committed by Gerrit Code Review
commit 1a88c64535

View File

@ -41,8 +41,12 @@ def fetch(context, image_href, path, _user_id, _project_id):
# checked before we got here.
(image_service, image_id) = nova.image.get_image_service(context,
image_href)
try:
with open(path, "wb") as image_file:
metadata = image_service.get(context, image_id, image_file)
except Exception:
os.unlink(path)
raise
return metadata