Change in vdsm[master]: cleanup: Remove unused pidfile option and argument parsing code

nsoffer at redhat.com nsoffer at redhat.com
Wed Sep 9 22:39:09 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: cleanup: Remove unused pidfile option and argument parsing code
......................................................................

cleanup: Remove unused pidfile option and argument parsing code

Since we move to systemd, we don't need the pidfile option, and since it
is the only option, the argument parsing code and the usage messsage.

Change-Id: I7dcc9f3feea6e3f56cf38d95e6548213cafd817d
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/vdsm
1 file changed, 2 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/45964/1

diff --git a/vdsm/vdsm b/vdsm/vdsm
index a2955ff..80723c7 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -18,7 +18,6 @@
     pthreading.monkey_patch()
 
 import os
-import getopt
 import signal
 import getpass
 import pwd
@@ -57,11 +56,6 @@
 
 class FatalError(Exception):
     """ Raised when vdsm fail to start """
-
-
-def usage():
-    print("Usage:  vdsm [OPTIONS]")
-    print("     -h  - Display this help message")
 
 
 def serve_clients(log):
@@ -119,7 +113,7 @@
         libvirtconnection.stop_event_loop(wait=False)
 
 
-def run(pidfile=None):
+def run():
     try:
         lconfig.fileConfig(loggerConfFile, disable_existing_loggers=False)
     except RuntimeError as e:
@@ -154,12 +148,6 @@
         logging.root.handlers.append(logging.StreamHandler())
         log.handlers.append(logging.StreamHandler())
 
-        pid = str(os.getpid())
-        if pidfile:
-            with open(pidfile, 'w') as f:
-                f.write(pid + "\n")
-            os.chmod(pidfile, 0o664)
-
         sysname, nodename, release, version, machine = os.uname()
         log.info('(PID: %s) I am the actual vdsm %s %s (%s)',
                  pid, dsaversion.raw_version_revision, nodename, release)
@@ -173,24 +161,6 @@
         if hasattr(t, 'stop'):
             t.stop()
         log.info(str(t))
-
-
-def parse_args():
-    argDict = {}
-    opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "pidfile="])
-    for o, v in opts:
-        o = o.lower()
-        if o == "-h" or o == "--help":
-            usage()
-            sys.exit(0)
-        if o == "--pidfile":
-            argDict['pidfile'] = v
-
-    if len(args) >= 1:
-        usage()
-        sys.exit(1)
-
-    return argDict
 
 
 def install_manhole(locals):
@@ -268,8 +238,7 @@
         # environment. So we setpgrp only when run by traditional init system
         # that does not prepare the environment.
         os.setpgrp()
-    argDict = parse_args()
-    run(**argDict)
+    run()
 
 
 if __name__ == '__main__':


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7dcc9f3feea6e3f56cf38d95e6548213cafd817d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list