summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorRafi Khardalian <rafi@metacloud.com>2013-01-23 01:55:09 +0000
committerRafi Khardalian <rafi@metacloud.com>2013-01-28 07:10:40 +0000
commite8386a27968f5a53f97681e7caf63b2243b7ed05 (patch)
tree2ae1ad5e787c76ae483c2fb7315a3e67262a35e0 /nova/utils.py
parente1ce3878b951ea491548c129453bb84a77205649 (diff)
downloadnova-e8386a27968f5a53f97681e7caf63b2243b7ed05.tar.gz
nova-e8386a27968f5a53f97681e7caf63b2243b7ed05.tar.xz
nova-e8386a27968f5a53f97681e7caf63b2243b7ed05.zip
Allow users to specify a tmp location via config
Fixes bug 981104 Although the temporary directory used can be controlled via environment variables, this patch provides a way to define it explicitly via a config option. The default value is None, which behaves per the doc below: http://docs.python.org/2/library/tempfile.html#tempfile.tempdir Flags: DocImpact Change-Id: I47b6d8bac734f453c80d541b46086a30e847c859
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 97091e42c..52d4868c9 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -76,6 +76,9 @@ utils_opts = [
default="/etc/nova/rootwrap.conf",
help='Path to the rootwrap configuration file to use for '
'running commands as root'),
+ cfg.StrOpt('tempdir',
+ default=None,
+ help='Explicitly specify the temporary working directory'),
]
CONF = cfg.CONF
CONF.register_opts(monkey_patch_opts)
@@ -1147,6 +1150,7 @@ def temporary_chown(path, owner_uid=None):
@contextlib.contextmanager
def tempdir(**kwargs):
+ tempfile.tempdir = CONF.tempdir
tmpdir = tempfile.mkdtemp(**kwargs)
try:
yield tmpdir