From 9afb67fedd2c08aa6617b4e902e0a36805e44079 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Fri, 27 Feb 2009 17:09:15 +0000
Subject: [PATCH] Use EnsureDirs in KVM as well.

The KVM hypervisor has also code to ensure a list of directories exist.
Substitute it with our new utils function.

Reviewed-by: iustinp
---
 lib/hypervisor/hv_kvm.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index a94aecaaf..50df891a9 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -73,9 +73,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     hv_base.BaseHypervisor.__init__(self)
     # Let's make sure the directories we need exist, even if the RUN_DIR lives
     # in a tmpfs filesystem or has been otherwise wiped out.
-    for mydir in self._DIRS:
-      if not os.path.exists(mydir):
-        os.mkdir(mydir)
+    dirs = [(dir, constants.RUN_DIRS_MODE) for dir in self._DIRS]
+    utils.EnsureDirs(dirs)
 
   def _InstancePidAlive(self, instance_name):
     """Returns the instance pid and pidfile
-- 
GitLab