Liron Aravot has uploaded a new change for review. Change subject: sp: adding detachSDHsm ......................................................................
sp: adding detachSDHsm Change-Id: Ie0799873c2fb57853d5a8f058577612cef42b574 Signed-off-by: [email protected] <[email protected]> --- M vdsm/storage/sp.py 1 file changed, 21 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/42030/1 diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index 40991ec..3a6c24d 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -966,7 +966,8 @@ # If the domain that we are detaching is the master domain # we attempt to stop the SPM before releasing the host id - if self.masterDomain.sdUUID == sdUUID: + if self.masterDomain is not None and \ + self.masterDomain.sdUUID == sdUUID: self.stopSpm() self.updateMonitoringThreads() @@ -979,16 +980,32 @@ and leaves the storage domain in 'unattached' status. 'sdUUID' - storage domain UUID """ + if sdUUID == self.masterDomain.sdUUID: + raise se.CannotDetachMasterStorageDomain(sdUUID) + self._detachSD(sdUUID) + + @unsecured + def detachSDHsm(self, sdUUID, force=False): + """ + Detach a storage domain from a storage pool. + This removes the storage domain entry in the storage pool meta-data + and leaves the storage domain in 'unattached' status. + 'sdUUID' - storage domain UUID + """ + self.validateNoSpm() + if force: + self.forcedDetachSD(sdUUID) + else: + self._detachSD(sdUUID) + + def _detachSD(self, sdUUID): self.log.info("sdUUID=%s spUUID=%s", sdUUID, self.spUUID) dom = sdCache.produce(sdUUID) # Avoid detach domains if not owned by pool self.validateAttachedDomain(dom) - - if sdUUID == self.masterDomain.sdUUID: - raise se.CannotDetachMasterStorageDomain(sdUUID) # TODO: clusterLock protection should be moved to # StorageDomain.[at,de]tach() -- To view, visit https://gerrit.ovirt.org/42030 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie0799873c2fb57853d5a8f058577612cef42b574 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Liron Aravot <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
