Change in vdsm[master]: sp.py: adding attachSDHsm
laravot at redhat.com
laravot at redhat.com
Sun Jun 7 09:54:15 UTC 2015
Liron Aravot has uploaded a new change for review.
Change subject: sp.py: adding attachSDHsm
......................................................................
sp.py: adding attachSDHsm
Change-Id: I040022fe1a5fb8c618f6ff7a786ab65a56643955
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, 77 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/42013/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index c267b75..02bafa7 100755
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -656,6 +656,14 @@
return dom['status']['code'], dom['status']['message']
return 0, ''
+ def attachStorageDomainHsm(self, args):
+ sdUUID = args[0]
+ spUUID = args[1]
+ dom = self.s.attachStorageDomainHsm(sdUUID, spUUID)
+ if dom['status']['code']:
+ return dom['status']['code'], dom['status']['message']
+ return 0, ''
+
def detachStorageDomain(self, args):
sdUUID = args[0]
spUUID = args[1]
diff --git a/vdsm/API.py b/vdsm/API.py
index 2ceb85e..9f66400f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -994,6 +994,9 @@
def attach(self, storagepoolID):
return self._irs.attachStorageDomain(self._UUID, storagepoolID)
+ def attachHsm(self, storagepoolID):
+ return self._irs.attachStorageDomainHsm(self._UUID, storagepoolID)
+
def create(self, domainType, typeArgs, name, domainClass, version=None):
if version is None:
version = constants.SUPPORTED_DOMAIN_VERSIONS[0]
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index 96eda1d..e86bba9 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -611,6 +611,10 @@
domain = API.StorageDomain(sdUUID)
return domain.attach(spUUID)
+ def domainAttachHSM(self, sdUUID, spUUID):
+ domain = API.StorageDomain(sdUUID)
+ return domain.attachHsm(spUUID)
+
def domainCreate(self, storageType, sdUUID, domainName,
typeSpecificArg, domClass,
domVersion=None, options=None):
@@ -1068,7 +1072,8 @@
(self.vmSetIoTune, 'setIoTune'),
(self.vmGetIoTunePolicy, 'getIoTunePolicy'),
(self.getExternalVMs, 'getExternalVMs'),
- (self.convertExternalVm, 'convertExternalVm'))
+ (self.convertExternalVm, 'convertExternalVm'),
+ (self.domainAttachHSM, 'attachStorageDomainHSM'))
def getIrsMethods(self):
return ((self.domainActivate, 'activateStorageDomain'),
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 3409e81..96918b9 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -4982,6 +4982,20 @@
'data': {'storagedomainID': 'UUID', 'storagepoolID': 'UUID'}}
##
+# @StorageDomain.attachHsm:
+#
+# Attach a Storage Domain to a Storage Pool.
+#
+# @storagedomainID: The UUID of the Storage Domain
+#
+# @storagepoolID: The UUID of the Storage Pool
+#
+# Since: 4.18.0
+##
+{'command': {'class': 'StorageDomain', 'name': 'attachHsm'},
+ 'data': {'storagedomainID': 'UUID', 'storagepoolID': 'UUID'}}
+
+##
# @StorageDomainCreateArgumentsBlock:
#
# Creation argument for Block-based Storage Domains.
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f0e3eb8..7d1ce11 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1207,14 +1207,38 @@
:type spUUID: UUID
:param options: ?
"""
+ pool = self._prepareAttachStorageDomain(sdUUID, spUUID)
+ pool.attachSD(sdUUID)
+
+ @public
+ def attachStorageDomainHsm(self, sdUUID, spUUID):
+ """
+ Attach a storage domain to a storage pool.
+ This marks the storage domain as status 'attached' and link it to the
+ storage pool
+
+ .. note::
+ The target domain must be accessible in this point
+ (storage connected)
+
+ :param sdUUID: The UUID of the storage domain that you want to attach.
+ :type sdUUID: UUID
+ :param spUUID: The UUID of the storage pool that contains the storage
+ domain being attached.
+ :type spUUID: UUID
+ :param options: ?
+ """
+ pool = self._prepareAttachStorageDomain(sdUUID, spUUID)
+ pool.attachSDHsm(sdUUID)
+
+ def _prepareAttachStorageDomain(self, sdUUID, spUUID):
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.attachSD(sdUUID)
+ return self.getPool(spUUID)
@public
def deactivateStorageDomain(self, sdUUID, spUUID, msdUUID,
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 2adee55..99cbcec 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -867,7 +867,8 @@
self.log.exception(
'ignoring old master unmount and release failures')
- def attachSD(self, sdUUID):
+ @unsecured
+ def attachSDHsm(self, sdUUID):
"""
Attach a storage domain to the storage pool.
This marks the storage domain as "attached" and links it
@@ -901,15 +902,16 @@
dom.acquireClusterLock(self.id)
try:
- domVers = dom.getVersion()
- mstVers = self.masterDomain.getVersion()
+ if self.masterDomain is not None:
+ domVers = dom.getVersion()
+ mstVers = self.masterDomain.getVersion()
- # If you remove this condition, remove it from
- # public_createStoragePool too.
- if dom.isData() and domVers > mstVers:
- raise se.MixedSDVersionError(dom.sdUUID, domVers,
- self.masterDomain.sdUUID,
- mstVers)
+ # If you remove this condition, remove it from
+ # public_createStoragePool too.
+ if dom.isData() and domVers > mstVers:
+ raise se.MixedSDVersionError(dom.sdUUID, domVers,
+ self.masterDomain.sdUUID,
+ mstVers)
dom.attach(self.spUUID)
domains[sdUUID] = sd.DOM_ATTACHED_STATUS
@@ -924,6 +926,15 @@
self.updateMonitoringThreads()
+ def attachSD(self, sdUUID):
+ """
+ Attach a storage domain to the storage pool.
+ This marks the storage domain as "attached" and links it
+ to the storage pool
+ 'sdUUID' - storage domain UUID
+ """
+ self._attachSDHsm(sdUUID)
+
def forcedDetachSD(self, sdUUID):
self.log.warn("Force detaching domain `%s`", sdUUID)
domains = self.getDomains()
--
To view, visit https://gerrit.ovirt.org/42013
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I040022fe1a5fb8c618f6ff7a786ab65a56643955
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <laravot at redhat.com>
More information about the vdsm-patches
mailing list