diff --git a/libvirt-conf-parse-interface-source-dev-for-all-interface-types-with-backend-type-passt.patch b/libvirt-conf-parse-interface-source-dev-for-all-interface-types-with-backend-type-passt.patch new file mode 100644 index 0000000..a2e1303 --- /dev/null +++ b/libvirt-conf-parse-interface-source-dev-for-all-interface-types-with-backend-type-passt.patch @@ -0,0 +1,103 @@ +From 29ea0453595ee14cdd64b2e9c07343aa870426d0 Mon Sep 17 00:00:00 2001 +Message-ID: <29ea0453595ee14cdd64b2e9c07343aa870426d0.1744876587.git.jdenemar@redhat.com> +From: Laine Stump +Date: Thu, 6 Mar 2025 19:19:12 -0500 +Subject: [PATCH] conf: parse interface/source/@dev for all interface types + (with backend type='passt') + +The original implementation of the passt backend for vhost-user +interfaces erroneously forgot to parse: + + + +for interface type='vhostuser', so it wasn't being added to the passt +commandline, and also wasn't being saved to the domain config. Now we +parse it whenever the type='passt', no matter what the +interface type, and then throw an error during validation if +source/@dev was specified for interface type = 'user|vhostuser' and +backend type != 'passt'. + +Fixes: 1e9054b9c79d721a55f413c2983c5370044f8f60 +Resolves: https://issues.redhat.com/browse/RHEL-82539 +Signed-off-by: Laine Stump +Reviewed-by: Peter Krempa +(cherry picked from commit 4c979edaa545c8425f7a856c06ebc0de939d4b9f) +Signed-off-by: Jiri Denemark +--- + src/conf/domain_conf.c | 8 +++++--- + src/conf/domain_validate.c | 8 +++++++- + .../qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml | 2 ++ + 3 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index f6d3d849eb..726c3095ed 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -9919,9 +9919,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, + break; + + case VIR_DOMAIN_NET_TYPE_USER: +- def->sourceDev = virXMLPropString(source_node, "dev"); +- break; +- + case VIR_DOMAIN_NET_TYPE_NULL: + case VIR_DOMAIN_NET_TYPE_LAST: + break; +@@ -10036,6 +10033,11 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, + return NULL; + } + ++ if (def->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) { ++ def->sourceDev = virXMLPropString(source_node, "dev"); ++ } ++ ++ + def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; + if (linkstate != NULL) { + if ((def->linkstate = virDomainNetInterfaceLinkStateTypeFromString(linkstate)) <= 0) { +diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c +index 597ae3d938..9cedc8d6d2 100644 +--- a/src/conf/domain_validate.c ++++ b/src/conf/domain_validate.c +@@ -2160,12 +2160,18 @@ virDomainNetDefValidate(const virDomainNetDef *net) + if (net->type != VIR_DOMAIN_NET_TYPE_USER && + net->type != VIR_DOMAIN_NET_TYPE_VHOSTUSER) { + if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) { +- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("The 'passt' backend can only be used with interface type='user' or type='vhostuser'")); + return -1; + } + } + ++ if (net->sourceDev && net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("The 'dev' attribute of the element can only be used with type='user' or type='vhostuser' if the type='passt'")); ++ return -1; ++ } ++ + if (net->nPortForwards > 0) { + size_t p; + +diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml +index a1f9366722..529aff11f8 100644 +--- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml ++++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml +@@ -33,6 +33,7 @@ + + + ++ + + + +@@ -63,6 +64,7 @@ + + + ++ + + +
+-- +2.49.0 diff --git a/libvirt-esx-Accept-empty-path-URI-component-same-way-as.patch b/libvirt-esx-Accept-empty-path-URI-component-same-way-as.patch new file mode 100644 index 0000000..93bf0a0 --- /dev/null +++ b/libvirt-esx-Accept-empty-path-URI-component-same-way-as.patch @@ -0,0 +1,49 @@ +From e9899b64816f8086038098b44690df076d93d8d8 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Peter Krempa +Date: Tue, 8 Apr 2025 16:25:37 +0200 +Subject: [PATCH] esx: Accept empty "path" URI component same way as "/" + +When connecting to "esx://" URI there's code which prints a warning that +the path is not "empty". The check validates that "uri->path" is "/". + +In case when the user uses URI such as: + + esx://hostname + +the warning is printed as well. Since there is no effective difference +betweeen the two allow empty strings as well. + +Resolves: https://issues.redhat.com/browse/RHEL-86459 +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit 59f40ba67cc7d0a3f8eeb601c2f3c84def24a361) +--- + src/esx/esx_driver.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c +index 6ae4ef9658..512ca6c028 100644 +--- a/src/esx/esx_driver.c ++++ b/src/esx/esx_driver.c +@@ -687,7 +687,9 @@ esxConnectToVCenter(esxPrivate *priv, + g_autofree char *url = NULL; + + if (!hostSystemIPAddress && +- (!priv->parsedUri->path || STREQ(priv->parsedUri->path, "/"))) { ++ (!priv->parsedUri->path || ++ STREQ(priv->parsedUri->path, "") || ++ STREQ(priv->parsedUri->path, "/"))) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Path has to specify the datacenter and compute resource")); + return -1; +@@ -799,6 +801,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, + virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); + + if (STRCASENEQ(conn->uri->scheme, "vpx") && ++ STRNEQ(conn->uri->path, "") && + STRNEQ(conn->uri->path, "/")) { + VIR_WARN("Ignoring unexpected path '%s' for non-vpx scheme '%s'", + conn->uri->path, conn->uri->scheme); +-- +2.49.0 diff --git a/libvirt-esxConnectListAllDomains-Don-t-propagate-failure-to-lookup-a-single-domain.patch b/libvirt-esxConnectListAllDomains-Don-t-propagate-failure-to-lookup-a-single-domain.patch new file mode 100644 index 0000000..0a685b2 --- /dev/null +++ b/libvirt-esxConnectListAllDomains-Don-t-propagate-failure-to-lookup-a-single-domain.patch @@ -0,0 +1,63 @@ +From 7caecd5f75f22d6bab74efcb3bc151f8bf441ec9 Mon Sep 17 00:00:00 2001 +Message-ID: <7caecd5f75f22d6bab74efcb3bc151f8bf441ec9.1744876587.git.jdenemar@redhat.com> +From: Peter Krempa +Date: Tue, 25 Mar 2025 07:23:01 +0100 +Subject: [PATCH] esxConnectListAllDomains: Don't propagate failure to lookup a + single domain +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In esxConnectListAllDomains if the lookup of the VM name and UUID fails +for a single VM (possible e.g. with broken storage) the whole API would +return failure even when there are working VMs. + +Rework the lookup so that if a subset fails we ignore the failure on +those. We report an error only if lookup of all of the objects failed. +Failure is reported from the last one. + +Resolves: https://issues.redhat.com/browse/RHEL-80606 +Signed-off-by: Peter Krempa +Reviewed-by: Ján Tomko +(cherry picked from commit 7d4de62cfa8c684b2d63a48c71f0ae009acddf62) +--- + src/esx/esx_driver.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c +index 554fb3e18f..6ae4ef9658 100644 +--- a/src/esx/esx_driver.c ++++ b/src/esx/esx_driver.c +@@ -4792,18 +4792,20 @@ esxConnectListAllDomains(virConnectPtr conn, + virtualMachine = virtualMachine->_next) { + g_autofree char *name = NULL; + +- if (needIdentity) { +- if (esxVI_GetVirtualMachineIdentity(virtualMachine, &id, +- &name, uuid) < 0) { +- goto cleanup; +- } +- } ++ /* If the lookup of the required properties fails for some of the machines ++ * in the list it's preferrable to return the valid objects instead of ++ * failing outright */ ++ if ((needIdentity && esxVI_GetVirtualMachineIdentity(virtualMachine, &id, &name, uuid) < 0) || ++ (needPowerState && esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0)) { + +- if (needPowerState) { +- if (esxVI_GetVirtualMachinePowerState(virtualMachine, +- &powerState) < 0) { ++ /* Raise error only if we didn't successfuly fill any domain */ ++ if (count == 0 && !virtualMachine->_next) + goto cleanup; +- } ++ ++ /* failure to fetch information of a single VM must not interrupt ++ * the lookup of the rest */ ++ virResetLastError(); ++ continue; + } + + /* filter by active state */ +-- +2.49.0 diff --git a/libvirt-libvirt-host-Clarify-fix-description-of-the-CPU-frequency-field.patch b/libvirt-libvirt-host-Clarify-fix-description-of-the-CPU-frequency-field.patch new file mode 100644 index 0000000..81a06ec --- /dev/null +++ b/libvirt-libvirt-host-Clarify-fix-description-of-the-CPU-frequency-field.patch @@ -0,0 +1,51 @@ +From a96d1c90832b639c81f6cd893a79610d4379594d Mon Sep 17 00:00:00 2001 +Message-ID: +From: Peter Krempa +Date: Mon, 7 Apr 2025 13:35:37 +0200 +Subject: [PATCH] libvirt-host: Clarify/fix description of the CPU frequency + field + +The 'virNodeInfo' field for CPU frequency is named 'mhz'. The docs were +mentioning 'mHZ', which is neither the field name nor proper spelling of +the unit. + +Reword the paragraph to mention "CPU frequency" instead and explicitly +name the field in virNodeInfo struct. + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit e54cc1500ccfb36cd5b67eb4d886c491fdda5b2b) + +https://issues.redhat.com/browse/RHEL-86197 +--- + src/libvirt-host.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/libvirt-host.c b/src/libvirt-host.c +index b3a6421a7f..318a664d24 100644 +--- a/src/libvirt-host.c ++++ b/src/libvirt-host.c +@@ -410,9 +410,9 @@ virConnectGetMaxVcpus(virConnectPtr conn, + * Use of this API is strongly discouraged as the information provided + * is not guaranteed to be accurate on all hardware platforms. + * +- * The mHZ value merely reflects the speed that the first CPU in the +- * machine is currently running at. This speed may vary across CPUs +- * and changes continually as the host OS throttles. ++ * The CPU frequency value (field 'mhz' in virNodeInfo) merely reflects the ++ * speed that the first CPU in the machine is currently running at. This speed ++ * may vary across CPUs and changes continually as the host OS throttles. + * + * The nodes/sockets/cores/threads data is potentially inaccurate as + * it assumes a symmetric installation. If one NUMA node has more +@@ -420,7 +420,7 @@ virConnectGetMaxVcpus(virConnectPtr conn, + * wrong. It is also not able to report about CPU dies. + * + * Applications are recommended to use the virConnectGetCapabilities() +- * call instead, which provides all the information except CPU mHZ, ++ * call instead, which provides all the information except CPU frequency, + * in a more accurate representation. + * + * Returns 0 in case of success and -1 in case of failure. +-- +2.49.0 diff --git a/libvirt-manpages-virsh-Use-disclaimer-from-virNodeGetInfo-for-virsh-nodeinfo.patch b/libvirt-manpages-virsh-Use-disclaimer-from-virNodeGetInfo-for-virsh-nodeinfo.patch new file mode 100644 index 0000000..ac94a0c --- /dev/null +++ b/libvirt-manpages-virsh-Use-disclaimer-from-virNodeGetInfo-for-virsh-nodeinfo.patch @@ -0,0 +1,55 @@ +From 90859b9c9cda1ab3daa34847ac4608cf451102ce Mon Sep 17 00:00:00 2001 +Message-ID: <90859b9c9cda1ab3daa34847ac4608cf451102ce.1744876588.git.jdenemar@redhat.com> +From: Peter Krempa +Date: Mon, 7 Apr 2025 14:58:41 +0200 +Subject: [PATCH] manpages: virsh: Use disclaimer from 'virNodeGetInfo()' for + 'virsh nodeinfo' + +Adapt the disclarimer about the data not being accurate in many cases +from the API docs to the virsh command using the aforementioned API. + +Signed-off-by: Peter Krempa +Reviewed-by: Michal Privoznik +(cherry picked from commit 617e2dc3194204a88309e3da55bec8743a5df2ea) + +https://issues.redhat.com/browse/RHEL-86197 +--- + docs/manpages/virsh.rst | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst +index 2e525d3fac..aea920b7a7 100644 +--- a/docs/manpages/virsh.rst ++++ b/docs/manpages/virsh.rst +@@ -427,10 +427,25 @@ nodeinfo + nodeinfo + + Returns basic information about the node, like number and type of CPU, +-and size of the physical memory. The output corresponds to virNodeInfo +-structure. Specifically, the "CPU socket(s)" field means number of CPU +-sockets per NUMA cell. The information libvirt displays is dependent +-upon what each architecture may provide. ++and size of the physical memory. ++ ++Use of this command is strongly discouraged as the information provided ++is not guaranteed to be accurate on all hardware platforms. ++ ++The *CPU frequency* value merely reflects the speed that the first CPU in the ++machine is currently running at. This speed may vary across CPUs and changes ++continually as the host OS throttles. ++ ++The data structure used to fetch the data is not extensible thus only supports ++global nodes/sockets/cores/threads (sockets/cores/threads is per NUMA node) ++topology information. If the host CPU has any further groupings (e.g. ++dies, clusters, etc) or the NUMA topology is non-symmetrical the data structure ++can't faithfully represent the system. In such cases a fake topology ++(nodes = 1, sockets = 1, cores = number of host cpus, threads = 1) which ++only correctly represents the total host CPU count is reported. ++ ++Recommended replacement is to use the *capabilities* command which reports ++the data (except frequency) under ``/capabilities/host/topology`` XPath. + + + nodecpumap +-- +2.49.0 diff --git a/libvirt-qemu-Allow-virtio-mem-on-CCW.patch b/libvirt-qemu-Allow-virtio-mem-on-CCW.patch new file mode 100644 index 0000000..6eda024 --- /dev/null +++ b/libvirt-qemu-Allow-virtio-mem-on-CCW.patch @@ -0,0 +1,36 @@ +From 5c4270439f99bd52f91613a6ee833aa4bcb131c4 Mon Sep 17 00:00:00 2001 +Message-ID: <5c4270439f99bd52f91613a6ee833aa4bcb131c4.1744876588.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Wed, 15 Jan 2025 13:00:36 +0100 +Subject: [PATCH] qemu: Allow virtio-mem on CCW + +After previous commits, we can allow virtio-mem to live on CCW +channel. + +Signed-off-by: Michal Privoznik +Reviewed-by: Boris Fiuczynski +(cherry picked from commit ee0320a7fccc8088bc2830fe949ae2339db208cb) +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_domain.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index b6c36d85d7..4234e4605b 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -7673,9 +7673,10 @@ qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem, + + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: + if (mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && ++ mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && + mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, +- _("only 'pci' addresses are supported for the %1$s device"), ++ _("only 'pci' and 'ccw' addresses are supported for the %1$s device"), + virDomainMemoryModelTypeToString(mem->model)); + return -1; + } +-- +2.49.0 diff --git a/libvirt-qemu-Do-NOT-autoadd-NUMA-node-for-s390.patch b/libvirt-qemu-Do-NOT-autoadd-NUMA-node-for-s390.patch new file mode 100644 index 0000000..80f172f --- /dev/null +++ b/libvirt-qemu-Do-NOT-autoadd-NUMA-node-for-s390.patch @@ -0,0 +1,50 @@ +From b2e5469f35657b7d46842b39be04ecc34e5ff659 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Michal Privoznik +Date: Mon, 20 Jan 2025 17:10:24 +0100 +Subject: [PATCH] qemu: Do NOT autoadd NUMA node for s390 + +In some cases, we might automatically add a NUMA node. But this +doesn't work for s390 really, because in its commit +v2.12.0-rc0~41^2~6 QEMU forbade specifying NUMA nodes for s390. +Suppress automatic adding of NUMA node on our side. + +Signed-off-by: Michal Privoznik +Reviewed-by: David Hildenbrand +Reviewed-by: Boris Fiuczynski +(cherry picked from commit a8ed747b9a8c5cbd07557edc66962bc26205d7fb) +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_domain.c | 3 ++- + src/qemu/qemu_postparse.c | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 89e1b50366..b6c36d85d7 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -7761,7 +7761,8 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def, + return 0; + } + +- if (!ARCH_IS_PPC64(def->os.arch)) { ++ if (!ARCH_IS_PPC64(def->os.arch) && ++ !ARCH_IS_S390(def->os.arch)) { + /* due to guest support, qemu would silently enable NUMA with one node + * once the memory hotplug backend is enabled. To avoid possible + * confusion we will enforce user originated numa configuration along +diff --git a/src/qemu/qemu_postparse.c b/src/qemu/qemu_postparse.c +index 892330646a..141847b0ef 100644 +--- a/src/qemu/qemu_postparse.c ++++ b/src/qemu/qemu_postparse.c +@@ -1806,6 +1806,7 @@ qemuDomainDefNumaAutoAdd(virDomainDef *def, + + if (!abiUpdate || + !virDomainDefHasMemoryHotplug(def) || ++ qemuDomainIsS390CCW(def) || + virDomainNumaGetNodeCount(def->numa) > 0) { + return 0; + } +-- +2.49.0 diff --git a/libvirt-qemu-Properly-propagate-migration-state-to-TPM-cleanup-code.patch b/libvirt-qemu-Properly-propagate-migration-state-to-TPM-cleanup-code.patch new file mode 100644 index 0000000..1060783 --- /dev/null +++ b/libvirt-qemu-Properly-propagate-migration-state-to-TPM-cleanup-code.patch @@ -0,0 +1,135 @@ +From b6e803fc90bb9d49345adca4f38856ce97fde9f8 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Jiri Denemark +Date: Wed, 9 Apr 2025 15:35:20 +0200 +Subject: [PATCH] qemu: Properly propagate migration state to TPM cleanup code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When migrating a domain with TPM state on a shared disk, we need to skip +TPM cleanup on both ends. So far the code only handled successful +migration and skipped the cleanup on the source host. But if the +migration failed for some reason, the cleanup would be incorrectly +called on the destination host removing the TPM files even though the +domain was still running on the source host. + +https://issues.redhat.com/browse/RHEL-82411 + +Signed-off-by: Jiri Denemark +Reviewed-by: Ján Tomko +(cherry picked from commit 97ed7f22b089c5fdd9ee02cffc6854f6e021ab2b) + +https://issues.redhat.com/browse/RHEL-86800 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 7 +++++-- + src/qemu/qemu_migration.c | 6 +++--- + src/qemu/qemu_process.c | 8 ++------ + 3 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index f8f3d2c725..4c6eff9286 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -3853,6 +3853,7 @@ processMonitorEOFEvent(virQEMUDriver *driver, + const char *auditReason = "shutdown"; + unsigned int stopFlags = 0; + virObjectEvent *event = NULL; ++ bool migration; + + if (vm->def->id != domid) { + VIR_DEBUG("Domain %s was restarted, ignoring EOF", +@@ -3863,6 +3864,8 @@ processMonitorEOFEvent(virQEMUDriver *driver, + if (qemuProcessBeginStopJob(vm, VIR_JOB_DESTROY, true) < 0) + return; + ++ migration = vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_IN; ++ + if (!virDomainObjIsActive(vm)) { + VIR_DEBUG("Domain %p '%s' is not active, ignoring EOF", + vm, vm->def->name); +@@ -3877,7 +3880,7 @@ processMonitorEOFEvent(virQEMUDriver *driver, + auditReason = "failed"; + } + +- if (vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_IN) { ++ if (migration) { + stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; + qemuMigrationDstErrorSave(driver, vm->def->name, + qemuMonitorLastError(priv->mon)); +@@ -3890,7 +3893,7 @@ processMonitorEOFEvent(virQEMUDriver *driver, + virObjectEventStateQueue(driver->domainEventState, event); + + endjob: +- qemuDomainRemoveInactive(driver, vm, 0, false); ++ qemuDomainRemoveInactive(driver, vm, 0, migration); + qemuProcessEndStopJob(vm); + } + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 62da892254..5cb7642315 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -3592,7 +3592,7 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver, + * and there is no 'goto cleanup;' in the middle of those */ + VIR_FREE(priv->origname); + virDomainObjRemoveTransientDef(vm); +- qemuDomainRemoveInactive(driver, vm, 0, false); ++ qemuDomainRemoveInactive(driver, vm, 0, true); + } + virDomainObjEndAPI(&vm); + virErrorRestore(&origErr); +@@ -6963,7 +6963,7 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver, + } + + if (!qemuDomainObjIsActive(vm)) +- qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM, false); ++ qemuDomainRemoveInactive(driver, vm, VIR_DOMAIN_UNDEFINE_TPM, true); + + virErrorRestore(&orig_err); + return NULL; +@@ -7099,7 +7099,7 @@ qemuMigrationProcessUnattended(virQEMUDriver *driver, + qemuMigrationJobFinish(vm); + + if (!virDomainObjIsActive(vm)) +- qemuDomainRemoveInactive(driver, vm, 0, false); ++ qemuDomainRemoveInactive(driver, vm, 0, true); + } + + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index fac5678439..ad7e99750f 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -8731,7 +8731,6 @@ void qemuProcessStop(virQEMUDriver *driver, + size_t i; + g_autofree char *timestamp = NULL; + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); +- bool outgoingMigration; + + VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%lld, " + "reason=%s, asyncJob=%s, flags=0x%x", +@@ -8807,10 +8806,7 @@ void qemuProcessStop(virQEMUDriver *driver, + + qemuDomainCleanupRun(driver, vm); + +- outgoingMigration = (flags & VIR_QEMU_PROCESS_STOP_MIGRATED) && +- (asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT); +- +- qemuExtDevicesStop(driver, vm, outgoingMigration); ++ qemuExtDevicesStop(driver, vm, !!(flags & VIR_QEMU_PROCESS_STOP_MIGRATED)); + + qemuDBusStop(driver, vm); + +@@ -9070,7 +9066,7 @@ qemuProcessAutoDestroy(virDomainObj *dom, + VIR_DOMAIN_EVENT_STOPPED, + VIR_DOMAIN_EVENT_STOPPED_DESTROYED); + +- qemuDomainRemoveInactive(driver, dom, 0, false); ++ qemuDomainRemoveInactive(driver, dom, 0, !!(stopFlags & VIR_QEMU_PROCESS_STOP_MIGRATED)); + + qemuProcessEndStopJob(dom); + +-- +2.49.0 diff --git a/libvirt-qemu-Rename-outgoingMigration-parameter-in-various-TPM-functions.patch b/libvirt-qemu-Rename-outgoingMigration-parameter-in-various-TPM-functions.patch new file mode 100644 index 0000000..ed7eb10 --- /dev/null +++ b/libvirt-qemu-Rename-outgoingMigration-parameter-in-various-TPM-functions.patch @@ -0,0 +1,230 @@ +From c28859cbaeac298adbe957956cf8442c9a6b7264 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Jiri Denemark +Date: Tue, 11 Mar 2025 10:05:28 +0100 +Subject: [PATCH] qemu: Rename outgoingMigration parameter in various TPM + functions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The parameter is used to skip TPM state cleanup on outgoing migration +with shared storage. But we also need to skip the cleanup after a failed +incoming migration. Let's call the parameter "migration" to reflect its +usage on both sides of migration. + +Signed-off-by: Jiri Denemark +Reviewed-by: Ján Tomko +(cherry picked from commit a5e4ca6f02dc8250f84163a0d19b69300affde43) + +https://issues.redhat.com/browse/RHEL-86800 +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_domain.c | 8 ++++---- + src/qemu/qemu_domain.h | 2 +- + src/qemu/qemu_extdevice.c | 8 ++++---- + src/qemu/qemu_extdevice.h | 4 ++-- + src/qemu/qemu_tpm.c | 19 +++++++++---------- + src/qemu/qemu_tpm.h | 4 ++-- + 6 files changed, 22 insertions(+), 23 deletions(-) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 1ccaff90d9..89e1b50366 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -5749,7 +5749,7 @@ static void + qemuDomainRemoveInactiveCommon(virQEMUDriver *driver, + virDomainObj *vm, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + { + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); + g_autofree char *snapDir = NULL; +@@ -5775,7 +5775,7 @@ qemuDomainRemoveInactiveCommon(virQEMUDriver *driver, + if (rmdir(chkDir) < 0 && errno != ENOENT) + VIR_WARN("unable to remove checkpoint directory %s", chkDir); + } +- qemuExtDevicesCleanupHost(driver, vm->def, flags, outgoingMigration); ++ qemuExtDevicesCleanupHost(driver, vm->def, flags, migration); + } + + +@@ -5788,14 +5788,14 @@ void + qemuDomainRemoveInactive(virQEMUDriver *driver, + virDomainObj *vm, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + { + if (vm->persistent) { + /* Short-circuit, we don't want to remove a persistent domain */ + return; + } + +- qemuDomainRemoveInactiveCommon(driver, vm, flags, outgoingMigration); ++ qemuDomainRemoveInactiveCommon(driver, vm, flags, migration); + + virDomainObjListRemove(driver->domains, vm); + } +diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h +index e810f79599..6246988491 100644 +--- a/src/qemu/qemu_domain.h ++++ b/src/qemu/qemu_domain.h +@@ -689,7 +689,7 @@ int qemuDomainMomentDiscardAll(void *payload, + void qemuDomainRemoveInactive(virQEMUDriver *driver, + virDomainObj *vm, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration); ++ bool migration); + + void + qemuDomainRemoveInactiveLocked(virQEMUDriver *driver, +diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c +index 2384bab7a6..7451e0fa03 100644 +--- a/src/qemu/qemu_extdevice.c ++++ b/src/qemu/qemu_extdevice.c +@@ -154,7 +154,7 @@ void + qemuExtDevicesCleanupHost(virQEMUDriver *driver, + virDomainDef *def, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + { + size_t i; + +@@ -165,7 +165,7 @@ qemuExtDevicesCleanupHost(virQEMUDriver *driver, + virDomainTPMDef *tpm = def->tpms[i]; + + if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR) +- qemuExtTPMCleanupHost(driver, tpm, flags, outgoingMigration); ++ qemuExtTPMCleanupHost(driver, tpm, flags, migration); + } + } + +@@ -266,7 +266,7 @@ qemuExtDevicesStart(virQEMUDriver *driver, + void + qemuExtDevicesStop(virQEMUDriver *driver, + virDomainObj *vm, +- bool outgoingMigration) ++ bool migration) + { + virDomainDef *def = vm->def; + size_t i; +@@ -283,7 +283,7 @@ qemuExtDevicesStop(virQEMUDriver *driver, + + for (i = 0; i < def->ntpms; i++) { + if (def->tpms[i]->type == VIR_DOMAIN_TPM_TYPE_EMULATOR) +- qemuExtTPMStop(driver, vm, outgoingMigration); ++ qemuExtTPMStop(driver, vm, migration); + } + + for (i = 0; i < def->nnets; i++) { +diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h +index d4ac9f395c..36f7fb77a8 100644 +--- a/src/qemu/qemu_extdevice.h ++++ b/src/qemu/qemu_extdevice.h +@@ -48,7 +48,7 @@ int qemuExtDevicesPrepareHost(virQEMUDriver *driver, + void qemuExtDevicesCleanupHost(virQEMUDriver *driver, + virDomainDef *def, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + + int qemuExtDevicesStart(virQEMUDriver *driver, +@@ -59,7 +59,7 @@ int qemuExtDevicesStart(virQEMUDriver *driver, + + void qemuExtDevicesStop(virQEMUDriver *driver, + virDomainObj *vm, +- bool outgoingMigration) ++ bool migration) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + + bool qemuExtDevicesHasDevice(virDomainDef *def); +diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c +index f5e0184e54..f910a26286 100644 +--- a/src/qemu/qemu_tpm.c ++++ b/src/qemu/qemu_tpm.c +@@ -907,7 +907,8 @@ qemuTPMEmulatorInitPaths(virDomainTPMDef *tpm, + * @driver: QEMU driver + * @tpm: TPM definition + * @flags: flags indicating whether to keep or remove TPM persistent state +- * @outgoingMigration: whether cleanup is due to an outgoing migration ++ * @migration: whether cleanup is due to a successful outgoing or failed ++ * incoming migration + * + * Clean up persistent storage for the swtpm. + */ +@@ -915,14 +916,12 @@ static void + qemuTPMEmulatorCleanupHost(virQEMUDriver *driver, + virDomainTPMDef *tpm, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + { + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); + +- /* Never remove the state in case of outgoing migration with shared +- * storage. +- */ +- if (outgoingMigration && ++ /* Never remove the state in case of migration with shared storage. */ ++ if (migration && + virFileIsSharedFS(tpm->data.emulator.source_path, cfg->sharedFilesystems) == 1) + return; + +@@ -1293,9 +1292,9 @@ void + qemuExtTPMCleanupHost(virQEMUDriver *driver, + virDomainTPMDef *tpm, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + { +- qemuTPMEmulatorCleanupHost(driver, tpm, flags, outgoingMigration); ++ qemuTPMEmulatorCleanupHost(driver, tpm, flags, migration); + } + + +@@ -1319,7 +1318,7 @@ qemuExtTPMStart(virQEMUDriver *driver, + void + qemuExtTPMStop(virQEMUDriver *driver, + virDomainObj *vm, +- bool outgoingMigration) ++ bool migration) + { + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); + g_autofree char *shortName = virDomainDefGetShortName(vm->def); +@@ -1329,7 +1328,7 @@ qemuExtTPMStop(virQEMUDriver *driver, + return; + + qemuTPMEmulatorStop(cfg->swtpmStateDir, shortName); +- if (outgoingMigration && qemuTPMHasSharedStorage(driver, vm->def)) ++ if (migration && qemuTPMHasSharedStorage(driver, vm->def)) + restoreTPMStateLabel = false; + + if (qemuSecurityRestoreTPMLabels(driver, vm, restoreTPMStateLabel, false) < 0) +diff --git a/src/qemu/qemu_tpm.h b/src/qemu/qemu_tpm.h +index 7096060a2a..37813087cf 100644 +--- a/src/qemu/qemu_tpm.h ++++ b/src/qemu/qemu_tpm.h +@@ -38,7 +38,7 @@ int qemuExtTPMPrepareHost(virQEMUDriver *driver, + void qemuExtTPMCleanupHost(virQEMUDriver *driver, + virDomainTPMDef *tpm, + virDomainUndefineFlagsValues flags, +- bool outgoingMigration) ++ bool migration) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + + int qemuExtTPMStart(virQEMUDriver *driver, +@@ -52,7 +52,7 @@ int qemuExtTPMStart(virQEMUDriver *driver, + + void qemuExtTPMStop(virQEMUDriver *driver, + virDomainObj *vm, +- bool outgoingMigration) ++ bool migration) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + + int qemuExtTPMSetupCgroup(virQEMUDriver *driver, +-- +2.49.0 diff --git a/libvirt-qemu-Validate-virtio-mem-ccw.patch b/libvirt-qemu-Validate-virtio-mem-ccw.patch new file mode 100644 index 0000000..d79173f --- /dev/null +++ b/libvirt-qemu-Validate-virtio-mem-ccw.patch @@ -0,0 +1,86 @@ +From 6fa979b9735e988971203bca10903ba587a27f79 Mon Sep 17 00:00:00 2001 +Message-ID: <6fa979b9735e988971203bca10903ba587a27f79.1744876588.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Wed, 15 Jan 2025 15:48:41 +0100 +Subject: [PATCH] qemu: Validate virtio-mem-ccw + +There are basically two differences between virtio-mem-ccw and +virtio-mem-pci. s390 doesn't allow mixing different page sizes +and there's no NUMA support in QEMU. + +Signed-off-by: Michal Privoznik +Reviewed-by: Boris Fiuczynski +(cherry picked from commit 541dfe40bc9b3fe90d488ab85df8ea3ea31b8249) +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_validate.c | 35 ++++++++++++++++++++++++++++++++--- + 1 file changed, 32 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c +index 1c61038f93..97f8f58ffd 100644 +--- a/src/qemu/qemu_validate.c ++++ b/src/qemu/qemu_validate.c +@@ -5259,7 +5259,8 @@ qemuValidateDomainDeviceDefHub(virDomainHubDef *hub, + + + static int +-qemuValidateDomainDeviceDefMemory(virDomainMemoryDef *mem, ++qemuValidateDomainDeviceDefMemory(const virDomainMemoryDef *mem, ++ const virDomainDef *def, + virQEMUCaps *qemuCaps) + { + virSGXCapability *sgxCaps; +@@ -5298,12 +5299,40 @@ qemuValidateDomainDeviceDefMemory(virDomainMemoryDef *mem, + break; + + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: +- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI)) { ++ if ((mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && ++ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI)) || ++ (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && ++ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio-mem isn't supported by this QEMU binary")); + return -1; + } + ++ if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { ++ /* virtio-mem-ccw has a few differences compared to virtio-mem-pci: ++ * ++ * 1) corresponding memory-backing-* object can't have a different ++ * page size than the boot memory (see s390_machine_device_plug() ++ * in qemu sources). ++ * 2) Since its commit v2.12.0-rc0~41^2~6 QEMU doesn't allow NUMA ++ * for s390. ++ */ ++ ++ if (mem->source.virtio_mem.pagesize != 0 && ++ def->mem.nhugepages && ++ mem->source.virtio_mem.pagesize != def->mem.hugepages[0].size) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("virtio-mem-ccw can't use different page size than the boot memory")); ++ return -1; ++ } ++ ++ if (mem->targetNode != 0 && mem->targetNode != -1) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", ++ _("NUMA nodes are not supported for virtio-mem-ccw")); ++ return -1; ++ } ++ } ++ + if (mem->target.virtio_mem.dynamicMemslots == VIR_TRISTATE_BOOL_YES && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", +@@ -5490,7 +5519,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, + return qemuValidateDomainDeviceDefSound(dev->data.sound, qemuCaps); + + case VIR_DOMAIN_DEVICE_MEMORY: +- return qemuValidateDomainDeviceDefMemory(dev->data.memory, qemuCaps); ++ return qemuValidateDomainDeviceDefMemory(dev->data.memory, def, qemuCaps); + + case VIR_DOMAIN_DEVICE_SHMEM: + return qemuValidateDomainDeviceDefShmem(dev->data.shmem, qemuCaps); +-- +2.49.0 diff --git a/libvirt-qemuDomainBlockCopyCommon-Don-t-revoke-access-to-file-twice-on-failure.patch b/libvirt-qemuDomainBlockCopyCommon-Don-t-revoke-access-to-file-twice-on-failure.patch new file mode 100644 index 0000000..e4229ee --- /dev/null +++ b/libvirt-qemuDomainBlockCopyCommon-Don-t-revoke-access-to-file-twice-on-failure.patch @@ -0,0 +1,44 @@ +From bedbe8dd400e242ad346910bc2bdbfb1e6969fdf Mon Sep 17 00:00:00 2001 +Message-ID: +From: Peter Krempa +Date: Thu, 10 Apr 2025 16:18:29 +0200 +Subject: [PATCH] qemuDomainBlockCopyCommon: Don't revoke access to file twice + on failure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If the copy job fails to start up when calling the 'blockdev-mirror' +command the code would call qemuDomainStorageSourceChainAccessRevoke() +twice; once right after the monitor call and the second time in the +'endjob' section. + +Remove the one directly after the monitor call and let the common +cleanup handle it. + +Signed-off-by: Peter Krempa +Reviewed-by: Ján Tomko +(cherry picked from commit 68a83cac64b90b7069e6213d70a2faadb552cb80) +https://issues.redhat.com/browse/RHEL-7357 +--- + src/qemu/qemu_driver.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 4c6eff9286..8a354a606a 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -14413,10 +14413,8 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, + + virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0); + qemuDomainObjExitMonitor(vm); +- if (ret < 0) { +- qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); ++ if (ret < 0) + goto endjob; +- } + + /* Update vm in place to match changes. */ + need_unlink = false; +-- +2.49.0 diff --git a/libvirt-qemu_caps-Introduce-QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW.patch b/libvirt-qemu_caps-Introduce-QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW.patch new file mode 100644 index 0000000..821d47f --- /dev/null +++ b/libvirt-qemu_caps-Introduce-QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW.patch @@ -0,0 +1,76 @@ +From 4cf058f2a32fac160803b45c818d798ff268b172 Mon Sep 17 00:00:00 2001 +Message-ID: <4cf058f2a32fac160803b45c818d798ff268b172.1744876588.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Wed, 15 Jan 2025 10:46:16 +0100 +Subject: [PATCH] qemu_caps: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW + +This capability tracks whether QEMU supports virtio-mem-ccw +device. Introduced in QEMU commit v9.2.0-492-gaa910c20ec only +upcoming release of QEMU supports the device. + +Signed-off-by: Michal Privoznik +Reviewed-by: Boris Fiuczynski +(cherry picked from commit a46e33a92597ed03147e7f6a0c674cda55a0ec52) + +Conflicts: +src/qemu/qemu_capabilities.c: Upstream has more caps added meanwhile. +src/qemu/qemu_capabilities.h: Ditto. + +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_capabilities.c | 4 ++++ + src/qemu/qemu_capabilities.h | 3 +++ + tests/qemucapabilitiesdata/caps_10.0.0_s390x.xml | 1 + + 3 files changed, 8 insertions(+) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 65e19965dd..1a9cf72482 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -722,6 +722,9 @@ VIR_ENUM_IMPL(virQEMUCaps, + "virtio-ccw.loadparm", /* QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM */ + "netdev-stream-reconnect-miliseconds", /* QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS */ + "blockdev-set-active", /* QEMU_CAPS_BLOCKDEV_SET_ACTIVE */ ++ ++ /* 470 */ ++ "virtio-mem-ccw", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW */ + ); + + +@@ -1411,6 +1414,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = { + { "virtio-sound-device", QEMU_CAPS_DEVICE_VIRTIO_SOUND }, + { "sev-snp-guest", QEMU_CAPS_SEV_SNP_GUEST }, + { "acpi-erst", QEMU_CAPS_DEVICE_ACPI_ERST }, ++ { "virtio-mem-ccw", QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW }, + }; + + +diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h +index e93e6a01cc..6467a09796 100644 +--- a/src/qemu/qemu_capabilities.h ++++ b/src/qemu/qemu_capabilities.h +@@ -702,6 +702,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ + QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS, /* 'reconnect-ms' option for netdev stream supported */ + QEMU_CAPS_BLOCKDEV_SET_ACTIVE, /* blockdev-set-active QMP command supported */ + ++ /* 470 */ ++ QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW, /* -device virtio-mem-ccw */ ++ + QEMU_CAPS_LAST /* this must always be the last item */ + } virQEMUCapsFlags; + +diff --git a/tests/qemucapabilitiesdata/caps_10.0.0_s390x.xml b/tests/qemucapabilitiesdata/caps_10.0.0_s390x.xml +index 5c5ab096d1..82cabd13b2 100644 +--- a/tests/qemucapabilitiesdata/caps_10.0.0_s390x.xml ++++ b/tests/qemucapabilitiesdata/caps_10.0.0_s390x.xml +@@ -139,6 +139,7 @@ + + + ++ + 9002050 + 39100285 + v9.2.0-1203-gd6430c17d7 +-- +2.49.0 diff --git a/libvirt-qemu_command-Use-qemuBuildVirtioDevProps-to-build-cmd-line-for-virtio-mem-and-virtio-pmem.patch b/libvirt-qemu_command-Use-qemuBuildVirtioDevProps-to-build-cmd-line-for-virtio-mem-and-virtio-pmem.patch new file mode 100644 index 0000000..3994ff7 --- /dev/null +++ b/libvirt-qemu_command-Use-qemuBuildVirtioDevProps-to-build-cmd-line-for-virtio-mem-and-virtio-pmem.patch @@ -0,0 +1,95 @@ +From 782c337fb48b56a50ed85cbfe1dc3a8a1342ac08 Mon Sep 17 00:00:00 2001 +Message-ID: <782c337fb48b56a50ed85cbfe1dc3a8a1342ac08.1744876588.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Mon, 13 Jan 2025 15:48:03 +0100 +Subject: [PATCH] qemu_command: Use qemuBuildVirtioDevProps() to build cmd line + for virtio-mem and virtio-pmem + +Both, virtio-mem and virtio-pmem devices follow traditional QEMU +naming convention: their suffix determines what bus they live on. +For instance, virtio-mem-pci, virtio-mem-ccw, virtio-pmem-pci. +We already have a function that constructs device name following +this convention: qemuBuildVirtioDevGetConfigDev(). + +While there's no virtio-pmem-ccw device yet, the function can +still be used. + +Another advantage of using the function is - it'll be easier in +future when we want to configure various virtio aspects of memory +devices (like ats, iommu_platform, etc.). + +Signed-off-by: Michal Privoznik +Reviewed-by: Boris Fiuczynski +(cherry picked from commit 89d56c41ac16452eb5f6f27eb87658277b270f83) +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_command.c | 28 ++++++++++++++++++++++++---- + 1 file changed, 24 insertions(+), 4 deletions(-) + +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c +index b7d61edd19..fb70c79a94 100644 +--- a/src/qemu/qemu_command.c ++++ b/src/qemu/qemu_command.c +@@ -967,6 +967,23 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device, + break; + } + ++ case VIR_DOMAIN_DEVICE_MEMORY: ++ switch (device->data.memory->model) { ++ case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: ++ *baseName = "virtio-pmem"; ++ break; ++ case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: ++ *baseName = "virtio-mem"; ++ break; ++ case VIR_DOMAIN_MEMORY_MODEL_DIMM: ++ case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: ++ case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: ++ case VIR_DOMAIN_MEMORY_MODEL_NONE: ++ case VIR_DOMAIN_MEMORY_MODEL_LAST: ++ break; ++ } ++ break; ++ + case VIR_DOMAIN_DEVICE_LEASE: + case VIR_DOMAIN_DEVICE_WATCHDOG: + case VIR_DOMAIN_DEVICE_GRAPHICS: +@@ -979,7 +996,6 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device, + case VIR_DOMAIN_DEVICE_SHMEM: + case VIR_DOMAIN_DEVICE_TPM: + case VIR_DOMAIN_DEVICE_PANIC: +- case VIR_DOMAIN_DEVICE_MEMORY: + case VIR_DOMAIN_DEVICE_IOMMU: + case VIR_DOMAIN_DEVICE_AUDIO: + case VIR_DOMAIN_DEVICE_PSTORE: +@@ -3487,12 +3503,16 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, + break; + + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: +- device = "virtio-pmem-pci"; ++ /* Deliberately not setting @device. */ ++ if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_MEMORY, mem, priv->qemuCaps))) ++ return NULL; + address = mem->target.virtio_pmem.address; + break; + + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: +- device = "virtio-mem-pci"; ++ /* Deliberately not setting @device. */ ++ if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_MEMORY, mem, priv->qemuCaps))) ++ return NULL; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC) && + qemuBuildMemoryGetPagesize(cfg, def, mem, NULL, NULL, NULL, &prealloc) < 0) +@@ -3514,7 +3534,7 @@ qemuBuildMemoryDeviceProps(virQEMUDriverConfig *cfg, + } + + if (virJSONValueObjectAdd(&props, +- "s:driver", device, ++ "S:driver", device, + "k:node", mem->targetNode, + "P:label-size", labelsize * 1024, + "P:block-size", blocksize * 1024, +-- +2.49.0 diff --git a/libvirt-qemu_domain_address-fix-CCW-virtio-mem-hotplug.patch b/libvirt-qemu_domain_address-fix-CCW-virtio-mem-hotplug.patch new file mode 100644 index 0000000..64fb388 --- /dev/null +++ b/libvirt-qemu_domain_address-fix-CCW-virtio-mem-hotplug.patch @@ -0,0 +1,48 @@ +From 82f30944276f1cbb997ee42bad66c37cc059067e Mon Sep 17 00:00:00 2001 +Message-ID: <82f30944276f1cbb997ee42bad66c37cc059067e.1744876588.git.jdenemar@redhat.com> +From: Boris Fiuczynski +Date: Tue, 18 Mar 2025 14:48:50 +0100 +Subject: [PATCH] qemu_domain_address: fix CCW virtio-mem hotplug +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since commit f23f8ff91a virtio-mem supports also CCW. When hotplugging a +virtio-mem device with a CCW address results in a PCI device getting +attached. The method qemuDomainAssignMemoryDeviceSlot is only +considering PCI as address type and overwriting the CCW address. Adding +support for address type CCW. + +Signed-off-by: Boris Fiuczynski +Reviewed-by: Ján Tomko +Signed-off-by: Ján Tomko +(cherry picked from commit 9ef080d6d94643fffc413127bff2b2b008a11b27) +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + src/qemu/qemu_domain_address.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c +index 970ae3949d..b73ac9ebf1 100644 +--- a/src/qemu/qemu_domain_address.c ++++ b/src/qemu/qemu_domain_address.c +@@ -3073,6 +3073,7 @@ qemuDomainAssignMemoryDeviceSlot(virDomainObj *vm, + virDomainMemoryDef *mem) + { + g_autoptr(virBitmap) slotmap = NULL; ++ bool releaseaddr = false; + virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_MEMORY, .data.memory = mem}; + + switch (mem->model) { +@@ -3086,7 +3087,7 @@ qemuDomainAssignMemoryDeviceSlot(virDomainObj *vm, + + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: + case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: +- return qemuDomainEnsurePCIAddress(vm, &dev); ++ return qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev); + break; + + case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: +-- +2.49.0 diff --git a/libvirt-qemuxmlconftest-Drop-s390-default-cpu-.ccw-virtio-2.7-test-cases.patch b/libvirt-qemuxmlconftest-Drop-s390-default-cpu-.ccw-virtio-2.7-test-cases.patch new file mode 100644 index 0000000..3d476f3 --- /dev/null +++ b/libvirt-qemuxmlconftest-Drop-s390-default-cpu-.ccw-virtio-2.7-test-cases.patch @@ -0,0 +1,242 @@ +From 09dc3f583b342ef35b1ead29ff5d09d76140590c Mon Sep 17 00:00:00 2001 +Message-ID: <09dc3f583b342ef35b1ead29ff5d09d76140590c.1744876588.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Tue, 14 Jan 2025 12:16:06 +0100 +Subject: [PATCH] qemuxmlconftest: Drop s390-default-cpu-...ccw-virtio-2.7 test + cases + +In its upstream commit [1], qemu dropped s390-2.7 machine type, +then in commit [2] the s390-2.8 machine type was dropped. But as +Thomas Huth pointed out, any machine type that's older than 6 +years is subject to removal [3]. This means, any machine type +older than 4.1 is going to be removed eventually. + +We have two test cases that assumes existence of 2.7 machine type. +While they could be switched to 4.1 machine type, we also have +another test case that already check 4.2 machine type. +Therefore, just drop the 2.7 ones. + +1: https://gitlab.com/qemu-project/qemu/-/commit/3199c7ee76089fb6844f6b2bed1f5d3d99a7527c +2: https://gitlab.com/qemu-project/qemu/-/commit/66924fe36977d9d9e45ba3e0b6e851ee170507f6 +3: https://gitlab.com/qemu-project/qemu/-/commit/ce80c4fa6ff0f5c379bba7db74d04593e9fb12f2 +Signed-off-by: Michal Privoznik +Reviewed-by: Thomas Huth +Reviewed-by: Boris Fiuczynski +(cherry picked from commit 4933dfcce02baa941da6dd9e5b111d36d63ef900) +Resolves: https://issues.redhat.com/browse/RHEL-72976 +Signed-off-by: Michal Privoznik +--- + ...t-cpu-kvm-ccw-virtio-2.7.s390x-latest.args | 32 ------------------- + ...lt-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml | 25 --------------- + .../s390-default-cpu-kvm-ccw-virtio-2.7.xml | 16 ---------- + ...t-cpu-tcg-ccw-virtio-2.7.s390x-latest.args | 32 ------------------- + ...lt-cpu-tcg-ccw-virtio-2.7.s390x-latest.xml | 27 ---------------- + .../s390-default-cpu-tcg-ccw-virtio-2.7.xml | 16 ---------- + tests/qemuxmlconftest.c | 2 -- + 7 files changed, 150 deletions(-) + delete mode 100644 tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.args + delete mode 100644 tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml + delete mode 100644 tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.xml + delete mode 100644 tests/qemuxmlconfdata/s390-default-cpu-tcg-ccw-virtio-2.7.s390x-latest.args + delete mode 100644 tests/qemuxmlconfdata/s390-default-cpu-tcg-ccw-virtio-2.7.s390x-latest.xml + delete mode 100644 tests/qemuxmlconfdata/s390-default-cpu-tcg-ccw-virtio-2.7.xml + +diff --git a/tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.args b/tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.args +deleted file mode 100644 +index 0d44697425..0000000000 +--- a/tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.args ++++ /dev/null +@@ -1,32 +0,0 @@ +-LC_ALL=C \ +-PATH=/bin \ +-HOME=/var/lib/libvirt/qemu/domain--1-test \ +-USER=test \ +-LOGNAME=test \ +-XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-test/.local/share \ +-XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-test/.cache \ +-XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-test/.config \ +-/usr/bin/qemu-system-s390x \ +--name guest=test,debug-threads=on \ +--S \ +--object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \ +--machine s390-ccw-virtio-2.7,usb=off,dump-guest-core=off,memory-backend=s390.ram \ +--accel kvm \ +--cpu host \ +--m size=262144k \ +--object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456}' \ +--overcommit mem-lock=off \ +--smp 1,sockets=1,cores=1,threads=1 \ +--uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \ +--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 \ +--boot strict=on \ +--audiodev '{"id":"audio1","driver":"none"}' \ +--device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0000"}' \ +--sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +--msg timestamp=on +diff --git a/tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml b/tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml +deleted file mode 100644 +index ae39e6277d..0000000000 +--- a/tests/qemuxmlconfdata/s390-default-cpu-kvm-ccw-virtio-2.7.s390x-latest.xml ++++ /dev/null +@@ -1,25 +0,0 @@ +- +- test +- 9aa4b45c-b9dd-45ef-91fe-862b27b4231f +- 262144 +- 262144 +- 1 +- +- hvm +- +- +- +- +- destroy +- restart +- destroy +- +- /usr/bin/qemu-system-s390x +- +-