diff --git a/libvirt-qemu-Avoid-crash-in-qemuDomainCheckCPU-with-unknown-host-CPU.patch b/libvirt-qemu-Avoid-crash-in-qemuDomainCheckCPU-with-unknown-host-CPU.patch new file mode 100644 index 0000000..7eb1537 --- /dev/null +++ b/libvirt-qemu-Avoid-crash-in-qemuDomainCheckCPU-with-unknown-host-CPU.patch @@ -0,0 +1,38 @@ +From d874530eaded03d0b90139c9bbd80902b9464e87 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Jiri Denemark +Date: Tue, 18 Feb 2025 11:24:32 +0100 +Subject: [PATCH] qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU + +When we don't have any information about host CPU (for example when +running on an aarch64 host), the virQEMUCapsGetHostModel would return +NULL. + +Fixes: f928eb5fc80ca0ed7277f2513b63aed36c09d275 +Fixes: https://gitlab.com/libvirt/libvirt/-/issues/747 +Signed-off-by: Jiri Denemark +Tested-by: Jaroslav Suchanek +Reviewed-by: Michal Privoznik +(cherry picked from commit 43eae1b7077104d4e2ed52447407a335c2d093e3) + +https://issues.redhat.com/browse/RHEL-81747 + +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_domain.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 92035dd281..1ccaff90d9 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -11446,6 +11446,7 @@ qemuDomainCheckCPU(virArch arch, + /* Force compat check if the CPU model is not found in qemuCaps or + * we don't have host CPU data from QEMU */ + if (!cpu->model || ++ !hypervisorCPU || + hypervisorCPU->fallback != VIR_CPU_FALLBACK_FORBID || + virQEMUCapsGetCPUBlockers(qemuCaps, virtType, + cpu->model, &blockers) < 0) +-- +2.48.1 diff --git a/libvirt-qemu-snapshot-error-out-early-when-reverting-snapshot-for-VM-with-non-file-disk.patch b/libvirt-qemu-snapshot-error-out-early-when-reverting-snapshot-for-VM-with-non-file-disk.patch new file mode 100644 index 0000000..40c8120 --- /dev/null +++ b/libvirt-qemu-snapshot-error-out-early-when-reverting-snapshot-for-VM-with-non-file-disk.patch @@ -0,0 +1,75 @@ +From c9c9405687b78713b913c09113697fcadec1cdba Mon Sep 17 00:00:00 2001 +Message-ID: +From: Pavel Hrdina +Date: Wed, 26 Feb 2025 11:04:52 +0100 +Subject: [PATCH] qemu: snapshot: error out early when reverting snapshot for + VM with non-file disk + +Before this patch the code would start the revert process by destroying +the VM and preparing to revert where it would fail with following error: + + error: unsupported configuration: source for disk 'sdb' is not a regular file; refusing to generate external snapshot name + +and leaving user with offline VM even if it was running. + +Make the check before we start the revert process to not destroy VMs. + +Resolves: https://issues.redhat.com/browse/RHEL-30971 +Resolves: https://issues.redhat.com/browse/RHEL-79928 +Signed-off-by: Pavel Hrdina +Reviewed-by: Peter Krempa +(cherry picked from commit 278b8334eb26aa9495f6d37e4f72471cbc8739a6) + +Signed-off-by: Pavel Hrdina +--- + src/qemu/qemu_snapshot.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c +index 3a8510c69e..16d3aaf6e7 100644 +--- a/src/qemu/qemu_snapshot.c ++++ b/src/qemu/qemu_snapshot.c +@@ -2190,6 +2190,8 @@ qemuSnapshotRevertValidate(virDomainObj *vm, + virDomainSnapshotDef *snapdef, + unsigned int flags) + { ++ size_t i; ++ + if (!vm->persistent && + snapdef->state != VIR_DOMAIN_SNAPSHOT_RUNNING && + snapdef->state != VIR_DOMAIN_SNAPSHOT_PAUSED && +@@ -2217,6 +2219,22 @@ qemuSnapshotRevertValidate(virDomainObj *vm, + } + } + ++ /* Reverting to external snapshot creates overlay files for every disk and ++ * it would fail for non-file based disks. ++ * See qemuSnapshotRevertExternalPrepare for more details. */ ++ if (virDomainSnapshotIsExternal(snap)) { ++ for (i = 0; i < snap->def->dom->ndisks; i++) { ++ virDomainDiskDef *disk = snap->def->dom->disks[i]; ++ ++ if (disk->src->type != VIR_STORAGE_TYPE_FILE) { ++ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, ++ _("source disk for '%1$s' is not a regular file, reverting to snapshot is not supported"), ++ disk->dst); ++ return -1; ++ } ++ } ++ } ++ + return 0; + } + +@@ -2368,6 +2386,9 @@ qemuSnapshotRevertExternalPrepare(virDomainObj *vm, + if (virDomainMomentDefPostParse(&tmpsnapdef->parent) < 0) + return -1; + ++ /* Force default location to be external in order to create overlay files ++ * for every disk. In qemuSnapshotRevertValidate we make sure that each ++ * disk is regular file otherwise this would fail. */ + if (virDomainSnapshotAlignDisks(tmpsnapdef, domdef, + VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL, + false, true) < 0) { +-- +2.48.1 diff --git a/libvirt-qemu_snapshot-allow-reverting-to-external-disk-only-snapshot.patch b/libvirt-qemu_snapshot-allow-reverting-to-external-disk-only-snapshot.patch new file mode 100644 index 0000000..1354549 --- /dev/null +++ b/libvirt-qemu_snapshot-allow-reverting-to-external-disk-only-snapshot.patch @@ -0,0 +1,50 @@ +From b0282d5149f90b155a38881f92e3263bd23d9878 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Pavel Hrdina +Date: Wed, 31 Jan 2024 17:14:28 +0100 +Subject: [PATCH] qemu_snapshot: allow reverting to external disk only snapshot + +When snapshot is created with disk-only flag it is always external +snapshot without memory state. Historically when there was not support +to revert external snapshots this produced error message. + + error: Failed to revert snapshot s1 + error: internal error: Invalid target domain state 'disk-snapshot'. Refusing snapshot reversion + +Now we can simply consider this as reverting to offline snapshot as the +possible damage to file system is already done at the point of snapshot +creation. + +Resolves: https://issues.redhat.com/browse/RHEL-21549 +Signed-off-by: Pavel Hrdina +Reviewed-by: Peter Krempa +(cherry picked from commit 443ae4adec3a94a575ea2acaa112188e721c7dfe) + +Signed-off-by: Pavel Hrdina +--- + src/qemu/qemu_snapshot.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c +index b1f4ebb995..3a8510c69e 100644 +--- a/src/qemu/qemu_snapshot.c ++++ b/src/qemu/qemu_snapshot.c +@@ -2884,6 +2884,7 @@ qemuSnapshotRevert(virDomainObj *vm, + case VIR_DOMAIN_SNAPSHOT_SHUTDOWN: + case VIR_DOMAIN_SNAPSHOT_SHUTOFF: + case VIR_DOMAIN_SNAPSHOT_CRASHED: ++ case VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT: + ret = qemuSnapshotRevertInactive(vm, snapshot, snap, + driver, cfg, + &inactiveConfig, +@@ -2895,8 +2896,6 @@ qemuSnapshotRevert(virDomainObj *vm, + _("qemu doesn't support reversion of snapshot taken in PMSUSPENDED state")); + goto endjob; + +- case VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT: +- /* Rejected earlier as an external snapshot */ + case VIR_DOMAIN_SNAPSHOT_NOSTATE: + case VIR_DOMAIN_SNAPSHOT_BLOCKED: + case VIR_DOMAIN_SNAPSHOT_LAST: +-- +2.48.1 diff --git a/libvirt-remote-add-sysusers-file-to-create-libvirt-group.patch b/libvirt-remote-add-sysusers-file-to-create-libvirt-group.patch new file mode 100644 index 0000000..c2c5c4a --- /dev/null +++ b/libvirt-remote-add-sysusers-file-to-create-libvirt-group.patch @@ -0,0 +1,56 @@ +From 44fc545f45e2e0077fbdc9d45bf8743d115fca35 Mon Sep 17 00:00:00 2001 +Message-ID: <44fc545f45e2e0077fbdc9d45bf8743d115fca35.1741876175.git.jdenemar@redhat.com> +From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= +Date: Wed, 29 Jan 2025 15:37:46 +0000 +Subject: [PATCH] remote: add sysusers file to create 'libvirt' group +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We previously added a sysusers file, but missed the 'libvirt' group. +This group is referenced in the polkit rules, so we should be +registering that too. It must be done in a separate sysusers file, +however, since it is common to all daemons. + +Fixes: a2c3e390f7bedf36f4ddc544d09fe3b8772c5c6f +Reviewed-by: Jiri Denemark +Signed-off-by: Daniel P. Berrangé +(cherry picked from commit 18f0160994af80dfac2dcaf46097922e443b283b) + +https://issues.redhat.com/browse/RHEL-81749 + +Signed-off-by: Andrea Bolognani +--- + libvirt.spec.in | 1 + + src/remote/libvirt.sysusers.conf | 1 + + src/remote/meson.build | 7 +++++++ + 3 files changed, 9 insertions(+) + create mode 100644 src/remote/libvirt.sysusers.conf + +diff --git a/src/remote/libvirt.sysusers.conf b/src/remote/libvirt.sysusers.conf +new file mode 100644 +index 0000000000..50c6716cce +--- /dev/null ++++ b/src/remote/libvirt.sysusers.conf +@@ -0,0 +1 @@ ++g libvirt - +diff --git a/src/remote/meson.build b/src/remote/meson.build +index 831acaaa01..a96eaa1047 100644 +--- a/src/remote/meson.build ++++ b/src/remote/meson.build +@@ -307,6 +307,13 @@ if conf.has('WITH_REMOTE') + ) + endif + ++ # Install the sysuser config for the daemon polkit rules ++ install_data( ++ 'libvirt.sysusers.conf', ++ install_dir: sysusersdir, ++ rename: [ 'libvirt.conf' ], ++ ) ++ + virt_helpers += { + 'name': 'virt-ssh-helper', + 'sources': [ +-- +2.48.1 diff --git a/libvirt.spec b/libvirt.spec index 3a49182..d06729a 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -289,7 +289,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 10.10.0 -Release: 7%{?dist}%{?extra_release} +Release: 8%{?dist}%{?extra_release} License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 URL: https://libvirt.org/ @@ -380,6 +380,10 @@ Patch80: libvirt-qemu-fail-validation-if-a-domain-def-has-vhostuser-passt-but-no Patch81: libvirt-docs-improve-type-user-docs-to-higlight-differences-between-SLIRP-and-passt.patch Patch82: libvirt-docs-document-using-passt-backend-with-interface-type-vhostuser.patch Patch83: libvirt-utils-Canonicalize-paths-before-comparing-them.patch +Patch84: libvirt-remote-add-sysusers-file-to-create-libvirt-group.patch +Patch85: libvirt-qemu-Avoid-crash-in-qemuDomainCheckCPU-with-unknown-host-CPU.patch +Patch86: libvirt-qemu_snapshot-allow-reverting-to-external-disk-only-snapshot.patch +Patch87: libvirt-qemu-snapshot-error-out-early-when-reverting-snapshot-for-VM-with-non-file-disk.patch Requires: libvirt-daemon = %{version}-%{release} @@ -2137,6 +2141,7 @@ exit 0 %{_datadir}/polkit-1/actions/org.libvirt.unix.policy %{_datadir}/polkit-1/actions/org.libvirt.api.policy %{_datadir}/polkit-1/rules.d/50-libvirt.rules +%{_sysusersdir}/libvirt.conf %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/ %attr(0755, root, root) %{_libexecdir}/libvirt_iohelper %attr(0755, root, root) %{_bindir}/virt-ssh-helper @@ -2704,6 +2709,12 @@ exit 0 %endif %changelog +* Thu Mar 13 2025 Jiri Denemark - 10.10.0-8 +- remote: add sysusers file to create 'libvirt' group (RHEL-81749) +- qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU (RHEL-81747) +- qemu_snapshot: allow reverting to external disk only snapshot (RHEL-21549) +- qemu: snapshot: error out early when reverting snapshot for VM with non-file disk (RHEL-30971) + * Mon Feb 17 2025 Jiri Denemark - 10.10.0-7 - qemu_migration: Refactor qemuMigrationSrcRestoreDomainState (RHEL-79168) - qemu_migration: Do not automatically resume domain after I/O error (RHEL-79168)