Adam Litke has uploaded a new change for review.
Change subject: HACK: run GC in domain monitor ......................................................................
HACK: run GC in domain monitor
Change-Id: I3c560e6fbccdf50b135cc9c90b23824ae04b0376 Signed-off-by: Adam Litke alitke@redhat.com --- M vdsm/storage/monitor.py M vdsm/storage/sdm/__init__.py 2 files changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/40380/1
diff --git a/vdsm/storage/monitor.py b/vdsm/storage/monitor.py index ef032a5..a2a1bd7 100644 --- a/vdsm/storage/monitor.py +++ b/vdsm/storage/monitor.py @@ -28,6 +28,7 @@
from . import clusterlock from . import misc +from . import sdm from .sdc import sdCache
@@ -249,6 +250,7 @@ self._performDomainSelftest() self._checkReadDelay() self._collectStatistics() + self._garbageCollect() except Exception as e: self.log.exception("Error monitoring domain %s", self.sdUUID) self.nextStatus.error = e @@ -340,6 +342,14 @@ self.nextStatus.isoPrefix = self.isoPrefix self.nextStatus.version = self.domain.getVersion()
+ def _garbageCollect(self): + if True: # XXX: limit this to domain ver 4 or later + try: + sdm.garbageCollectStorageDomain(self.domain) + except: + self.log.exception("Garbage collection failed for domain %s", + self.domain.sdUUID) + # Managing host id
def _shouldAcquireHostId(self): diff --git a/vdsm/storage/sdm/__init__.py b/vdsm/storage/sdm/__init__.py index 1636e63..4a31332 100644 --- a/vdsm/storage/sdm/__init__.py +++ b/vdsm/storage/sdm/__init__.py @@ -226,3 +226,15 @@ cls.isolateVolumes(domain, srcImgUUID, dstImgUUID, volumeList) finally: domain.releaseClusterLock() + + +def garbageCollectStorageDomain(domain): + if domain.isISO(): + return + cls = __getStoreClass(domain) + hostId = getDomainHostId(domain.sdUUID) + domain.acquireClusterLock(hostId) + try: + cls.garbageCollectStorageDomain(domain) + finally: + domain.releaseClusterLock()