Adam Litke has uploaded a new change for review.

Change subject: Live Merge: Update drive.format after active layer merge
......................................................................

Live Merge: Update drive.format after active layer merge

A merge of the active layer can change the drive format from cow -> raw
if a snapshot was merged into a raw backing file.  In that case we must
correct the VM Drive metadata to ensure the drive is handled properly
after the merge has finished.

Change-Id: Ieb64bbfe798a27896442a173b7dac41cebc92543
Signed-off-by: Adam Litke <ali...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/36923/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9b4cc35..f22610d 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4967,15 +4967,25 @@
             return
 
         volumeID = volumes[-1]
+        res = self.cif.irs.getVolumeInfo(drive.domainID, drive.poolID,
+                                         drive.imageID, volumeID)
+        if res['status']['code'] != 0:
+            self.log.error("Unable to get info of volume %s (domain: %s image:"
+                           " %s)", volumeID, drive.domainID, drive.imageID)
+            raise RuntimeError("Unable to get volume info")
+        driveFormat = res['info']['format'].lower()
+
         # Sync this VM's data strctures.  Ugh, we're storing the same info in
         # two places so we need to change it twice.
         device = self._lookupConfByPath(drive['path'])
         if drive.volumeID != volumeID:
             # If the active layer changed:
-            #  Update the disk path, volumeID, and volumeInfo members
+            #  Update the disk path, volumeID, volumeInfo, and format members
             volInfo = getVolumeInfo(device, volumeID)
+
             # Path must be set with the value being used by libvirt
             device['path'] = drive.path = volInfo['path'] = activePath
+            device['format'] = drive.format = driveFormat
             device['volumeID'] = drive.volumeID = volumeID
             device['volumeInfo'] = drive.volumeInfo = volInfo
             for v in device['volumeChain']:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb64bbfe798a27896442a173b7dac41cebc92543
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to