Hello Ayal Baron, Haim Ateya,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/11462
to review the following change.
Change subject: upgrade: force upgrade to v2 before upgrading to v3
......................................................................
upgrade: force upgrade to v2 before upgrading to v3
During the upgrade of a domain to version 3 vdsm reallocates the
metadata slots that are higher than 1947 (given a leases LV of 2Gb)
in order to use the same offsets for the volume leases (BZ#882276
and git commit hash 2ba76e3).
This has no effect when the domain is version 0 since the metadata
slots offsets are fixed (the first physical extent of the LV) and
they can't be reallocated. In such case the domain must be upgraded
to version 2 first.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=893184
Change-Id: I2bd424ad29e76d1368ff2959bb8fe45afc595cdb
Signed-off-by: Federico Simoncelli <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/10792
Reviewed-by: Ayal Baron <[email protected]>
Tested-by: Haim Ateya <[email protected]>
---
M vdsm/storage/imageRepository/formatConverter.py
M vdsm/storage/volume.py
2 files changed, 21 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/11462/1
diff --git a/vdsm/storage/imageRepository/formatConverter.py
b/vdsm/storage/imageRepository/formatConverter.py
index 0d7dd6d..88b053d 100644
--- a/vdsm/storage/imageRepository/formatConverter.py
+++ b/vdsm/storage/imageRepository/formatConverter.py
@@ -93,6 +93,23 @@
log = logging.getLogger('Storage.v3DomainConverter')
log.debug("Starting conversion for domain %s", domain.sdUUID)
+ targetVersion = 3
+ currentVersion = domain.getVersion()
+
+ # For block domains if we're upgrading from version 0 we need to first
+ # upgrade to version 2 and then proceed to upgrade to version 3.
+ if domain.getStorageType() in sd.BLOCK_DOMAIN_TYPES:
+ if currentVersion == 0:
+ log.debug("Upgrading domain %s from version %s to version 2",
+ domain.sdUUID, currentVersion)
+ v2DomainConverter(repoPath, hostId, domain, isMsd)
+ currentVersion = domain.getVersion()
+
+ if currentVersion != 2:
+ log.debug("Unsupported conversion from version %s to version %s",
+ currentVersion, targetVersion)
+ raise se.UnsupportedDomainVersion(currentVersion)
+
if domain.getStorageType() in sd.FILE_DOMAIN_TYPES:
log.debug("Setting permissions for domain %s", domain.sdUUID)
domain.setMetadataPermissions()
@@ -268,17 +285,10 @@
"not critical since the volume might be in use",
imgUUID, exc_info=True)
- targetVersion = 3
- currentVersion = domain.getVersion()
log.debug("Finalizing the storage domain upgrade from version %s to "
"version %s for domain %s", currentVersion, targetVersion,
domain.sdUUID)
-
- if (currentVersion not in blockSD.VERS_METADATA_TAG
- and domain.getStorageType() in sd.BLOCK_DOMAIN_TYPES):
- __convertDomainMetadataToTags(domain, targetVersion)
- else:
- domain.setMetaParam(sd.DMDK_VERSION, targetVersion)
+ domain.setMetaParam(sd.DMDK_VERSION, targetVersion)
except:
if isMsd:
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index cde612a..12dd188 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -503,7 +503,9 @@
cls.newMetadata(metaId, sdUUID, imgUUID, srcVolUUID, size,
type2name(volFormat), type2name(preallocate),
volType, diskType, desc, LEGAL_VOL)
- cls.newVolumeLease(metaId, sdUUID, volUUID)
+
+ if dom.hasVolumeLeases():
+ cls.newVolumeLease(metaId, sdUUID, volUUID)
except se.StorageException:
cls.log.error("Unexpected error", exc_info=True)
--
To view, visit http://gerrit.ovirt.org/11462
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bd424ad29e76d1368ff2959bb8fe45afc595cdb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Haim Ateya <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches