From f399e11607bbd74cc39760ead9c29122f22c2b6a Mon Sep 17 00:00:00 2001 From: FFrog Date: Tue, 7 Sep 2021 15:44:00 +0800 Subject: [PATCH] downgrade the version of qemu from 4.2.0 to 4.1.0 --- nova/virt/libvirt/driver.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 8ee8757..865ecb7 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -213,7 +213,7 @@ patch_tpool_proxy() # # DO NOT FORGET to update this document when touching any versions below! MIN_LIBVIRT_VERSION = (6, 0, 0) -MIN_QEMU_VERSION = (4, 2, 0) +MIN_QEMU_VERSION = (4, 1, 0) NEXT_MIN_LIBVIRT_VERSION = (7, 0, 0) NEXT_MIN_QEMU_VERSION = (5, 2, 0) @@ -2092,7 +2092,23 @@ class LibvirtDriver(driver.ComputeDriver): guest.delete_configuration(support_uefi) try: - dev.copy(conf.to_xml(), reuse_ext=True) + # NOTE(lyarwood): Use virDomainBlockCopy from libvirt >= 6.0.0 + # and QEMU >= 4.2.0 with -blockdev domains allowing QEMU to + # copy to remote disks. + if self._host.has_min_version(lv_ver=MIN_LIBVIRT_BLOCKDEV, + hv_ver=MIN_QEMU_BLOCKDEV): + dev.copy(conf.to_xml(), reuse_ext=True) + else: + # TODO(lyarwood): Remove the following use of + # virDomainBlockRebase once MIN_LIBVIRT_VERSION hits >= + # 6.0.0 and MIN_QEMU_VERSION hits >= 4.2.0. + # Start copy with VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT flag to + # allow writing to existing external volume file. Use + # VIR_DOMAIN_BLOCK_REBASE_COPY_DEV if it's a block device + # to make sure XML is generated correctly (bug 1691195) + copy_dev = conf.source_type == 'block' + dev.rebase(conf.source_path, copy=True, reuse_ext=True, + copy_dev=copy_dev) while not dev.is_job_complete(): time.sleep(0.5) -- 2.27.0