From: Bharat Kumar Kobagana Date: Mon, 24 Nov 2014 08:38:26 +0000 (+0530) Subject: Create "image_conversion_dir" before creating temporary file X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c6d58672ed9666cbd9ad0d6454b064d8d05b43cc;p=openstack-build%2Fcinder-build.git Create "image_conversion_dir" before creating temporary file 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 --- diff --git a/cinder/image/image_utils.py b/cinder/image/image_utils.py index 7d0989486..9a56b18ff 100644 --- a/cinder/image/image_utils.py +++ b/cinder/image/image_utils.py @@ -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