Hello Zhou Zheng Sheng,
I'd like you to do a code review. Please visit
to review the following change.
Change subject: change of the isRunning function ......................................................................
change of the isRunning function
isRunning() now checks supervdsm pid this not guarantee supervdsmServer really listened and manager framework works right. since ping is call to local manager so it won't take much time. Only ping() can identify whether supervdsm works fine. Change isRunning() to use ping() also eliminate Authentication error usecases: 1.first launch: ping fails because of _svdsm=None, launch supervdsm 2.previous _svdsm: ping fails with Autherror,kill and launch 3.previous svdsm exit:ping fails with socket error,launch 4.call error: raise to caller 5.ping succeed,svdsm killed when callmethod: raise error to caller
Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Signed-off-by:Royce Lvlvroyce@linux.vnet.ibm.com Signed-off-by:Zhou Zheng Shengzhshzhou@linux.vnet.ibm.com --- M tests/superVdsmTests.py M vdsm/supervdsm.py M vdsm/supervdsmServer.py 3 files changed, 24 insertions(+), 79 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/10236/1
diff --git a/tests/superVdsmTests.py b/tests/superVdsmTests.py index 87de66d..57f4de8 100644 --- a/tests/superVdsmTests.py +++ b/tests/superVdsmTests.py @@ -28,7 +28,7 @@ superVdsmCmd = [getNeededPythonPath(), constants.EXT_PYTHON, supervdsm.SUPERVDSM, self._authkey, str(os.getpid()), - self.pidfile, self.timestamp, self.address, + self.pidfile, self.address, str(os.getuid())] misc.execCmd(superVdsmCmd, sync=False, sudo=True) sleep(2) @@ -41,33 +41,24 @@
# temporary values to run temporary svdsm self.pidfd, pidfile = tempfile.mkstemp() - self.timefd, timestamp = tempfile.mkstemp() self.addfd, address = tempfile.mkstemp()
- self._proxy.setIPCPaths(pidfile, timestamp, address) + self._proxy.setIPCPaths(pidfile, address)
def tearDown(self): supervdsm.extraPythonPathList = [] - for fd in (self.pidfd, self.timefd, self.addfd): - os.close(fd) + os.close(self.pidfd) self._proxy.kill() # cleanning old temp files
@MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart) def testIsSuperUp(self): - self._proxy.ping() # this call initiate svdsm - self.assertTrue(self._proxy.isRunning()) + self._proxy.ping() + self.assertTrue(self._proxy.isRunning()) # this call initiate svdsm
@MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart) def testKillSuper(self): self._proxy.ping() self._proxy.kill() - self.assertFalse(self._proxy.isRunning()) + self.assertRaises(AttributeError, self._proxy.isRunning) self._proxy.ping() # Launching vdsm after kill self.assertTrue(self._proxy.isRunning()) - - @MonkeyPatch(supervdsm.SuperVdsmProxy, '_start', monkeyStart) - def testNoPidFile(self): - self._proxy.ping() # svdsm is up - self.assertTrue(self._proxy.isRunning()) - utils.rmFile(self._proxy.timestamp) - self.assertRaises(IOError, self._proxy.isRunning) diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py index 532d5ac..a9bbdf6 100644 --- a/vdsm/supervdsm.py +++ b/vdsm/supervdsm.py @@ -20,13 +20,11 @@ #
import os -from multiprocessing import AuthenticationError from multiprocessing.managers import BaseManager import logging import threading import uuid from time import sleep -from errno import ENOENT, ESRCH
import storage.misc as misc from vdsm import constants, utils @@ -45,7 +43,6 @@ 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")
@@ -66,22 +63,16 @@ callMethod = lambda: \ getattr(self._supervdsmProxy._svdsm, self._funcName)(*args, **kwargs) - if not self._supervdsmProxy.isRunning(): - # getting inside only when svdsm is down. its rare case so we - # don't care that isRunning will run twice - with self._supervdsmProxy.proxyLock: - if not self._supervdsmProxy.isRunning(): - self._supervdsmProxy.launch()
- try: - return callMethod() - # handling internal exception that we raise to identify supervdsm - # validation. only this exception can cause kill! - except AuthenticationError: - with self._supervdsmProxy.proxyLock: + with self._supervdsmProxy.proxyLock: + try: + # make sure supervdsmServer works right + self._supervdsmProxy.isRunning() + except: self._supervdsmProxy.kill() self._supervdsmProxy.launch() - return callMethod() + + return callMethod()
class SuperVdsmProxy(object): @@ -92,25 +83,19 @@
def __init__(self): self.proxyLock = threading.Lock() - self._firstLaunch = True + self.setIPCPaths(PIDFILE, ADDRESS)
- # Declaration of public variables that keep files' names that svdsm - # uses. We need to be able to change these variables so that running - # tests doesn't disturb and already running VDSM on the host. - self.setIPCPaths(PIDFILE, TIMESTAMP, ADDRESS) - - def setIPCPaths(self, pidfile, timestamp, address): + def setIPCPaths(self, pidfile, address): self.pidfile = pidfile - self.timestamp = timestamp self.address = address
def open(self, *args, **kwargs): return self._manager.open(*args, **kwargs)
def _cleanOldFiles(self): - self._log.debug("Cleanning svdsm old files: %s, %s, %s", - self.pidfile, self.timestamp, self.address) - for f in (self.pidfile, self.timestamp, self.address): + self._log.debug("Cleanning svdsm old files: %s, %s", + self.pidfile, self.address) + for f in (self.pidfile, self.address): utils.rmFile(f)
def _start(self): @@ -122,7 +107,7 @@ # permissions to read those files. superVdsmCmd = [constants.EXT_PYTHON, SUPERVDSM, self._authkey, str(os.getpid()), - self.pidfile, self.timestamp, self.address, + self.pidfile, self.address, str(os.getuid())]
misc.execCmd(superVdsmCmd, sync=False, sudo=True) @@ -134,42 +119,15 @@ pid = int(f.read().strip()) misc.execCmd([constants.EXT_KILL, "-9", str(pid)], sudo=True) except Exception: - self._log.error("Could not kill old Super Vdsm %s", - exc_info=True) + self._log.warn("Could not kill old Super Vdsm")
self._cleanOldFiles() self._authkey = None self._manager = None self._svdsm = None - self._firstLaunch = True
def isRunning(self): - try: - with open(self.pidfile, "r") as f: - spid = f.read().strip() - with open(self.timestamp, "r") as f: - createdTime = f.read().strip() - except IOError as e: - # pid file and timestamp file must be exist after first launch, - # otherwise excpetion will be raised to svdsm caller - if e.errno == ENOENT and self._firstLaunch: - return False - else: - raise - - try: - pTime = str(misc.getProcCtime(spid)) - except OSError as e: - if e.errno == ESRCH: - # Means pid is not exist, svdsm was killed - return False - else: - raise - - if pTime == createdTime: - return True - else: - return False + return self._svdsm.ping()
def _connect(self): self._manager = _SuperVdsmManager(address=self.address, @@ -185,7 +143,6 @@ self._svdsm = self._manager.instance()
def launch(self): - self._firstLaunch = False self._start() utils.retry(self._connect, Exception, timeout=60)
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py index 5effd41..8968a82 100755 --- a/vdsm/supervdsmServer.py +++ b/vdsm/supervdsmServer.py @@ -336,15 +336,12 @@ sys.exit(errno.EPERM)
log.debug("Parsing cmd args") - authkey, parentPid, pidfile, timestamp, address, uid = sys.argv[1:] + authkey, parentPid, pidfile, address, uid = sys.argv[1:]
- log.debug("Creating PID and TIMESTAMP files: %s, %s", - pidfile, timestamp) + log.debug("Creating PID:%s", pidfile) spid = os.getpid() with open(pidfile, "w") as f: f.write(str(spid) + "\n") - with open(timestamp, "w") as f: - f.write(str(misc.getProcCtime(spid) + "\n"))
log.debug("Cleaning old socket %s", address) if os.path.exists(address): @@ -369,7 +366,7 @@ servThread.setDaemon(True) servThread.start()
- for f in (address, timestamp, pidfile): + for f in (address, pidfile): chown(f, int(uid), METADATA_GROUP)
log.debug("Started serving super vdsm object")
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: change of the isRunning function ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/475/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: change of the isRunning function ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/440/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: change of the isRunning function ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/440/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/475/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yaniv Bronhaim has posted comments on this change.
Change subject: change of the isRunning function ......................................................................
Patch Set 1: Fails
(2 inline comments)
It fails to call svdsm if you kill the first instance (without calling proxy.kill(), just kill it manually), after killing the instance call to vdsClient getStorageDomainsList and you will see.
Anyways, You to verify if you can perform an action by trying to perform it before, and by trying to perform it you try again and again.. sounds tricky, no?
You need to add more tests for the cases you mentioned in the commit message, it sounds like it cover all cases .
.................................................... File vdsm/supervdsm.py Line 66: Line 67: with self._supervdsmProxy.proxyLock: Line 68: try: Line 69: # make sure supervdsmServer works right Line 70: self._supervdsmProxy.isRunning() dont you get into infinite loop when you call ping here and _svdsm is not None? did you check it? Line 71: except: Line 72: self._supervdsmProxy.kill() Line 73: self._supervdsmProxy.launch() Line 74:
Line 83: Line 84: def __init__(self): Line 85: self.proxyLock = threading.Lock() Line 86: self.setIPCPaths(PIDFILE, ADDRESS) Line 87: i prefer that svdsm will try to kill old instance (by reading its pid from pidfile) and launch new instance on __init__, and not in first call. Line 88: def setIPCPaths(self, pidfile, address): Line 89: self.pidfile = pidfile Line 90: self.address = address Line 91:
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yaniv Bronhaim has posted comments on this change.
Change subject: change of the isRunning function ......................................................................
Patch Set 1: Verified
(1 inline comment)
- still need to add unit tests for each case. - we need to verify that after prepareForShutdown, svdsm dies and initializes new instance properly
.................................................... File vdsm/supervdsm.py Line 66: Line 67: with self._supervdsmProxy.proxyLock: Line 68: try: Line 69: # make sure supervdsmServer works right Line 70: self._supervdsmProxy.isRunning() my mistake. you call to supervdsmServer directly Line 71: except: Line 72: self._supervdsmProxy.kill() Line 73: self._supervdsmProxy.launch() Line 74:
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yaniv Bronhaim has posted comments on this change.
Change subject: change of the isRunning function ......................................................................
Patch Set 1: I would prefer that you didn't submit this
(1 inline comment)
please read my comment about the timestamp usage
.................................................... File vdsm/supervdsm.py Line 131 Line 132 Line 133 Line 134 Line 135 the reason for the timestamp file was to verify that if pid of old svdsm still exist, we want to be sure that no other process got this pid after svdsm died, and it's actually the old instance that we kill.
Otherwise we might kill another process that got this pid after svdsm died.
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: refactor supervdsm proxy call logic ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/609/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: refactor supervdsm proxy call logic ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/574/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: refactor supervdsm proxy call logic ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/574/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/609/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Royce Lv has posted comments on this change.
Change subject: refactor supervdsm proxy call logic ......................................................................
Patch Set 2: Verified
Tested: vdsm killed, vdsm will restart and start new svdsm; supervdsm killed, vdsm restart new supervdsm
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 3:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/576/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 3:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/611/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/611/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/576/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Zhou Zheng Sheng has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 3: (1 inline comment)
.................................................... File tests/superVdsmTests.py Line 71: def testKillSuper(self): Line 72: self._proxy.kill() Line 73: self.assertFalse(self._proxy.isFunctional()) Line 74: self._proxy.launch() # Launching vdsm after kill Line 75: self.assertTrue(self._proxy.isFunctional()) I'd like to see a unit test for re-raising payload exception. In super vdsm server, we can add a new method like,
def raiseExt(self, ext): '''Just for unit test''' raise ext
then add a test like,
def testServerNotAffectedByPayloadException(self): launch the super vdsm server assert the server is functional open self._proxy.pidfile and read the content to a variable "pid"
class PayloadError(Exception): pass self.assertRaises(PayloadError, self._proxy.raiseExt, PayloadError("Simulate an exception inside the called method"))
assert the server is still functional open self._proxy.pidfile again and assert the content is equal to "pid"
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Yaniv Bronhaim has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 3: I would prefer that you didn't submit this
(4 inline comments)
how is it better then current implementation? the split between framework error and call error was handled also in previous version.
not sure if it adds something, but if you and one more will think that this implementation is better or more clear and understandable than the current version i will accept it
.................................................... File vdsm/supervdsm.py Line 72: with self._supervdsmProxy.proxyLock: Line 73: if not self._supervdsmProxy.isFunctional(): Line 74: self._supervdsmProxy.kill() Line 75: self._supervdsmProxy.launch() Line 76: raise shouldn't you call the method again after launch? Line 77: if ex: Line 78: raise ex Line 79: else: Line 80: return ret
Line 127: Line 128: def kill(self): Line 129: try: Line 130: if self._isSvdsmAlive(): Line 131: with open(self.pidfile, "r") as f: you already read it, you can get it from _isSvdsmAlive as a return value Line 132: pid = int(f.read().strip()) Line 133: misc.execCmd([constants.EXT_KILL, "-9", str(pid)], sudo=True) Line 134: except Exception: Line 135: self._log.warn("Could not kill old Super Vdsm %s",
Line 146: spid = f.read().strip() Line 147: with open(self.timestamp, "r") as f: Line 148: createdTime = f.read().strip() Line 149: except IOError as e: Line 150: # pid file and timestamp file must be exist after first launch, you omit the first launch variable.. and i still think it useful. this is my way to distinguish if someone deleted our svdsm files manually, or the files weren't exist before we got here (possible only in first call). Line 151: # otherwise excpetion will be raised to svdsm caller Line 152: if e.errno == ENOENT: Line 153: return False Line 154: else:
.................................................... File vdsm/supervdsmServer.py Line 80: try: Line 81: ret = func(*args, **kwargs) Line 82: except Exception: Line 83: callbackLogger.error("Error in %s", func.__name__, exc_info=True) Line 84: ex = Exception it doesn't keep the exception object.. it should be:
except Exception as e: ex = e Line 85: return (ret, ex) Line 86: Line 87: return wrapper Line 88:
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 4:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/810/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 4:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/844/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 4: Fails
Build Failed
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/810/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/844/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 5:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/817/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 5:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/852/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 5:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/817/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/852/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 6:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/824/ (1/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 6:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/859/ (2/2)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 6:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/824/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/859/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 7:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/866/ (1/3)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 7:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/9/ (2/3)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 7:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/901/ (3/3)
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Patch Set 7: Fails
Build Failed
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/866/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/901/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/9/ : FAILURE
-- To view, visit http://gerrit.ovirt.org/10236 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ib25809d4416f26bc95dc72e7b32b8b2a17a71879 Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Royce Lv lvroyce@linux.vnet.ibm.com Gerrit-Reviewer: Yaniv Bronhaim ybronhei@redhat.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Itamar Heim has abandoned this change.
Change subject: [WIP]normalize startup: seperate supervdsm framework err and function err ......................................................................
Abandoned
supervdsm design changed this - please re-open if relevant
vdsm-patches@lists.fedorahosted.org