Change in vdsm[ovirt-3.5]: irs: Directly register domain state change callbacks

alitke at redhat.com alitke at redhat.com
Tue Dec 2 19:09:59 UTC 2014


Hello Nir Soffer, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/35809

to review the following change.

Change subject: irs: Directly register domain state change callbacks
......................................................................

irs: Directly register domain state change callbacks

Currently, domain state change callbacks aren't actually registered
until a storage pool is connected.  In a hosted engine environment there
is not a traditional storage pool associated with the storage domain
that is hosting the engine VM so in this case the event doesn't get
registered.  Since storage pools are becoming deprecated, there is no
reason to delay callback registration based on connectStoragePool.

Change-Id: I28d4f1af4f94da1a8e3511abbe160ea66e81daad
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1157421
Signed-off-by: Adam Litke <alitke at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35369
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 2 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/35809/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 0f6930b..45f1694 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -362,8 +362,6 @@
 
         oop.setDefaultImpl(config.get('irs', 'oop_impl'))
 
-        self.domainStateChangeCallbacks = set()
-
         # cleanStorageRepoitory uses tasksDir value, this must be assigned
         # before calling it
         self.tasksDir = config.get('irs', 'hsm_tasks')
@@ -401,10 +399,9 @@
     @public
     def registerDomainStateChangeCallback(self, callbackFunc):
         """
-        Currently this method assumes that all registrations
-        are done *prior* to connecting to pool.
+        Register a state change callback function with the domain monitor.
         """
-        self.domainStateChangeCallbacks.add(callbackFunc)
+        self.domainMonitor.onDomainStateChange.register(callbackFunc)
 
     def _hsmSchedule(self, name, func, *args):
         self.taskMng.scheduleJob("hsm", None, vars.task, name, func, *args)
@@ -1074,12 +1071,6 @@
             else:
                 pool.setBackend(
                     StoragePoolMemoryBackend(pool, masterVersion, domainsMap))
-
-            # Must register domain state change callbacks *before* connecting
-            # the pool, which starts domain monitor threads. Otherwise we will
-            # miss the first event from the monitor thread.
-            for cb in self.domainStateChangeCallbacks:
-                pool.domainMonitor.onDomainStateChange.register(cb)
 
             res = pool.connect(hostID, msdUUID, masterVersion)
             if res:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I28d4f1af4f94da1a8e3511abbe160ea66e81daad
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list