Zhou Zheng Sheng has posted comments on this change.
Change subject: Adding [start|stop]MonitoringDomain(). ......................................................................
Patch Set 1:
(1 comment)
.................................................... File vdsm/storage/sp.py Line 1548: activeDomains = tuple(sdUUID for sdUUID in poolDoms Line 1549: if poolDoms[sdUUID] == sd.DOM_ACTIVE_STATUS) Line 1550: monitoredDomains = self.domainMonitor.monitoredDomains Line 1551: Line 1552: for sdUUID in poolDoms: When we invoke destroyStoragePool, it detaches master storage domain and updateMonitoringThreads. After detaching, master storage domain is not in poolDoms but it's in monitoredDomains. However in updateMonitoringThreads it traverses through poolDoms to seek potential monitored domains to stop, so it never finds master domain in poolDoms. The monitoring thread on master domain is not stopped, the host id lease is not released. The monitoring thread on master domain becomes "orphan".
Attempting to detach a non-master storage domain from the pool results the same. After detaching, it is removed from poolDoms, but it is still in monitoredDomains, so updateMonitoringThreads never finds it and never stops it. The worst thing is it succeeds silently in this case.
I find this problem when running functional tests, this problem prevents the test from formatting detached storage domains and master domains. Line 1553: if sdUUID not in activeDomains: Line 1554: try: Line 1555: self.domainMonitor.stopMonitoring(sdUUID) Line 1556: self.log.debug("Storage Pool `%s` stopped monitoring "