Change in vdsm[master]: Searching for both py and pyc file to start super vdsm

ybronhei at redhat.com ybronhei at redhat.com
Thu Jan 10 12:02:34 UTC 2013


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Searching for both py and pyc file to start super vdsm
......................................................................

Searching for both py and pyc file to start super vdsm

In oVirt Node we don't keep py files.

Change-Id: I36771ce46f5d00ad8befe33569252bdb8cffeaa1
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M vdsm/supervdsm.py
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/10854/1

diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py
index 44f9b73..6a38076 100644
--- a/vdsm/supervdsm.py
+++ b/vdsm/supervdsm.py
@@ -35,19 +35,23 @@
 _g_singletonSupervdsmInstance_lock = threading.Lock()
 
 
-def __supervdsmServerPath(serverFile):
+def __supervdsmServerPath():
     base = os.path.dirname(__file__)
 
-    serverPath = os.path.join(base, serverFile)
-    if os.path.exists(serverPath):
-        return os.path.abspath(serverPath)
+    # serverFile can be both the py or pyc file. In oVirt node we don't keep
+    # py files. this method looks for one of the two to calculate the absolute
+    # path of supervdsmServer
+    for serverFile in ("supervdsmServer.py", "supervdsmServer.pyc"):
+        serverPath = os.path.join(base, serverFile)
+        if os.path.exists(serverPath):
+            return os.path.abspath(serverPath)
 
     raise RuntimeError("SuperVDSM Server not found")
 
 PIDFILE = os.path.join(constants.P_VDSM_RUN, "svdsm.pid")
 TIMESTAMP = os.path.join(constants.P_VDSM_RUN, "svdsm.time")
 ADDRESS = os.path.join(constants.P_VDSM_RUN, "svdsm.sock")
-SUPERVDSM = __supervdsmServerPath("supervdsmServer.py")
+SUPERVDSM = __supervdsmServerPath()
 
 extraPythonPathList = []
 


--
To view, visit http://gerrit.ovirt.org/10854
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36771ce46f5d00ad8befe33569252bdb8cffeaa1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list