From Yaniv Bronhaim <ybron...@redhat.com>:

Yaniv Bronhaim has uploaded a new change for review.

Change subject: Handling fatal fail in supervdsm when log conf is invalid
......................................................................

Handling fatal fail in supervdsm when log conf is invalid

Copying same treatment we use in vdsmd.py when we have a fail in loading
logging conf. Currently implementation tried to use stdout and it fails
when running as systemd service. See bugzilla for more details.

Change-Id: Idb37e6ba92483599dfef57e4e8fb3cc22f9aa016
Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1216880
---
M lib/vdsm/supervdsm_server.py
1 file changed, 12 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/80231/1

diff --git a/lib/vdsm/supervdsm_server.py b/lib/vdsm/supervdsm_server.py
index c4baf8f..df181f1 100644
--- a/lib/vdsm/supervdsm_server.py
+++ b/lib/vdsm/supervdsm_server.py
@@ -38,17 +38,6 @@
 from vdsm.common import time
 from vdsm.common import zombiereaper
 
-
-LOG_CONF_PATH = "/etc/vdsm/svdsm.logger.conf"
-
-try:
-    logging.config.fileConfig(LOG_CONF_PATH, disable_existing_loggers=False)
-except:
-    logging.basicConfig(filename='/dev/stdout', filemode='w+',
-                        level=logging.DEBUG)
-    log = logging.getLogger("SuperVdsm.Server")
-    log.warn("Could not init proper logging", exc_info=True)
-
 from multiprocessing import Pipe, Process
 try:
     from vdsm.gluster import listPublicFunctions
@@ -80,10 +69,22 @@
 _running = True
 
 
+class FatalError(Exception):
+    """ Raised when supervdsm fails to start """
+
+
 class Timeout(RuntimeError):
     pass
 
 
+LOG_CONF_PATH = "/etc/vdsm/svdsm.logger.conf"
+
+try:
+    logging.config.fileConfig(LOG_CONF_PATH, disable_existing_loggers=False)
+except RuntimeError as e:
+    raise FatalError("Cannot configure logging: %s" % e)
+
+
 def logDecorator(func):
     callbackLogger = logging.getLogger("SuperVdsm.ServerCallback")
 


-- 
To view, visit https://gerrit.ovirt.org/80231
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb37e6ba92483599dfef57e4e8fb3cc22f9aa016
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to