Hello Nir Soffer, Ala Hino,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/63634

to review the following change.

Change subject: Live Merge: Refresh base volume before live merge
......................................................................

Live Merge: Refresh base volume before live merge

When live merging raw base volume, engine extends the base volume
if it is smaller than the top volume. However, on the host running
the vm, the lv is already active and does not reflect the new size
until we refresh it.  During the merge we don't know whether base
volume extended, so we always refresh it.

Change-Id: I787d6854e780035b09e4f09d71ca776342dff5be
Bug-Url: https://bugzilla.redhat.com/1367281
Signed-off-by: Ala Hino <ah...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/63454
Reviewed-by: Nir Soffer <nsof...@redhat.com>
Continuous-Integration: Nir Soffer <nsof...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/63634/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index f50aa16..d719f1e 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4947,6 +4947,25 @@
         if not self._can_merge_into(drive, baseInfo, topInfo):
             return errCode['destVolumeTooSmall']
 
+        # If the base volume format is RAW and its size is smaller than its
+        # capacity (this could happen because the engine extended the base
+        # volume), we have to refresh the volume to cause lvm to get current lv
+        # size from storage, and update the kernel so the lv reflects the real
+        # size on storage. Not refreshing the volume may fail live merge.
+        # This could happen if disk extended after taking a snapshot but before
+        # performing the live merge.  See https://bugzilla.redhat.com/1367281
+        if (drive.chunked and
+                baseInfo['format'] == 'RAW' and
+                int(baseInfo['apparentsize']) < int(baseInfo['capacity'])):
+            self.log.info("Refreshing raw volume %r (apparentsize=%s, "
+                          "capacity=%s)",
+                          baseVolUUID, baseInfo['apparentsize'],
+                          baseInfo['capacity'])
+            self.__refreshDriveVolume({
+                'domainID': drive.domainID, 'poolID': drive.poolID,
+                'imageID': drive.imageID, 'volumeID': baseVolUUID,
+            })
+
         # Take the jobs lock here to protect the new job we are tracking from
         # being cleaned up by queryBlockJobs() since it won't exist right away
         with self._jobsLock:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I787d6854e780035b09e4f09d71ca776342dff5be
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Ala Hino <ah...@redhat.com>
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to