From 61fdc7d0caa978864e196a48d06ff262f7c78dc9 Mon Sep 17 00:00:00 2001 From: FFrog Date: Thu, 9 Sep 2021 19:35:41 +0800 Subject: [PATCH] downgrade the version of qemu from 4.2.0 to 4.1.0 --- nova/virt/libvirt/driver.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 8ee8757..e447b85 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) @@ -234,6 +234,10 @@ VGPU_RESOURCE_SEMAPHORE = 'vgpu_resources' LIBVIRT_PERF_EVENT_PREFIX = 'VIR_PERF_PARAM_' +# -blockdev support (replacing -drive) +MIN_LIBVIRT_BLOCKDEV = (6, 0, 0) +MIN_QEMU_BLOCKDEV = (4, 2, 0) + # VDPA interface support MIN_LIBVIRT_VDPA = (6, 9, 0) MIN_QEMU_VDPA = (5, 1, 0) @@ -2092,7 +2096,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