Change in vdsm[master]: adding StorageDomain.activateHsm()
laravot at redhat.com
laravot at redhat.com
Thu Feb 25 16:35:19 UTC 2016
Liron Aravot has uploaded a new change for review.
Change subject: adding StorageDomain.activateHsm()
......................................................................
adding StorageDomain.activateHsm()
Change-Id: Ic661b44b060ddfeeb2a2caedb2662c6102b950e0
Signed-off-by: laravot at redhat.com <laravot at redhat.com>
---
M client/vdsClient.py
M vdsm/API.py
M vdsm/rpc/BindingXMLRPC.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
6 files changed, 96 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/43102/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index 01f2211..9c42228 100755
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -647,6 +647,14 @@
return dom['status']['code'], dom['status']['message']
return 0, ''
+ def activateStorageDomainHsm(self, args):
+ sdUUID = args[0]
+ spUUID = args[1]
+ dom = self.s.activateStorageDomainHsm(sdUUID, spUUID)
+ if dom['status']['code']:
+ return dom['status']['code'], dom['status']['message']
+ return 0, ''
+
def deactivateStorageDomain(self, args):
sdUUID = args[0]
spUUID = args[1]
@@ -2502,6 +2510,10 @@
'Get list of VMs from the'
'given backup domain'
)),
+ 'updateStorageDomainVmData': (serv.updateStorageDomainVmData,
+ ('<sdUUID> <spUUID> <vmID> <vmDATA>',
+ 'Update VM on a Backup domain'
+ )),
'validateStorageDomain': (serv.validateStorageDomain,
('<domain UUID>',
'Validate storage domain'
@@ -2511,6 +2523,12 @@
'Activate a storage domain that is already '
'a member in a storage pool.'
)),
+ 'activateStorageDomainHsm': (serv.activateStorageDomainHsm,
+ ('<domain UUID> <pool UUID>',
+ 'Activate a storage domain that is '
+ 'already a member in a storage pool '
+ 'that operates without Spm.'
+ )),
'deactivateStorageDomain': (serv.deactivateStorageDomain,
('<domain UUID> <pool UUID> <new master '
'domain UUID> <masterVer>',
diff --git a/vdsm/API.py b/vdsm/API.py
index 8af2ad0..73f1a1f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -991,6 +991,9 @@
def activate(self, storagepoolID):
return self._irs.activateStorageDomain(self._UUID, storagepoolID)
+ def activateHsm(self, storagepoolID):
+ return self._irs.activateStorageDomainHsm(self._UUID, storagepoolID)
+
def attach(self, storagepoolID):
return self._irs.attachStorageDomain(self._UUID, storagepoolID)
@@ -1108,7 +1111,8 @@
return self._irs.fenceSpmStorage(self._UUID, lastOwner, lastLver)
def getBackedUpVmsInfo(self, storagedomainID, vmList):
- return self._irs.getVmsInfo(self._UUID, storagedomainID, vmList)
+ return self._irs.getBackedUpVmsInfo(self._UUID,
+ storagedomainID, vmList)
def getBackedUpVmsList(self, storagedomainID):
return self._irs.getVmsList(self._UUID, storagedomainID)
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index bd86804..0ab159f 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -607,6 +607,10 @@
domain = API.StorageDomain(sdUUID)
return domain.activate(spUUID)
+ def domainActivateHsm(self, sdUUID, spUUID):
+ domain = API.StorageDomain(sdUUID)
+ return domain.activateHsm(spUUID)
+
def domainAttach(self, sdUUID, spUUID, options=None):
domain = API.StorageDomain(sdUUID)
return domain.attach(spUUID)
@@ -1101,6 +1105,7 @@
'upgradeStorageDomainVersion'),
(self.domainGetBackedUpVmsInfo,
'getStorageDomainBackedUpVmsInfo'),
+ (self.domainActivateHsm, 'activateStorageDomainHsm'),
(self.domainUpdateVMData, 'updateStorageDomainVmData'))
def getIrsMethods(self):
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 96d7661..2173ac2 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -4968,6 +4968,22 @@
'data': {'storagedomainID': 'UUID', 'storagepoolID': 'UUID'}}
##
+# @StorageDomain.activateHsm:
+#
+# Activate an attached but inactive Storage Domain.
+# Can be used only in Storage Pools that operate without SPM.
+#
+# @storagedomainID: The UUID of the Storage Domain
+#
+# @storagepoolID: The UUID of the Storage Pool to which the Storage Domain
+# is attached
+#
+# Since: 4.18.0
+##
+{'command': {'class': 'StorageDomain', 'name': 'activateHsm'},
+ 'data': {'storagedomainID': 'UUID', 'storagepoolID': 'UUID'}}
+
+##
# @StorageDomain.attach:
#
# Attach a Storage Domain to a Storage Pool.
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 7ab8fb1..8302a52 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1344,14 +1344,33 @@
:type spUUID: UUID
:param options: ?
"""
+ pool = self._prepareActivateStorageDomain(spUUID, sdUUID)
+ pool.activateSD(sdUUID)
+
+ @public
+ def activateStorageDomainHsm(self, sdUUID, spUUID):
+ """
+ Activates a storage domain that is already a member in a storage pool.
+
+ :param sdUUID: The UUID of the storage domain that you want to
+ activate.
+ :type sdUUID: UUID
+ :param spUUID: The UUID of the storage pool that contains the storage
+ domain being activated.
+ :type spUUID: UUID
+ :param options: ?
+ """
+ pool = self._prepareActivateStorageDomain(spUUID, sdUUID)
+ pool.activateSDHSM(sdUUID)
+
+ def _prepareActivateStorageDomain(self, spUUID, sdUUID):
vars.task.setDefaultException(
se.StorageDomainActionError(
"sdUUID=%s, spUUID=%s" % (sdUUID, spUUID)))
vars.task.getExclusiveLock(STORAGE, spUUID)
vars.task.getExclusiveLock(STORAGE, sdUUID)
- pool = self.getPool(spUUID)
- pool.activateSD(sdUUID)
+ return self.getPool(spUUID)
@public
def setStoragePoolDescription(self, spUUID, description, options=None):
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 3f934a3..58de8ac 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1115,6 +1115,11 @@
Validate that the storage domain is owned by the storage pool.
'sdUUID' - storage domain UUID
"""
+ self._activateSD(sdUUID)
+ return True
+
+ @unsecured
+ def _activateSD(self, sdUUID):
self.log.info("sdUUID=%s spUUID=%s", sdUUID, self.spUUID)
dom = sdCache.produce(sdUUID)
@@ -1133,12 +1138,15 @@
if dom.getDomainClass() == sd.DATA_DOMAIN:
self._convertDomain(dom)
- dom.activate()
- # set domains also do rebuild
- domainStatuses[sdUUID] = sd.DOM_ACTIVE_STATUS
- self._backend.setDomainsMap(domainStatuses)
- self.updateMonitoringThreads()
- return True
+ @unsecured
+ def activateSDHSM(self, sdUUID):
+ """
+ Activate a storage domain that is already a member in a storage pool.
+ Validate that the storage domain is owned by the storage pool.
+ 'sdUUID' - storage domain UUID
+ """
+ self.validateNoSpm()
+ self._activateSD(sdUUID)
def deactivateSD(self, sdUUID, newMsdUUID, masterVersion):
"""
@@ -1387,6 +1395,23 @@
'vmUUID' - Virtual machine UUID
"""
self.validatePoolSD(sdUUID)
+ self._removeVM(vmUUID, sdUUID)
+
+ @unsecured
+ def removeVMHsm(self, vmUUID, sdUUID):
+ """
+ Remove VM.
+ 'vmUUID' - Virtual machine UUID
+ """
+ self.validatePoolSD(sdUUID)
+ self._removeVM(vmUUID, sdUUID)
+
+ @unsecured
+ def _removeVM(self, vmUUID, sdUUID):
+ """
+ Remove VM.
+ 'vmUUID' - Virtual machine UUID
+ """
self.log.info("spUUID=%s vmUUID=%s sdUUID=%s", self.spUUID, vmUUID,
sdUUID)
vms = self._getVMsPath(sdUUID)
--
To view, visit https://gerrit.ovirt.org/43102
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic661b44b060ddfeeb2a2caedb2662c6102b950e0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Jenkins CI RO
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
More information about the vdsm-patches
mailing list