Nir Soffer has uploaded a new change for review. Change subject: vm: Use blockRebase if blockCopy is not supported ......................................................................
vm: Use blockRebase if blockCopy is not supported blockCopy is available in libvirt 1.2.8, but supported by the qemu driver only in 1.2.9. The recommended way to check for blockCopy availability is to try it and handle VIR_ERR_NO_SUPPORT error. This patch should be reverted when we require libvirt >= 1.2.9. Change-Id: Ic03474e36d7e073b7e5924cb02f417e12d4ad75e Signed-off-by: Nir Soffer <[email protected]> --- M vdsm/virt/vm.py 1 file changed, 20 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/40158/1 diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 98bda81..7e345cf 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -3562,7 +3562,26 @@ flags = (libvirt.VIR_DOMAIN_BLOCK_COPY_SHALLOW | libvirt.VIR_DOMAIN_BLOCK_COPY_REUSE_EXT) - self._dom.blockCopy(drive.name, destxml, flags=flags) + # TODO: Remove fallback when using libvirt >= 1.2.9. + try: + self._dom.blockCopy(drive.name, destxml, flags=flags) + except libvirt.libvirtError as e: + if e.get_error_code() != libvirt.VIR_ERR_NO_SUPPORT: + raise + + self.log.warning("blockCopy not supportted, using blockRebase") + + base = drive.diskReplicate["path"] + self.log.debug("Replicating drive %s to %s", drive.name, base) + + flags = (libvirt.VIR_DOMAIN_BLOCK_REBASE_COPY | + libvirt.VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT | + libvirt.VIR_DOMAIN_BLOCK_REBASE_SHALLOW) + + if drive.diskReplicate["diskType"] == DISK_TYPE.BLOCK: + flags |= libvirt.VIR_DOMAIN_BLOCK_REBASE_COPY_DEV + + self._dom.blockRebase(drive.name, base, flags=flags) def _diskSizeExtendCow(self, drive, newSizeBytes): # Apparently this is what libvirt would do anyway, except that -- To view, visit https://gerrit.ovirt.org/40158 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic03474e36d7e073b7e5924cb02f417e12d4ad75e Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
