Commit a8828704 authored by Michele Tartara's avatar Michele Tartara
Browse files

Add infrastructure for allowing additional logfiles



Some daemons will need more than the single logfile that is currently
allowed. This patch introduces the infrastructure to allow this.
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 14013e5d
......@@ -158,6 +158,13 @@ CONFD = "ganeti-confd"
RAPI = "ganeti-rapi"
MASTERD = "ganeti-masterd"
DAEMONS = compat.UniqueFrozenset([
NODED,
CONFD,
RAPI,
MASTERD,
])
DAEMONS_PORTS = {
# daemon-name: ("proto", "default-port")
NODED: ("tcp", 1811),
......@@ -183,6 +190,26 @@ DAEMONS_LOGFILES = \
dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon]))
for daemon in DAEMONS_LOGBASE)
# Some daemons might require more than one logfile.
# These are the only valid reasons for having an extra logfile
EXTRA_LOGREASON_ACCESS = "access"
EXTRA_LOGREASON_ERROR = "error"
VALID_EXTRA_LOGREASONS = compat.UniqueFrozenset([
EXTRA_LOGREASON_ACCESS,
EXTRA_LOGREASON_ERROR,
])
# These are the extra logfiles, grouped by daemon
DAEMONS_EXTRA_LOGBASE = {}
DAEMONS_EXTRA_LOGFILES = \
dict((daemon, dict((extra,
pathutils.GetLogFilename(DAEMONS_EXTRA_LOGBASE[daemon][extra]))
for extra in DAEMONS_EXTRA_LOGBASE[daemon]))
for daemon in DAEMONS_EXTRA_LOGBASE)
DEV_CONSOLE = "/dev/console"
PROC_MOUNTS = "/proc/mounts"
......
......@@ -98,6 +98,12 @@ class TestConstants(unittest.TestCase):
self.assertTrue(constants.DEFAULT_ENABLED_HYPERVISOR in
constants.HYPER_TYPES)
def testExtraLogfiles(self):
for daemon in constants.DAEMONS_EXTRA_LOGBASE:
self.assertTrue(daemon in constants.DAEMONS)
for log_reason in constants.DAEMONS_EXTRA_LOGBASE[daemon]:
self.assertTrue(log_reason in constants.VALID_EXTRA_LOGREASONS)
class TestExportedNames(unittest.TestCase):
_VALID_NAME_RE = re.compile(r"^[A-Z][A-Z0-9_]+$")
......
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