Change in vdsm[master]: vm: Use blockCopy for live storage migration

nsoffer at redhat.com nsoffer at redhat.com
Tue Apr 21 22:11:00 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: vm: Use blockCopy for live storage migration
......................................................................

vm: Use blockCopy for live storage migration

We use now blockCopy for live-storage migration, allowing migration
between mixed storage types.

This command is a superset of the older blockRebase() when used
with the VIR_DOMAIN_BLOCK_REBASE_COPY flag, and offers better control
over the destination format, the ability to copy to a destination that
is not a local file, and the possibility of additional tuning
parameters.

For more info see:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockCopy

Change-Id: I6a69e5af76bb6114f363441f22ea3dd70c7c2508
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/40112/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 485b74f..98bda81 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3445,7 +3445,7 @@
             self._setDiskReplica(drive, replica)
 
             try:
-                self._startDriveReplication(drive, replica)
+                self._startDriveReplication(drive)
             except Exception:
                 t, v, tb = sys.exc_info()
                 try:
@@ -3555,17 +3555,14 @@
 
         return {'status': doneCode}
 
-    def _startDriveReplication(self, drive, replica):
-        flags = (libvirt.VIR_DOMAIN_BLOCK_REBASE_COPY |
-                 libvirt.VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
-                 libvirt.VIR_DOMAIN_BLOCK_REBASE_SHALLOW)
+    def _startDriveReplication(self, drive):
+        destxml = drive.getReplicaXML().toprettyxml()
+        self.log.debug("Replicating drive %s to %s", drive.name, destxml)
 
-        # Recent libvirt requires a flag for preserving the type of
-        # block-based disk.  See https://bugzilla.redhat.com/1176673.
-        if drive.blockDev:
-            flags |= getattr(libvirt, "VIR_DOMAIN_BLOCK_REBASE_COPY_DEV", 0)
+        flags = (libvirt.VIR_DOMAIN_BLOCK_COPY_SHALLOW |
+                 libvirt.VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)
 
-        self._dom.blockRebase(drive.name, replica['path'], 0, flags)
+        self._dom.blockCopy(drive.name, destxml, flags=flags)
 
     def _diskSizeExtendCow(self, drive, newSizeBytes):
         # Apparently this is what libvirt would do anyway, except that


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a69e5af76bb6114f363441f22ea3dd70c7c2508
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list