]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Create "image_conversion_dir" before creating temporary file
authorBharat Kumar Kobagana <bkobagan@redhat.com>
Mon, 24 Nov 2014 08:38:26 +0000 (14:08 +0530)
committerBharat Kumar Kobagana <bkobagan@redhat.com>
Mon, 24 Nov 2014 09:07:28 +0000 (14:37 +0530)
In file "image_utils.py", "create_temporary_file" method is
failing because, CONF.image_conversion_dir folder doesn't exist.

This patch solves the issue by creating image_conversion_dir
directory before calling "create_temporary_file" method.

Change-Id: I546180e0521616fccdaf261d25fd4356d05f0274
Closes-Bug: #1394578

cinder/image/image_utils.py

index 7d0989486a8afe18ccdae711be071d7e6d10a5a0..9a56b18ff19bfd73cd6f806f4eafb36b9cdabd15 100644 (file)
@@ -378,6 +378,10 @@ def coalesce_vhd(vhd_path):
 
 
 def create_temporary_file(*args, **kwargs):
+    if (CONF.image_conversion_dir and not
+            os.path.exists(CONF.image_conversion_dir)):
+        os.makedirs(CONF.image_conversion_dir)
+
     fd, tmp = tempfile.mkstemp(dir=CONF.image_conversion_dir, *args, **kwargs)
     os.close(fd)
     return tmp