Change in vdsm[master]: isRunning didn't check local variable before reading saved d...

ybronhei at redhat.com ybronhei at redhat.com
Sun Dec 30 14:10:00 UTC 2012


Yaniv Bronhaim has uploaded a new change for review.

Change subject: isRunning didn't check local variable before reading saved data
......................................................................

isRunning didn't check local variable before reading saved data

All internal svdsm  files contained last svdsm instance info,
after restart we didn't verify local manager instance before processing
the operation and got AttributeError exception when calling svdsm
manager.

This returns false when _svdsm instance is None.

Change-Id: I9dec0c6955dadcd959cc1c8df4e9745322fb0ce3
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=890365
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M vdsm/supervdsm.py
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/10491/1

diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py
index 532d5ac..99da80f 100644
--- a/vdsm/supervdsm.py
+++ b/vdsm/supervdsm.py
@@ -63,9 +63,6 @@
         self._supervdsmProxy = supervdsmProxy
 
     def __call__(self, *args, **kwargs):
-        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
@@ -73,6 +70,9 @@
                 if not self._supervdsmProxy.isRunning():
                     self._supervdsmProxy.launch()
 
+        callMethod = lambda: \
+            getattr(self._supervdsmProxy._svdsm, self._funcName)(*args,
+                                                                 **kwargs)
         try:
             return callMethod()
         # handling internal exception that we raise to identify supervdsm
@@ -144,6 +144,9 @@
         self._firstLaunch = True
 
     def isRunning(self):
+        if self._svdsm is None:
+            return False
+
         try:
             with open(self.pidfile, "r") as f:
                 spid = f.read().strip()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9dec0c6955dadcd959cc1c8df4e9745322fb0ce3
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