From aa224134849b97c487618a860be1a79194ed7327 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 17 Nov 2011 12:04:58 +0100 Subject: [PATCH] Adapt watcher for ENABLE_CONFD If confd is disabled, do not automatically restart it. Furthermore, we can't run maintenance actions if it is disabled so log a warning. Note that I haven't completely disabled the NodeMaintenance class with ENABLE_CONFD = False because I think they are at two different levels (e.g. we might have other maintenance actions done even with confd disabled). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/watcher/__init__.py | 3 ++- lib/watcher/nodemaint.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/watcher/__init__.py b/lib/watcher/__init__.py index b7efac391..915dea031 100644 --- a/lib/watcher/__init__.py +++ b/lib/watcher/__init__.py @@ -92,7 +92,8 @@ def StartNodeDaemons(): # on master or not, try to start the node daemon utils.EnsureDaemon(constants.NODED) # start confd as well. On non candidates it will be in disabled mode. - utils.EnsureDaemon(constants.CONFD) + if constants.ENABLE_CONFD: + utils.EnsureDaemon(constants.CONFD) def RunWatcherHooks(): diff --git a/lib/watcher/nodemaint.py b/lib/watcher/nodemaint.py index 33be4f13a..6cb2a48de 100644 --- a/lib/watcher/nodemaint.py +++ b/lib/watcher/nodemaint.py @@ -130,6 +130,10 @@ class NodeMaintenance(object): """Check node status versus cluster desired state. """ + if not constants.ENABLE_CONFD: + logging.warning("Confd use not enabled, cannot do maintenance") + return + my_name = netutils.Hostname.GetSysName() req = \ confd.client.ConfdClientRequest(type=constants.CONFD_REQ_NODE_ROLE_BYNAME, -- GitLab