From 8c37d6183c857c7a7b9a5b7cd2cdaa0299025b36 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 20 Sep 2012 18:49:32 +0200
Subject: [PATCH] daemon-util: Support virtual clusters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GANETI_ROOTDIR contains the root directory for the current β€œvirtual node”.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 daemons/daemon-util.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/daemons/daemon-util.in b/daemons/daemon-util.in
index b754e7f60..9a0b5bc2c 100644
--- a/daemons/daemon-util.in
+++ b/daemons/daemon-util.in
@@ -20,7 +20,8 @@
 
 set -e
 
-defaults_file=@SYSCONFDIR@/default/ganeti
+readonly defaults_file="${GANETI_ROOTDIR}@SYSCONFDIR@/default/ganeti"
+readonly localstatedir="${GANETI_ROOTDIR}@LOCALSTATEDIR@"
 
 # This is a list of all daemons and the order in which they're started. The
 # order is important as there are dependencies between them. On shutdown,
@@ -52,7 +53,7 @@ _ignore_error() {
 }
 
 _daemon_pidfile() {
-  echo "@LOCALSTATEDIR@/run/ganeti/$1.pid"
+  echo "$localstatedir/run/ganeti/$1.pid"
 }
 
 _daemon_executable() {
@@ -81,7 +82,7 @@ _daemon_usergroup() {
 
 # Checks whether the local machine is part of a cluster
 check_config() {
-  local server_pem=@LOCALSTATEDIR@/lib/ganeti/server.pem
+  local server_pem=$localstatedir/lib/ganeti/server.pem
   local fname
 
   for fname in $server_pem; do
-- 
GitLab