From 9411474b18589f310df55db652076b951c206a99 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 4 Feb 2013 14:34:33 +0100 Subject: [PATCH] Fix Haskell log file naming after virtual cluster changes Commit 3329f4de changed the Haskell log file from constants to functions, but introduced a bug: it uses now the daemon name instead of the correct log file, which means "ganeti-confd.log" instead of "conf-daemon.log". In order to fix this, we need to abstract the log file base (in constants.py) into a separate set of constants, so that we can reuse it in the Haskell code. This fixes issue 343. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/constants.py | 14 +++++++++----- src/Ganeti/Runtime.hs | 11 +++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/constants.py b/lib/constants.py index 4e04dff4f..b99b12c4d 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -166,13 +166,17 @@ DEFAULT_RAPI_PORT = DAEMONS_PORTS[RAPI][1] FIRST_DRBD_PORT = 11000 LAST_DRBD_PORT = 14999 -DAEMONS_LOGFILES = { - NODED: pathutils.GetLogFilename("node-daemon"), - CONFD: pathutils.GetLogFilename("conf-daemon"), - RAPI: pathutils.GetLogFilename("rapi-daemon"), - MASTERD: pathutils.GetLogFilename("master-daemon"), +DAEMONS_LOGBASE = { + NODED: "node-daemon", + CONFD: "conf-daemon", + RAPI: "rapi-daemon", + MASTERD: "master-daemon", } +DAEMONS_LOGFILES = \ + dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon])) + for daemon in DAEMONS_LOGBASE) + DEV_CONSOLE = "/dev/console" PROC_MOUNTS = "/proc/mounts" diff --git a/src/Ganeti/Runtime.hs b/src/Ganeti/Runtime.hs index 2ebef2e35..33f114cdb 100644 --- a/src/Ganeti/Runtime.hs +++ b/src/Ganeti/Runtime.hs @@ -4,7 +4,7 @@ {- -Copyright (C) 2011, 2012 Google Inc. +Copyright (C) 2011, 2012, 2013 Google Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,6 +75,13 @@ daemonName GanetiNoded = C.noded daemonName GanetiRapi = C.rapi daemonName GanetiConfd = C.confd +-- | Returns the log file base for a daemon. +daemonLogBase :: GanetiDaemon -> String +daemonLogBase GanetiMasterd = C.daemonsLogbaseGanetiMasterd +daemonLogBase GanetiNoded = C.daemonsLogbaseGanetiNoded +daemonLogBase GanetiRapi = C.daemonsLogbaseGanetiRapi +daemonLogBase GanetiConfd = C.daemonsLogbaseGanetiConfd + -- | Returns the configured user name for a daemon. daemonUser :: GanetiDaemon -> String daemonUser GanetiMasterd = C.masterdUser @@ -95,7 +102,7 @@ daemonGroup (ExtraGroup AdminGroup) = C.adminGroup daemonLogFile :: GanetiDaemon -> IO FilePath daemonLogFile daemon = do logDir <- Path.logDir - return $ logDir </> daemonName daemon <.> "log" + return $ logDir </> daemonLogBase daemon <.> "log" -- | Returns the pid file name for a daemon. daemonPidFile :: GanetiDaemon -> IO FilePath -- GitLab