diff --git a/nova/virt/lxd/driver.py b/nova/virt/lxd/driver.py index ec486ba7..246861db 100644 --- a/nova/virt/lxd/driver.py +++ b/nova/virt/lxd/driver.py @@ -273,8 +273,8 @@ def _sync_glance_image_to_lxd(client, context, image_ref): raise try: - image_file = tempfile.mkstemp()[1] - manifest_file = tempfile.mkstemp()[1] + ifd, image_file = tempfile.mkstemp() + mfd, manifest_file = tempfile.mkstemp() image = IMAGE_API.get(context, image_ref) if image.get('disk_format') not in ACCEPTABLE_IMAGE_FORMATS: @@ -371,6 +371,8 @@ def _sync_glance_image_to_lxd(client, context, image_ref): image.add_alias(image_ref, '') finally: + os.close(ifd) + os.close(mfd) os.unlink(image_file) os.unlink(manifest_file)