From 195c7f914657e46ce26900311b0ac74df99d8be2 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 8 Jul 2008 14:42:15 +0000
Subject: [PATCH] Create all SUB_RUN_DIRS in ganeti-noded

Rather than just creating BDEV_CACHE_DIR we loop through the
SUB_RUN_DIRS list and create all its childs.

Reviewed-by: iustinp
---
 daemons/ganeti-noded | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
index 27baa1d94..d03b49dc2 100755
--- a/daemons/ganeti-noded
+++ b/daemons/ganeti-noded
@@ -609,20 +609,20 @@ def main():
     print "Cluster configuration incomplete: '%s'" % str(err)
     sys.exit(5)
 
-  # create /var/run/ganeti if not existing, in order to take care of
-  # tmpfs /var/run
-  if not os.path.exists(constants.BDEV_CACHE_DIR):
-    try:
-      os.mkdir(constants.BDEV_CACHE_DIR, 0755)
-    except EnvironmentError, err:
-      if err.errno != errno.EEXIST:
-        print ("Node setup wrong, cannot create directory %s: %s" %
-               (constants.BDEV_CACHE_DIR, err))
-        sys.exit(5)
-  if not os.path.isdir(constants.BDEV_CACHE_DIR):
-    print ("Node setup wrong, %s is not a directory" %
-           constants.BDEV_CACHE_DIR)
-    sys.exit(5)
+  # create the various SUB_RUN_DIRS, if not existing, so that we handle the
+  # situation where RUN_DIR is tmpfs
+  for dir_name in constants.SUB_RUN_DIRS:
+    if not os.path.exists(dir_name):
+      try:
+        os.mkdir(dir_name, 0755)
+      except EnvironmentError, err:
+        if err.errno != errno.EEXIST:
+          print ("Node setup wrong, cannot create directory %s: %s" %
+                 (dir_name, err))
+          sys.exit(5)
+    if not os.path.isdir(dir_name):
+      print ("Node setup wrong, %s is not a directory" % dir_name)
+      sys.exit(5)
 
   # become a daemon
   if options.fork:
-- 
GitLab