Change in vdsm[ovirt-3.5]: Live Merge: Allow extension of non-leaf raw volumes

alitke at redhat.com alitke at redhat.com
Wed Aug 19 16:33:38 UTC 2015


Adam Litke has uploaded a new change for review.

Change subject: Live Merge: Allow extension of non-leaf raw volumes
......................................................................

Live Merge: Allow extension of non-leaf raw volumes

volume.extendSize() is currently prohibited for any non-leaf volume.
For a very specific live merge scenario we must permit extension of an
internal raw base volume.  Allow this usage and add a comment explaining
the reasoning.

The scenario:
 - User begins with a raw block disk.
 - User creates a snapshot.
 - User enlarges the disk (diskSizeExtend)
 - User performs live merge to remove the snapshot

In this case the base volume is too small to accommodate the data
from the child volume and an error is raised since libvirt cannot
enlarge a block device.  The solution is to require engine to call
extendVolumeSize on the base volume before requesting the live merge
operation.

Change-Id: Ia1918aa11876e9ebe9e43f6f95f3fff50c21b41c
Signed-off-by: Adam Litke <alitke at redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1251958
---
M vdsm/storage/volume.py
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/45105/1

diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 75fa1c4..0cd6de6 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -548,11 +548,10 @@
         """
         Extend the size (virtual disk size seen by the guest) of the volume.
         """
-        if not self.isLeaf() or self.isShared():
+        if self.isShared():
             raise se.VolumeNonWritable(self.volUUID)
 
         volFormat = self.getFormat()
-
         if volFormat == COW_FORMAT:
             self.log.debug("skipping cow size extension for volume %s to "
                            "size %s", self.volUUID, newSize)
@@ -560,6 +559,14 @@
         elif volFormat != RAW_FORMAT:
             raise se.IncorrectFormat(self.volUUID)
 
+        # Note: This function previously prohibited extending non-leaf volumes.
+        # If a disk is enlarged a volume may become larger than its parent.  In
+        # order to support live merge of a larger volume into its raw parent we
+        # must permit extension of this raw volume prior to starting the merge.
+        isBase = self.getParent() == BLANK_UUID
+        if not (isBase or self.isLeaf()):
+            raise se.VolumeNonWritable(self.volUUID)
+
         curRawSize = self.getVolumeSize()
 
         if (newSize < curRawSize):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia1918aa11876e9ebe9e43f6f95f3fff50c21b41c
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