Change in vdsm[ovirt-3.5]: Live Merge: Mark active layer ILLEGAL before pivoting

alitke at redhat.com alitke at redhat.com
Tue Sep 2 17:20:44 UTC 2014


Hello Nir Soffer, Federico Simoncelli, Francesco Romani,

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

    http://gerrit.ovirt.org/32324

to review the following change.

Change subject: Live Merge: Mark active layer ILLEGAL before pivoting
......................................................................

Live Merge: Mark active layer ILLEGAL before pivoting

A block commit of the active layer takes place in two phases.  First,
data is copied from the current leaf to its parent.  During this time,
all writes to the disk are mirrored to both volumes.  When this process
converges the two volumes are and will remain identical due to ongoing
drive mirroring by qemu.  At this point we instruct libvirt to perform a
pivot from the current leaf to the new leaf.  Once this is complete we
synchronize our metadata and end the job.

If we are catastrophically interrupted (lose contact with the host)
between the pivot request and final metadata synchronization there is
currently no way to know whether the pivot actually happened.  This
could be dangerous because restarting the VM on another host with the
wrong leaf volume could lead to data corruption.

The solution is to mark the current leaf ILLEGAL before requesting a
pivot.  Since the volumes are identical at this point it will always be
safe to rerun the VM using the new leaf.  A subsequent patch will take
advantage of this ILLEGAL marker to provide engine with a reliable and
correct volume chain for this recovery scenario.

Change-Id: I97ce8fbdfad7c81181a206f160ffdd647c552d4d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1127294
Signed-off-by: Adam Litke <alitke at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/31787
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/32324/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index d743759..b6972af 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1831,9 +1831,17 @@
                 return
 
             dstParent = sdDom.produceVolume(imgUUID, subChain[0]).getParent()
-            children = sdDom.produceVolume(imgUUID, subChain[-1]).getChildren()
-            for childID in children:
-                sdDom.produceVolume(imgUUID, childID).setParentMeta(dstParent)
+            subChainTailVol = sdDom.produceVolume(imgUUID, subChain[-1])
+            if subChainTailVol.isLeaf():
+                self.log.debug("Leaf volume is being removed from the chain. "
+                               "Marking it ILLEGAL to prevent data corruption")
+                subChainTailVol.setLegality(volume.ILLEGAL_VOL)
+            else:
+                for childID in subChainTailVol.getChildren():
+                    self.log.debug("Setting parent of volume %s to %s",
+                                   childID, dstParent)
+                    sdDom.produceVolume(imgUUID, childID). \
+                        setParentMeta(dstParent)
 
     @public
     def mergeSnapshots(self, sdUUID, spUUID, vmUUID, imgUUID, ancestor,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97ce8fbdfad7c81181a206f160ffdd647c552d4d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list