Dan Kenigsberg has uploaded a new change for review. Change subject: pep8ize vdsm/vdsm entry point ......................................................................
pep8ize vdsm/vdsm entry point Change-Id: Ia8c20b5dad7bf502e2862db14d6062ddc239ca3c Signed-off-by: Dan Kenigsberg <[email protected]> --- M Makefile.am M vdsm/vdsm 2 files changed, 24 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/8026/1 diff --git a/Makefile.am b/Makefile.am index d13b2fb..b17f4c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -95,6 +95,7 @@ vdsm/supervdsm.py \ vdsm/supervdsmServer.py \ vdsm/tc.py \ + vdsm/vdsm \ vdsm_cli \ vdsm_hooks/fileinject/before_vm_start.py \ vdsm_hooks/promisc/after_vm_start.py \ diff --git a/vdsm/vdsm b/vdsm/vdsm index 5baa254..f2db404 100755 --- a/vdsm/vdsm +++ b/vdsm/vdsm @@ -8,8 +8,13 @@ # LICENSE_GPL_v2 which accompany this distribution. # -import os, sys, getopt, signal -import getpass, pwd, grp +import os +import sys +import getopt +import signal +import getpass +import pwd +import grp import threading import logging from logging import config as lconfig @@ -24,30 +29,36 @@ loggerConfFile = constants.P_VDSM_CONF + 'logger.conf' + def usage(): print "Usage: vdsm [OPTIONS]" print " -h - Display this help message" + def serve_clients(log): cif = None + def sigtermHandler(signum, frame): if cif: cif.prepareForShutdown() + def sigusr1Handler(signum, frame): if cif and cif.irs: - cif.irs.spmStop(cif.irs.getConnectedStoragePoolsList()['poollist'][0]) + cif.irs.spmStop( + cif.irs.getConnectedStoragePoolsList()['poollist'][0]) signal.signal(signal.SIGTERM, sigtermHandler) signal.signal(signal.SIGUSR1, sigusr1Handler) - from clientIF import clientIF # must import after config is read + from clientIF import clientIF # must import after config is read cif = clientIF.getInstance(log) cif.serve() + def run(): lconfig.fileConfig(loggerConfFile) logging.addLevelName(5, 'TRACE') - logging.TRACE = 5 # impolite but helpful + logging.TRACE = 5 # impolite but helpful # Used to debug vdsm. on production machines # vdsmDebugPlugin.py should not exists @@ -59,7 +70,6 @@ # Any other error is an error in the debug # plugin and we would like to print that out. pass - log = logging.getLogger('vds') try: @@ -77,14 +87,17 @@ except: log.error("Exception raised", exc_info=True) - log.info("VDSM main thread ended. Waiting for %d other threads..." % (threading.activeCount() - 1)) + log.info("VDSM main thread ended. Waiting for %d other threads..." % + (threading.activeCount() - 1)) for t in threading.enumerate(): - if hasattr(t, 'stop'): t.stop() + if hasattr(t, 'stop'): + t.stop() log.info(str(t)) + def parse_args(): opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) - for o,v in opts: + for o, v in opts: o = o.lower() if o == "-h" or o == "--help": usage() @@ -94,6 +107,7 @@ usage() sys.exit(1) + def __assertVdsmUser(): username = getpass.getuser() assert username == constants.VDSM_USER, ( -- To view, visit http://gerrit.ovirt.org/8026 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia8c20b5dad7bf502e2862db14d6062ddc239ca3c Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
