Royce Lv has uploaded a new change for review.
Change subject: avoid redundant domain produce() in createStoragePool
......................................................................
avoid redundant domain produce() in createStoragePool
Change-Id: If1c236aa3043068ca8f3f376cb340e986cd484bb
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 4 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/7347/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 2227c03..b2c20c0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -765,19 +765,6 @@
if msdType in sd.BLOCK_DOMAIN_TYPES and msdVersion in blockSD.VERS_METADATA_LV
and len(domList) > sp.MAX_DOMAINS:
raise se.TooManyDomainsInStoragePoolError()
- for sdUUID in domList:
- try:
- dom = sdCache.produce(sdUUID=sdUUID)
- # TODO: consider removing validate() from here, as the domains
- # are going to be accessed much later, and may loose validity
- # until then.
- dom.validate()
- except:
- raise se.StorageDomainAccessError(sdUUID)
- #If you remove this condition, remove it from StoragePool.attachSD() too.
- if dom.isData() and (dom.getVersion() != msdVersion):
- raise se.MixedSDVersionError(dom.sdUUID, dom.getVersion(), msd.sdUUID,
msdVersion)
-
vars.task.getExclusiveLock(STORAGE, spUUID)
for dom in sorted(domList):
vars.task.getExclusiveLock(STORAGE, dom)
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index ee45151..a5b65c7 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -549,6 +549,7 @@
domain.validate()
if sdUUID == msdUUID:
msd = domain
+ msdVersion = msd.getVersion()
except se.StorageException:
self.log.error("Unexpected error", exc_info=True)
raise se.StorageDomainAccessError(sdUUID)
@@ -560,6 +561,9 @@
# Non ISO domains have only 1 pool
if len(spUUIDs) > 0:
raise se.StorageDomainAlreadyAttached(spUUIDs[0], sdUUID)
+
+ if domain.isData() and (domain.getVersion() != msdVersion):
+ raise se.MixedSDVersionError(domain.sdUUID, domain.getVersion(),
msd.sdUUID, msdVersion)
fileUtils.createdir(self.poolPath)
self._acquireTemporaryClusterLock(msdUUID, safeLease)
--
To view, visit
http://gerrit.ovirt.org/7347
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1c236aa3043068ca8f3f376cb340e986cd484bb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>