Tal Nisan has uploaded a new change for review.
Change subject: Cleanup of storage domain creation in hsm.py
......................................................................
Cleanup of storage domain creation in hsm.py
This patch changes the specific per domain type creation handling is done
to remove duplicate code, allow uniform error handling when we call the
actual creation and make the flow more clear
Change-Id: Ib4f3771e40595d77fd80811c6b7ea6bf4c768d69
Signed-off-by: Tal Nisan <tnisan(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 7 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/75/45375/2
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 0806abb..485e092 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2673,24 +2673,19 @@
# getSharedLock(connectionsResource...)
# getExclusiveLock(sdUUID...)
if storageType in sd.BLOCK_DOMAIN_TYPES:
- newSD = blockSD.BlockStorageDomain.create(
- sdUUID, domainName, domClass, typeSpecificArg, storageType,
- domVersion)
+ create = blockSD.BlockStorageDomain.create
elif storageType in (sd.NFS_DOMAIN, sd.POSIXFS_DOMAIN):
- newSD = nfsSD.NfsStorageDomain.create(
- sdUUID, domainName, domClass, typeSpecificArg, storageType,
- domVersion)
+ create = nfsSD.NfsStorageDomain.create
elif storageType == sd.GLUSTERFS_DOMAIN:
- newSD = glusterSD.GlusterStorageDomain.create(
- sdUUID, domainName, domClass, typeSpecificArg, storageType,
- domVersion)
+ create = glusterSD.GlusterStorageDomain.create
elif storageType == sd.LOCALFS_DOMAIN:
- newSD = localFsSD.LocalFsStorageDomain.create(
- sdUUID, domainName, domClass, typeSpecificArg, storageType,
- domVersion)
+ create = localFsSD.LocalFsStorageDomain.create
else:
raise se.StorageDomainTypeError(storageType)
+ newSD = create(sdUUID, domainName, domClass, typeSpecificArg,
+ storageType, domVersion)
+
findMethod = self.__getSDTypeFindMethod(storageType)
sdCache.knownSDs[sdUUID] = findMethod
self.log.debug("knownSDs: {%s}", ", ".join("%s:
%s.%s" %
--
To view, visit
https://gerrit.ovirt.org/45375
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4f3771e40595d77fd80811c6b7ea6bf4c768d69
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <tnisan(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org