Change in vdsm[master]: hsm: Prevent stop monitoring of a pool domain

nsoffer at redhat.com nsoffer at redhat.com
Sun Nov 29 22:55:00 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: hsm: Prevent stop monitoring of a pool domain
......................................................................

hsm: Prevent stop monitoring of a pool domain

When hosted engine agent is entering local maintenance, it must stop
monitoring the hosted engine domain. This is racy because the domain may
be in the middle of an import operation.

To avoid this race, stopMonitoringDomain will fail now with new
StorageDomainIsMemberOfPool exception, so hosted engine agent can stop
monitoring safely.

This failure is also important even without this race; if a domain is
owned by the pool, nobody should be able to stop monitoring it. The only
way to stop monitoring a pool domain is disconnecting from the pool.

Change-Id: I99555b230dfdab41384af0461e4b30c590b669b9
Bug-Url: https://bugzilla.redhat.com/1282187
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/storage_exception.py
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/49387/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index e673b25..13cf998 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3665,6 +3665,8 @@
     def stopMonitoringDomain(self, sdUUID, options=None):
         with rmanager.acquireResource(STORAGE, HSM_DOM_MON_LOCK,
                                       rm.LockType.exclusive):
+            if sdUUID in self.domainMonitor.poolDomains:
+                raise se.StorageDomainIsMemberOfPool(sdUUID)
             self.domainMonitor.stopMonitoring([sdUUID])
 
     @public
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 5ac78a5..1f3c9e6 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -1732,3 +1732,14 @@
     code = 855
     message = ("Could not acquire resource. "
                "Probably resource factory threw an exception.")
+
+
+#################################################
+#  External domains exceptions
+#################################################
+
+class StorageDomainIsMemberOfPool(StorageException):
+    code = 900
+    message = "Storage domain is member of pool"
+    def __init__(self, sdUUID):
+        self.value = "domain=%s" % (sdUUID,)


-- 
To view, visit https://gerrit.ovirt.org/49387
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99555b230dfdab41384af0461e4b30c590b669b9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list