diff options
author | Jenkins <jenkins@review.openstack.org> | 2012-02-02 23:14:31 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2012-02-02 23:14:31 +0000 |
commit | 1a88c64535bbf88ccbf1b94fbd01d5bd158885ea (patch) | |
tree | dc1faa2d06b876f9af371ba68541267cccc7d2ce | |
parent | 38399a7333206bfc4385291b1903ae76c9a124f8 (diff) | |
parent | 3db5b1e7099e1c10d557577350dc28e323c70af4 (diff) | |
download | nova-1a88c64535bbf88ccbf1b94fbd01d5bd158885ea.tar.gz nova-1a88c64535bbf88ccbf1b94fbd01d5bd158885ea.tar.xz nova-1a88c64535bbf88ccbf1b94fbd01d5bd158885ea.zip |
Merge "fix stale libvirt images on download failure. Bug 801412"
-rw-r--r-- | nova/virt/images.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/virt/images.py b/nova/virt/images.py index b884e5124..25f968185 100644 --- a/nova/virt/images.py +++ b/nova/virt/images.py @@ -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) - with open(path, "wb") as image_file: - metadata = image_service.get(context, image_id, image_file) + 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 |