Change in vdsm[master]: upgrade: force upgrade to v2 before upgrading to v3

fsimonce at redhat.com fsimonce at redhat.com
Wed Jan 9 08:06:07 UTC 2013


Federico Simoncelli has uploaded a new change for review.

Change subject: upgrade: force upgrade to v2 before upgrading to v3
......................................................................

upgrade: force upgrade to v2 before upgrading to v3

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=893184
Change-Id: I2bd424ad29e76d1368ff2959bb8fe45afc595cdb
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/imageRepository/formatConverter.py
1 file changed, 14 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/10792/1

diff --git a/vdsm/storage/imageRepository/formatConverter.py b/vdsm/storage/imageRepository/formatConverter.py
index ff9a507..037c212 100644
--- a/vdsm/storage/imageRepository/formatConverter.py
+++ b/vdsm/storage/imageRepository/formatConverter.py
@@ -93,6 +93,19 @@
     log = logging.getLogger('Storage.v3DomainConverter')
     log.debug("Starting conversion for domain %s", domain.sdUUID)
 
+    targetVersion = 3
+    currentVersion = domain.getVersion()
+
+    # If we're upgrading from version 0 we need to first upgrade to version 2
+    # and then proceed to upgrade to version 3.
+    if currentVersion == 0:
+        v2DomainConverter(repoPath, hostId, domain, isMsd)
+        currentVersion = domain.getVersion()
+
+    if currentVersion != 2:
+        log.debug("Unsupported conversion from version %s to version %s",
+                  currentVersion, targetVersion)
+
     if domain.getStorageType() in sd.FILE_DOMAIN_TYPES:
         log.debug("Setting permissions for domain %s", domain.sdUUID)
         domain.setMetadataPermissions()
@@ -268,17 +281,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:


--
To view, visit http://gerrit.ovirt.org/10792
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bd424ad29e76d1368ff2959bb8fe45afc595cdb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list