aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/dha_adapters/libvirt_adapter.py
diff options
context:
space:
mode:
authorPeter Barabas <peter.barabas@ericsson.com>2015-12-08 13:05:57 +0100
committerPeter Barabas <peter.barabas@ericsson.com>2015-12-08 13:05:57 +0100
commitfaecd53622b233f72961ce626ef70788b8a12562 (patch)
treeb693dfa9b8f5cb07f004cb420a1f7c0aa9c5fd4e /deploy/dha_adapters/libvirt_adapter.py
parent8b7b4f8bde98b05ee68dbed04fa2861bbaaebc22 (diff)
Refactor temporary directory creation
Use Python's tempfile instead of forking a shell for mktemp. Change-Id: Icba442ea08d4098d67fb51575da16e85d4363beb Signed-off-by: Peter Barabas <peter.barabas@ericsson.com>
Diffstat (limited to 'deploy/dha_adapters/libvirt_adapter.py')
-rw-r--r--deploy/dha_adapters/libvirt_adapter.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/deploy/dha_adapters/libvirt_adapter.py b/deploy/dha_adapters/libvirt_adapter.py
index d6a30d75e..c65dab554 100644
--- a/deploy/dha_adapters/libvirt_adapter.py
+++ b/deploy/dha_adapters/libvirt_adapter.py
@@ -10,6 +10,7 @@
from lxml import etree
from hardware_adapter import HardwareAdapter
+import tempfile
from common import (
log,
@@ -60,7 +61,7 @@ class LibvirtAdapter(HardwareAdapter):
def node_set_boot_order(self, node_id, boot_order_list):
boot_order_list = self.translate(boot_order_list)
vm_name = self.get_node_property(node_id, 'libvirtName')
- temp_dir = exec_cmd('mktemp -d')
+ temp_dir = tempfile.mkdtemp()
log('Set boot order %s on Node %s' % (boot_order_list, vm_name))
resp = exec_cmd('virsh dumpxml %s' % vm_name)
xml_dump = etree.fromstring(resp, self.parser)