Hello Ayal Baron,
I'd like you to do a code review. Please visit
to review the following change.
Change subject: domainMonitor: tag pool monitored domains ......................................................................
domainMonitor: tag pool monitored domains
As part of the monitoring implementation:
7b1cc6a Adding [start|stop]MonitoringDomain()
updateMonitoringThreads has been modified to assume that the list of the monitored domains is the same as the list of the attached domains:
+ poolDoms = self.getDomains() ... - for sdUUID in monitoredDomains: + for sdUUID in poolDoms: if sdUUID not in activeDomains: try: self.domainMonitor.stopMonitoring(sdUUID)
This assumption is not valid when we are detaching a storage domain (as it won't be listed by getDomains anymore). The resulting issue is that the monitor domain thread is not stopped and the host id is left acquired (ids file/device kept open by sanlock).
This patch reverts the updateMonitoringThreads changes and adds a tag mechanism for the pool monitored domains.
Label: DOWNSTREAM ONLY Change-Id: I71714b24b7c8bbb437cbb2e8e254690215df020a Signed-off-by: Federico Simoncelli fsimonce@redhat.com Reviewed-on: http://gerrit.ovirt.org/21165 Reviewed-by: Ayal Baron abaron@redhat.com Signed-off-by: Federico Simoncelli fsimonce@redhat.com --- M vdsm/storage/domainMonitor.py M vdsm/storage/hsm.py M vdsm/storage/sp.py 3 files changed, 17 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/21357/1
diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py index a998f80..4f4b823 100644 --- a/vdsm/storage/domainMonitor.py +++ b/vdsm/storage/domainMonitor.py @@ -84,12 +84,20 @@ def monitoredDomains(self): return self._domains.keys()
- def startMonitoring(self, sdUUID, hostId): - if sdUUID in self._domains: + @property + def poolMonitoredDomains(self): + return [k for k, v in self._domains.iteritems() if v.poolDomain] + + def startMonitoring(self, sdUUID, hostId, poolDomain=True): + domainThread = self._domains.get(sdUUID) + + if domainThread is not None: + domainThread.poolDomain |= poolDomain return
domainThread = DomainMonitorThread(weakref.proxy(self), sdUUID, hostId, self._interval) + domainThread.poolDomain = poolDomain domainThread.start() # The domain should be added only after it succesfully started self._domains[sdUUID] = domainThread diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index bb89d94..7481064 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -3699,7 +3699,7 @@ def startMonitoringDomain(self, sdUUID, hostID, options=None): with rmanager.acquireResource(STORAGE, HSM_DOM_MON_LOCK, rm.LockType.exclusive): - self.domainMonitor.startMonitoring(sdUUID, int(hostID)) + self.domainMonitor.startMonitoring(sdUUID, int(hostID), False)
@deprecated @public diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index cae84b3..cf12d35 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -142,7 +142,7 @@ return self.spmRole, self.getSpmLver(), self.getSpmId()
def __del__(self): - if len(self.domainMonitor.monitoredDomains) > 0: + if len(self.domainMonitor.poolMonitoredDomains) > 0: threading.Thread(target=self.stopMonitoringDomains).start()
@unsecured @@ -1541,15 +1541,13 @@ @unsecured @misc.samplingmethod def updateMonitoringThreads(self): - # getDomains() returns a dict of {sdUUID:status} - # {sdUUID1: status1, sdUUID2: status2, ...} + # domain list it's list of sdUUID:status + # sdUUID1:status1,sdUUID2:status2,... self.invalidateMetadata() - poolDoms = self.getDomains() - activeDomains = tuple(sdUUID for sdUUID in poolDoms - if poolDoms[sdUUID] == sd.DOM_ACTIVE_STATUS) - monitoredDomains = self.domainMonitor.monitoredDomains + activeDomains = self.getDomains(activeOnly=True) + monitoredDomains = self.domainMonitor.poolMonitoredDomains
- for sdUUID in poolDoms: + for sdUUID in monitoredDomains: if sdUUID not in activeDomains: try: self.domainMonitor.stopMonitoring(sdUUID)
Allon Mureinik has posted comments on this change.
Change subject: domainMonitor: tag pool monitored domains ......................................................................
Patch Set 2: Code-Review+1
Ayal Baron has posted comments on this change.
Change subject: domainMonitor: tag pool monitored domains ......................................................................
Patch Set 2: Code-Review+1
Itamar Heim has posted comments on this change.
Change subject: domainMonitor: tag pool monitored domains ......................................................................
Patch Set 2:
ping?
Federico Simoncelli has abandoned this change.
Change subject: domainMonitor: tag pool monitored domains ......................................................................
Abandoned
vdsm-patches@lists.fedorahosted.org