Mark Wu has uploaded a new change for review.

Change subject: Fix a race existing in the singleton interface of clientIF
......................................................................

Fix a race existing in the singleton interface of clientIF

There's a race in getInstance() between clientIF initialization and MOM thread.
If for some reason the initialization of clientIF is slowed down and not 
finished
before MOM calls vdsm API, an exception will happen in MOM thread due to that
the parameter 'log' is missing. The fix is just moving the parameter check into
the protection of the singleton lock. Then MOM thread will be blocked if it 
tries
to access vdsm API when the initialization of clientIF is ongoing.

Change-Id: I6d907f5613963438c99749da674bb6588a23fe38
Signed-off-by: Mark Wu <[email protected]>
---
M vdsm/clientIF.py
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/7283/1

diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 8ba25a7..ab34eaa 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -117,13 +117,13 @@
 
     @classmethod
     def getInstance(cls, log=None):
-        if cls._instance == None:
-            if log == None:
-                raise Exception("Logging facility is required to create \
-                                the single clientIF instance")
         with cls._instanceLock:
             if cls._instance == None:
-                cls._instance = clientIF(log)
+                if log == None:
+                    raise Exception("Logging facility is required to create "
+                                    "the single clientIF instance")
+                else:
+                    cls._instance = clientIF(log)
         return cls._instance
 
     def _getServerIP(self, addr=None):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d907f5613963438c99749da674bb6588a23fe38
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to