Hello Ayal Baron,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/21357
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(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/21165
Reviewed-by: Ayal Baron <abaron(a)redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce(a)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)
--
To view, visit http://gerrit.ovirt.org/21357
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71714b24b7c8bbb437cbb2e8e254690215df020a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/20300
to review the following change.
Change subject: hsm: fix isoprefix KeyError for inactive domains
......................................................................
hsm: fix isoprefix KeyError for inactive domains
In a recent change f9cf58b (Make getRepoStats() a hsm method) a
new regression was introduced that causes a KeyError on isoprefix
for inactive domains.
In this patch:
* fix the isoprefix KeyError for inactive domains
* fix indentation for a related block of code
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1020543
Change-Id: Ice78a4d652d495aff8672524fcd80b7306013928
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/20250
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/20300/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index a432fe9..b38b0b0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2555,8 +2555,8 @@
domInfo = self._getDomsStats(pool.domainMonitor, doms)
for sdUUID in doms.iterkeys():
if domInfo[sdUUID]['isoprefix']:
- poolInfo['isoprefix'] = domInfo[sdUUID]['isoprefix']
- break
+ poolInfo['isoprefix'] = domInfo[sdUUID]['isoprefix']
+ break
else:
poolInfo['isoprefix'] = '' # No ISO domain found
@@ -3583,7 +3583,8 @@
for sdUUID, sdStatus in doms.iteritems():
# Return statistics for active domains only
- domInfo[sdUUID] = {'status': sdStatus, 'alerts': []}
+ domInfo[sdUUID] = {'status': sdStatus, 'alerts': [],
+ 'isoprefix': ''}
if sdStatus != sd.DOM_ACTIVE_STATUS or sdUUID not in repoStats:
continue
@@ -3615,9 +3616,8 @@
repoStats[sdUUID]['mdasize'],
repoStats[sdUUID]['mdafree'])
- isoprefix = repoStats[sdUUID]['isoprefix']
- domInfo[sdUUID]['isoprefix'] = \
- isoprefix if isoprefix is not None else ''
+ if repoStats[sdUUID]['isoprefix'] is not None:
+ domInfo[sdUUID]['isoprefix'] = repoStats[sdUUID]['isoprefix']
return domInfo
--
To view, visit http://gerrit.ovirt.org/20300
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice78a4d652d495aff8672524fcd80b7306013928
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>