From de6df887c54560f3e88e4ec14c6b90668d630530 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 27 Sep 2022 04:59:09 -0400 Subject: [PATCH] import libvirt-8.5.0-5.el9 --- .gitignore | 2 +- .libvirt.metadata | 2 +- ...ke-systemd-unit-ordering-more-robust.patch | 89 -- ...HEL-Fix-virConnectGetMaxVcpus-output.patch | 46 - ...sGetStatInfo-is-unable-to-parse-data.patch | 104 --- ...ibvirt-guests-when-building-libvirtd.patch | 75 -- ...docs-Add-man-page-for-libvirt-guests.patch | 217 ----- ...docs-Document-TPM-portion-of-domcaps.patch | 62 ++ ...nf-Format-defaultiothread-more-often.patch | 96 ++ ..._conf-Format-iothread-IDs-more-often.patch | 61 ++ ...domcaps-Introduce-TPM-backendVersion.patch | 74 ++ ...lock-when-creating-deleting-bindings.patch | 77 -- ...PS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE.patch | 183 ++++ ...u-Make-IOThread-changing-more-robust.patch | 195 ++++ ...on-flags-to-qemuMigrationParamsApply.patch | 148 +++ ...elease-job-in-qemuDomainSaveInternal.patch | 38 + ...ort-supported-TPM-version-in-domcaps.patch | 49 + ...al-memory-locking-limit-on-reconnect.patch | 85 ++ ...-domain-definition-even-on-migration.patch | 71 -- ...ev-from-qemuMigrationDstPrepareFresh.patch | 61 ++ ...on-blockers-during-offline-migration.patch | 87 ++ ...rt-qemu-fix-inactive-snapshot-revert.patch | 41 - ...-QEMU_CAPS_MIGRATION_BLOCKED_REASONS.patch | 206 +++++ ...c-remove-use-to-nwfilter-update-lock.patch | 222 ----- ...-migration-blocker-reasons-from-QEMU.patch | 140 +++ ...ckers-before-our-own-harcoded-checks.patch | 80 ++ ...-for-vDPA-devices-if-we-can-ask-QEMU.patch | 58 ++ ...ation-check-if-QEMU-can-do-it-for-us.patch | 62 ++ ...riptor-flash-mode-for-optional-NVRAM.patch | 471 ---------- ...pport-multiqueue-for-vdpa-net-device.patch | 186 ---- ...Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch | 41 + ...mainSetupDisk-Initialize-targetPaths.patch | 41 - ...nerate-memory-only-after-controllers.patch | 662 -------------- ...ect-job-in-qemuMigrationSrcIsAllowed.patch | 132 +++ ...stcopy-bandwidth-on-post-copy-resume.patch | 229 +++++ ...-migParams-to-qemuMigrationSrcResume.patch | 70 ++ ...ginal-migration-params-in-status-XML.patch | 51 ++ ...nc-in-qemuDomainGetMigrationBlockers.patch | 64 ++ ...deadlock-in-qemuMigrationParamsReset.patch | 62 ++ ...ms-Refactor-qemuMigrationParamsApply.patch | 107 +++ ...ms-Refactor-qemuMigrationParamsReset.patch | 63 ++ ...eplace-qemuMigrationParamTypes-array.patch | 176 ++++ SOURCES/libvirt-remove-sysconfig-files.patch | 846 ------------------ ...NSSL_CONF-through-to-ssh-invocations.patch | 82 ++ ...ibvirt-util-Fix-machined-servicename.patch | 71 -- ...cpi-Add-PCIe-5.0-and-6.0-link-speeds.patch | 64 ++ ...rsh-Implement-config-for-iothreadset.patch | 62 ++ ...virt-virsh-Require-xpath-for-dumpxml.patch | 215 +++++ ...duce-TPM-1.2-and-TPM-2.0-capabilieis.patch | 48 + SOURCES/symlinks | 19 +- SPECS/libvirt.spec | 185 +++- 51 files changed, 3311 insertions(+), 3267 deletions(-) delete mode 100644 SOURCES/libvirt-Make-systemd-unit-ordering-more-robust.patch delete mode 100644 SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch delete mode 100644 SOURCES/libvirt-Revert-report-error-when-virProcessGetStatInfo-is-unable-to-parse-data.patch delete mode 100644 SOURCES/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch delete mode 100644 SOURCES/libvirt-docs-Add-man-page-for-libvirt-guests.patch create mode 100644 SOURCES/libvirt-docs-Document-TPM-portion-of-domcaps.patch create mode 100644 SOURCES/libvirt-domain_conf-Format-defaultiothread-more-often.patch create mode 100644 SOURCES/libvirt-domain_conf-Format-iothread-IDs-more-often.patch create mode 100644 SOURCES/libvirt-domcaps-Introduce-TPM-backendVersion.patch delete mode 100644 SOURCES/libvirt-nwfilter-hold-filter-update-lock-when-creating-deleting-bindings.patch create mode 100644 SOURCES/libvirt-qemu-Always-assume-support-for-QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE.patch create mode 100644 SOURCES/libvirt-qemu-Make-IOThread-changing-more-robust.patch create mode 100644 SOURCES/libvirt-qemu-Pass-migration-flags-to-qemuMigrationParamsApply.patch create mode 100644 SOURCES/libvirt-qemu-Properly-release-job-in-qemuDomainSaveInternal.patch create mode 100644 SOURCES/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch create mode 100644 SOURCES/libvirt-qemu-Restore-original-memory-locking-limit-on-reconnect.patch delete mode 100644 SOURCES/libvirt-qemu-Validate-domain-definition-even-on-migration.patch create mode 100644 SOURCES/libvirt-qemu-don-t-call-qemuMigrationSrcIsAllowedHostdev-from-qemuMigrationDstPrepareFresh.patch create mode 100644 SOURCES/libvirt-qemu-don-t-try-to-query-QEMU-about-migration-blockers-during-offline-migration.patch delete mode 100644 SOURCES/libvirt-qemu-fix-inactive-snapshot-revert.patch create mode 100644 SOURCES/libvirt-qemu-introduce-capability-QEMU_CAPS_MIGRATION_BLOCKED_REASONS.patch delete mode 100644 SOURCES/libvirt-qemu-lxc-remove-use-to-nwfilter-update-lock.patch create mode 100644 SOURCES/libvirt-qemu-new-function-to-retrieve-migration-blocker-reasons-from-QEMU.patch create mode 100644 SOURCES/libvirt-qemu-query-QEMU-for-migration-blockers-before-our-own-harcoded-checks.patch create mode 100644 SOURCES/libvirt-qemu-remove-hardcoded-migration-fail-for-vDPA-devices-if-we-can-ask-QEMU.patch create mode 100644 SOURCES/libvirt-qemu-skip-hardcoded-hostdev-migration-check-if-QEMU-can-do-it-for-us.patch delete mode 100644 SOURCES/libvirt-qemu-support-firmware-descriptor-flash-mode-for-optional-NVRAM.patch delete mode 100644 SOURCES/libvirt-qemu-support-multiqueue-for-vdpa-net-device.patch create mode 100644 SOURCES/libvirt-qemuDomainSetIOThreadParams-Accept-VIR_DOMAIN_AFFECT_CONFIG-flag.patch delete mode 100644 SOURCES/libvirt-qemuDomainSetupDisk-Initialize-targetPaths.patch delete mode 100644 SOURCES/libvirt-qemu_command-Generate-memory-only-after-controllers.patch create mode 100644 SOURCES/libvirt-qemu_migration-Acquire-correct-job-in-qemuMigrationSrcIsAllowed.patch create mode 100644 SOURCES/libvirt-qemu_migration-Apply-max-postcopy-bandwidth-on-post-copy-resume.patch create mode 100644 SOURCES/libvirt-qemu_migration-Pass-migParams-to-qemuMigrationSrcResume.patch create mode 100644 SOURCES/libvirt-qemu_migration-Store-original-migration-params-in-status-XML.patch create mode 100644 SOURCES/libvirt-qemu_migration-Use-EnterMonitorAsync-in-qemuDomainGetMigrationBlockers.patch create mode 100644 SOURCES/libvirt-qemu_migration_params-Avoid-deadlock-in-qemuMigrationParamsReset.patch create mode 100644 SOURCES/libvirt-qemu_migration_params-Refactor-qemuMigrationParamsApply.patch create mode 100644 SOURCES/libvirt-qemu_migration_params-Refactor-qemuMigrationParamsReset.patch create mode 100644 SOURCES/libvirt-qemu_migration_params-Replace-qemuMigrationParamTypes-array.patch delete mode 100644 SOURCES/libvirt-remove-sysconfig-files.patch create mode 100644 SOURCES/libvirt-rpc-Pass-OPENSSL_CONF-through-to-ssh-invocations.patch delete mode 100644 SOURCES/libvirt-util-Fix-machined-servicename.patch create mode 100644 SOURCES/libvirt-vircpi-Add-PCIe-5.0-and-6.0-link-speeds.patch create mode 100644 SOURCES/libvirt-virsh-Implement-config-for-iothreadset.patch create mode 100644 SOURCES/libvirt-virsh-Require-xpath-for-dumpxml.patch create mode 100644 SOURCES/libvirt-virtpm-Introduce-TPM-1.2-and-TPM-2.0-capabilieis.patch diff --git a/.gitignore b/.gitignore index fbb5a7e..5ab37f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/libvirt-8.0.0.tar.xz +SOURCES/libvirt-8.5.0.tar.xz diff --git a/.libvirt.metadata b/.libvirt.metadata index 76dff0f..047ffb5 100644 --- a/.libvirt.metadata +++ b/.libvirt.metadata @@ -1 +1 @@ -e440412e9b45d7e24f0ef492d8edf5cf2cbd3f4c SOURCES/libvirt-8.0.0.tar.xz +d5fc6173368e7c32cd87d6c8e3c9cfd9d5622860 SOURCES/libvirt-8.5.0.tar.xz diff --git a/SOURCES/libvirt-Make-systemd-unit-ordering-more-robust.patch b/SOURCES/libvirt-Make-systemd-unit-ordering-more-robust.patch deleted file mode 100644 index be38df5..0000000 --- a/SOURCES/libvirt-Make-systemd-unit-ordering-more-robust.patch +++ /dev/null @@ -1,89 +0,0 @@ -From ee1ce580f5373070e4b6a50d1ae4a3218c737a72 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Martin Kletzander -Date: Mon, 14 Feb 2022 12:37:37 +0100 -Subject: [PATCH] Make systemd unit ordering more robust - -Since libvirt-guests script/service can operate on various URIs and we do -support both socket activation and traditional services, the ordering should be -specified for all the possible sockets and services. - -Also remove the Wants= dependency since do not want to start any service. We -cannot know which one libvirt-guests is configured, so we'd have to start all -the daemons which would break if unused colliding services are not -masked (libvirtd.service in the modular case and all the modular daemon service -units in the monolithic scenario). Fortunately we can assume that the system is -configured properly to start services/sockets that are of interest to the user. -That also works with the setup described in https://libvirt.org/daemons.html . - -To make it even more robust we add the daemon service into the machine units -created for individual domains as it was missing there. - -https://bugzilla.redhat.com/show_bug.cgi?id=1868537 - -Signed-off-by: Martin Kletzander -Reviewed-by: Michal Privoznik -(cherry picked from commit 4e42686adef8b9e9266f0099ddcd25bc95c4ed43) -Signed-off-by: Martin Kletzander ---- - src/util/virsystemd.c | 8 ++++++-- - tools/libvirt-guests.service.in | 12 +++++++++++- - 2 files changed, 17 insertions(+), 3 deletions(-) - -diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c -index a86d4c6bb9..f156c2f39a 100644 ---- a/src/util/virsystemd.c -+++ b/src/util/virsystemd.c -@@ -441,8 +441,10 @@ int virSystemdCreateMachine(const char *name, - nicindexes, nnicindexes, sizeof(int)); - gprops = g_variant_new_parsed("[('Slice', <%s>)," - " ('After', <['libvirtd.service']>)," -+ " ('After', <['virt%sd.service']>)," - " ('Before', <['virt-guest-shutdown.target']>)]", -- slicename); -+ slicename, -+ drivername); - message = g_variant_new("(s@ayssus@ai@a(sv))", - name, - guuid, -@@ -489,8 +491,10 @@ int virSystemdCreateMachine(const char *name, - uuid, 16, sizeof(unsigned char)); - gprops = g_variant_new_parsed("[('Slice', <%s>)," - " ('After', <['libvirtd.service']>)," -+ " ('After', <['virt%sd.service']>)," - " ('Before', <['virt-guest-shutdown.target']>)]", -- slicename); -+ slicename, -+ drivername); - message = g_variant_new("(s@ayssus@a(sv))", - name, - guuid, -diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in -index 1a9b233e11..3cf6476196 100644 ---- a/tools/libvirt-guests.service.in -+++ b/tools/libvirt-guests.service.in -@@ -1,10 +1,20 @@ - [Unit] - Description=Suspend/Resume Running libvirt Guests --Wants=libvirtd.service - Requires=virt-guest-shutdown.target - After=network.target - After=time-sync.target -+After=libvirtd.socket -+After=virtqemud.socket -+After=virtlxcd.socket -+After=virtvboxd.socket -+After=virtvzd.socket -+After=virtxend.socket - After=libvirtd.service -+After=virtqemud.service -+After=virtlxcd.service -+After=virtvboxd.service -+After=virtvzd.service -+After=virtxend.service - After=virt-guest-shutdown.target - Documentation=man:libvirt-guests(8) - Documentation=https://libvirt.org --- -2.35.1 - diff --git a/SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch b/SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch deleted file mode 100644 index 245859e..0000000 --- a/SOURCES/libvirt-RHEL-Fix-virConnectGetMaxVcpus-output.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 16b9ab85b004308e1d99db4ed4769a5fa56e2dfa Mon Sep 17 00:00:00 2001 -Message-Id: <16b9ab85b004308e1d99db4ed4769a5fa56e2dfa@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Mon, 27 Aug 2018 13:09:38 +0200 -Subject: [PATCH] RHEL: Fix virConnectGetMaxVcpus output -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -https://bugzilla.redhat.com/show_bug.cgi?id=1092363 - -RHEL-only. - -Ignore the maximum vcpu limit (KVM_CAP_MAX_VCPUS) on RHEL, -since RHEL QEMU treats the recommended limit (KVM_CAP_NR_VCPUS) -as the maximum, see: -https://bugzilla.redhat.com/show_bug.cgi?id=998708 - -(cherry picked from commit 7dff909fa34bdd93ad200dbffe70c0c1ee931925) -Signed-off-by: Ján Tomko - -https: //bugzilla.redhat.com/show_bug.cgi?id=1582222 -Reviewed-by: Andrea Bolognani ---- - src/util/virhostcpu.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c -index a07c00a0e9..35f41daef2 100644 ---- a/src/util/virhostcpu.c -+++ b/src/util/virhostcpu.c -@@ -1166,6 +1166,11 @@ virHostCPUGetKVMMaxVCPUs(void) - return -1; - } - -+/* Ignore KVM_CAP_MAX_VCPUS on RHEL - the recommended maximum -+ * is treated as a hard limit. -+ */ -+# undef KVM_CAP_MAX_VCPUS -+ - # ifdef KVM_CAP_MAX_VCPUS - /* at first try KVM_CAP_MAX_VCPUS to determine the maximum count */ - if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_MAX_VCPUS)) > 0) --- -2.34.1 - diff --git a/SOURCES/libvirt-Revert-report-error-when-virProcessGetStatInfo-is-unable-to-parse-data.patch b/SOURCES/libvirt-Revert-report-error-when-virProcessGetStatInfo-is-unable-to-parse-data.patch deleted file mode 100644 index f2ab83f..0000000 --- a/SOURCES/libvirt-Revert-report-error-when-virProcessGetStatInfo-is-unable-to-parse-data.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 81f1508d99d4740e7a2a092128d651cf245a554e Mon Sep 17 00:00:00 2001 -Message-Id: <81f1508d99d4740e7a2a092128d651cf245a554e@dist-git> -From: Michal Privoznik -Date: Tue, 18 Jan 2022 12:40:09 +0100 -Subject: [PATCH] Revert "report error when virProcessGetStatInfo() is unable - to parse data" - -This reverts commit 938382b60ae5bd1f83b5cb09e1ce68b9a88f679a. - -Turns out, the commit did more harm than good. It changed -semantics on some public APIs. For instance, while -qemuDomainGetInfo() previously did not returned an error it does -now. While the calls to virProcessGetStatInfo() is guarded with -virDomainObjIsActive() it doesn't necessarily mean that QEMU's -PID is still alive. QEMU might be gone but we just haven't -realized it (e.g. because the eof handler thread is waiting for a -job). - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2041610 -Signed-off-by: Michal Privoznik -Reviewed-by: Andrea Bolognani -(cherry picked from commit 105dace22cc7b5b18d72a4dcad4a2cf386ce5c99) -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2043579 -Signed-off-by: Michal Privoznik ---- - src/ch/ch_driver.c | 2 ++ - src/qemu/qemu_driver.c | 7 ++++++- - src/util/virprocess.c | 8 ++------ - 3 files changed, 10 insertions(+), 7 deletions(-) - -diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c -index 3cbc668489..53e0872207 100644 ---- a/src/ch/ch_driver.c -+++ b/src/ch/ch_driver.c -@@ -1073,6 +1073,8 @@ chDomainHelperGetVcpus(virDomainObj *vm, - if (virProcessGetStatInfo(&vcpuinfo->cpuTime, - &vcpuinfo->cpu, NULL, - vm->pid, vcpupid) < 0) { -+ virReportSystemError(errno, "%s", -+ _("cannot get vCPU placement & pCPU time")); - return -1; - } - } -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index 65ac5ef367..d3d76c003f 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -1359,6 +1359,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm, - if (virProcessGetStatInfo(&vcpuinfo->cpuTime, - &vcpuinfo->cpu, NULL, - vm->pid, vcpupid) < 0) { -+ virReportSystemError(errno, "%s", -+ _("cannot get vCPU placement & pCPU time")); - return -1; - } - } -@@ -2519,6 +2521,8 @@ qemuDomainGetInfo(virDomainPtr dom, - if (virDomainObjIsActive(vm)) { - if (virProcessGetStatInfo(&(info->cpuTime), NULL, NULL, - vm->pid, 0) < 0) { -+ virReportError(VIR_ERR_OPERATION_FAILED, "%s", -+ _("cannot read cputime for domain")); - goto cleanup; - } - } -@@ -10526,7 +10530,8 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver, - } - - if (virProcessGetStatInfo(NULL, NULL, &rss, vm->pid, 0) < 0) { -- virResetLastError(); -+ virReportError(VIR_ERR_OPERATION_FAILED, "%s", -+ _("cannot get RSS for domain")); - } else { - stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS; - stats[ret].val = rss; -diff --git a/src/util/virprocess.c b/src/util/virprocess.c -index 85d8c8e747..b559a4257e 100644 ---- a/src/util/virprocess.c -+++ b/src/util/virprocess.c -@@ -1784,10 +1784,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime, - virStrToLong_ullp(proc_stat[VIR_PROCESS_STAT_STIME], NULL, 10, &systime) < 0 || - virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < 0 || - virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &cpu) < 0) { -- virReportError(VIR_ERR_INTERNAL_ERROR, -- _("cannot parse process status data for pid '%d/%d'"), -- (int) pid, (int) tid); -- return -1; -+ VIR_WARN("cannot parse process status data"); - } - - /* We got jiffies -@@ -1884,8 +1881,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime G_GNUC_UNUSED, - pid_t pid G_GNUC_UNUSED, - pid_t tid G_GNUC_UNUSED) - { -- virReportSystemError(ENOSYS, "%s", -- _("Process statistics data is not supported on this platform")); -+ errno = ENOSYS; - return -1; - } - --- -2.35.0 - diff --git a/SOURCES/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch b/SOURCES/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch deleted file mode 100644 index a2ecb09..0000000 --- a/SOURCES/libvirt-build-Only-install-libvirt-guests-when-building-libvirtd.patch +++ /dev/null @@ -1,75 +0,0 @@ -From f45c99be9258f2d97c1f19b93ae8f5e73f4cb486 Mon Sep 17 00:00:00 2001 -Message-Id: -From: Jim Fehlig -Date: Mon, 10 Jan 2022 11:42:58 -0700 -Subject: [PATCH] build: Only install libvirt-guests when building libvirtd - -libvirt-guests was already moved to the libvirt daemon package in commit -d800c50349. It only needs to be installed when building libvirtd. - -Signed-off-by: Jim Fehlig -Reviewed-by: Andrea Bolognani -(cherry picked from commit 3be5ba11a2c6fcb2dfdffa03ab4f847113f36b85) - -https://bugzilla.redhat.com/show_bug.cgi?id=2042529 ---- - tools/meson.build | 38 ++++++++++++++++++++------------------ - 1 file changed, 20 insertions(+), 18 deletions(-) - -diff --git a/tools/meson.build b/tools/meson.build -index 22fa3604ba..2d0aecb90b 100644 ---- a/tools/meson.build -+++ b/tools/meson.build -@@ -297,29 +297,31 @@ if conf.has('WITH_SANLOCK') - ) - endif - --configure_file( -- input: 'libvirt-guests.sh.in', -- output: '@BASENAME@', -- configuration: tools_conf, -- install: true, -- install_dir: libexecdir, -- install_mode: 'rwxrwxr-x', --) -- --if init_script == 'systemd' -- install_data( -- 'libvirt-guests.sysconf', -- install_dir: sysconfdir / 'sysconfig', -- rename: 'libvirt-guests', -- ) -- -+if conf.has('WITH_LIBVIRTD') - configure_file( -- input: 'libvirt-guests.service.in', -+ input: 'libvirt-guests.sh.in', - output: '@BASENAME@', - configuration: tools_conf, - install: true, -- install_dir: prefix / 'lib' / 'systemd' / 'system', -+ install_dir: libexecdir, -+ install_mode: 'rwxrwxr-x', - ) -+ -+ if init_script == 'systemd' -+ install_data( -+ 'libvirt-guests.sysconf', -+ install_dir: sysconfdir / 'sysconfig', -+ rename: 'libvirt-guests', -+ ) -+ -+ configure_file( -+ input: 'libvirt-guests.service.in', -+ output: '@BASENAME@', -+ configuration: tools_conf, -+ install: true, -+ install_dir: prefix / 'lib' / 'systemd' / 'system', -+ ) -+ endif - endif - - if bash_completion_dep.found() --- -2.35.0 - diff --git a/SOURCES/libvirt-docs-Add-man-page-for-libvirt-guests.patch b/SOURCES/libvirt-docs-Add-man-page-for-libvirt-guests.patch deleted file mode 100644 index de5f819..0000000 --- a/SOURCES/libvirt-docs-Add-man-page-for-libvirt-guests.patch +++ /dev/null @@ -1,217 +0,0 @@ -From 8363046dd5f3e018aaea7b6d9b711fb3d1e417cc Mon Sep 17 00:00:00 2001 -Message-Id: <8363046dd5f3e018aaea7b6d9b711fb3d1e417cc@dist-git> -From: Jim Fehlig -Date: Fri, 7 Jan 2022 14:35:10 -0700 -Subject: [PATCH] docs: Add man page for libvirt-guests - -Signed-off-by: Jim Fehlig -Reviewed-by: Andrea Bolognani -(cherry picked from commit 161727417a91bdddf8f3167cf70c3de2829be81c) - -https://bugzilla.redhat.com/show_bug.cgi?id=2042529 ---- - docs/manpages/index.rst | 1 + - docs/manpages/libvirt-guests.rst | 151 +++++++++++++++++++++++++++++++ - docs/manpages/meson.build | 1 + - libvirt.spec.in | 1 + - tools/libvirt-guests.service.in | 2 +- - 5 files changed, 155 insertions(+), 1 deletion(-) - create mode 100644 docs/manpages/libvirt-guests.rst - -diff --git a/docs/manpages/index.rst b/docs/manpages/index.rst -index fb4a36d46a..8fd0d90041 100644 ---- a/docs/manpages/index.rst -+++ b/docs/manpages/index.rst -@@ -41,6 +41,7 @@ Tools - * `virt-admin(1) `__ - daemon administration interface - * `virsh(1) `__ - management user interface - * `virt-qemu-run(1) `__ - run standalone QEMU instances -+* `libvirt-guests(8) `__ - suspend/resume running libvirt guests - - Key codes - ========= -diff --git a/docs/manpages/libvirt-guests.rst b/docs/manpages/libvirt-guests.rst -new file mode 100644 -index 0000000000..76045ed11a ---- /dev/null -+++ b/docs/manpages/libvirt-guests.rst -@@ -0,0 +1,151 @@ -+============== -+libvirt-guests -+============== -+ -+------------------------------------- -+suspend/resume running libvirt guests -+------------------------------------- -+ -+:Manual section: 8 -+:Manual group: Virtualization Support -+ -+.. contents:: -+ -+SYNOPSIS -+======== -+ -+``libvirt-guests`` *COMMAND* -+ -+ -+DESCRIPTION -+=========== -+ -+``libvirt-guests`` is a service that can be used to coordinate guest and host -+lifecyle actions. By default, ``libvirt-guests`` will suspend running guests -+when the host shuts down, and restore them to their pre-shutdown state when -+the host reboots. -+ -+``libvirt-guests`` is typically under control of systemd. When -+``libvirt-guests.service`` is enabled, systemd will call ``libvirt-guests`` -+with the ``start`` *COMMAND* when the host boots. Conversely, systemd will call -+``libvirt-guests`` with the ``stop`` *COMMAND* when the host shuts down. -+ -+``libvirt-guests`` can be used directly. In addition to the ``start`` and -+``stop`` *COMMAND*\s, it also supports ``status``, ``restart``, ``condrestart``, -+``try-restart``, ``reload``, ``force-reload``, ``gueststatus``, and -+``shutdown`` *COMMAND*\s. -+ -+ -+FILES -+===== -+ -+``libvirt-guests`` defines several variables to control service behavior. -+The default vaule of these variables can be overridden in: -+ -+* ``@SYSCONFDIR@/sysconfig/libvirt-guests`` -+ -+The following variables are supported: -+ -+- URIS=default -+ -+ URIs to check for running guests. Example: -+ ``URIS='default xen:///system xen+tcp://host/system lxc:///system'`` -+ -+- ON_BOOT=start -+ -+ Action taken on host boot -+ -+ * start -+ -+ All guests which were running on shutdown are started on boot regardless -+ of their autostart settings -+ -+ * ignore -+ -+ ``libvirt-guests`` won't start any guest on boot, however, guests marked -+ as autostart will still be automatically started by libvirtd -+ -+- START_DELAY=0 -+ -+ Number of seconds to wait between each guest start. Set to 0 to allow parallel -+ startup. -+ -+- ON_SHUTDOWN=suspend -+ -+ Action taken on host shutdown -+ -+ * suspend -+ -+ All running guests are suspended using virsh managedsave -+ -+ * shutdown -+ -+ All running guests are asked to shutdown. Please be careful with this -+ settings since there is no way to distinguish between a guest which is -+ stuck or ignores shutdown requests and a guest which just needs a long -+ time to shutdown. When setting ON_SHUTDOWN=shutdown, you must also set -+ SHUTDOWN_TIMEOUT to a value suitable for your guests. -+ -+- PARALLEL_SHUTDOWN=0 -+ -+ Number of guests will be shutdown concurrently, taking effect when -+ "ON_SHUTDOWN" is set to "shutdown". If Set to 0, guests will be shutdown one -+ after another. Number of guests on shutdown at any time will not exceed number -+ set in this variable. -+ -+- SHUTDOWN_TIMEOUT=300 -+ -+ Number of seconds we're willing to wait for a guest to shut down. If parallel -+ shutdown is enabled, this timeout applies as a timeout for shutting down all -+ guests on a single URI defined in the variable URIS. If this is 0, then there -+ is no time out (use with caution, as guests might not respond to a shutdown -+ request). The default value is 300 seconds (5 minutes). -+ -+- BYPASS_CACHE=0 -+ -+ If non-zero, try to bypass the file system cache when saving and -+ restoring guests, even though this may give slower operation for -+ some file systems. -+ -+- SYNC_TIME=0 -+ -+ If non-zero, try to sync guest time on domain resume. Be aware, that -+ this requires guest agent with support for time synchronization -+ running in the guest. By default, this functionality is turned off. -+ -+ -+BUGS -+==== -+ -+Please report all bugs you discover. This should be done via either: -+ -+#. the mailing list -+ -+ `https://libvirt.org/contact.html `_ -+ -+#. the bug tracker -+ -+ `https://libvirt.org/bugs.html `_ -+ -+Alternatively, you may report bugs to your software distributor / vendor. -+ -+ -+AUTHORS -+======= -+ -+Please refer to the AUTHORS file distributed with libvirt. -+ -+ -+LICENSE -+======= -+ -+``libvirt-guests`` is distributed under the terms of the GNU LGPL v2.1+. -+This is free software; see the source for copying conditions. There -+is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -+PURPOSE -+ -+ -+SEE ALSO -+======== -+ -+libvirtd(8), `https://libvirt.org/ `_ -diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build -index 150f45d296..bad9b62a2e 100644 ---- a/docs/manpages/meson.build -+++ b/docs/manpages/meson.build -@@ -21,6 +21,7 @@ docs_man_files = [ - { 'name': 'virt-qemu-run', 'section': '1', 'install': conf.has('WITH_QEMU') }, - { 'name': 'virt-xml-validate', 'section': '1', 'install': true }, - -+ { 'name': 'libvirt-guests', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, - { 'name': 'libvirtd', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, - { 'name': 'virt-sanlock-cleanup', 'section': '8', 'install': conf.has('WITH_SANLOCK') }, - { 'name': 'virt-ssh-helper', 'section': '8', 'install': conf.has('WITH_LIBVIRTD') }, -diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in -index 10c664016a..1a9b233e11 100644 ---- a/tools/libvirt-guests.service.in -+++ b/tools/libvirt-guests.service.in -@@ -6,7 +6,7 @@ After=network.target - After=time-sync.target - After=libvirtd.service - After=virt-guest-shutdown.target --Documentation=man:libvirtd(8) -+Documentation=man:libvirt-guests(8) - Documentation=https://libvirt.org - - [Service] --- -2.35.0 - diff --git a/SOURCES/libvirt-docs-Document-TPM-portion-of-domcaps.patch b/SOURCES/libvirt-docs-Document-TPM-portion-of-domcaps.patch new file mode 100644 index 0000000..e093c28 --- /dev/null +++ b/SOURCES/libvirt-docs-Document-TPM-portion-of-domcaps.patch @@ -0,0 +1,62 @@ +From b5a226f307b01bb1b58a88c95d29da34c246757f Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Tue, 12 Jul 2022 16:10:08 +0200 +Subject: [PATCH] docs: Document TPM portion of domcaps + +Surprisingly, we don't document TPM part of domain capabilities. +Fortunately, the information exposed is pretty much self +explanatory, but we should document it regardless. + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 6a00c565c4d0f0ec970e043ea2686bd30396ed79) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +--- + docs/formatdomaincaps.rst | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + +diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst +index 933469b2a2..3c425a9a4a 100644 +--- a/docs/formatdomaincaps.rst ++++ b/docs/formatdomaincaps.rst +@@ -494,6 +494,35 @@ instance: + ``driverType`` + Options for the ``type`` attribute of the element. + ++TPM device ++^^^^^^^^^^ ++ ++TPM device capabilities are exposed under the ``tpm`` element. For instance: ++ ++:: ++ ++ ++ ... ++ ++ ++ ++ tpm-tis ++ tpm-crb ++ ++ ++ passthrough ++ emulator ++ ++ ++ ... ++ ++ ++ ++``model`` ++ Options for the ``model`` attribute of the ```` element. ++``backendModel`` ++ Options for the ``type`` attribute of the ```` element. ++ + Features + ~~~~~~~~ + +-- +2.35.1 + diff --git a/SOURCES/libvirt-domain_conf-Format-defaultiothread-more-often.patch b/SOURCES/libvirt-domain_conf-Format-defaultiothread-more-often.patch new file mode 100644 index 0000000..46b436d --- /dev/null +++ b/SOURCES/libvirt-domain_conf-Format-defaultiothread-more-often.patch @@ -0,0 +1,96 @@ +From a39ce54007de67ce6909c1770a7759b09c41bfd6 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Thu, 7 Jul 2022 16:29:18 +0200 +Subject: [PATCH] domain_conf: Format more often +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The element is formatted inside +virDomainDefaultIOThreadDefFormat() which is called only from +virDomainDefIOThreadsFormat() (so that IOThread related stuff is +formatted calling one function). However, when there are no + defined (or only autoallocated ones are present), +then the outer formatting function exits early never calling the + formatter. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 24fa7004e47ce86b92bc23c1f2ef9c3d6152c3a8) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/conf/domain_conf.c | 46 ++++++++++++++++++++---------------------- + 1 file changed, 22 insertions(+), 24 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 709ca53790..207a45d9ae 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27763,40 +27763,38 @@ static void + virDomainDefIOThreadsFormat(virBuffer *buf, + const virDomainDef *def) + { +- g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); +- size_t i; +- +- if (def->niothreadids == 0) +- return; ++ if (def->niothreadids > 0) { ++ virBufferAsprintf(buf, "%zu\n", ++ def->niothreadids); ++ } + +- virBufferAsprintf(buf, "%zu\n", +- def->niothreadids); ++ if (virDomainDefIothreadShouldFormat(def)) { ++ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); ++ size_t i; + +- if (!virDomainDefIothreadShouldFormat(def)) +- return; ++ for (i = 0; i < def->niothreadids; i++) { ++ virDomainIOThreadIDDef *iothread = def->iothreadids[i]; ++ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; + +- for (i = 0; i < def->niothreadids; i++) { +- virDomainIOThreadIDDef *iothread = def->iothreadids[i]; +- g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER; ++ virBufferAsprintf(&attrBuf, " id='%u'", ++ iothread->iothread_id); + +- virBufferAsprintf(&attrBuf, " id='%u'", +- iothread->iothread_id); ++ if (iothread->thread_pool_min >= 0) { ++ virBufferAsprintf(&attrBuf, " thread_pool_min='%d'", ++ iothread->thread_pool_min); ++ } + +- if (iothread->thread_pool_min >= 0) { +- virBufferAsprintf(&attrBuf, " thread_pool_min='%d'", +- iothread->thread_pool_min); +- } ++ if (iothread->thread_pool_max >= 0) { ++ virBufferAsprintf(&attrBuf, " thread_pool_max='%d'", ++ iothread->thread_pool_max); ++ } + +- if (iothread->thread_pool_max >= 0) { +- virBufferAsprintf(&attrBuf, " thread_pool_max='%d'", +- iothread->thread_pool_max); ++ virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); + } + +- virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL); ++ virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); + } + +- virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); +- + virDomainDefaultIOThreadDefFormat(buf, def); + } + +-- +2.35.1 + diff --git a/SOURCES/libvirt-domain_conf-Format-iothread-IDs-more-often.patch b/SOURCES/libvirt-domain_conf-Format-iothread-IDs-more-often.patch new file mode 100644 index 0000000..3a3d874 --- /dev/null +++ b/SOURCES/libvirt-domain_conf-Format-iothread-IDs-more-often.patch @@ -0,0 +1,61 @@ +From 711cf329b9847c4d42994389d89a7e7b83c71596 Mon Sep 17 00:00:00 2001 +Message-Id: <711cf329b9847c4d42994389d89a7e7b83c71596@dist-git> +From: Michal Privoznik +Date: Thu, 7 Jul 2022 16:29:33 +0200 +Subject: [PATCH] domain_conf: Format iothread IDs more often +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When formatting IOThreads (in virDomainDefIOThreadsFormat()), we +may only output the number of IOThreads, or the full list of IOThreads too: + + 4 + + + + + + + +Now, the deciding factor here is whether those individual +IOThreads were so called 'autofill-ed' or user provided. Well, we +need to take another factor in: if an IOThread has pool size +limit set, then we ought to format the full list. + +But how can we get into a situation when a thread is autofilled +(i.e. not provided by user in the XML) and yet it has pool size +limit set? virDomainSetIOThreadParams() is the answer. + +Sure, we could also unset the autofill flag whenever a pool size +limit is being set. But this approach allows us to not format +anything if the limits are reset (we don't lose the autofill +information). + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 5aa24958546c94a48fb8f8d6022213ca7c07c8a7) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/conf/domain_conf.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 207a45d9ae..fbc285d981 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27728,7 +27728,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef *def) + size_t i; + + for (i = 0; i < def->niothreadids; i++) { +- if (!def->iothreadids[i]->autofill) ++ if (!def->iothreadids[i]->autofill || ++ def->iothreadids[i]->thread_pool_min >= 0 || ++ def->iothreadids[i]->thread_pool_max >= 0) + return true; + } + +-- +2.35.1 + diff --git a/SOURCES/libvirt-domcaps-Introduce-TPM-backendVersion.patch b/SOURCES/libvirt-domcaps-Introduce-TPM-backendVersion.patch new file mode 100644 index 0000000..3631a14 --- /dev/null +++ b/SOURCES/libvirt-domcaps-Introduce-TPM-backendVersion.patch @@ -0,0 +1,74 @@ +From 266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c Mon Sep 17 00:00:00 2001 +Message-Id: <266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c@dist-git> +From: Michal Privoznik +Date: Tue, 12 Jul 2022 15:58:12 +0200 +Subject: [PATCH] domcaps: Introduce TPM backendVersion + +We accept TPM version in the domain XML. However, supported +version depends on the host (swtpm_setup binary) and thus it may +be tricky for users (or mgmt applications) chose a version. +Introduce machinery for reporting supported version in domain +capabilities. + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 1277a9c884039e92765c977917420511f45e52e8) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +--- + docs/formatdomaincaps.rst | 6 ++++++ + src/conf/domain_capabilities.c | 1 + + src/conf/domain_capabilities.h | 1 + + 3 files changed, 8 insertions(+) + +diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst +index 3c425a9a4a..70f46b972a 100644 +--- a/docs/formatdomaincaps.rst ++++ b/docs/formatdomaincaps.rst +@@ -513,6 +513,10 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance: + passthrough + emulator + ++ ++ 1.2 ++ 2.0 ++ + + ... + +@@ -522,6 +526,8 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance: + Options for the ``model`` attribute of the ```` element. + ``backendModel`` + Options for the ``type`` attribute of the ```` element. ++``backendVersion`` ++ Options for the ``version`` attribute of the ```` element. + + Features + ~~~~~~~~ +diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c +index 895e8d00e8..33570a51db 100644 +--- a/src/conf/domain_capabilities.c ++++ b/src/conf/domain_capabilities.c +@@ -539,6 +539,7 @@ virDomainCapsDeviceTPMFormat(virBuffer *buf, + + ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString); + ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString); ++ ENUM_PROCESS(tpm, backendVersion, virDomainTPMVersionTypeToString); + + FORMAT_EPILOGUE(tpm); + } +diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h +index f2eed80b15..a526969cda 100644 +--- a/src/conf/domain_capabilities.h ++++ b/src/conf/domain_capabilities.h +@@ -127,6 +127,7 @@ struct _virDomainCapsDeviceTPM { + virTristateBool supported; + virDomainCapsEnum model; /* virDomainTPMModel */ + virDomainCapsEnum backendModel; /* virDomainTPMBackendType */ ++ virDomainCapsEnum backendVersion; /* virDomainTPMVersion */ + }; + + STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST); +-- +2.35.1 + diff --git a/SOURCES/libvirt-nwfilter-hold-filter-update-lock-when-creating-deleting-bindings.patch b/SOURCES/libvirt-nwfilter-hold-filter-update-lock-when-creating-deleting-bindings.patch deleted file mode 100644 index d9f6fab..0000000 --- a/SOURCES/libvirt-nwfilter-hold-filter-update-lock-when-creating-deleting-bindings.patch +++ /dev/null @@ -1,77 +0,0 @@ -From bbab997f4307da65856dedd3f319037ce442d17e Mon Sep 17 00:00:00 2001 -Message-Id: -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Thu, 24 Feb 2022 18:41:29 +0000 -Subject: [PATCH] nwfilter: hold filter update lock when creating/deleting - bindings -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The nwfilter update lock is historically acquired by the virt -drivers in order to achieve serialization between nwfilter -define/undefine, and instantiation/teardown of filters. - -When running in the modular daemons, however, the mutex that -the virt drivers are locking is in a completely different -process from the mutex that the nwfilter driver is locking. - -Serialization is lost and thus call from the virt driver to -virNWFilterBindingCreateXML can deadlock with a concurrent -call to the virNWFilterDefineXML method. - -The solution is surprisingly easy, the update lock simply -needs acquiring in the virNWFilterBindingCreateXML method -and virNWFilterBindingUndefine method instead of in the -virt drivers. - -The only semantic difference here is that when a virtual -machine has multiple NICs, the instantiation and teardown -of filters is no longer serialized for the whole VM, but -rather for each NIC. This should not be a problem since -the virt drivers already need to cope with tearing down -a partially created VM where only some of the NICs are -setup. - -Reviewed-by: Laine Stump -Signed-off-by: Daniel P. Berrangé -(cherry picked from commit 65dc79f50b96b34b2253601b8972d5ca90658f33) -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2044379 -Signed-off-by: Michal Privoznik ---- - src/nwfilter/nwfilter_driver.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c -index 200451d6b1..a4479fc9fe 100644 ---- a/src/nwfilter/nwfilter_driver.c -+++ b/src/nwfilter/nwfilter_driver.c -@@ -760,12 +760,15 @@ nwfilterBindingCreateXML(virConnectPtr conn, - if (!(ret = virGetNWFilterBinding(conn, def->portdevname, def->filter))) - goto cleanup; - -+ virNWFilterReadLockFilterUpdates(); - if (virNWFilterInstantiateFilter(driver, def) < 0) { -+ virNWFilterUnlockFilterUpdates(); - virNWFilterBindingObjListRemove(driver->bindings, obj); - virObjectUnref(ret); - ret = NULL; - goto cleanup; - } -+ virNWFilterUnlockFilterUpdates(); - virNWFilterBindingObjSave(obj, driver->bindingDir); - - cleanup: -@@ -802,7 +805,9 @@ nwfilterBindingDelete(virNWFilterBindingPtr binding) - if (virNWFilterBindingDeleteEnsureACL(binding->conn, def) < 0) - goto cleanup; - -+ virNWFilterReadLockFilterUpdates(); - virNWFilterTeardownFilter(def); -+ virNWFilterUnlockFilterUpdates(); - virNWFilterBindingObjDelete(obj, driver->bindingDir); - virNWFilterBindingObjListRemove(driver->bindings, obj); - --- -2.35.1 - diff --git a/SOURCES/libvirt-qemu-Always-assume-support-for-QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE.patch b/SOURCES/libvirt-qemu-Always-assume-support-for-QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE.patch new file mode 100644 index 0000000..7ecdf33 --- /dev/null +++ b/SOURCES/libvirt-qemu-Always-assume-support-for-QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE.patch @@ -0,0 +1,183 @@ +From b020ddee84458afd8de70d9f296b91fa2b6a95fd Mon Sep 17 00:00:00 2001 +Message-Id: +From: Peter Krempa +Date: Fri, 15 Jul 2022 14:16:54 +0200 +Subject: [PATCH] qemu: Always assume support for + QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE + +The 'xbzrle-cache-size' parameter was added in qemu-2.11 thus all +supported qemu versions now use the new code path. + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit 06e0ba3da71ec6c58024efe57d0f55d3d1352d60) + +This commit is not strictly needed for fixing the following BZ, but it +removes a code which will be never executed in RHEL 9 and backporting it +avoids conflicts with the actual bug fix. + +https://bugzilla.redhat.com/show_bug.cgi?id=2107892 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 56 +++++++++----------------------- + src/qemu/qemu_migration_params.c | 18 ---------- + 2 files changed, 16 insertions(+), 58 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 17e4c23199..256e126ae1 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -13172,10 +13172,8 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, + { + virQEMUDriver *driver = dom->conn->privateData; + virDomainObj *vm; +- qemuDomainObjPrivate *priv; + g_autoptr(qemuMigrationParams) migParams = NULL; + int ret = -1; +- int rc; + + virCheckFlags(0, -1); + +@@ -13191,8 +13189,6 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, + if (virDomainObjCheckActive(vm) < 0) + goto endjob; + +- priv = vm->privateData; +- + if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_XBZRLE)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Compressed migration is not supported by " +@@ -13200,22 +13196,14 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, + goto endjob; + } + +- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { +- if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, +- &migParams) < 0) +- goto endjob; ++ if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE, ++ &migParams) < 0) ++ goto endjob; + +- if (qemuMigrationParamsGetULL(migParams, +- QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, +- cacheSize) < 0) +- goto endjob; +- } else { +- qemuDomainObjEnterMonitor(driver, vm); +- rc = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize); +- qemuDomainObjExitMonitor(vm); +- if (rc < 0) +- goto endjob; +- } ++ if (qemuMigrationParamsGetULL(migParams, ++ QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, ++ cacheSize) < 0) ++ goto endjob; + + ret = 0; + +@@ -13234,10 +13222,8 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, + { + virQEMUDriver *driver = dom->conn->privateData; + virDomainObj *vm; +- qemuDomainObjPrivate *priv; + g_autoptr(qemuMigrationParams) migParams = NULL; + int ret = -1; +- int rc; + + virCheckFlags(0, -1); + +@@ -13253,8 +13239,6 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, + if (virDomainObjCheckActive(vm) < 0) + goto endjob; + +- priv = vm->privateData; +- + if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_XBZRLE)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Compressed migration is not supported by " +@@ -13263,25 +13247,17 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, + } + + VIR_DEBUG("Setting compression cache to %llu B", cacheSize); +- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { +- if (!(migParams = qemuMigrationParamsNew())) +- goto endjob; ++ if (!(migParams = qemuMigrationParamsNew())) ++ goto endjob; + +- if (qemuMigrationParamsSetULL(migParams, +- QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, +- cacheSize) < 0) +- goto endjob; ++ if (qemuMigrationParamsSetULL(migParams, ++ QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE, ++ cacheSize) < 0) ++ goto endjob; + +- if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, +- migParams, 0) < 0) +- goto endjob; +- } else { +- qemuDomainObjEnterMonitor(driver, vm); +- rc = qemuMonitorSetMigrationCacheSize(priv->mon, cacheSize); +- qemuDomainObjExitMonitor(vm); +- if (rc < 0) +- goto endjob; +- } ++ if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, ++ migParams, 0) < 0) ++ goto endjob; + + ret = 0; + +diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c +index 6ea0bde13a..0bce358ac3 100644 +--- a/src/qemu/qemu_migration_params.c ++++ b/src/qemu/qemu_migration_params.c +@@ -886,10 +886,8 @@ qemuMigrationParamsApply(virQEMUDriver *driver, + unsigned long apiFlags) + { + qemuDomainObjPrivate *priv = vm->privateData; +- bool xbzrleCacheSize_old = false; + g_autoptr(virJSONValue) params = NULL; + g_autoptr(virJSONValue) caps = NULL; +- qemuMigrationParam xbzrle = QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE; + bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME); + int ret = -1; + +@@ -917,19 +915,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver, + } + } + +- /* If QEMU is too old to support xbzrle-cache-size migration parameter, +- * we need to set it via migrate-set-cache-size and tell +- * qemuMonitorSetMigrationParams to ignore this parameter. +- */ +- if (migParams->params[xbzrle].set && +- !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) { +- if (qemuMonitorSetMigrationCacheSize(priv->mon, +- migParams->params[xbzrle].value.ull) < 0) +- goto cleanup; +- xbzrleCacheSize_old = true; +- migParams->params[xbzrle].set = false; +- } +- + if (!(params = qemuMigrationParamsToJSON(migParams, postcopyResume))) + goto cleanup; + +@@ -942,9 +927,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver, + cleanup: + qemuDomainObjExitMonitor(vm); + +- if (xbzrleCacheSize_old) +- migParams->params[xbzrle].set = true; +- + return ret; + } + +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-Make-IOThread-changing-more-robust.patch b/SOURCES/libvirt-qemu-Make-IOThread-changing-more-robust.patch new file mode 100644 index 0000000..a94f31c --- /dev/null +++ b/SOURCES/libvirt-qemu-Make-IOThread-changing-more-robust.patch @@ -0,0 +1,195 @@ +From 5853ac5261b2934ca300b24a7bd78cc4b377c90c Mon Sep 17 00:00:00 2001 +Message-Id: <5853ac5261b2934ca300b24a7bd78cc4b377c90c@dist-git> +From: Michal Privoznik +Date: Thu, 7 Jul 2022 17:37:46 +0200 +Subject: [PATCH] qemu: Make IOThread changing more robust +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There are three APIs that allow changing IOThreads: + + virDomainAddIOThread() + virDomainDelIOThread() + virDomainSetIOThreadParams() + +In case of QEMU driver these are handled by +qemuDomainChgIOThread() which attempts to be versatile enough to +work on both inactive and live domain definitions at the same +time. However, it's a bit clumsy - when a change to live +definition succeeds but fails in inactive definition then there's +no rollback. And somewhat rightfully so - changes to live +definition are in general harder to roll back. Therefore, do what +we do elsewhere (qemuDomainAttachDeviceLiveAndConfig(), +qemuDomainDetachDeviceAliasLiveAndConfig(), ...): + + 1) do the change to inactive XML first, + 2) in fact, do the change to a copy of inactive XML, + 3) swap inactive XML and its copy only after everything + succeeded. + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit 6db9c95a45d4e24cdcd5c009b7fe5da3745b5d59) +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_driver.c | 74 ++++++++++++++++++++++++------------------ + 1 file changed, 43 insertions(+), 31 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 3b5c3db67c..2c627396f1 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -5594,6 +5594,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + { + g_autoptr(virQEMUDriverConfig) cfg = NULL; + qemuDomainObjPrivate *priv; ++ g_autoptr(virDomainDef) defcopy = NULL; + virDomainDef *def; + virDomainDef *persistentDef; + virDomainIOThreadIDDef *iothreaddef = NULL; +@@ -5609,34 +5610,34 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) + goto endjob; + +- if (def) { +- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { +- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +- _("IOThreads not supported with this binary")); +- goto endjob; +- } ++ if (persistentDef) { ++ /* Make a copy of persistent definition and do all the changes there. ++ * Swap the definitions only after changes to live definition ++ * succeeded. */ ++ if (!(defcopy = virDomainObjCopyPersistentDef(vm, driver->xmlopt, ++ priv->qemuCaps))) ++ return -1; + + switch (action) { + case VIR_DOMAIN_IOTHREAD_ACTION_ADD: +- if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0) ++ if (virDomainDriverAddIOThreadCheck(defcopy, iothread.iothread_id) < 0) + goto endjob; + +- if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0) ++ if (!virDomainIOThreadIDAdd(defcopy, iothread.iothread_id)) + goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_DEL: +- if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0) ++ if (virDomainDriverDelIOThreadCheck(defcopy, iothread.iothread_id) < 0) + goto endjob; + +- if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0) +- goto endjob; ++ virDomainIOThreadIDDel(defcopy, iothread.iothread_id); + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_MOD: +- iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id); ++ iothreaddef = virDomainIOThreadIDFind(defcopy, iothread.iothread_id); + + if (!iothreaddef) { + virReportError(VIR_ERR_INVALID_ARG, +@@ -5645,41 +5646,47 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + goto endjob; + } + +- if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0) ++ if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0) + goto endjob; + +- if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0) ++ if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) { ++ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", ++ _("configuring persistent polling values is not supported")); + goto endjob; ++ } + +- qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread); + break; +- + } +- +- qemuDomainSaveStatus(vm); + } + +- if (persistentDef) { ++ if (def) { ++ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("IOThreads not supported with this binary")); ++ goto endjob; ++ } ++ + switch (action) { + case VIR_DOMAIN_IOTHREAD_ACTION_ADD: +- if (virDomainDriverAddIOThreadCheck(persistentDef, iothread.iothread_id) < 0) ++ if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0) + goto endjob; + +- if (!virDomainIOThreadIDAdd(persistentDef, iothread.iothread_id)) ++ if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0) + goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_DEL: +- if (virDomainDriverDelIOThreadCheck(persistentDef, iothread.iothread_id) < 0) ++ if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0) + goto endjob; + +- virDomainIOThreadIDDel(persistentDef, iothread.iothread_id); ++ if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0) ++ goto endjob; + + break; + + case VIR_DOMAIN_IOTHREAD_ACTION_MOD: +- iothreaddef = virDomainIOThreadIDFind(persistentDef, iothread.iothread_id); ++ iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id); + + if (!iothreaddef) { + virReportError(VIR_ERR_INVALID_ARG, +@@ -5688,21 +5695,26 @@ qemuDomainChgIOThread(virQEMUDriver *driver, + goto endjob; + } + +- if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0) ++ if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0) + goto endjob; + +- if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) { +- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", +- _("configuring persistent polling values is not supported")); ++ if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0) + goto endjob; +- } + ++ qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread); + break; ++ + } + +- if (virDomainDefSave(persistentDef, driver->xmlopt, +- cfg->configDir) < 0) ++ qemuDomainSaveStatus(vm); ++ } ++ ++ /* Finally, if no error until here, we can save config. */ ++ if (defcopy) { ++ if (virDomainDefSave(defcopy, driver->xmlopt, cfg->configDir) < 0) + goto endjob; ++ ++ virDomainObjAssignDef(vm, &defcopy, false, NULL); + } + + ret = 0; +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-Pass-migration-flags-to-qemuMigrationParamsApply.patch b/SOURCES/libvirt-qemu-Pass-migration-flags-to-qemuMigrationParamsApply.patch new file mode 100644 index 0000000..a94344e --- /dev/null +++ b/SOURCES/libvirt-qemu-Pass-migration-flags-to-qemuMigrationParamsApply.patch @@ -0,0 +1,148 @@ +From 4c906acec14efe3893491d749465ed7e285a825c Mon Sep 17 00:00:00 2001 +Message-Id: <4c906acec14efe3893491d749465ed7e285a825c@dist-git> +From: Jiri Denemark +Date: Wed, 29 Jun 2022 12:00:03 +0200 +Subject: [PATCH] qemu: Pass migration flags to qemuMigrationParamsApply + +The flags will later be used to determine which parameters should +actually be applied. + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 0eae541257cd4f01c9d90db62056ad8d03c5af23) + +https://bugzilla.redhat.com/show_bug.cgi?id=2111070 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 6 +++--- + src/qemu/qemu_migration.c | 8 ++++---- + src/qemu/qemu_migration_params.c | 11 ++++++++--- + src/qemu/qemu_migration_params.h | 3 ++- + 4 files changed, 17 insertions(+), 11 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 847c96639d..17e4c23199 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -13091,7 +13091,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, + goto endjob; + + if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, +- migParams) < 0) ++ migParams, 0) < 0) + goto endjob; + } else { + qemuDomainObjEnterMonitor(driver, vm); +@@ -13273,7 +13273,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, + goto endjob; + + if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, +- migParams) < 0) ++ migParams, 0) < 0) + goto endjob; + } else { + qemuDomainObjEnterMonitor(driver, vm); +@@ -13360,7 +13360,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, + goto endjob; + + if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE, +- migParams) < 0) ++ migParams, 0) < 0) + goto endjob; + } else { + int rc; +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 76903d612b..8cbd73a809 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -3259,7 +3259,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver, + } + + if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN, +- migParams) < 0) ++ migParams, flags) < 0) + goto error; + + if (mig->nbd && +@@ -4847,7 +4847,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver, + goto error; + + if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT, +- migParams) < 0) ++ migParams, flags) < 0) + goto error; + + if (flags & VIR_MIGRATE_ZEROCOPY) { +@@ -6941,7 +6941,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, + QEMU_DOMAIN_MIG_BANDWIDTH_MAX * 1024 * 1024) < 0) + return -1; + +- if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams) < 0) ++ if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams, 0) < 0) + return -1; + + priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; +@@ -7037,7 +7037,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, + QEMU_MIGRATION_PARAM_MAX_BANDWIDTH, + saveMigBandwidth * 1024 * 1024) == 0) + ignore_value(qemuMigrationParamsApply(driver, vm, asyncJob, +- migParams)); ++ migParams, 0)); + } else { + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth); +diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c +index cc66ed8229..398c07efd0 100644 +--- a/src/qemu/qemu_migration_params.c ++++ b/src/qemu/qemu_migration_params.c +@@ -833,8 +833,10 @@ qemuMigrationCapsToJSON(virBitmap *caps, + * @vm: domain object + * @asyncJob: migration job + * @migParams: migration parameters to send to QEMU ++ * @apiFlags: migration flags, some of them may affect which parameters are applied + * +- * Send all parameters stored in @migParams to QEMU. ++ * Send parameters stored in @migParams to QEMU. If @apiFlags is non-zero, some ++ * parameters that do not make sense for the enabled flags will be ignored. + * + * Returns 0 on success, -1 on failure. + */ +@@ -842,7 +844,8 @@ int + qemuMigrationParamsApply(virQEMUDriver *driver, + virDomainObj *vm, + int asyncJob, +- qemuMigrationParams *migParams) ++ qemuMigrationParams *migParams, ++ unsigned long apiFlags G_GNUC_UNUSED) + { + qemuDomainObjPrivate *priv = vm->privateData; + bool xbzrleCacheSize_old = false; +@@ -1245,7 +1248,9 @@ qemuMigrationParamsReset(virQEMUDriver *driver, + if (!virDomainObjIsActive(vm) || !origParams) + goto cleanup; + +- if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams) < 0) ++ /* Do not pass apiFlags to qemuMigrationParamsApply here to make sure all ++ * parameters and capabilities are reset. */ ++ if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams, 0) < 0) + goto cleanup; + + qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags); +diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h +index d1184acded..9e990e09bd 100644 +--- a/src/qemu/qemu_migration_params.h ++++ b/src/qemu/qemu_migration_params.h +@@ -98,7 +98,8 @@ int + qemuMigrationParamsApply(virQEMUDriver *driver, + virDomainObj *vm, + int asyncJob, +- qemuMigrationParams *migParams); ++ qemuMigrationParams *migParams, ++ unsigned long apiFlags); + + int + qemuMigrationParamsEnableTLS(virQEMUDriver *driver, +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-Properly-release-job-in-qemuDomainSaveInternal.patch b/SOURCES/libvirt-qemu-Properly-release-job-in-qemuDomainSaveInternal.patch new file mode 100644 index 0000000..dd92c38 --- /dev/null +++ b/SOURCES/libvirt-qemu-Properly-release-job-in-qemuDomainSaveInternal.patch @@ -0,0 +1,38 @@ +From b35eb8dd4800be4dba22eb0a38da4d4d1c54521f Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Wed, 27 Jul 2022 15:40:12 +0200 +Subject: [PATCH] qemu: Properly release job in qemuDomainSaveInternal + +The function would fail to release the job in case +qemuMigrationSrcIsAllowed failed. + +Fixes v8.5.0-157-g69e0e33873 + +Signed-off-by: Jiri Denemark +Reviewed-by: Pavel Hrdina +(cherry picked from commit 9c3d398df11024ef6c00a50c98fcc0f1f66c16a1) + +https://bugzilla.redhat.com/show_bug.cgi?id=1497907 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 256e126ae1..ebd6365f52 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -2655,7 +2655,7 @@ qemuDomainSaveInternal(virQEMUDriver *driver, + goto cleanup; + + if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SAVE, 0)) +- goto cleanup; ++ goto endjob; + + if (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch b/SOURCES/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch new file mode 100644 index 0000000..cb84c51 --- /dev/null +++ b/SOURCES/libvirt-qemu-Report-supported-TPM-version-in-domcaps.patch @@ -0,0 +1,49 @@ +From b3d2dae261768c00b5d92203351ff6dd7cde468e Mon Sep 17 00:00:00 2001 +Message-Id: +From: Michal Privoznik +Date: Tue, 12 Jul 2022 15:58:17 +0200 +Subject: [PATCH] qemu: Report supported TPM version in domcaps + +Now that we have everything prepared, we can start detecting +supported TPM versions and setting corresponding values in +backendModel struct. + +Resolves: https://gitlab.com/libvirt/libvirt/-/issues/340 +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119 +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 430ab88ab17727ac9774ee5b47f09f69c57add73) +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_capabilities.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 2c3be3ecec..8586930266 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -6368,9 +6368,18 @@ virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps, + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_PASSTHROUGH); +- if (virTPMHasSwtpm() && +- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) +- VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR); ++ if (virTPMHasSwtpm()) { ++ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) ++ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR); ++ if (virTPMSwtpmSetupCapsGet(VIR_TPM_SWTPM_SETUP_FEATURE_TPM_1_2)) { ++ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendVersion, VIR_DOMAIN_TPM_VERSION_1_2); ++ tpm->backendVersion.report = true; ++ } ++ if (virTPMSwtpmSetupCapsGet(VIR_TPM_SWTPM_SETUP_FEATURE_TPM_2_0)) { ++ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendVersion, VIR_DOMAIN_TPM_VERSION_2_0); ++ tpm->backendVersion.report = true; ++ } ++ } + + /* + * Need at least one frontend if it is to be usable by applications +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-Restore-original-memory-locking-limit-on-reconnect.patch b/SOURCES/libvirt-qemu-Restore-original-memory-locking-limit-on-reconnect.patch new file mode 100644 index 0000000..6b22dd7 --- /dev/null +++ b/SOURCES/libvirt-qemu-Restore-original-memory-locking-limit-on-reconnect.patch @@ -0,0 +1,85 @@ +From a1d825e5dcb8cbe0854fa852d25e5997a52d57cd Mon Sep 17 00:00:00 2001 +Message-Id: +From: Jiri Denemark +Date: Wed, 27 Jul 2022 14:33:23 +0200 +Subject: [PATCH] qemu: Restore original memory locking limit on reconnect + +Commit v8.4.0-287-gd4d3bb8130 tried to make sure the original +pre-migration memory locking limit is restored at the end of migration, +but it missed the case when libvirt daemon is restarted during +migration which needs to be aborted on reconnect. + +And if this was not enough, I forgot to actually save the status XML +after setting the field in priv (in the commit mentioned above and also +in v8.4.0-291-gd375993ab3). + +https://bugzilla.redhat.com/show_bug.cgi?id=2107424 + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit bb9badb9168ad0d40bca86b6463ef504624f096d) + +Conflicts: + src/qemu/qemu_migration.c + - commit v8.5.0-2-gf9dcc01a0f not backported + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_migration.c | 13 +++++++++---- + src/qemu/qemu_process.c | 2 ++ + 2 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 9289df81eb..61fcaf4258 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -4672,10 +4672,12 @@ qemuMigrationSrcStart(virDomainObj *vm, + switch (spec->destType) { + case MIGRATION_DEST_HOST: + if (STREQ(spec->dest.host.protocol, "rdma") && +- vm->def->mem.hard_limit > 0 && +- qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, +- &priv->preMigrationMemlock) < 0) { +- return -1; ++ vm->def->mem.hard_limit > 0) { ++ if (qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, ++ &priv->preMigrationMemlock) < 0) ++ return -1; ++ /* Store the original memory locking limit */ ++ qemuDomainSaveStatus(vm); + } + return qemuMonitorMigrateToHost(priv->mon, migrateFlags, + spec->dest.host.protocol, +@@ -4870,6 +4872,9 @@ qemuMigrationSrcRun(virQEMUDriver *driver, + + if (qemuDomainSetMaxMemLock(vm, limit << 10, &priv->preMigrationMemlock) < 0) + goto error; ++ ++ /* Store the original memory locking limit */ ++ qemuDomainSaveStatus(vm); + } + + if (storageMigration) { +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 771a623ef7..1c28d4b102 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -3677,6 +3677,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver, + { + virDomainJobStatus migStatus = VIR_DOMAIN_JOB_STATUS_NONE; + qemuDomainJobPrivate *jobPriv = job->privateData; ++ qemuDomainObjPrivate *priv = vm->privateData; + virDomainState state; + int reason; + int rc; +@@ -3726,6 +3727,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver, + + qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_NONE, + jobPriv->migParams, job->apiFlags); ++ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock); + + return 0; + } +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-Validate-domain-definition-even-on-migration.patch b/SOURCES/libvirt-qemu-Validate-domain-definition-even-on-migration.patch deleted file mode 100644 index a20b9bc..0000000 --- a/SOURCES/libvirt-qemu-Validate-domain-definition-even-on-migration.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 84cedeca547585a51f6044186d241a501ff757d2 Mon Sep 17 00:00:00 2001 -Message-Id: <84cedeca547585a51f6044186d241a501ff757d2@dist-git> -From: Michal Privoznik -Date: Mon, 31 Jan 2022 12:55:47 +0100 -Subject: [PATCH] qemu: Validate domain definition even on migration - -When we are about to spawn QEMU, we validate the domain -definition against qemuCaps. Except when domain is/was already -running before (i.e. on incoming migration, snapshots, resume -from a file). However, especially on incoming migration it may -happen that the destination QEMU is different to the source -QEMU, e.g. the destination QEMU may have some devices disabled. - -And we have a function that validates devices/features requested -in domain XML against the desired QEMU capabilities (aka -qemuCaps) - it's virDomainDefValidate() which calls -qemuValidateDomainDef() and qemuValidateDomainDeviceDef() -subsequently. - -But the problem here is that the validation function is -explicitly skipped over in specific scenarios (like incoming -migration, restore from a snapshot or previously saved file). - -This in turn means that we may spawn QEMU and request -device/features it doesn't support. When that happens QEMU fails -to load migration stream: - - qemu-kvm: ... 'virtio-mem-pci' is not a valid device model name - -(NB, while the example shows one particular device, the problem -is paramount) - -This problem is easier to run into since we are slowly moving -validation from qemu_command.c into said validation functions. - -The solution is simple: do the validation in all cases. And while -it may happen that users would be unable to migrate/restore a -guest due to a bug in our validator, spawning QEMU without -validation is worse (especially when you consider that users can -supply their own XMLs for migrate/restore operations - these were -never validated). - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2048435 -Signed-off-by: Michal Privoznik -Reviewed-by: Peter Krempa -(cherry picked from commit 517b8c12b98d7ac0bb4d582e0b491d50d776eb6d) -Signed-off-by: Michal Privoznik ---- - src/qemu/qemu_process.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 5c9ca0fe4f..5c6657a876 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -5411,11 +5411,7 @@ qemuProcessStartValidate(virQEMUDriver *driver, - - } - -- /* Checks below should not be executed when starting a qemu process for a -- * VM that was running before (migration, snapshots, save). It's more -- * important to start such VM than keep the configuration clean */ -- if ((flags & VIR_QEMU_PROCESS_START_NEW) && -- virDomainDefValidate(vm->def, 0, driver->xmlopt, qemuCaps) < 0) -+ if (virDomainDefValidate(vm->def, 0, driver->xmlopt, qemuCaps) < 0) - return -1; - - if (qemuProcessStartValidateGraphics(vm) < 0) --- -2.35.1 - diff --git a/SOURCES/libvirt-qemu-don-t-call-qemuMigrationSrcIsAllowedHostdev-from-qemuMigrationDstPrepareFresh.patch b/SOURCES/libvirt-qemu-don-t-call-qemuMigrationSrcIsAllowedHostdev-from-qemuMigrationDstPrepareFresh.patch new file mode 100644 index 0000000..537f227 --- /dev/null +++ b/SOURCES/libvirt-qemu-don-t-call-qemuMigrationSrcIsAllowedHostdev-from-qemuMigrationDstPrepareFresh.patch @@ -0,0 +1,61 @@ +From d51e6092ed7977daf662ed1def0f6cd5cc6ba33d Mon Sep 17 00:00:00 2001 +Message-Id: +From: Laine Stump +Date: Wed, 27 Jul 2022 12:14:10 -0400 +Subject: [PATCH] qemu: don't call qemuMigrationSrcIsAllowedHostdev() from + qemuMigrationDstPrepareFresh() + +This call to qemuMigrationSrcIsAllowedHostdev() (which does a +hardcoded fail of the migration if there is any PCI or mdev hostdev +device in the domain) while doing the destination side of migration +prep was found once the call to that same function was removed from +the source side migration prep (commit 25883cd5). + +According to jdenemar, for the V2 migration protocol, prep of the +destination is the first step, so this *was* the proper place to do +the check, but for V3 migration this is in a way redundant (since we +will have already done the check on the source side (updated by +25883cd5 to query QEMU rather than do a hardcoded fail)). + +Of course it's possible that the source could support migration of a +particular VFIO device, but the destination doesn't. But the current +check on the destination side is worthless even in that case, since it +is just *always* failing rather than querying QEMU; and QEMU can't be +queried at the point where the destination check is happening, since +it isn't yet running. + +Anyway QEMU should complain when it's started if it's going to fail, +so removing this check should just move the failure to happen a bit +later. So the best solution to this problem is to simply remove the +hardcoded check/fail from qemuMigrationDstPrepareFresh() and rely on +QEMU to fail if it needs to. + +Fixes: 25883cd5f0b188f2417f294b7d219a77b219f7c2 +Signed-off-by: Laine Stump +Reviewed-by: Jiri Denemark +(cherry picked from commit 640d185f01858b7a8db401235c929ac4798592d0) + +https://bugzilla.redhat.com/show_bug.cgi?id=1497907 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_migration.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 61fcaf4258..e3ba4c3f78 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -3382,9 +3382,6 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, + QEMU_MIGRATION_COOKIE_CAPS; + } + +- if (!qemuMigrationSrcIsAllowedHostdev(*def)) +- goto cleanup; +- + /* Let migration hook filter domain XML */ + if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { + g_autofree char *xml = NULL; +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-don-t-try-to-query-QEMU-about-migration-blockers-during-offline-migration.patch b/SOURCES/libvirt-qemu-don-t-try-to-query-QEMU-about-migration-blockers-during-offline-migration.patch new file mode 100644 index 0000000..29ff19b --- /dev/null +++ b/SOURCES/libvirt-qemu-don-t-try-to-query-QEMU-about-migration-blockers-during-offline-migration.patch @@ -0,0 +1,87 @@ +From 80ac99d0f947f5e2fe4ff7fe9fb63b6dc6cbc1bb Mon Sep 17 00:00:00 2001 +Message-Id: <80ac99d0f947f5e2fe4ff7fe9fb63b6dc6cbc1bb@dist-git> +From: Laine Stump +Date: Thu, 21 Jul 2022 01:56:11 -0400 +Subject: [PATCH] qemu: don't try to query QEMU about migration blockers during + offline migration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The new code that queries QEMU about migration blockers was put at the +top of qemuMigrationSrcIsAllowed(), but that function can also be +called in the case of offline migration (ie when the domain is +inactive / QEMU isn't running). This check should have been put inside +the "if (!(flags & VIR_MIGRATE_OFFLINE))" conditional, so let's move +it there. + +Fixes: 156e99f686690855be4e45d9b8b3194191a8bc31 +Signed-off-by: Laine Stump +Reviewed-by: Jiri Denemark +(cherry picked from commit 2dd5587f1dc8e2cf4e6e0a4e4cf576b8183b33cd) +Resolves: https://bugzilla.redhat.com/2092833 +Signed-off-by: Eugenio Pérez +--- + src/qemu/qemu_migration.c | 39 +++++++++++++++++++++------------------ + 1 file changed, 21 insertions(+), 18 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 735eb02673..96c4c0f1da 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1458,24 +1458,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + int nsnapshots; + int pauseReason; + size_t i; +- bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps, +- QEMU_CAPS_MIGRATION_BLOCKED_REASONS); +- +- /* Ask qemu if it has a migration blocker */ +- if (blockedReasonsCap) { +- g_auto(GStrv) blockers = NULL; +- if (qemuDomainGetMigrationBlockers(driver, vm, +- VIR_ASYNC_JOB_MIGRATION_OUT, +- &blockers) < 0) +- return false; +- +- if (blockers && blockers[0]) { +- g_autofree char *reasons = g_strjoinv("; ", blockers); +- virReportError(VIR_ERR_OPERATION_INVALID, +- _("cannot migrate domain: %s"), reasons); +- return false; +- } +- } + + /* perform these checks only when migrating to remote hosts */ + if (remote) { +@@ -1493,6 +1475,27 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + + /* following checks don't make sense for offline migration */ + if (!(flags & VIR_MIGRATE_OFFLINE)) { ++ bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps, ++ QEMU_CAPS_MIGRATION_BLOCKED_REASONS); ++ ++ /* Ask qemu if it has a migration blocker */ ++ if (blockedReasonsCap) { ++ g_auto(GStrv) blockers = NULL; ++ ++ if (qemuDomainGetMigrationBlockers(driver, vm, ++ VIR_ASYNC_JOB_MIGRATION_OUT, ++ &blockers) < 0) { ++ return false; ++ } ++ ++ if (blockers && blockers[0]) { ++ g_autofree char *reasons = g_strjoinv("; ", blockers); ++ virReportError(VIR_ERR_OPERATION_INVALID, ++ _("cannot migrate domain: %s"), reasons); ++ return false; ++ } ++ } ++ + if (remote) { + /* cancel migration if disk I/O error is emitted while migrating */ + if (flags & VIR_MIGRATE_ABORT_ON_ERROR && +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-fix-inactive-snapshot-revert.patch b/SOURCES/libvirt-qemu-fix-inactive-snapshot-revert.patch deleted file mode 100644 index ae4c4cf..0000000 --- a/SOURCES/libvirt-qemu-fix-inactive-snapshot-revert.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1911ebd62779701aae271dd3e047415bfd2cd303 Mon Sep 17 00:00:00 2001 -Message-Id: <1911ebd62779701aae271dd3e047415bfd2cd303@dist-git> -From: =?UTF-8?q?J=C3=A1n=20Tomko?= -Date: Thu, 20 Jan 2022 14:53:33 +0100 -Subject: [PATCH] qemu: fix inactive snapshot revert -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The commit splitting out the qemuSnapshotRevertInactive function -dropped the 'defined = true' line by accident and instead -returned -1, leaving the user with a cryptic error: -error: An error occurred, but the cause is unknown - -https://bugzilla.redhat.com/show_bug.cgi?id=2039136 -https://gitlab.com/libvirt/libvirt/-/issues/266 - -Fixes: 85e4a13c3f19078fb6af5ffb4a80022c142cbc7e -Signed-off-by: Ján Tomko -(cherry picked from commit 76deb656132bb8817ddae4b7f417930c4db824c9) -Signed-off-by: Ján Tomko ---- - src/qemu/qemu_snapshot.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c -index f92e00f9c0..ac7bab90f8 100644 ---- a/src/qemu/qemu_snapshot.c -+++ b/src/qemu/qemu_snapshot.c -@@ -2193,7 +2193,7 @@ qemuSnapshotRevertInactive(virDomainObj *vm, - - if (*inactiveConfig) { - virDomainObjAssignDef(vm, inactiveConfig, false, NULL); -- return -1; -+ defined = true; - } - - if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | --- -2.35.0 - diff --git a/SOURCES/libvirt-qemu-introduce-capability-QEMU_CAPS_MIGRATION_BLOCKED_REASONS.patch b/SOURCES/libvirt-qemu-introduce-capability-QEMU_CAPS_MIGRATION_BLOCKED_REASONS.patch new file mode 100644 index 0000000..5335271 --- /dev/null +++ b/SOURCES/libvirt-qemu-introduce-capability-QEMU_CAPS_MIGRATION_BLOCKED_REASONS.patch @@ -0,0 +1,206 @@ +From 81f8b07ed1e4e485ded7f366739c110351120785 Mon Sep 17 00:00:00 2001 +Message-Id: <81f8b07ed1e4e485ded7f366739c110351120785@dist-git> +From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= +Date: Thu, 21 Jul 2022 19:29:05 +0200 +Subject: [PATCH] qemu: introduce capability + QEMU_CAPS_MIGRATION_BLOCKED_REASONS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +since qemu 6.0, if migration is blocked for some reason, 'query-migrate' +will return an array of error strings describing the migration blockers. +This can be used to check whether there are any devices blocking +migration, etc. + +Signed-off-by: Jonathon Jongsma +Signed-off-by: Eugenio Pérez +Reviewed-by: Jiri Denemark +Reviewed-by: Laine Stump + +(cherry picked from commit 1e9d84d9f9513a73572842db30e3d1445e892291) +Resolves: https://bugzilla.redhat.com/2092833 +Signed-off-by: Eugenio Pérez +--- + src/qemu/qemu_capabilities.c | 2 ++ + src/qemu/qemu_capabilities.h | 1 + + tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 + + tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 + + tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 + + tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 + + tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 + + tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 + + 13 files changed, 14 insertions(+) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 8586930266..48002f3b58 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -671,6 +671,7 @@ VIR_ENUM_IMPL(virQEMUCaps, + "chardev.qemu-vdagent", /* QEMU_CAPS_CHARDEV_QEMU_VDAGENT */ + "display-dbus", /* QEMU_CAPS_DISPLAY_DBUS */ + "iothread.thread-pool-max", /* QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX */ ++ "migration.blocked-reasons", /* QEMU_CAPS_MIGRATION_BLOCKED_REASONS */ + ); + + +@@ -1623,6 +1624,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = { + { "chardev-add/arg-type/backend/+qemu-vdagent", QEMU_CAPS_CHARDEV_QEMU_VDAGENT }, + { "query-display-options/ret-type/+dbus", QEMU_CAPS_DISPLAY_DBUS }, + { "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX }, ++ { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKED_REASONS }, + }; + + typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index 6f35ba1485..570e43292d 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -650,6 +650,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ + QEMU_CAPS_CHARDEV_QEMU_VDAGENT, /* -chardev qemu-vdagent */ + QEMU_CAPS_DISPLAY_DBUS, /* -display dbus */ + QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX, /* -object iothread.thread-pool-max */ ++ QEMU_CAPS_MIGRATION_BLOCKED_REASONS, /* query-migrate returns 'blocked-reasons */ + + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; +diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml +index 4b4cc2d3aa..3e48d17811 100644 +--- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml +@@ -189,6 +189,7 @@ + + + ++ + 6000000 + 0 + 61700242 +diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +index 06543071aa..790b7221d4 100644 +--- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml ++++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +@@ -147,6 +147,7 @@ + + + ++ + 6000000 + 0 + 39100242 +diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +index 8c61bf8a84..86c3732c72 100644 +--- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +@@ -231,6 +231,7 @@ + + + ++ + 6000000 + 0 + 43100242 +diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +index afd8f606eb..bd76a7a398 100644 +--- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +@@ -236,6 +236,7 @@ + + + ++ + 6001000 + 0 + 43100243 +diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml +index 86fc46918f..6ed51ec796 100644 +--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml +@@ -201,6 +201,7 @@ + + + ++ + 6001050 + 0 + 61700244 +diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml +index 983b54430d..1a98fe122e 100644 +--- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml +@@ -196,6 +196,7 @@ + + + ++ + 6002000 + 0 + 42900244 +diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml +index 19605d93ae..a77efaaa37 100644 +--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml +@@ -238,6 +238,7 @@ + + + ++ + 6002000 + 0 + 43100244 +diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml +index e24e2235fb..6848a075a8 100644 +--- a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml ++++ b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml +@@ -209,6 +209,7 @@ + + + ++ + 6002092 + 0 + 61700243 +diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml +index 83e0f50e3a..cf4286b78b 100644 +--- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml ++++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml +@@ -213,6 +213,7 @@ + + + ++ + 7000000 + 0 + 42900243 +diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml +index 05f844fd5b..8e2c1652f9 100644 +--- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml +@@ -243,6 +243,7 @@ + + + ++ + 7000000 + 0 + 43100243 +diff --git a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml +index 3707d9b7c9..9bdb207c4e 100644 +--- a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml ++++ b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml +@@ -244,6 +244,7 @@ + + + ++ + 7000050 + 0 + 43100244 +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-lxc-remove-use-to-nwfilter-update-lock.patch b/SOURCES/libvirt-qemu-lxc-remove-use-to-nwfilter-update-lock.patch deleted file mode 100644 index 6699b1c..0000000 --- a/SOURCES/libvirt-qemu-lxc-remove-use-to-nwfilter-update-lock.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 7bcd75ca73d8eda05fafa8342309a8fd058cd326 Mon Sep 17 00:00:00 2001 -Message-Id: <7bcd75ca73d8eda05fafa8342309a8fd058cd326@dist-git> -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Thu, 24 Feb 2022 19:02:32 +0000 -Subject: [PATCH] qemu,lxc: remove use to nwfilter update lock -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Now that the virNWFilterBinding APIs are using the nwfilter -update lock directly, there is no need for the virt drivers -to do it themselves. - -Reviewed-by: Laine Stump -Signed-off-by: Daniel P. Berrangé -(cherry picked from commit 5f8b090f421cd6a6c46f44905431491e2d3cf8f5) -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2044379 -Signed-off-by: Michal Privoznik ---- - src/lxc/lxc_driver.c | 6 ------ - src/qemu/qemu_driver.c | 18 ------------------ - src/qemu/qemu_migration.c | 3 --- - src/qemu/qemu_process.c | 4 ---- - 4 files changed, 31 deletions(-) - -diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c -index 7bc39120ee..e581c62668 100644 ---- a/src/lxc/lxc_driver.c -+++ b/src/lxc/lxc_driver.c -@@ -971,8 +971,6 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom, - - virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, -1); - -- virNWFilterReadLockFilterUpdates(); -- - if (!(vm = lxcDomObjFromDomain(dom))) - goto cleanup; - -@@ -1014,7 +1012,6 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom, - cleanup: - virDomainObjEndAPI(&vm); - virObjectEventStateQueue(driver->domainEventState, event); -- virNWFilterUnlockFilterUpdates(); - return ret; - } - -@@ -1080,8 +1077,6 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, - if (flags & VIR_DOMAIN_START_VALIDATE) - parse_flags |= VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; - -- virNWFilterReadLockFilterUpdates(); -- - if (!(caps = virLXCDriverGetCapabilities(driver, false))) - goto cleanup; - -@@ -1138,7 +1133,6 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, - cleanup: - virDomainObjEndAPI(&vm); - virObjectEventStateQueue(driver->domainEventState, event); -- virNWFilterUnlockFilterUpdates(); - return dom; - } - -diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c -index d3d76c003f..00a86b6c7c 100644 ---- a/src/qemu/qemu_driver.c -+++ b/src/qemu/qemu_driver.c -@@ -1603,8 +1603,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, - if (flags & VIR_DOMAIN_START_AUTODESTROY) - start_flags |= VIR_QEMU_PROCESS_START_AUTODESTROY; - -- virNWFilterReadLockFilterUpdates(); -- - if (!(def = virDomainDefParseString(xml, driver->xmlopt, - NULL, parse_flags))) - goto cleanup; -@@ -1658,7 +1656,6 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn, - virDomainObjEndAPI(&vm); - virObjectEventStateQueue(driver->domainEventState, event); - virObjectEventStateQueue(driver->domainEventState, event2); -- virNWFilterUnlockFilterUpdates(); - return dom; - } - -@@ -5773,8 +5770,6 @@ qemuDomainRestoreFlags(virConnectPtr conn, - VIR_DOMAIN_SAVE_PAUSED, -1); - - -- virNWFilterReadLockFilterUpdates(); -- - fd = qemuSaveImageOpen(driver, NULL, path, &def, &data, - (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0, - &wrapperFd, false, false); -@@ -5846,7 +5841,6 @@ qemuDomainRestoreFlags(virConnectPtr conn, - if (vm && ret < 0) - qemuDomainRemoveInactiveJob(driver, vm); - virDomainObjEndAPI(&vm); -- virNWFilterUnlockFilterUpdates(); - return ret; - } - -@@ -6395,8 +6389,6 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) - VIR_DOMAIN_START_BYPASS_CACHE | - VIR_DOMAIN_START_FORCE_BOOT, -1); - -- virNWFilterReadLockFilterUpdates(); -- - if (!(vm = qemuDomainObjFromDomain(dom))) - goto cleanup; - -@@ -6425,7 +6417,6 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) - - cleanup: - virDomainObjEndAPI(&vm); -- virNWFilterUnlockFilterUpdates(); - return ret; - } - -@@ -7811,8 +7802,6 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, - virDomainObj *vm = NULL; - int ret = -1; - -- virNWFilterReadLockFilterUpdates(); -- - if (!(vm = qemuDomainObjFromDomain(dom))) - goto cleanup; - -@@ -7835,7 +7824,6 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, - - cleanup: - virDomainObjEndAPI(&vm); -- virNWFilterUnlockFilterUpdates(); - return ret; - } - -@@ -7865,8 +7853,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, - VIR_DOMAIN_AFFECT_CONFIG | - VIR_DOMAIN_DEVICE_MODIFY_FORCE, -1); - -- virNWFilterReadLockFilterUpdates(); -- - cfg = virQEMUDriverGetConfig(driver); - - if (!(vm = qemuDomainObjFromDomain(dom))) -@@ -7943,7 +7929,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, - if (dev != dev_copy) - virDomainDeviceDefFree(dev_copy); - virDomainObjEndAPI(&vm); -- virNWFilterUnlockFilterUpdates(); - return ret; - } - -@@ -13644,8 +13629,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, - virDomainObj *vm = NULL; - int ret = -1; - -- virNWFilterReadLockFilterUpdates(); -- - if (!(vm = qemuDomObjFromSnapshot(snapshot))) - goto cleanup; - -@@ -13656,7 +13639,6 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, - - cleanup: - virDomainObjEndAPI(&vm); -- virNWFilterUnlockFilterUpdates(); - return ret; - } - -diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c -index 2635ef1162..358cb9c3b5 100644 ---- a/src/qemu/qemu_migration.c -+++ b/src/qemu/qemu_migration.c -@@ -2779,8 +2779,6 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver, - int rv; - g_autofree char *tlsAlias = NULL; - -- virNWFilterReadLockFilterUpdates(); -- - if (flags & VIR_MIGRATE_OFFLINE) { - if (flags & (VIR_MIGRATE_NON_SHARED_DISK | - VIR_MIGRATE_NON_SHARED_INC)) { -@@ -3101,7 +3099,6 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver, - virDomainObjEndAPI(&vm); - virObjectEventStateQueue(driver->domainEventState, event); - qemuMigrationCookieFree(mig); -- virNWFilterUnlockFilterUpdates(); - virErrorRestore(&origErr); - return ret; - -diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c -index 5c6657a876..914f9bef8b 100644 ---- a/src/qemu/qemu_process.c -+++ b/src/qemu/qemu_process.c -@@ -8986,7 +8986,6 @@ qemuProcessReconnect(void *opaque) - qemuDomainRemoveInactiveJob(driver, obj); - } - virDomainObjEndAPI(&obj); -- virNWFilterUnlockFilterUpdates(); - virIdentitySetCurrent(NULL); - return; - -@@ -9038,8 +9037,6 @@ qemuProcessReconnectHelper(virDomainObj *obj, - data->obj = obj; - data->identity = virIdentityGetCurrent(); - -- virNWFilterReadLockFilterUpdates(); -- - /* this lock and reference will be eventually transferred to the thread - * that handles the reconnect */ - virObjectLock(obj); -@@ -9062,7 +9059,6 @@ qemuProcessReconnectHelper(virDomainObj *obj, - qemuDomainRemoveInactiveJobLocked(src->driver, obj); - - virDomainObjEndAPI(&obj); -- virNWFilterUnlockFilterUpdates(); - g_clear_object(&data->identity); - VIR_FREE(data); - return -1; --- -2.35.1 - diff --git a/SOURCES/libvirt-qemu-new-function-to-retrieve-migration-blocker-reasons-from-QEMU.patch b/SOURCES/libvirt-qemu-new-function-to-retrieve-migration-blocker-reasons-from-QEMU.patch new file mode 100644 index 0000000..827112d --- /dev/null +++ b/SOURCES/libvirt-qemu-new-function-to-retrieve-migration-blocker-reasons-from-QEMU.patch @@ -0,0 +1,140 @@ +From 90d326f60706a990db3ed49ba338d911471578c0 Mon Sep 17 00:00:00 2001 +Message-Id: <90d326f60706a990db3ed49ba338d911471578c0@dist-git> +From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= +Date: Thu, 21 Jul 2022 19:29:10 +0200 +Subject: [PATCH] qemu: new function to retrieve migration blocker reasons from + QEMU +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since QEMU 6.0, if migration is blocked for some reason, +'query-migrate' will return an array of error strings describing the +migration blockers. This can be used to check whether there are any +devices, or other conditions, that would cause migration to fail. + +This patch adds a function that sends this query via a QMP command and +returns the resulting array of reasons. qemuMigrationSrcIsAllowed() +will be able to use the new function to ask QEMU for migration +blockers, instead of the hardcoded guesses that libvirt currently has. + +Signed-off-by: Eugenio Pérez +Reviewed-by: Jiri Denemark +Reviewed-by: Laine Stump + +(cherry picked from commit 7e52c4839fabac2d19c6f22c99142e992e3d898e) +Resolves: https://bugzilla.redhat.com/2092833 +Signed-off-by: Eugenio Pérez +--- + src/qemu/qemu_monitor.c | 12 ++++++++++ + src/qemu/qemu_monitor.h | 4 ++++ + src/qemu/qemu_monitor_json.c | 46 ++++++++++++++++++++++++++++++++++++ + src/qemu/qemu_monitor_json.h | 3 +++ + 4 files changed, 65 insertions(+) + +diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c +index fda5d2f368..865a3e69ed 100644 +--- a/src/qemu/qemu_monitor.c ++++ b/src/qemu/qemu_monitor.c +@@ -4541,3 +4541,15 @@ qemuMonitorMigrateRecover(qemuMonitor *mon, + + return qemuMonitorJSONMigrateRecover(mon, uri); + } ++ ++ ++int ++qemuMonitorGetMigrationBlockers(qemuMonitor *mon, ++ char ***blockers) ++{ ++ VIR_DEBUG("blockers=%p", blockers); ++ ++ QEMU_CHECK_MONITOR(mon); ++ ++ return qemuMonitorJSONGetMigrationBlockers(mon, blockers); ++} +diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h +index 95267ec6c7..0c3f023419 100644 +--- a/src/qemu/qemu_monitor.h ++++ b/src/qemu/qemu_monitor.h +@@ -1554,3 +1554,7 @@ qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon, + int + qemuMonitorMigrateRecover(qemuMonitor *mon, + const char *uri); ++ ++int ++qemuMonitorGetMigrationBlockers(qemuMonitor *mon, ++ char ***blockers); +diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c +index 3aad2ab212..84f4589c42 100644 +--- a/src/qemu/qemu_monitor_json.c ++++ b/src/qemu/qemu_monitor_json.c +@@ -3434,6 +3434,52 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon, + return 0; + } + ++ ++/* ++ * Get the exposed migration blockers. ++ * ++ * This function assume qemu has the capability of request them. ++ * ++ * It returns a NULL terminated array on blockers if there are any, or it set ++ * it to NULL otherwise. ++ */ ++int ++qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon, ++ char ***blockers) ++{ ++ g_autoptr(virJSONValue) cmd = NULL; ++ g_autoptr(virJSONValue) reply = NULL; ++ virJSONValue *data; ++ virJSONValue *jblockers; ++ size_t i; ++ ++ *blockers = NULL; ++ if (!(cmd = qemuMonitorJSONMakeCommand("query-migrate", NULL))) ++ return -1; ++ ++ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) ++ return -1; ++ ++ if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT) < 0) ++ return -1; ++ ++ data = virJSONValueObjectGetObject(reply, "return"); ++ ++ if (!(jblockers = virJSONValueObjectGetArray(data, "blocked-reasons"))) ++ return 0; ++ ++ *blockers = g_new0(char *, virJSONValueArraySize(jblockers) + 1); ++ for (i = 0; i < virJSONValueArraySize(jblockers); i++) { ++ virJSONValue *jblocker = virJSONValueArrayGet(jblockers, i); ++ const char *blocker = virJSONValueGetString(jblocker); ++ ++ (*blockers)[i] = g_strdup(blocker); ++ } ++ ++ return 0; ++} ++ ++ + int qemuMonitorJSONMigrateCancel(qemuMonitor *mon) + { + g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("migrate_cancel", NULL); +diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h +index ad3853ae69..4e7d6a1a8d 100644 +--- a/src/qemu/qemu_monitor_json.h ++++ b/src/qemu/qemu_monitor_json.h +@@ -199,6 +199,9 @@ qemuMonitorJSONMigrate(qemuMonitor *mon, + unsigned int flags, + const char *uri); + int ++qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon, ++ char ***blockers); ++int + qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitor *mon, + bool *spice_migrated); + +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-query-QEMU-for-migration-blockers-before-our-own-harcoded-checks.patch b/SOURCES/libvirt-qemu-query-QEMU-for-migration-blockers-before-our-own-harcoded-checks.patch new file mode 100644 index 0000000..89152e4 --- /dev/null +++ b/SOURCES/libvirt-qemu-query-QEMU-for-migration-blockers-before-our-own-harcoded-checks.patch @@ -0,0 +1,80 @@ +From 9764a6c484d4f3586b0e0be33e8c53de63b11edd Mon Sep 17 00:00:00 2001 +Message-Id: <9764a6c484d4f3586b0e0be33e8c53de63b11edd@dist-git> +From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= +Date: Thu, 21 Jul 2022 19:29:13 +0200 +Subject: [PATCH] qemu: query QEMU for migration blockers before our own + harcoded checks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since QEMU 6.0, if QEMU knows that a migration would fail, +'query-migrate' will return an array of error strings describing the +migration blockers. This can be used to check whether there are any +devices/conditions blocking migration. + +This patch adds a call to this query at the top of +qemuMigrationSrcIsAllowed(). + +Signed-off-by: Eugenio Pérez +Reviewed-by: Jiri Denemark +Reviewed-by: Laine Stump + +(cherry picked from commit 156e99f686690855be4e45d9b8b3194191a8bc31) +Resolves: https://bugzilla.redhat.com/2092833 +Signed-off-by: Eugenio Pérez +--- + src/qemu/qemu_migration.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 2a6b7b7819..cfb7626bb0 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1415,6 +1415,22 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def) + } + + ++static int ++qemuDomainGetMigrationBlockers(virQEMUDriver *driver, ++ virDomainObj *vm, ++ char ***blockers) ++{ ++ qemuDomainObjPrivate *priv = vm->privateData; ++ int rc; ++ ++ qemuDomainObjEnterMonitor(driver, vm); ++ rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers); ++ qemuDomainObjExitMonitor(vm); ++ ++ return rc; ++} ++ ++ + /** + * qemuMigrationSrcIsAllowed: + * @driver: qemu driver struct +@@ -1440,6 +1456,20 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + int pauseReason; + size_t i; + ++ /* Ask qemu if it has a migration blocker */ ++ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) { ++ g_auto(GStrv) blockers = NULL; ++ if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0) ++ return false; ++ ++ if (blockers && blockers[0]) { ++ g_autofree char *reasons = g_strjoinv("; ", blockers); ++ virReportError(VIR_ERR_OPERATION_INVALID, ++ _("cannot migrate domain: %s"), reasons); ++ return false; ++ } ++ } ++ + /* perform these checks only when migrating to remote hosts */ + if (remote) { + nsnapshots = virDomainSnapshotObjListNum(vm->snapshots, NULL, 0); +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-remove-hardcoded-migration-fail-for-vDPA-devices-if-we-can-ask-QEMU.patch b/SOURCES/libvirt-qemu-remove-hardcoded-migration-fail-for-vDPA-devices-if-we-can-ask-QEMU.patch new file mode 100644 index 0000000..1db6c10 --- /dev/null +++ b/SOURCES/libvirt-qemu-remove-hardcoded-migration-fail-for-vDPA-devices-if-we-can-ask-QEMU.patch @@ -0,0 +1,58 @@ +From 0ba11af2300d0aaf80456575e03848f843ae29de Mon Sep 17 00:00:00 2001 +Message-Id: <0ba11af2300d0aaf80456575e03848f843ae29de@dist-git> +From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= +Date: Thu, 21 Jul 2022 19:29:15 +0200 +Subject: [PATCH] qemu: remove hardcoded migration fail for vDPA devices if we + can ask QEMU +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +vDPA devices will be migratable soon, so we shouldn't unconditionally +block migration of any domain with a vDPA device. Instead, we should +rely on QEMU to make the decision when that info is available from the +query-migrate QMP command (QEMU versions too old to have that info in +the results of query-migrate don't support migration of vDPA devices, +so in that case we will continue to unconditionally block migration). + +Signed-off-by: Eugenio Pérez +Reviewed-by: Jiri Denemark +Reviewed-by: Laine Stump + +(cherry picked from commit 2103807e330487952f423d86f541a7a28e003e95) +Resolves: https://bugzilla.redhat.com/2092833 +Signed-off-by: Eugenio Pérez +--- + src/qemu/qemu_migration.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index cfb7626bb0..2f77e45abf 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1455,9 +1455,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + int nsnapshots; + int pauseReason; + size_t i; ++ bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps, ++ QEMU_CAPS_MIGRATION_BLOCKED_REASONS); + +- /* Ask qemu if it has a migration blocker */ +- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) { ++ /* Ask qemu if it have a migration blocker */ ++ if (blockedReasonsCap) { + g_auto(GStrv) blockers = NULL; + if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0) + return false; +@@ -1576,7 +1578,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + virDomainNetDef *net = vm->def->nets[i]; + qemuSlirp *slirp; + +- if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) { ++ if (!blockedReasonsCap && net->type == VIR_DOMAIN_NET_TYPE_VDPA) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("vDPA devices cannot be migrated")); + return false; +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-skip-hardcoded-hostdev-migration-check-if-QEMU-can-do-it-for-us.patch b/SOURCES/libvirt-qemu-skip-hardcoded-hostdev-migration-check-if-QEMU-can-do-it-for-us.patch new file mode 100644 index 0000000..633a169 --- /dev/null +++ b/SOURCES/libvirt-qemu-skip-hardcoded-hostdev-migration-check-if-QEMU-can-do-it-for-us.patch @@ -0,0 +1,62 @@ +From 8f2cd77dc208cfa90b37faa18b092ca4a76a0716 Mon Sep 17 00:00:00 2001 +Message-Id: <8f2cd77dc208cfa90b37faa18b092ca4a76a0716@dist-git> +From: Laine Stump +Date: Thu, 21 Jul 2022 02:03:49 -0400 +Subject: [PATCH] qemu: skip hardcoded hostdev migration check if QEMU can do + it for us + +libvirt currently will block migration for any vfio-assigned device +unless it is a network device that is associated with a virtio-net +failover device (ie. if the hostdev object has a teaming->type == +VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT). + +In the future there will be other vfio devices that can be migrated, +so we don't want to rely on this hardcoded block. QEMU 6.0+ will +anyway inform us of any devices that will block migration (as a part +of qemuDomainGetMigrationBlockers()), so we only need to do the +hardcoded check in the case of old QEMU that can't provide that +information. + +Signed-off-by: Laine Stump +Reviewed-by: Jiri Denemark +(cherry picked from commit 25883cd5f0b188f2417f294b7d219a77b219f7c2) + +https://bugzilla.redhat.com/show_bug.cgi?id=1497907 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_migration.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index f571c9eb27..76903d612b 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -1495,6 +1495,14 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + _("cannot migrate domain: %s"), reasons); + return false; + } ++ } else { ++ /* checks here are for anything that doesn't need to be ++ * checked by libvirt if running QEMU that can be queried ++ * about migration blockers. ++ */ ++ ++ if (!qemuMigrationSrcIsAllowedHostdev(vm->def)) ++ return false; + } + + if (remote) { +@@ -1521,9 +1529,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, + return false; + } + +- if (!qemuMigrationSrcIsAllowedHostdev(vm->def)) +- return false; +- + if (vm->def->cpu) { + /* QEMU blocks migration and save with invariant TSC enabled + * unless TSC frequency is explicitly set. +-- +2.35.1 + diff --git a/SOURCES/libvirt-qemu-support-firmware-descriptor-flash-mode-for-optional-NVRAM.patch b/SOURCES/libvirt-qemu-support-firmware-descriptor-flash-mode-for-optional-NVRAM.patch deleted file mode 100644 index 822b859..0000000 --- a/SOURCES/libvirt-qemu-support-firmware-descriptor-flash-mode-for-optional-NVRAM.patch +++ /dev/null @@ -1,471 +0,0 @@ -From 3cde498c98be902fc8fe87c895dfeaaa95352b38 Mon Sep 17 00:00:00 2001 -Message-Id: <3cde498c98be902fc8fe87c895dfeaaa95352b38@dist-git> -From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= -Date: Thu, 3 Feb 2022 13:43:18 +0000 -Subject: [PATCH] qemu: support firmware descriptor flash 'mode' for optional - NVRAM -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Currently the 'nvram_template' entry is mandatory when parsing the -firmware descriptor based on flash. QEMU is extending the firmware -descriptor spec to make the 'nvram_template' optional, depending -on the value of a new 'mode' field: - - - "split" - * "executable" contains read-only CODE - * "nvram_template" contains read-write VARS - - - "combined" - * "executable" contains read-write CODE and VARs - * "nvram_template" not present - - - "stateless" - * "executable" contains read-only CODE and VARs - * "nvram_template" not present - -In the latter case, the guest OS can write vars but the -firmware will make no attempt to persist them, so any changes -will be lost at poweroff. - -For now we parse this new 'mode' but discard any firmware -which is not 'mode=split' when matching for a domain. - -In the tests we have a mixture of files with and without the -mode attribute. - -Reviewed-by: Michal Privoznik -Signed-off-by: Daniel P. Berrangé -(cherry picked from commit 32b9d8b0ae00669555f01f91ee11612a636c4b69) -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2057769 ---- - src/qemu/qemu_firmware.c | 79 ++++++++++++++++--- - .../share/qemu/firmware/50-ovmf-sb-keys.json | 33 ++++++++ - .../out/usr/share/qemu/firmware/61-ovmf.json | 31 ++++++++ - .../out/usr/share/qemu/firmware/70-aavmf.json | 28 +++++++ - .../qemu/firmware/45-ovmf-sev-stateless.json | 31 ++++++++ - .../qemu/firmware/55-ovmf-sb-combined.json | 33 ++++++++ - .../usr/share/qemu/firmware/60-ovmf-sb.json | 1 + - tests/qemufirmwaretest.c | 31 ++++++-- - 8 files changed, 246 insertions(+), 21 deletions(-) - create mode 100644 tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json - create mode 100644 tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json - create mode 100644 tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json - create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json - create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json - -diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c -index 529ab8d68e..7911d45aa0 100644 ---- a/src/qemu/qemu_firmware.c -+++ b/src/qemu/qemu_firmware.c -@@ -59,6 +59,22 @@ VIR_ENUM_IMPL(qemuFirmwareOSInterface, - ); - - -+typedef enum { -+ QEMU_FIRMWARE_FLASH_MODE_SPLIT, -+ QEMU_FIRMWARE_FLASH_MODE_COMBINED, -+ QEMU_FIRMWARE_FLASH_MODE_STATELESS, -+ -+ QEMU_FIRMWARE_FLASH_MODE_LAST, -+} qemuFirmwareFlashMode; -+ -+VIR_ENUM_DECL(qemuFirmwareFlashMode); -+VIR_ENUM_IMPL(qemuFirmwareFlashMode, -+ QEMU_FIRMWARE_FLASH_MODE_LAST, -+ "split", -+ "combined", -+ "stateless", -+); -+ - typedef struct _qemuFirmwareFlashFile qemuFirmwareFlashFile; - struct _qemuFirmwareFlashFile { - char *filename; -@@ -68,6 +84,7 @@ struct _qemuFirmwareFlashFile { - - typedef struct _qemuFirmwareMappingFlash qemuFirmwareMappingFlash; - struct _qemuFirmwareMappingFlash { -+ qemuFirmwareFlashMode mode; - qemuFirmwareFlashFile executable; - qemuFirmwareFlashFile nvram_template; - }; -@@ -359,9 +376,31 @@ qemuFirmwareMappingFlashParse(const char *path, - virJSONValue *doc, - qemuFirmwareMappingFlash *flash) - { -+ virJSONValue *mode; - virJSONValue *executable; - virJSONValue *nvram_template; - -+ if (!(mode = virJSONValueObjectGet(doc, "mode"))) { -+ /* Historical default */ -+ flash->mode = QEMU_FIRMWARE_FLASH_MODE_SPLIT; -+ } else { -+ const char *modestr = virJSONValueGetString(mode); -+ int modeval; -+ if (!modestr) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", -+ _("Firmware flash mode value was malformed")); -+ return -1; -+ } -+ modeval = qemuFirmwareFlashModeTypeFromString(modestr); -+ if (modeval < 0) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("Firmware flash mode value '%s' unexpected"), -+ modestr); -+ return -1; -+ } -+ flash->mode = modeval; -+ } -+ - if (!(executable = virJSONValueObjectGet(doc, "executable"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing 'executable' in '%s'"), -@@ -372,15 +411,17 @@ qemuFirmwareMappingFlashParse(const char *path, - if (qemuFirmwareFlashFileParse(path, executable, &flash->executable) < 0) - return -1; - -- if (!(nvram_template = virJSONValueObjectGet(doc, "nvram-template"))) { -- virReportError(VIR_ERR_INTERNAL_ERROR, -- _("missing 'nvram-template' in '%s'"), -- path); -- return -1; -- } -+ if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) { -+ if (!(nvram_template = virJSONValueObjectGet(doc, "nvram-template"))) { -+ virReportError(VIR_ERR_INTERNAL_ERROR, -+ _("missing 'nvram-template' in '%s'"), -+ path); -+ return -1; -+ } - -- if (qemuFirmwareFlashFileParse(path, nvram_template, &flash->nvram_template) < 0) -- return -1; -+ if (qemuFirmwareFlashFileParse(path, nvram_template, &flash->nvram_template) < 0) -+ return -1; -+ } - - return 0; - } -@@ -693,10 +734,12 @@ qemuFirmwareMappingFlashFormat(virJSONValue *mapping, - g_autoptr(virJSONValue) executable = NULL; - g_autoptr(virJSONValue) nvram_template = NULL; - -- if (!(executable = qemuFirmwareFlashFileFormat(flash->executable))) -+ if (virJSONValueObjectAppendString(mapping, -+ "mode", -+ qemuFirmwareFlashModeTypeToString(flash->mode)) < 0) - return -1; - -- if (!(nvram_template = qemuFirmwareFlashFileFormat(flash->nvram_template))) -+ if (!(executable = qemuFirmwareFlashFileFormat(flash->executable))) - return -1; - - if (virJSONValueObjectAppend(mapping, -@@ -704,11 +747,15 @@ qemuFirmwareMappingFlashFormat(virJSONValue *mapping, - &executable) < 0) - return -1; - -+ if (flash->mode == QEMU_FIRMWARE_FLASH_MODE_SPLIT) { -+ if (!(nvram_template = qemuFirmwareFlashFileFormat(flash->nvram_template))) -+ return -1; - -- if (virJSONValueObjectAppend(mapping, -+ if (virJSONValueObjectAppend(mapping, - "nvram-template", -- &nvram_template) < 0) -- return -1; -+ &nvram_template) < 0) -+ return -1; -+ } - - return 0; - } -@@ -1053,6 +1100,12 @@ qemuFirmwareMatchDomain(const virDomainDef *def, - return false; - } - -+ if (fw->mapping.device == QEMU_FIRMWARE_DEVICE_FLASH && -+ fw->mapping.data.flash.mode != QEMU_FIRMWARE_FLASH_MODE_SPLIT) { -+ VIR_DEBUG("Discarding loader without split flash"); -+ return false; -+ } -+ - if (def->sec) { - switch ((virDomainLaunchSecurity) def->sec->sectype) { - case VIR_DOMAIN_LAUNCH_SECURITY_SEV: -diff --git a/tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json -new file mode 100644 -index 0000000000..c251682cd9 ---- /dev/null -+++ b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/50-ovmf-sb-keys.json -@@ -0,0 +1,33 @@ -+{ -+ "interface-types": [ -+ "uefi" -+ ], -+ "mapping": { -+ "device": "flash", -+ "mode": "split", -+ "executable": { -+ "filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd", -+ "format": "raw" -+ }, -+ "nvram-template": { -+ "filename": "/usr/share/OVMF/OVMF_VARS.secboot.fd", -+ "format": "raw" -+ } -+ }, -+ "targets": [ -+ { -+ "architecture": "x86_64", -+ "machines": [ -+ "pc-q35-*" -+ ] -+ } -+ ], -+ "features": [ -+ "acpi-s3", -+ "amd-sev", -+ "enrolled-keys", -+ "requires-smm", -+ "secure-boot", -+ "verbose-dynamic" -+ ] -+} -diff --git a/tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json -new file mode 100644 -index 0000000000..2a9aa23efb ---- /dev/null -+++ b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/61-ovmf.json -@@ -0,0 +1,31 @@ -+{ -+ "interface-types": [ -+ "uefi" -+ ], -+ "mapping": { -+ "device": "flash", -+ "mode": "split", -+ "executable": { -+ "filename": "/usr/share/OVMF/OVMF_CODE.fd", -+ "format": "raw" -+ }, -+ "nvram-template": { -+ "filename": "/usr/share/OVMF/OVMF_VARS.fd", -+ "format": "raw" -+ } -+ }, -+ "targets": [ -+ { -+ "architecture": "x86_64", -+ "machines": [ -+ "pc-i440fx-*", -+ "pc-q35-*" -+ ] -+ } -+ ], -+ "features": [ -+ "acpi-s3", -+ "amd-sev", -+ "verbose-dynamic" -+ ] -+} -diff --git a/tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json -new file mode 100644 -index 0000000000..9bd5ac2868 ---- /dev/null -+++ b/tests/qemufirmwaredata/out/usr/share/qemu/firmware/70-aavmf.json -@@ -0,0 +1,28 @@ -+{ -+ "interface-types": [ -+ "uefi" -+ ], -+ "mapping": { -+ "device": "flash", -+ "mode": "split", -+ "executable": { -+ "filename": "/usr/share/AAVMF/AAVMF_CODE.fd", -+ "format": "raw" -+ }, -+ "nvram-template": { -+ "filename": "/usr/share/AAVMF/AAVMF_VARS.fd", -+ "format": "raw" -+ } -+ }, -+ "targets": [ -+ { -+ "architecture": "aarch64", -+ "machines": [ -+ "virt-*" -+ ] -+ } -+ ], -+ "features": [ -+ -+ ] -+} -diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json -new file mode 100644 -index 0000000000..5a619f3ab0 ---- /dev/null -+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/45-ovmf-sev-stateless.json -@@ -0,0 +1,31 @@ -+{ -+ "description": "OVMF for x86_64, with SEV, without SB, without SMM, with NO varstore", -+ "interface-types": [ -+ "uefi" -+ ], -+ "mapping": { -+ "device": "flash", -+ "mode": "stateless", -+ "executable": { -+ "filename": "/usr/share/OVMF/OVMF.sev.fd", -+ "format": "raw" -+ } -+ }, -+ "targets": [ -+ { -+ "architecture": "x86_64", -+ "machines": [ -+ "pc-q35-*" -+ ] -+ } -+ ], -+ "features": [ -+ "acpi-s3", -+ "amd-sev", -+ "amd-sev-es", -+ "verbose-dynamic" -+ ], -+ "tags": [ -+ -+ ] -+} -diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json -new file mode 100644 -index 0000000000..eb3332e4ab ---- /dev/null -+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/55-ovmf-sb-combined.json -@@ -0,0 +1,33 @@ -+{ -+ "description": "OVMF with SB+SMM, SB enabled, MS certs enrolled", -+ "interface-types": [ -+ "uefi" -+ ], -+ "mapping": { -+ "device": "flash", -+ "mode": "combined", -+ "executable": { -+ "filename": "/usr/share/OVMF/OVMF.secboot.fd", -+ "format": "raw" -+ } -+ }, -+ "targets": [ -+ { -+ "architecture": "x86_64", -+ "machines": [ -+ "pc-q35-*" -+ ] -+ } -+ ], -+ "features": [ -+ "acpi-s3", -+ "amd-sev", -+ "enrolled-keys", -+ "requires-smm", -+ "secure-boot", -+ "verbose-dynamic" -+ ], -+ "tags": [ -+ -+ ] -+} -diff --git a/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json b/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json -index 5e8a94ae78..a5273a5e8b 100644 ---- a/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json -+++ b/tests/qemufirmwaredata/usr/share/qemu/firmware/60-ovmf-sb.json -@@ -5,6 +5,7 @@ - ], - "mapping": { - "device": "flash", -+ "mode": "split", - "executable": { - "filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd", - "format": "raw" -diff --git a/tests/qemufirmwaretest.c b/tests/qemufirmwaretest.c -index cad4b6d383..fc3416b2ae 100644 ---- a/tests/qemufirmwaretest.c -+++ b/tests/qemufirmwaretest.c -@@ -17,22 +17,31 @@ static int - testParseFormatFW(const void *opaque) - { - const char *filename = opaque; -- g_autofree char *path = NULL; -+ g_autofree char *inpath = NULL; -+ g_autofree char *outpath = NULL; - g_autoptr(qemuFirmware) fw = NULL; -- g_autofree char *buf = NULL; - g_autoptr(virJSONValue) json = NULL; - g_autofree char *expected = NULL; - g_autofree char *actual = NULL; -+ g_autofree char *buf = NULL; - -- path = g_strdup_printf("%s/qemufirmwaredata/%s", abs_srcdir, filename); -+ inpath = g_strdup_printf("%s/qemufirmwaredata/%s", abs_srcdir, filename); -+ outpath = g_strdup_printf("%s/qemufirmwaredata/out/%s", abs_srcdir, filename); - -- if (!(fw = qemuFirmwareParse(path))) -+ if (!(fw = qemuFirmwareParse(inpath))) - return -1; - -- if (virFileReadAll(path, -- 1024 * 1024, /* 1MiB */ -- &buf) < 0) -- return -1; -+ if (virFileExists(outpath)) { -+ if (virFileReadAll(outpath, -+ 1024 * 1024, /* 1MiB */ -+ &buf) < 0) -+ return -1; -+ } else { -+ if (virFileReadAll(inpath, -+ 1024 * 1024, /* 1MiB */ -+ &buf) < 0) -+ return -1; -+ } - - if (!(json = virJSONValueFromString(buf))) - return -1; -@@ -60,7 +69,9 @@ testFWPrecedence(const void *opaque G_GNUC_UNUSED) - const char *expected[] = { - PREFIX "/share/qemu/firmware/40-bios.json", - SYSCONFDIR "/qemu/firmware/40-ovmf-sb-keys.json", -+ PREFIX "/share/qemu/firmware/45-ovmf-sev-stateless.json", - PREFIX "/share/qemu/firmware/50-ovmf-sb-keys.json", -+ PREFIX "/share/qemu/firmware/55-ovmf-sb-combined.json", - PREFIX "/share/qemu/firmware/61-ovmf.json", - PREFIX "/share/qemu/firmware/70-aavmf.json", - NULL -@@ -218,7 +229,9 @@ mymain(void) - } while (0) - - DO_PARSE_TEST("usr/share/qemu/firmware/40-bios.json"); -+ DO_PARSE_TEST("usr/share/qemu/firmware/45-ovmf-sev-stateless.json"); - DO_PARSE_TEST("usr/share/qemu/firmware/50-ovmf-sb-keys.json"); -+ DO_PARSE_TEST("usr/share/qemu/firmware/55-ovmf-sb-combined.json"); - DO_PARSE_TEST("usr/share/qemu/firmware/60-ovmf-sb.json"); - DO_PARSE_TEST("usr/share/qemu/firmware/61-ovmf.json"); - DO_PARSE_TEST("usr/share/qemu/firmware/70-aavmf.json"); -@@ -250,6 +263,8 @@ mymain(void) - DO_SUPPORTED_TEST("pc-q35-3.1", VIR_ARCH_X86_64, true, - "/usr/share/seabios/bios-256k.bin:NULL:" - "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.secboot.fd:" -+ "/usr/share/OVMF/OVMF.sev.fd:NULL:" -+ "/usr/share/OVMF/OVMF.secboot.fd:NULL:" - "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd", - VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS, - VIR_DOMAIN_OS_DEF_FIRMWARE_EFI); --- -2.35.1 - diff --git a/SOURCES/libvirt-qemu-support-multiqueue-for-vdpa-net-device.patch b/SOURCES/libvirt-qemu-support-multiqueue-for-vdpa-net-device.patch deleted file mode 100644 index 83d9be3..0000000 --- a/SOURCES/libvirt-qemu-support-multiqueue-for-vdpa-net-device.patch +++ /dev/null @@ -1,186 +0,0 @@ -From 563e17f59f088d4ba76e7a95ea8958792ae165e2 Mon Sep 17 00:00:00 2001 -Message-Id: <563e17f59f088d4ba76e7a95ea8958792ae165e2@dist-git> -From: Jonathon Jongsma -Date: Tue, 1 Mar 2022 16:55:21 -0600 -Subject: [PATCH] qemu: support multiqueue for vdpa net device - -Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406 - -Signed-off-by: Jonathon Jongsma -Reviewed-by: Martin Kletzander - -(cherry picked from commit a5e659f071ae5f5fc9aadb46ad7c31736425f8cf) -Signed-off-by: Jonathon Jongsma ---- - src/qemu/qemu_domain.c | 3 +- - .../net-vdpa-multiqueue.x86_64-latest.args | 36 +++++++++++++++++++ - .../qemuxml2argvdata/net-vdpa-multiqueue.xml | 30 ++++++++++++++++ - tests/qemuxml2argvtest.c | 1 + - .../net-vdpa-multiqueue.xml | 36 +++++++++++++++++++ - tests/qemuxml2xmltest.c | 1 + - 6 files changed, 106 insertions(+), 1 deletion(-) - create mode 100644 tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args - create mode 100644 tests/qemuxml2argvdata/net-vdpa-multiqueue.xml - create mode 100644 tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml - -diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c -index a8401bac30..68052769af 100644 ---- a/src/qemu/qemu_domain.c -+++ b/src/qemu/qemu_domain.c -@@ -4511,7 +4511,8 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, - actualType == VIR_DOMAIN_NET_TYPE_BRIDGE || - actualType == VIR_DOMAIN_NET_TYPE_DIRECT || - actualType == VIR_DOMAIN_NET_TYPE_ETHERNET || -- actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)) { -+ actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER || -+ actualType == VIR_DOMAIN_NET_TYPE_VDPA)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("interface %s - multiqueue is not supported for network interfaces of type %s"), - macstr, virDomainNetTypeToString(actualType)); -diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args -new file mode 100644 -index 0000000000..61ba85a847 ---- /dev/null -+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args -@@ -0,0 +1,36 @@ -+LC_ALL=C \ -+PATH=/bin \ -+HOME=/tmp/lib/domain--1-QEMUGuest1 \ -+USER=test \ -+LOGNAME=test \ -+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -+/usr/bin/qemu-system-x86_64 \ -+-name guest=QEMUGuest1,debug-threads=on \ -+-S \ -+-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ -+-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \ -+-accel tcg \ -+-cpu qemu64 \ -+-m 214 \ -+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ -+-overcommit mem-lock=off \ -+-smp 1,sockets=1,cores=1,threads=1 \ -+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -+-display none \ -+-no-user-config \ -+-nodefaults \ -+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ -+-mon chardev=charmonitor,id=monitor,mode=control \ -+-rtc base=utc \ -+-no-shutdown \ -+-no-acpi \ -+-boot strict=on \ -+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -+-add-fd set=0,fd=1732,opaque=/dev/vhost-vdpa-0 \ -+-netdev vhost-vdpa,vhostdev=/dev/fdset/0,id=hostnet0 \ -+-device virtio-net-pci,mq=on,vectors=6,netdev=hostnet0,id=net0,mac=52:54:00:95:db:c0,bus=pci.0,addr=0x2 \ -+-audiodev '{"id":"audio1","driver":"none"}' \ -+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -+-msg timestamp=on -diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml b/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml -new file mode 100644 -index 0000000000..6e369c1916 ---- /dev/null -+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.xml -@@ -0,0 +1,30 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c -index cc67d806e4..1abb5d0124 100644 ---- a/tests/qemuxml2argvtest.c -+++ b/tests/qemuxml2argvtest.c -@@ -1652,6 +1652,7 @@ mymain(void) - DO_TEST_FAILURE("net-hostdev-fail", - QEMU_CAPS_DEVICE_VFIO_PCI); - DO_TEST_CAPS_LATEST("net-vdpa"); -+ DO_TEST_CAPS_LATEST("net-vdpa-multiqueue"); - - DO_TEST("hostdev-pci-multifunction", - QEMU_CAPS_KVM, -diff --git a/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml b/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml -new file mode 100644 -index 0000000000..0876d5df62 ---- /dev/null -+++ b/tests/qemuxml2xmloutdata/net-vdpa-multiqueue.xml -@@ -0,0 +1,36 @@ -+ -+ QEMUGuest1 -+ c7a5fdbd-edaf-9455-926a-d65c16db1809 -+ 219136 -+ 219136 -+ 1 -+ -+ hvm -+ -+ -+ -+ destroy -+ restart -+ destroy -+ -+ /usr/bin/qemu-system-x86_64 -+ -+
-+ -+ -+
-+ -+ -+ -+ -+ -+ -+ -+
-+ -+ -+ -+