Commit 9411474b authored by Iustin Pop's avatar Iustin Pop

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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent f006f110
......@@ -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"
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment