Change in vdsm[ovirt-3.5]: Live Merge: Fix pre-extension calculation for chunked drives

alitke at redhat.com alitke at redhat.com
Wed Oct 21 14:39:23 UTC 2015


Adam Litke has uploaded a new change for review.

Change subject: Live Merge: Fix pre-extension calculation for chunked drives
......................................................................

Live Merge: Fix pre-extension calculation for chunked drives

Live merge causes data to be written from the volume that will be
removed (top volume) into its parent (base volume).  If the base volume
is on a thinly-provisioned block device (ie. COW_FORMAT) then we need to
make sure the parent's LV is large enough to accomodate growth of the
qcow2 volume as a result of the writes.  The amount of growth can be
anywhere between 0 (if all writes are replacing old data) and the
allocated size of the top volume (if all writes target unallocated
blocks in the base volume).  If the top volume is the active layer the
amount of growth required could be more due to writes from the VM that
come after this calculation is performed.

To prevent live merge failures when the base volume's LV is too small we
request an extension to accomodate the worst case scenario and increase
the base volume's LV by the size of the top volume's LV plus one
additional chunk.  The LV will never be increased beyond the actual
capacity of the VM disk.

The old code extended the base volume's LV to the size of the top
volume's LV which does not cover all the possible scenarios.

After live merge completes, the base volume's LV may be larger than is
necessary.  This will not impact the VM but a manual cleanup step could
be used to reclaim some storage space.

Change-Id: I959608dc2f5a71afca605610267478e8a16e2c4b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1272077
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/47589/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index ef62bc8..4fbc089 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -5874,6 +5874,7 @@
         if res['info']['voltype'] == 'SHARED':
             self.log.error("merge: Refusing to merge into a shared volume")
             return errCode['mergeErr']
+        baseSize = int(res['info']['apparentsize'])
 
         # Indicate that we expect libvirt to maintain the relative paths of
         # backing files.  This is necessary to ensure that a volume chain is
@@ -5927,10 +5928,11 @@
         # copy all the required data.  Normally we'd use monitoring to extend
         # the volume on-demand but internal watermark information is not being
         # reported by libvirt so we must do the full extension up front.  In
-        # the worst case, we'll need to extend 'base' to the same size as 'top'
-        # plus a bit more to accomodate additional writes to 'top' during the
-        # live merge operation.
-        self.extendDriveVolume(drive, baseVolUUID, topSize)
+        # the worst case, the allocated size of 'base' should be increased by
+        # the allocated size of 'top' plus one additional chunk to accomodate
+        # additional writes to 'top' during the live merge operation.
+        maxAlloc = baseSize + topSize
+        self.extendDriveVolume(drive, baseVolUUID, maxAlloc)
 
         # Trigger the collection of stats before returning so that callers
         # of getVmStats after this returns will see the new job


-- 
To view, visit https://gerrit.ovirt.org/47589
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I959608dc2f5a71afca605610267478e8a16e2c4b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke at redhat.com>


More information about the vdsm-patches mailing list