Federico Simoncelli has uploaded a new change for review.

Change subject: Fix the check to convert block domains V0 to tag metadata
......................................................................

Fix the check to convert block domains V0 to tag metadata

In this patch:
* fix the check to decide if we should upgrade to tag metadata
* make __convertDomainMetadataToTags safer

Change-Id: Ic034c0bf90ce3ecd82dad2f5879838bb1445e7e2
Signed-off-by: Federico Simoncelli <[email protected]>
---
M vdsm/storage/imageRepository/formatConverter.py
1 file changed, 13 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/7654/1

diff --git a/vdsm/storage/imageRepository/formatConverter.py 
b/vdsm/storage/imageRepository/formatConverter.py
index 081f9a0..4b431bc 100644
--- a/vdsm/storage/imageRepository/formatConverter.py
+++ b/vdsm/storage/imageRepository/formatConverter.py
@@ -38,17 +38,25 @@
     # We use _dict to bypass the validators in order to copy all metadata
     metadata = oldMetadata._dict.copy()
     metadata[sd.DMDK_VERSION] = targetVersion
-    newMetadata._dict.update(metadata)
+
+    log.debug("Converting to tag based metadata the domain %s", domain.sdUUID)
 
     try:
-        domain._metadata = newMetadata
-        oldMetadata._dict.clear()
+        newMetadata._dict.update(metadata)
+
     except:
         log.error("Cannot covert the domain %s metadata to tags for "
                   "version %s", domain.sdUUID, targetVersion, exc_info=True)
-        newMetadata._dict.clear()
         domain._metadata = oldMetadata
+        newMetadata._dict.clear()
         raise
+
+    else:
+        domain._metadata = newMetadata
+        oldMetadata._dict.clear()
+
+    log.debug("Conversion to tag based metadata completed for domain %s",
+              domain.sdUUID)
 
 
 def v2DomainConverter(repoPath, hostId, domain, isMsd):
@@ -164,7 +172,7 @@
                   "version %s for domain %s", currentVersion, targetVersion,
                   domain.sdUUID)
 
-        if (currentVersion == "0"
+        if (currentVersion not in blockSD.VERS_METADATA_TAG
                         and domain.getStorageType() in sd.BLOCK_DOMAIN_TYPES):
             __convertDomainMetadataToTags(domain, targetVersion)
         else:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic034c0bf90ce3ecd82dad2f5879838bb1445e7e2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to