From 75afaefc007446f767dcf6b3d8fdb18f514be73c Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 8 Jul 2008 14:42:05 +0000
Subject: [PATCH] Add a top level RUN_GANETI_DIR constant

This patch creates a base RUN_GANETI_DIR and then moves the other run
dir constants to use that (even if just setting BDEV_CACHE_DIR as equal
to it, rather than putting it deeper, for now).

Also we create a constant list of all the subdirs we need in RUN_DIR to
work properly, which we'll use when creating them in ganeti-noded.

Reviewed-by: iustinp
---
 lib/constants.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/constants.py b/lib/constants.py
index de8dd489f..327c8e4ea 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -80,8 +80,12 @@ CONFIG_VERSION = BuildVersion(CONFIG_MAJOR, CONFIG_MINOR, CONFIG_REVISION)
 # file paths
 DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
 RUN_DIR = _autoconf.LOCALSTATEDIR + "/run"
-BDEV_CACHE_DIR = RUN_DIR + "/ganeti"
-DISK_LINKS_DIR = RUN_DIR + "/ganeti/instance-disks"
+RUN_GANETI_DIR = RUN_DIR + "/ganeti"
+BDEV_CACHE_DIR = RUN_GANETI_DIR # TODO(2.0): move deeper
+DISK_LINKS_DIR = RUN_GANETI_DIR + "/instance-disks"
+# keep RUN_GANETI_DIR first here, to make sure all get created when the node
+# daemon is started (this takes care of RUN_DIR being tmpfs)
+SUB_RUN_DIRS = [ RUN_GANETI_DIR, BDEV_CACHE_DIR, DISK_LINKS_DIR ]
 LOCK_DIR = _autoconf.LOCALSTATEDIR + "/lock"
 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
 SSL_CERT_FILE = DATA_DIR + "/server.pem"
-- 
GitLab