Merge "Fix file descriptors leak which as result disk usage leak produced by wrong use of python tempfile.mkstemp"
This commit is contained in:
commit
b3b4555b09
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue