Change in vdsm[ovirt-3.4]: hsm: move domainStateCallback to HSM

Federico Simoncelli fsimonce at redhat.com
Wed May 7 15:31:27 UTC 2014


Federico Simoncelli has uploaded a new change for review.

Change subject: hsm: move domainStateCallback to HSM
......................................................................

hsm: move domainStateCallback to HSM

It seems that the garbage collector is not fast enough to clear the
callback per-pool that we added in commit:

 7e30615 sp: update domain links on state change

This different approach will allow us to add only one callback (per
HSM) and forward the event to the current connected pools.

Change-Id: I7509aced432dfa77dbec727d57f507d1a9c550b7
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 11 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/27478/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 7e4dc15..21a0002 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -37,6 +37,7 @@
 import types
 import math
 import stat
+from weakref import proxy
 
 from vdsm.config import config
 import sp
@@ -399,6 +400,11 @@
         monitorInterval = config.getint('irs', 'sd_health_check_delay')
         self.domainMonitor = domainMonitor.DomainMonitor(monitorInterval)
 
+        self._domainStateCallback = partial(
+            HSM._onDomainStateChange, proxy(self))
+        self.domainMonitor.onDomainStateChange.register(
+            self._domainStateCallback)
+
     @property
     def ready(self):
         return self._ready
@@ -411,6 +417,10 @@
         """
         self.domainStateChangeCallbacks.add(callbackFunc)
 
+    def _onDomainStateChange(self, sdUUID, isValid):
+        for pool in self.pools.values():
+            pool.domainStateChangeEvent(sdUUID, isValid)
+
     def _hsmSchedule(self, name, func, *args):
         self.taskMng.scheduleJob("hsm", self.tasksDir, vars.task,
                                  name, func, *args)
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4d6a487..3d7ab55 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -104,10 +104,6 @@
         self.domainMonitor = domainMonitor
         self._upgradeCallback = partial(StoragePool._upgradePoolDomain,
                                         proxy(self))
-        self._domainStateCallback = partial(
-            StoragePool._domainStateChange, proxy(self))
-        self.domainMonitor.onDomainStateChange.register(
-            self._domainStateCallback)
         self._backend = None
 
     def __is_secure__(self):
@@ -141,7 +137,7 @@
     def getBackend(self):
         return self._backend
 
-    def _domainStateChange(self, sdUUID, isValid):
+    def domainStateChangeEvent(self, sdUUID, isValid):
         if isValid and sdUUID in self.getDomains():
             self._refreshDomainLinks(sdCache.produce(sdUUID))
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7509aced432dfa77dbec727d57f507d1a9c550b7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list