From 72ff12082013c1682604e2ffb9e8a06b2714d64e Mon Sep 17 00:00:00 2001
From: Yaniv Bronhaim <ybronhei@redhat.com>
Date: Thu, 17 Jan 2013 09:38:43 +0200
Subject: [PATCH 10/22] 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@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10854
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11133
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
---
vdsm/supervdsm.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py
index 532d5ac..740a93e 100644
--- a/vdsm/supervdsm.py
+++ b/vdsm/supervdsm.py
@@ -35,19 +35,23 @@ _g_singletonSupervdsmInstance = None
_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 = []
--
1.8.1