From 05ff4ee618160291bbc6be7eeaa5310744d0df99 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 22 May 2025 12:11:58 +0200 Subject: [PATCH] libvirt-10.10.0-11.el9 - Add load average information type into virDomainGetGuestInfo (RHEL-88447) - qemu_agent: Add qemuAgentGetLoadAvg() (RHEL-88447) - qemu: Add support for VIR_DOMAIN_GUEST_INFO_LOAD (RHEL-88447) - virsh: Add support for VIR_DOMAIN_GUEST_INFO_LOAD (RHEL-88447) - qemu_capabilities: Fetch caps for virtio-mem-ccw too (RHEL-87532) - cpu_map: Add avx10* CPU features (RHEL-87796) - cpu_map: Add GraniteRapids-v2 CPU model (RHEL-87796) - cpu_map: Add sha512, sm3, and sm4 CPU features (RHEL-87796) - virsh: Introduce new hypervisor-cpu-models command (RHEL-11435) - qemu: remove nonsensical sanity check in processNetdevStreamDisconnectedEvent() (RHEL-80169) - qemu: make processNetDevStreamDisconnectedEvent() reusable (RHEL-80169) - qemu: respond to NETDEV_VHOST_USER_DISCONNECTED event (RHEL-80169) - qemu: put vhost-user code that's special for passt in a helper function (RHEL-80169) - qemu: make passt+vhostuser reconnect behave identically to passt+user (RHEL-80169) Resolves: RHEL-11435, RHEL-80169, RHEL-87532, RHEL-87796, RHEL-88447 --- ...tion-type-into-virDomainGetGuestInfo.patch | 53 ++ ...u_map-Add-GraniteRapids-v2-CPU-model.patch | 669 ++++++++++++++++++ libvirt-cpu_map-Add-avx10-CPU-features.patch | 51 ++ ...-Add-sha512-sm3-and-sm4-CPU-features.patch | 46 ++ ...pport-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch | 72 ++ ...ect-behave-identically-to-passt-user.patch | 111 +++ ...tDevStreamDisconnectedEvent-reusable.patch | 119 ++++ ...ecial-for-passt-in-a-helper-function.patch | 110 +++ ...processNetdevStreamDisconnectedEvent.patch | 56 ++ ...NETDEV_VHOST_USER_DISCONNECTED-event.patch | 224 ++++++ ...t-qemu_agent-Add-qemuAgentGetLoadAvg.patch | 163 +++++ ...es-Fetch-caps-for-virtio-mem-ccw-too.patch | 409 +++++++++++ ...pport-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch | 71 ++ ...ce-new-hypervisor-cpu-models-command.patch | 160 +++++ libvirt.spec | 32 +- 15 files changed, 2345 insertions(+), 1 deletion(-) create mode 100644 libvirt-Add-load-average-information-type-into-virDomainGetGuestInfo.patch create mode 100644 libvirt-cpu_map-Add-GraniteRapids-v2-CPU-model.patch create mode 100644 libvirt-cpu_map-Add-avx10-CPU-features.patch create mode 100644 libvirt-cpu_map-Add-sha512-sm3-and-sm4-CPU-features.patch create mode 100644 libvirt-qemu-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch create mode 100644 libvirt-qemu-make-passt-vhostuser-reconnect-behave-identically-to-passt-user.patch create mode 100644 libvirt-qemu-make-processNetDevStreamDisconnectedEvent-reusable.patch create mode 100644 libvirt-qemu-put-vhost-user-code-that-s-special-for-passt-in-a-helper-function.patch create mode 100644 libvirt-qemu-remove-nonsensical-sanity-check-in-processNetdevStreamDisconnectedEvent.patch create mode 100644 libvirt-qemu-respond-to-NETDEV_VHOST_USER_DISCONNECTED-event.patch create mode 100644 libvirt-qemu_agent-Add-qemuAgentGetLoadAvg.patch create mode 100644 libvirt-qemu_capabilities-Fetch-caps-for-virtio-mem-ccw-too.patch create mode 100644 libvirt-virsh-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch create mode 100644 libvirt-virsh-Introduce-new-hypervisor-cpu-models-command.patch diff --git a/libvirt-Add-load-average-information-type-into-virDomainGetGuestInfo.patch b/libvirt-Add-load-average-information-type-into-virDomainGetGuestInfo.patch new file mode 100644 index 0000000..224dd74 --- /dev/null +++ b/libvirt-Add-load-average-information-type-into-virDomainGetGuestInfo.patch @@ -0,0 +1,53 @@ +From 9874072fc9396d609f1a0213bb06fa7e9a2fa019 Mon Sep 17 00:00:00 2001 +Message-ID: <9874072fc9396d609f1a0213bb06fa7e9a2fa019.1747908717.git.jdenemar@redhat.com> +From: Martin Kletzander +Date: Tue, 25 Feb 2025 15:36:03 +0100 +Subject: [PATCH] Add load average information type into virDomainGetGuestInfo + +The public API part. + +Signed-off-by: Martin Kletzander +Reviewed-by: Peter Krempa +(cherry picked from commit c52c449fd40c7263896d5f17129207b815c3a09c) + +https://issues.redhat.com/browse/RHEL-88447 + +Signed-off-by: Martin Kletzander +--- + include/libvirt/libvirt-domain.h | 1 + + src/libvirt-domain.c | 8 ++++++++ + 2 files changed, 9 insertions(+) + +diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h +index f026ce197c..c04b696f03 100644 +--- a/include/libvirt/libvirt-domain.h ++++ b/include/libvirt/libvirt-domain.h +@@ -6425,6 +6425,7 @@ typedef enum { + VIR_DOMAIN_GUEST_INFO_FILESYSTEM = (1 << 4), /* return filesystem information (Since: 5.7.0) */ + VIR_DOMAIN_GUEST_INFO_DISKS = (1 << 5), /* return disks information (Since: 7.0.0) */ + VIR_DOMAIN_GUEST_INFO_INTERFACES = (1 << 6), /* return interfaces information (Since: 7.10.0) */ ++ VIR_DOMAIN_GUEST_INFO_LOAD = (1 << 7), /* return load averages (Since: 11.2.0) */ + } virDomainGuestInfoTypes; + + int virDomainGetGuestInfo(virDomainPtr domain, +diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c +index 7c6b93963c..24752a9888 100644 +--- a/src/libvirt-domain.c ++++ b/src/libvirt-domain.c +@@ -13292,6 +13292,14 @@ virDomainSetVcpu(virDomainPtr domain, + * "if..addr..addr" - the IP address of addr + * "if..addr..prefix" - the prefix of IP address of addr + * ++ * VIR_DOMAIN_GUEST_INFO_LOAD: ++ * Returns load (the number of processes in the runqueue or waiting for disk ++ * I/O) as double values: ++ * ++ * "load.1m" - load averaged over 1 minute ++ * "load.5m" - load averaged over 5 minutes ++ * "load.15m" - load averaged over 15 minutes ++ * + * Using 0 for @types returns all information groups supported by the given + * hypervisor. + * +-- +2.49.0 diff --git a/libvirt-cpu_map-Add-GraniteRapids-v2-CPU-model.patch b/libvirt-cpu_map-Add-GraniteRapids-v2-CPU-model.patch new file mode 100644 index 0000000..1a18848 --- /dev/null +++ b/libvirt-cpu_map-Add-GraniteRapids-v2-CPU-model.patch @@ -0,0 +1,669 @@ +From 7a9d85a3159fdc0ecec40338f7f28df91ba08a0c Mon Sep 17 00:00:00 2001 +Message-ID: <7a9d85a3159fdc0ecec40338f7f28df91ba08a0c.1747908717.git.jdenemar@redhat.com> +From: Jiri Denemark +Date: Wed, 18 Dec 2024 13:46:25 +0100 +Subject: [PATCH] cpu_map: Add GraniteRapids-v2 CPU model + +Introduced by QEMU 9.2.0 + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 41a6de76bc6e31a206d9d82c84c5d485b710fe01) + +https://issues.redhat.com/browse/RHEL-71897 + +Signed-off-by: Jiri Denemark +(cherry picked from commit 4dbeaa7e1ce9fffb3e2a2b19ba10cc3d2c19091d) + + Conflicts: + - tests/domaincapsdata/qemu_10.0.0* were updated by a later + upstream commit (712c39f987e1fb75a9fe3168dfb2501b719b5070) + which was already backported to RHEL-9 as commit + d056b57fff98c30ef64a695dec44a2ddfcc1c55b with the hunks + related to GraniteRapids-v2 removed, thus this backport has to + incorporate those hunks + +https://issues.redhat.com/browse/RHEL-87796 + +Signed-off-by: Jiri Denemark + +=> 4c2001ea03d9466db571ddf07248c20d652ac775 +--- + src/cpu_map/index.xml | 1 + + src/cpu_map/meson.build | 1 + + src/cpu_map/x86_GraniteRapids-v2.xml | 206 ++++++++++++++++++ + .../domaincapsdata/qemu_10.0.0-q35.x86_64.xml | 57 +++++ + .../domaincapsdata/qemu_10.0.0-tcg.x86_64.xml | 47 ++++ + tests/domaincapsdata/qemu_10.0.0.x86_64.xml | 57 +++++ + .../domaincapsdata/qemu_9.2.0-q35.x86_64.xml | 57 +++++ + .../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml | 47 ++++ + tests/domaincapsdata/qemu_9.2.0.x86_64.xml | 57 +++++ + 9 files changed, 530 insertions(+) + create mode 100644 src/cpu_map/x86_GraniteRapids-v2.xml + +diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml +index 8e74195312..dba2f21811 100644 +--- a/src/cpu_map/index.xml ++++ b/src/cpu_map/index.xml +@@ -121,6 +121,7 @@ + + + ++ + + + +diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build +index fa7faa4016..9a1c048620 100644 +--- a/src/cpu_map/meson.build ++++ b/src/cpu_map/meson.build +@@ -77,6 +77,7 @@ cpumap_data = [ + 'x86_EPYC.xml', + 'x86_features.xml', + 'x86_GraniteRapids-v1.xml', ++ 'x86_GraniteRapids-v2.xml', + 'x86_GraniteRapids.xml', + 'x86_Haswell-IBRS.xml', + 'x86_Haswell-noTSX-IBRS.xml', +diff --git a/src/cpu_map/x86_GraniteRapids-v2.xml b/src/cpu_map/x86_GraniteRapids-v2.xml +new file mode 100644 +index 0000000000..855a43d4ad +--- /dev/null ++++ b/src/cpu_map/x86_GraniteRapids-v2.xml +@@ -0,0 +1,206 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/tests/domaincapsdata/qemu_10.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_10.0.0-q35.x86_64.xml +index e4d8862569..f1a7963d34 100644 +--- a/tests/domaincapsdata/qemu_10.0.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_10.0.0-q35.x86_64.xml +@@ -565,6 +565,63 @@ + + + ++ GraniteRapids-v2 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + Haswell + + +diff --git a/tests/domaincapsdata/qemu_10.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_10.0.0-tcg.x86_64.xml +index a21ed4997e..9a7d39c1f8 100644 +--- a/tests/domaincapsdata/qemu_10.0.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_10.0.0-tcg.x86_64.xml +@@ -733,6 +733,53 @@ + + + ++ GraniteRapids-v2 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + Haswell + + +diff --git a/tests/domaincapsdata/qemu_10.0.0.x86_64.xml b/tests/domaincapsdata/qemu_10.0.0.x86_64.xml +index f4989749ce..64dc451eda 100644 +--- a/tests/domaincapsdata/qemu_10.0.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_10.0.0.x86_64.xml +@@ -564,6 +564,63 @@ + + + ++ GraniteRapids-v2 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + Haswell + + +diff --git a/tests/domaincapsdata/qemu_9.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_9.2.0-q35.x86_64.xml +index 99445e5f44..d5db9af49e 100644 +--- a/tests/domaincapsdata/qemu_9.2.0-q35.x86_64.xml ++++ b/tests/domaincapsdata/qemu_9.2.0-q35.x86_64.xml +@@ -565,6 +565,63 @@ + + + ++ GraniteRapids-v2 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + Haswell + + +diff --git a/tests/domaincapsdata/qemu_9.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_9.2.0-tcg.x86_64.xml +index 8bf967c99f..7ccdc11412 100644 +--- a/tests/domaincapsdata/qemu_9.2.0-tcg.x86_64.xml ++++ b/tests/domaincapsdata/qemu_9.2.0-tcg.x86_64.xml +@@ -733,6 +733,53 @@ + + + ++ GraniteRapids-v2 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + Haswell + + +diff --git a/tests/domaincapsdata/qemu_9.2.0.x86_64.xml b/tests/domaincapsdata/qemu_9.2.0.x86_64.xml +index 40aa971144..05a5ce4bee 100644 +--- a/tests/domaincapsdata/qemu_9.2.0.x86_64.xml ++++ b/tests/domaincapsdata/qemu_9.2.0.x86_64.xml +@@ -564,6 +564,63 @@ + + + ++ GraniteRapids-v2 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + Haswell + + +-- +2.49.0 diff --git a/libvirt-cpu_map-Add-avx10-CPU-features.patch b/libvirt-cpu_map-Add-avx10-CPU-features.patch new file mode 100644 index 0000000..788f1e7 --- /dev/null +++ b/libvirt-cpu_map-Add-avx10-CPU-features.patch @@ -0,0 +1,51 @@ +From 9a44ff8f39bc9873ea9efa42d5705dab5f43be2a Mon Sep 17 00:00:00 2001 +Message-ID: <9a44ff8f39bc9873ea9efa42d5705dab5f43be2a.1747908717.git.jdenemar@redhat.com> +From: Jiri Denemark +Date: Wed, 18 Dec 2024 13:30:16 +0100 +Subject: [PATCH] cpu_map: Add avx10* CPU features + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 30f05acf354437a776b528487bb70ddccf324cd2) + +https://issues.redhat.com/browse/RHEL-87796 + +Signed-off-by: Jiri Denemark +--- + src/cpu_map/x86_features.xml | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml +index 08bf014604..8be8fab42e 100644 +--- a/src/cpu_map/x86_features.xml ++++ b/src/cpu_map/x86_features.xml +@@ -469,6 +469,9 @@ + + + ++ ++ ++ + + + +@@ -541,6 +544,17 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +-- +2.49.0 diff --git a/libvirt-cpu_map-Add-sha512-sm3-and-sm4-CPU-features.patch b/libvirt-cpu_map-Add-sha512-sm3-and-sm4-CPU-features.patch new file mode 100644 index 0000000..35a1057 --- /dev/null +++ b/libvirt-cpu_map-Add-sha512-sm3-and-sm4-CPU-features.patch @@ -0,0 +1,46 @@ +From a28c3abf6f5c7c1d8d45b3fc681f6768e2a3d7a9 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Jiri Denemark +Date: Wed, 18 Dec 2024 13:27:40 +0100 +Subject: [PATCH] cpu_map: Add sha512, sm3, and sm4 CPU features + +Introduced by Clearwater Forest platform. + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 212b7d8e280cabddef1f0996bd9553c6a55babd8) + +https://issues.redhat.com/browse/RHEL-71898 + +Signed-off-by: Jiri Denemark +(cherry picked from commit 153ee694e806ebf1ba684c1b7ddfa7a90c9d3adf) + +https://issues.redhat.com/browse/RHEL-87796 + +Signed-off-by: Jiri Denemark +--- + src/cpu_map/x86_features.xml | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/cpu_map/x86_features.xml b/src/cpu_map/x86_features.xml +index 8be8fab42e..0e1fee6e98 100644 +--- a/src/cpu_map/x86_features.xml ++++ b/src/cpu_map/x86_features.xml +@@ -416,6 +416,15 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +-- +2.49.0 diff --git a/libvirt-qemu-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch b/libvirt-qemu-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch new file mode 100644 index 0000000..c78f850 --- /dev/null +++ b/libvirt-qemu-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch @@ -0,0 +1,72 @@ +From aeff1ebf96b595337f14ef6d1412d6c407bdc085 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Martin Kletzander +Date: Tue, 25 Feb 2025 15:36:32 +0100 +Subject: [PATCH] qemu: Add support for VIR_DOMAIN_GUEST_INFO_LOAD + +Signed-off-by: Martin Kletzander +Reviewed-by: Peter Krempa +(cherry picked from commit b4cf9c8cba45e65551aa9440dea2c3757a96aa0c) + +https://issues.redhat.com/browse/RHEL-88447 + +Signed-off-by: Martin Kletzander +--- + src/qemu/qemu_driver.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 8a354a606a..11dbbc1aab 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -19276,7 +19276,8 @@ static const unsigned int qemuDomainGetGuestInfoSupportedTypes = + VIR_DOMAIN_GUEST_INFO_HOSTNAME | + VIR_DOMAIN_GUEST_INFO_FILESYSTEM | + VIR_DOMAIN_GUEST_INFO_DISKS | +- VIR_DOMAIN_GUEST_INFO_INTERFACES; ++ VIR_DOMAIN_GUEST_INFO_INTERFACES | ++ VIR_DOMAIN_GUEST_INFO_LOAD; + + static int + qemuDomainGetGuestInfoCheckSupport(unsigned int types, +@@ -19563,6 +19564,10 @@ qemuDomainGetGuestInfo(virDomainPtr dom, + qemuAgentDiskInfo **agentdiskinfo = NULL; + virDomainInterfacePtr *ifaces = NULL; + size_t nifaces = 0; ++ double load1m = 0; ++ double load5m = 0; ++ double load15m = 0; ++ bool format_load = false; + size_t i; + + virCheckFlags(0, -1); +@@ -19633,6 +19638,14 @@ qemuDomainGetGuestInfo(virDomainPtr dom, + nifaces = rc; + } + ++ if (supportedTypes & VIR_DOMAIN_GUEST_INFO_LOAD) { ++ rc = qemuAgentGetLoadAvg(agent, &load1m, &load5m, &load15m, report_unsupported); ++ if (rc == -1) ++ goto exitagent; ++ if (rc >= 0) ++ format_load = true; ++ } ++ + qemuDomainObjExitAgent(vm, agent); + virDomainObjEndAgentJob(vm); + +@@ -19659,6 +19672,12 @@ qemuDomainGetGuestInfo(virDomainPtr dom, + virDomainInterfaceFormatParams(ifaces, nifaces, params, nparams, &maxparams); + } + ++ if (format_load) { ++ virTypedParamsAddDouble(params, nparams, &maxparams, "load.1m", load1m); ++ virTypedParamsAddDouble(params, nparams, &maxparams, "load.5m", load5m); ++ virTypedParamsAddDouble(params, nparams, &maxparams, "load.15m", load15m); ++ } ++ + ret = 0; + + cleanup: +-- +2.49.0 diff --git a/libvirt-qemu-make-passt-vhostuser-reconnect-behave-identically-to-passt-user.patch b/libvirt-qemu-make-passt-vhostuser-reconnect-behave-identically-to-passt-user.patch new file mode 100644 index 0000000..e428f5b --- /dev/null +++ b/libvirt-qemu-make-passt-vhostuser-reconnect-behave-identically-to-passt-user.patch @@ -0,0 +1,111 @@ +From 74aeb210bdbeba3389eff4f07860217dd8bb068e Mon Sep 17 00:00:00 2001 +Message-ID: <74aeb210bdbeba3389eff4f07860217dd8bb068e.1747908718.git.jdenemar@redhat.com> +From: Laine Stump +Date: Fri, 4 Apr 2025 19:44:52 -0400 +Subject: [PATCH] qemu: make passt+vhostuser reconnect behave identically to + passt+user + +When "original passt" support was added, we decided that we always +wanted to reconnect (i.e. restart the passt process) if it was somehow +terminated. Generic vhost-user, on the other hand, only turns on +reconnect if specified by the user in the config. But there is no +reason to require the user to specify this if the other end of the +vhost-user socket is a passt process - we know what has happened and +what we want to do; no reason to do the *wrong* thing by default, and +force the user to make an arbitrary decision about what to add to the +config in order to make it do the *right* thing; instead we just +hardcode it to always do the right thing. + +(NB: when the backend is passt, has +always ignored the reconnect setting in when parsing and +formatting, just as it has always ignored the socket path (since that +also is not user configurable for the passt backend) + +Resolves: https://issues.redhat.com/browse/RHEL-80169 + +Signed-off-by: Laine Stump +Tested-by: Stefano Brivio +Reviewed-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 44abaa0128ac0fc8be9de4eebc15c03809bf5867) + +Conflicts: + +tests/qemuxmlconfdata/schema-reorder-domain-subelements.x86_64-latest.args: + This file (created by upstream commit be5332c81d28) was modified + upstream but doesin't exist downstream + +https://issues.redhat.com/browse/RHEL-80169 +Signed-off-by: Laine Stump +--- + src/qemu/qemu_passt.c | 16 +++++++++++++--- + .../net-vhostuser-passt.x86_64-latest.args | 6 +++--- + 2 files changed, 16 insertions(+), 6 deletions(-) + +diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c +index bc495eca1e..fcc34de384 100644 +--- a/src/qemu/qemu_passt.c ++++ b/src/qemu/qemu_passt.c +@@ -36,7 +36,7 @@ VIR_LOG_INIT("qemu.passt"); + + + #define PASST "passt" +- ++#define QEMU_PASST_RECONNECT_TIMEOUT 5 + + static char * + qemuPasstCreatePidFilename(virDomainObj *vm, +@@ -106,11 +106,15 @@ qemuPasstAddNetProps(virDomainObj *vm, + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS)) { +- if (virJSONValueObjectAdd(netprops, "u:reconnect-ms", 5000, NULL) < 0) ++ if (virJSONValueObjectAdd(netprops, "u:reconnect-ms", ++ QEMU_PASST_RECONNECT_TIMEOUT * 1000, NULL) < 0) { + return -1; ++ } + } else { +- if (virJSONValueObjectAdd(netprops, "u:reconnect", 5, NULL) < 0) ++ if (virJSONValueObjectAdd(netprops, "u:reconnect", ++ QEMU_PASST_RECONNECT_TIMEOUT, NULL) < 0) { + return -1; ++ } + } + } + +@@ -182,6 +186,12 @@ qemuPasstPrepareVhostUser(virDomainObj *vm, + */ + g_free(net->data.vhostuser->data.nix.path); + net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net); ++ ++ /* reconnect is always enabled, with timeout always at 5 seconds, when ++ * using passt ++ */ ++ net->data.vhostuser->data.nix.reconnect.enabled = VIR_TRISTATE_BOOL_YES; ++ net->data.vhostuser->data.nix.reconnect.timeout = QEMU_PASST_RECONNECT_TIMEOUT; + } + + int +diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args +index 7c030d7067..afbbe188cf 100644 +--- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args ++++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args +@@ -28,13 +28,13 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ + -boot strict=on \ + -blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","read-only":false}' \ + -device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-storage","id":"ide0-0-0","bootindex":1}' \ +--chardev socket,id=charnet0,path=/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket \ ++-chardev socket,id=charnet0,path=/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net0.socket,reconnect-ms=5000 \ + -netdev '{"type":"vhost-user","chardev":"charnet0","id":"hostnet0"}' \ + -device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \ +--chardev socket,id=charnet1,path=/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net1.socket \ ++-chardev socket,id=charnet1,path=/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net1.socket,reconnect-ms=5000 \ + -netdev '{"type":"vhost-user","chardev":"charnet1","id":"hostnet1"}' \ + -device '{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:11","bus":"pci.0","addr":"0x3"}' \ +--chardev socket,id=charnet2,path=/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net2.socket \ ++-chardev socket,id=charnet2,path=/var/run/libvirt/qemu/passt/-1-QEMUGuest1-net2.socket,reconnect-ms=5000 \ + -netdev '{"type":"vhost-user","chardev":"charnet2","id":"hostnet2"}' \ + -device '{"driver":"virtio-net-pci","netdev":"hostnet2","id":"net2","mac":"00:11:22:33:44:11","bus":"pci.0","addr":"0x4"}' \ + -audiodev '{"id":"audio1","driver":"none"}' \ +-- +2.49.0 diff --git a/libvirt-qemu-make-processNetDevStreamDisconnectedEvent-reusable.patch b/libvirt-qemu-make-processNetDevStreamDisconnectedEvent-reusable.patch new file mode 100644 index 0000000..533ff1e --- /dev/null +++ b/libvirt-qemu-make-processNetDevStreamDisconnectedEvent-reusable.patch @@ -0,0 +1,119 @@ +From a34cd486d22bf36ea64a6dd14541138fcca31b37 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Laine Stump +Date: Fri, 4 Apr 2025 16:57:21 -0400 +Subject: [PATCH] qemu: make processNetDevStreamDisconnectedEvent() reusable + +We will be adding a new event whose response will be *exactly* the +same as the response to NETDEV_STREAM_DISCONNECTED. Rather than doing +a copy-paste of the complete function that does the processing, turn +that function into something more generic that takes the name of the +event as an arg (the event name is only used in log messages). + +Signed-off-by: Laine Stump +Tested-by: Stefano Brivio +Reviewed-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 03a6bc7752ec73d7ea222d5386e8f4124fe51c7f) + +Conflicts: + +src/qemu/qemu_driver.c: + In context surrounding a chunk, the arguments to + processNicRxFilterChangedEvent() changed upstream (due to upstream + commit 50981052a5f) + +https://issues.redhat.com/browse/RHEL-80169 +Signed-off-by: Laine Stump +--- + src/qemu/qemu_driver.c | 37 +++++++++++++++++++++++-------------- + 1 file changed, 23 insertions(+), 14 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 89bb10756e..3373dfb845 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -3618,8 +3618,9 @@ processDeviceDeletedEvent(virQEMUDriver *driver, + + + static void +-processNetdevStreamDisconnectedEvent(virDomainObj *vm, +- const char *netdevId) ++processNetdevDisconnectedEvent(virDomainObj *vm, ++ const char *netdevId, ++ const char *eventName) + { + virDomainDeviceDef dev; + virDomainNetDef *def; +@@ -3634,13 +3635,13 @@ processNetdevStreamDisconnectedEvent(virDomainObj *vm, + */ + + if (!devAlias) { +- VIR_WARN("Received NETDEV_STREAM_DISCONNECTED event for unrecognized netdev %s from domain %p %s", +- netdevId, vm, vm->def->name); ++ VIR_WARN("Received %s event for unrecognized netdev %s from domain %p %s", ++ eventName, netdevId, vm, vm->def->name); + return; + } + +- VIR_DEBUG("Received NETDEV_STREAM_DISCONNECTED event for device %s from domain %p %s", +- devAlias, vm, vm->def->name); ++ VIR_DEBUG("Received %s event for device %s from domain %p %s", ++ eventName, devAlias, vm, vm->def->name); + + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + return; +@@ -3651,28 +3652,28 @@ processNetdevStreamDisconnectedEvent(virDomainObj *vm, + } + + if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) { +- VIR_WARN("NETDEV_STREAM_DISCONNECTED event received for non-existent device %s in domain %s", +- devAlias, vm->def->name); ++ VIR_WARN("%s event received for non-existent device %s in domain %s", ++ eventName, devAlias, vm->def->name); + goto endjob; + } + if (dev.type != VIR_DOMAIN_DEVICE_NET) { +- VIR_WARN("NETDEV_STREAM_DISCONNECTED event received for non-network device %s in domain %s", +- devAlias, vm->def->name); ++ VIR_WARN("%s event received for non-network device %s in domain %s", ++ eventName, devAlias, vm->def->name); + goto endjob; + } + def = dev.data.net; + + if (def->backend.type != VIR_DOMAIN_NET_BACKEND_PASST) { +- VIR_DEBUG("ignore NETDEV_STREAM_DISCONNECTED event for non-passt network device %s in domain %s", +- def->info.alias, vm->def->name); ++ VIR_DEBUG("ignore %s event for non-passt network device %s in domain %s", ++ eventName, def->info.alias, vm->def->name); + goto endjob; + } + + /* handle the event - restart the passt process with its original + * parameters + */ +- VIR_DEBUG("process NETDEV_STREAM_DISCONNECTED event for network device %s in domain %s", +- def->info.alias, vm->def->name); ++ VIR_DEBUG("process %s event for network device %s in domain %s", ++ eventName, def->info.alias, vm->def->name); + + if (qemuPasstStart(vm, def) < 0) + goto endjob; +@@ -3682,6 +3683,14 @@ processNetdevStreamDisconnectedEvent(virDomainObj *vm, + } + + ++static void ++processNetdevStreamDisconnectedEvent(virDomainObj *vm, ++ const char *netdevId) ++{ ++ processNetdevDisconnectedEvent(vm, netdevId, "NETDEV_STREAM_DISCONNECTED"); ++} ++ ++ + static void + processNicRxFilterChangedEvent(virDomainObj *vm, + const char *devAlias) +-- +2.49.0 diff --git a/libvirt-qemu-put-vhost-user-code-that-s-special-for-passt-in-a-helper-function.patch b/libvirt-qemu-put-vhost-user-code-that-s-special-for-passt-in-a-helper-function.patch new file mode 100644 index 0000000..7427878 --- /dev/null +++ b/libvirt-qemu-put-vhost-user-code-that-s-special-for-passt-in-a-helper-function.patch @@ -0,0 +1,110 @@ +From 0cc716142961427bd257a528ef54b87b3a053ade Mon Sep 17 00:00:00 2001 +Message-ID: <0cc716142961427bd257a528ef54b87b3a053ade.1747908718.git.jdenemar@redhat.com> +From: Laine Stump +Date: Fri, 4 Apr 2025 19:38:28 -0400 +Subject: [PATCH] qemu: put vhost-user code that's special for passt in a + helper function + +Rather than duplicating these two lines of chr device object setup for +hotplug and domain start, put them in a helper function that's called +from both places. That way when we need to setup *more* stuff specific +to passt+vhostuser, we can just add it in that one place. + +Signed-off-by: Laine Stump +Tested-by: Stefano Brivio +Reviewed-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 95ff77f2896478e039673bb552affec2c5a5e822) + +https://issues.redhat.com/browse/RHEL-80169 +Signed-off-by: Laine Stump +--- + src/qemu/qemu_hotplug.c | 7 +------ + src/qemu/qemu_passt.c | 19 +++++++++++++++++++ + src/qemu/qemu_passt.h | 3 +++ + src/qemu/qemu_process.c | 9 ++------- + 4 files changed, 25 insertions(+), 13 deletions(-) + +diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c +index c8746f5e22..ff09b58bfe 100644 +--- a/src/qemu/qemu_hotplug.c ++++ b/src/qemu/qemu_hotplug.c +@@ -1264,12 +1264,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, + + if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) { + +- /* vhostuser needs socket path in this location, and when +- * backend is passt, the path is derived from other info, +- * not taken from config. +- */ +- g_free(net->data.vhostuser->data.nix.path); +- net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net); ++ qemuPasstPrepareVhostUser(vm, net); + + if (qemuPasstStart(vm, net) < 0) + goto cleanup; +diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c +index b9616d1c63..bc495eca1e 100644 +--- a/src/qemu/qemu_passt.c ++++ b/src/qemu/qemu_passt.c +@@ -165,6 +165,25 @@ qemuPasstSetupCgroup(virDomainObj *vm, + } + + ++void ++qemuPasstPrepareVhostUser(virDomainObj *vm, ++ virDomainNetDef *net) ++{ ++ /* There are some options on the QEMU commandline for a vhost-user ++ * chr device that are normally configurable, but when it is passt ++ * speaking to the vhost-user device those things are ++ * derived/fixed. This function, which is called prior to ++ * generating the QEMU commandline, sets thos derived/fixed things ++ * in the chr device object. ++ */ ++ ++ /* The socket path is not user-configurable for passt - it is ++ * derived from other info ++ */ ++ g_free(net->data.vhostuser->data.nix.path); ++ net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net); ++} ++ + int + qemuPasstStart(virDomainObj *vm, + virDomainNetDef *net) +diff --git a/src/qemu/qemu_passt.h b/src/qemu/qemu_passt.h +index e0b9aaac8d..ea545ccf38 100644 +--- a/src/qemu/qemu_passt.h ++++ b/src/qemu/qemu_passt.h +@@ -37,5 +37,8 @@ int qemuPasstSetupCgroup(virDomainObj *vm, + virDomainNetDef *net, + virCgroup *cgroup); + ++void qemuPasstPrepareVhostUser(virDomainObj *vm, ++ virDomainNetDef *net); ++ + char *qemuPasstCreateSocketPath(virDomainObj *vm, + virDomainNetDef *net); +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index 2076ad8208..c1ae324ad4 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -5898,13 +5898,8 @@ qemuProcessPrepareDomainNetwork(virDomainObj *vm) + + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) { +- /* when using the passt backend, the path of the +- * unix socket is always derived from other info +- * *not* manually given in the config, but all the +- * vhostuser code looks for it there. +- */ +- g_free(net->data.vhostuser->data.nix.path); +- net->data.vhostuser->data.nix.path = qemuPasstCreateSocketPath(vm, net); ++ /* some extra setup of internal data for passt vhostuser mode */ ++ qemuPasstPrepareVhostUser(vm, net); + } + break; + +-- +2.49.0 diff --git a/libvirt-qemu-remove-nonsensical-sanity-check-in-processNetdevStreamDisconnectedEvent.patch b/libvirt-qemu-remove-nonsensical-sanity-check-in-processNetdevStreamDisconnectedEvent.patch new file mode 100644 index 0000000..43353b4 --- /dev/null +++ b/libvirt-qemu-remove-nonsensical-sanity-check-in-processNetdevStreamDisconnectedEvent.patch @@ -0,0 +1,56 @@ +From 13ff514007822c650ad0f3006882e2f85aab9b48 Mon Sep 17 00:00:00 2001 +Message-ID: <13ff514007822c650ad0f3006882e2f85aab9b48.1747908718.git.jdenemar@redhat.com> +From: Laine Stump +Date: Fri, 4 Apr 2025 16:48:23 -0400 +Subject: [PATCH] qemu: remove nonsensical sanity check in + processNetdevStreamDisconnectedEvent() + +By definition QEMU will never send a NETDEV_STREAM_DISCONNECTED event +if it doesn't support the reconnect option for a stream netdev. And +even if, by some comedy of errors, it did send +NETDEV_STREAM_DISCONNECTED in that case, our response to the event +doesn't request anything at all of QEMU (much less something that +would fail if QEMU didn't understand NETDEV_STREAM_DISCONNECTED) - it +just starts a new passt process to replace the one that has been +terminated, so we don't need to check the QEMU capabilities for +QEMU_CAPS_NETDEV_STREAM_RECONNECT. + +Signed-off-by: Laine Stump +Tested-by: Stefano Brivio +Reviewed-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit 51a54dc1c4ecf37d60acee1cb94252e51c5ef627) + +https://issues.redhat.com/browse/RHEL-80169 +Signed-off-by: Laine Stump +--- + src/qemu/qemu_driver.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 11dbbc1aab..89bb10756e 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -3623,7 +3623,6 @@ processNetdevStreamDisconnectedEvent(virDomainObj *vm, + { + virDomainDeviceDef dev; + virDomainNetDef *def; +- virQEMUCaps *qemuCaps = QEMU_DOMAIN_PRIVATE(vm)->qemuCaps; + const char *devAlias = STRSKIP(netdevId, "host"); + + /* The event sends us the "netdev-id", but we don't store the +@@ -3669,12 +3668,6 @@ processNetdevStreamDisconnectedEvent(virDomainObj *vm, + goto endjob; + } + +- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM_RECONNECT)) { +- VIR_WARN("ignore NETDEV_STREAM_DISCONNECTED event for passt network device %s in domain %s - QEMU binary does not support reconnect", +- def->info.alias, vm->def->name); +- goto endjob; +- } +- + /* handle the event - restart the passt process with its original + * parameters + */ +-- +2.49.0 diff --git a/libvirt-qemu-respond-to-NETDEV_VHOST_USER_DISCONNECTED-event.patch b/libvirt-qemu-respond-to-NETDEV_VHOST_USER_DISCONNECTED-event.patch new file mode 100644 index 0000000..f4dcbb7 --- /dev/null +++ b/libvirt-qemu-respond-to-NETDEV_VHOST_USER_DISCONNECTED-event.patch @@ -0,0 +1,224 @@ +From 1be043d47792afe408bef01a5c169dcd4e98e782 Mon Sep 17 00:00:00 2001 +Message-ID: <1be043d47792afe408bef01a5c169dcd4e98e782.1747908718.git.jdenemar@redhat.com> +From: Laine Stump +Date: Fri, 4 Apr 2025 17:16:43 -0400 +Subject: [PATCH] qemu: respond to NETDEV_VHOST_USER_DISCONNECTED event + +This response to this event is identical to NETDEV_STREAM_DISCONNECTED +(start a new passt process to replace the one that just disappeared - +see commitf62ce81b8a5), except that the new passt process will have +"--vhost-user" appended to the commandline. Fortunately that +difference is already handled based on the virDomainNetDef contents, +so we can, in fact, respond to the new event in exactly the same +manner. + +Signed-off-by: Laine Stump +Tested-by: Stefano Brivio +Reviewed-by: Jiri Denemark +Reviewed-by: Michal Privoznik +(cherry picked from commit dedf1ada95f046310827194eb8794fa18975b9e7) + +Conflicts: + +src/qemu/qemu_driver.c: + In context surrounding a chunk, the arguments to + processNicRxFilterChangedEvent() changed upstream (due to upstream + commit 50981052a5f) + +https://issues.redhat.com/browse/RHEL-80169 +Signed-off-by: Laine Stump +--- + src/qemu/qemu_domain.c | 1 + + src/qemu/qemu_domain.h | 1 + + src/qemu/qemu_driver.c | 11 +++++++++++ + src/qemu/qemu_monitor.c | 11 +++++++++++ + src/qemu/qemu_monitor.h | 6 ++++++ + src/qemu/qemu_monitor_json.c | 16 ++++++++++++++++ + src/qemu/qemu_process.c | 18 ++++++++++++++++++ + 7 files changed, 64 insertions(+) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 4234e4605b..cc47adb724 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -10038,6 +10038,7 @@ qemuProcessEventFree(struct qemuProcessEvent *event) + case QEMU_PROCESS_EVENT_WATCHDOG: + case QEMU_PROCESS_EVENT_DEVICE_DELETED: + case QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED: ++ case QEMU_PROCESS_EVENT_NETDEV_VHOST_USER_DISCONNECTED: + case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED: + case QEMU_PROCESS_EVENT_SERIAL_CHANGED: + case QEMU_PROCESS_EVENT_GUEST_CRASHLOADED: +diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h +index 6246988491..63f422bbcb 100644 +--- a/src/qemu/qemu_domain.h ++++ b/src/qemu/qemu_domain.h +@@ -465,6 +465,7 @@ typedef enum { + QEMU_PROCESS_EVENT_GUESTPANIC, + QEMU_PROCESS_EVENT_DEVICE_DELETED, + QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED, ++ QEMU_PROCESS_EVENT_NETDEV_VHOST_USER_DISCONNECTED, + QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED, + QEMU_PROCESS_EVENT_SERIAL_CHANGED, + QEMU_PROCESS_EVENT_JOB_STATUS_CHANGE, +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 3373dfb845..b374b1978c 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -3691,6 +3691,14 @@ processNetdevStreamDisconnectedEvent(virDomainObj *vm, + } + + ++static void ++processNetdevVhostUserDisconnectedEvent(virDomainObj *vm, ++ const char *netdevId) ++{ ++ processNetdevDisconnectedEvent(vm, netdevId, "NETDEV_VHOST_USER_DISCONNECTED"); ++} ++ ++ + static void + processNicRxFilterChangedEvent(virDomainObj *vm, + const char *devAlias) +@@ -4089,6 +4097,9 @@ static void qemuProcessEventHandler(void *data, void *opaque) + case QEMU_PROCESS_EVENT_NETDEV_STREAM_DISCONNECTED: + processNetdevStreamDisconnectedEvent(vm, processEvent->data); + break; ++ case QEMU_PROCESS_EVENT_NETDEV_VHOST_USER_DISCONNECTED: ++ processNetdevVhostUserDisconnectedEvent(vm, processEvent->data); ++ break; + case QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED: + processNicRxFilterChangedEvent(vm, processEvent->data); + break; +diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c +index 82aa1cbc5f..ed63b7a29b 100644 +--- a/src/qemu/qemu_monitor.c ++++ b/src/qemu/qemu_monitor.c +@@ -1267,6 +1267,17 @@ qemuMonitorEmitNetdevStreamDisconnected(qemuMonitor *mon, + } + + ++void ++qemuMonitorEmitNetdevVhostUserDisconnected(qemuMonitor *mon, ++ const char *devAlias) ++{ ++ VIR_DEBUG("mon=%p", mon); ++ ++ QEMU_MONITOR_CALLBACK(mon, domainNetdevVhostUserDisconnected, ++ mon->vm, devAlias); ++} ++ ++ + void + qemuMonitorEmitSerialChange(qemuMonitor *mon, + const char *devAlias, +diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h +index 672cd6487e..bcb39409ac 100644 +--- a/src/qemu/qemu_monitor.h ++++ b/src/qemu/qemu_monitor.h +@@ -255,6 +255,9 @@ typedef void (*qemuMonitorDomainDeviceUnplugErrCallback)(qemuMonitor *mon, + typedef void (*qemuMonitorDomainNetdevStreamDisconnectedCallback)(qemuMonitor *mon, + virDomainObj *vm, + const char *devAlias); ++typedef void (*qemuMonitorDomainNetdevVhostUserDisconnectedCallback)(qemuMonitor *mon, ++ virDomainObj *vm, ++ const char *devAlias); + typedef void (*qemuMonitorDomainNicRxFilterChangedCallback)(qemuMonitor *mon, + virDomainObj *vm, + const char *devAlias); +@@ -403,6 +406,7 @@ struct _qemuMonitorCallbacks { + qemuMonitorDomainMemoryDeviceSizeChange domainMemoryDeviceSizeChange; + qemuMonitorDomainDeviceUnplugErrCallback domainDeviceUnplugError; + qemuMonitorDomainNetdevStreamDisconnectedCallback domainNetdevStreamDisconnected; ++ qemuMonitorDomainNetdevVhostUserDisconnectedCallback domainNetdevVhostUserDisconnected; + }; + + qemuMonitor *qemuMonitorOpen(virDomainObj *vm, +@@ -490,6 +494,8 @@ void qemuMonitorEmitDeviceUnplugErr(qemuMonitor *mon, + const char *devAlias); + void qemuMonitorEmitNetdevStreamDisconnected(qemuMonitor *mon, + const char *devAlias); ++void qemuMonitorEmitNetdevVhostUserDisconnected(qemuMonitor *mon, ++ const char *devAlias); + void qemuMonitorEmitNicRxFilterChanged(qemuMonitor *mon, + const char *devAlias); + void qemuMonitorEmitSerialChange(qemuMonitor *mon, +diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c +index 6f9f495888..be5d3be7e6 100644 +--- a/src/qemu/qemu_monitor_json.c ++++ b/src/qemu/qemu_monitor_json.c +@@ -85,6 +85,7 @@ static void qemuMonitorJSONHandleMemoryFailure(qemuMonitor *mon, virJSONValue *d + static void qemuMonitorJSONHandleMemoryDeviceSizeChange(qemuMonitor *mon, virJSONValue *data); + static void qemuMonitorJSONHandleDeviceUnplugErr(qemuMonitor *mon, virJSONValue *data); + static void qemuMonitorJSONHandleNetdevStreamDisconnected(qemuMonitor *mon, virJSONValue *data); ++static void qemuMonitorJSONHandleNetdevVhostUserDisconnected(qemuMonitor *mon, virJSONValue *data); + + typedef struct { + const char *type; +@@ -108,6 +109,7 @@ static qemuEventHandler eventHandlers[] = { + { "MIGRATION", qemuMonitorJSONHandleMigrationStatus, }, + { "MIGRATION_PASS", qemuMonitorJSONHandleMigrationPass, }, + { "NETDEV_STREAM_DISCONNECTED", qemuMonitorJSONHandleNetdevStreamDisconnected, }, ++ { "NETDEV_VHOST_USER_DISCONNECTED", qemuMonitorJSONHandleNetdevVhostUserDisconnected, }, + { "NIC_RX_FILTER_CHANGED", qemuMonitorJSONHandleNicRxFilterChanged, }, + { "PR_MANAGER_STATUS_CHANGED", qemuMonitorJSONHandlePRManagerStatusChanged, }, + { "RDMA_GID_STATUS_CHANGED", qemuMonitorJSONHandleRdmaGidStatusChanged, }, +@@ -1044,6 +1046,20 @@ qemuMonitorJSONHandleNetdevStreamDisconnected(qemuMonitor *mon, virJSONValue *da + } + + ++static void ++qemuMonitorJSONHandleNetdevVhostUserDisconnected(qemuMonitor *mon, virJSONValue *data) ++{ ++ const char *name; ++ ++ if (!(name = virJSONValueObjectGetString(data, "netdev-id"))) { ++ VIR_WARN("missing device in NETDEV_VHOST_USER_DISCONNECTED event"); ++ return; ++ } ++ ++ qemuMonitorEmitNetdevVhostUserDisconnected(mon, name); ++} ++ ++ + static void + qemuMonitorJSONHandleNicRxFilterChanged(qemuMonitor *mon, virJSONValue *data) + { +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index ad7e99750f..2076ad8208 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -1402,6 +1402,23 @@ qemuProcessHandleNetdevStreamDisconnected(qemuMonitor *mon G_GNUC_UNUSED, + } + + ++static void ++qemuProcessHandleNetdevVhostUserDisconnected(qemuMonitor *mon G_GNUC_UNUSED, ++ virDomainObj *vm, ++ const char *devAlias) ++{ ++ virObjectLock(vm); ++ ++ VIR_DEBUG("Device %s Netdev vhost-user Disconnected in domain %p %s", ++ devAlias, vm, vm->def->name); ++ ++ qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_NETDEV_VHOST_USER_DISCONNECTED, ++ 0, 0, g_strdup(devAlias)); ++ ++ virObjectUnlock(vm); ++} ++ ++ + static void + qemuProcessHandleNicRxFilterChanged(qemuMonitor *mon G_GNUC_UNUSED, + virDomainObj *vm, +@@ -1848,6 +1865,7 @@ static qemuMonitorCallbacks monitorCallbacks = { + .domainMemoryDeviceSizeChange = qemuProcessHandleMemoryDeviceSizeChange, + .domainDeviceUnplugError = qemuProcessHandleDeviceUnplugErr, + .domainNetdevStreamDisconnected = qemuProcessHandleNetdevStreamDisconnected, ++ .domainNetdevVhostUserDisconnected = qemuProcessHandleNetdevVhostUserDisconnected, + }; + + static void +-- +2.49.0 diff --git a/libvirt-qemu_agent-Add-qemuAgentGetLoadAvg.patch b/libvirt-qemu_agent-Add-qemuAgentGetLoadAvg.patch new file mode 100644 index 0000000..8ae5cc2 --- /dev/null +++ b/libvirt-qemu_agent-Add-qemuAgentGetLoadAvg.patch @@ -0,0 +1,163 @@ +From 8c10ceadcb2c32217b90277ee73f1eb990c67cbc Mon Sep 17 00:00:00 2001 +Message-ID: <8c10ceadcb2c32217b90277ee73f1eb990c67cbc.1747908717.git.jdenemar@redhat.com> +From: Martin Kletzander +Date: Tue, 25 Feb 2025 15:23:07 +0100 +Subject: [PATCH] qemu_agent: Add qemuAgentGetLoadAvg() + +With qemu guest agent 9.3 we are able to get the load averages with a +new command. + +Signed-off-by: Martin Kletzander +Reviewed-by: Peter Krempa +(cherry picked from commit 1669d91eade46b930ebb44e4b9d398ea8c2064e7) + +https://issues.redhat.com/browse/RHEL-88447 + +Signed-off-by: Martin Kletzander +--- + src/qemu/qemu_agent.c | 46 +++++++++++++++++++++++++++++++++++++ + src/qemu/qemu_agent.h | 6 +++++ + tests/qemuagenttest.c | 53 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 105 insertions(+) + +diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c +index 43fca86f10..16a6eaa998 100644 +--- a/src/qemu/qemu_agent.c ++++ b/src/qemu/qemu_agent.c +@@ -2568,3 +2568,49 @@ int qemuAgentGetDisks(qemuAgent *agent, + g_free(*disks); + return -1; + } ++ ++ ++int ++qemuAgentGetLoadAvg(qemuAgent *agent, ++ double *load1m, ++ double *load5m, ++ double *load15m, ++ bool report_unsupported) ++{ ++ g_autoptr(virJSONValue) cmd = NULL; ++ g_autoptr(virJSONValue) reply = NULL; ++ virJSONValue *data = NULL; ++ int rc; ++ ++ if (!(cmd = qemuAgentMakeCommand("guest-get-load", NULL))) ++ return -1; ++ ++ if ((rc = qemuAgentCommandFull(agent, cmd, &reply, agent->timeout, ++ report_unsupported)) < 0) ++ return rc; ++ ++ if (!(data = virJSONValueObjectGetObject(reply, "return"))) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", ++ _("qemu agent didn't return an array of loads")); ++ return -1; ++ } ++ ++#define GET_NUMBER_PARAM(param_) \ ++ do { \ ++ if (param_ && \ ++ virJSONValueObjectGetNumberDouble(data, #param_, param_) < 0) { \ ++ virReportError(VIR_ERR_INTERNAL_ERROR, \ ++ _("parameter '%1$s' is missing in reply of guest-get-load"), \ ++ #param_); \ ++ return -1; \ ++ } \ ++ } while (0) ++ ++ GET_NUMBER_PARAM(load1m); ++ GET_NUMBER_PARAM(load5m); ++ GET_NUMBER_PARAM(load15m); ++ ++#undef GET_NUMBER_PARAM ++ ++ return 0; ++} +diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h +index f98586e8f8..cd17a98d39 100644 +--- a/src/qemu/qemu_agent.h ++++ b/src/qemu/qemu_agent.h +@@ -195,3 +195,9 @@ int qemuAgentSSHRemoveAuthorizedKeys(qemuAgent *agent, + int qemuAgentGetDisks(qemuAgent *mon, + qemuAgentDiskInfo ***disks, + bool report_unsupported); ++ ++int qemuAgentGetLoadAvg(qemuAgent *agent, ++ double *load1m, ++ double *load5m, ++ double *load15m, ++ bool report_unsupported); +diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c +index 3287880241..566571cf11 100644 +--- a/tests/qemuagenttest.c ++++ b/tests/qemuagenttest.c +@@ -1356,6 +1356,58 @@ testQemuAgentTimezone(const void *data) + virTypedParamsFree(params, nparams); + return ret; + } ++ ++ ++static const char testQemuAgentGetLoadAvgResponse[] = ++ "{" ++ " \"return\": {" ++ " \"load15m\": 0.03564453125," ++ " \"load5m\": 0.064453125," ++ " \"load1m\": 0.00390625" ++ " }" ++ "}"; ++ ++static int ++testQemuAgentGetLoadAvg(const void *data) ++{ ++ virDomainXMLOption *xmlopt = (virDomainXMLOption *)data; ++ g_autoptr(qemuMonitorTest) test = qemuMonitorTestNewAgent(xmlopt); ++ double load1m = 0; ++ double load5m = 0; ++ double load15m = 0; ++ ++ if (!test) ++ return -1; ++ ++ if (qemuMonitorTestAddAgentSyncResponse(test) < 0) ++ return -1; ++ ++ if (qemuMonitorTestAddItem(test, "guest-get-load", ++ testQemuAgentGetLoadAvgResponse) < 0) ++ return -1; ++ ++ if (qemuAgentGetLoadAvg(qemuMonitorTestGetAgent(test), ++ &load1m, &load5m, &load15m, true) < 0) ++ return -1; ++ ++#define VALIDATE_LOAD(value_, expected_) \ ++ do { \ ++ if (value_ != expected_) { \ ++ virReportError(VIR_ERR_INTERNAL_ERROR, \ ++ "Expected " #value_ " '%.11f', got '%.11f'", \ ++ expected_, value_); \ ++ return -1; \ ++ } \ ++ } while (0) ++ ++ VALIDATE_LOAD(load1m, 0.00390625); ++ VALIDATE_LOAD(load5m, 0.064453125); ++ VALIDATE_LOAD(load15m, 0.03564453125); ++ ++ return 0; ++} ++ ++ + static int + mymain(void) + { +@@ -1392,6 +1444,7 @@ mymain(void) + DO_TEST(Timezone); + DO_TEST(SSHKeys); + DO_TEST(GetDisks); ++ DO_TEST(GetLoadAvg); + + DO_TEST(Timeout); /* Timeout should always be called last */ + +-- +2.49.0 diff --git a/libvirt-qemu_capabilities-Fetch-caps-for-virtio-mem-ccw-too.patch b/libvirt-qemu_capabilities-Fetch-caps-for-virtio-mem-ccw-too.patch new file mode 100644 index 0000000..5cc1402 --- /dev/null +++ b/libvirt-qemu_capabilities-Fetch-caps-for-virtio-mem-ccw-too.patch @@ -0,0 +1,409 @@ +From 6d104057ac63fed07c493e2a73694503ac0ef0f1 Mon Sep 17 00:00:00 2001 +Message-ID: <6d104057ac63fed07c493e2a73694503ac0ef0f1.1747908717.git.jdenemar@redhat.com> +From: Michal Privoznik +Date: Wed, 7 May 2025 14:32:52 +0200 +Subject: [PATCH] qemu_capabilities: Fetch caps for virtio-mem-ccw too + +While with upstream QEMU it's impossible to have virtio-mem-ccw and not +have virtio-mem-pci, in RHEL the QEMU's build system is patched to make +that possible. But this breaks our assumption when fetching +capabilities. + +Well, just do what we are already doing in this situation (e.g. +"virtio-blk-pci"/"virtio-blk-ccw" & virQEMUCapsDevicePropsVirtioBlk, or +"virtio-scsi-pci"/"virtio-net-ccw" & virQEMUCapsDevicePropsVirtioSCSI): +fetch the same set of props for both devices. + +Resolves: https://issues.redhat.com/browse/RHEL-87532 + +Signed-off-by: Michal Privoznik +Reviewed-by: Peter Krempa +(cherry picked from commit 6ff8d08777ebbcb9a1e11534c3a3341fbf0343e8) +Signed-off-by: Michal Privoznik + +Conflicts: +tests/qemucapabilitiesdata/caps_10.0.0_s390x.replies: Context, +becuase v11.3.0-28-g670aae6cda is not backported. +--- + src/qemu/qemu_capabilities.c | 4 + + .../caps_10.0.0_s390x.replies | 202 +++++++++++++++--- + 2 files changed, 182 insertions(+), 24 deletions(-) + +diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c +index 1a9cf72482..b507027667 100644 +--- a/src/qemu/qemu_capabilities.c ++++ b/src/qemu/qemu_capabilities.c +@@ -1546,6 +1546,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVhostUserFS[] = + { "bootindex", QEMU_CAPS_VHOST_USER_FS_BOOTINDEX, NULL }, + }; + ++/* This is used also for QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW */ + static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioMemPCI[] = { + { "prealloc", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC, NULL }, + { "dynamic-memslots", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_DYNAMIC_MEMSLOTS, NULL }, +@@ -1714,6 +1715,9 @@ static virQEMUCapsDeviceTypeProps virQEMUCapsDeviceProps[] = { + { "virtio-mem-pci", virQEMUCapsDevicePropsVirtioMemPCI, + G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioMemPCI), + QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI }, ++ { "virtio-mem-ccw", virQEMUCapsDevicePropsVirtioMemPCI, ++ G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioMemPCI), ++ QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW }, + { "virtio-iommu-pci", virQEMUCapsDevicePropsVirtioIOMMU, + G_N_ELEMENTS(virQEMUCapsDevicePropsVirtioIOMMU), + QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI }, +diff --git a/tests/qemucapabilitiesdata/caps_10.0.0_s390x.replies b/tests/qemucapabilitiesdata/caps_10.0.0_s390x.replies +index 05b13b2d2b..18f098153d 100644 +--- a/tests/qemucapabilitiesdata/caps_10.0.0_s390x.replies ++++ b/tests/qemucapabilitiesdata/caps_10.0.0_s390x.replies +@@ -29500,11 +29500,165 @@ + { + "execute": "device-list-properties", + "arguments": { +- "typename": "virtio-iommu-pci" ++ "typename": "virtio-mem-ccw" + }, + "id": "libvirt-30" + } + ++{ ++ "return": [ ++ { ++ "name": "dev_id", ++ "description": "Read-only identifier of an I/O device in the channel subsystem, example: fe.1.23ab", ++ "type": "str" ++ }, ++ { ++ "name": "devno", ++ "description": "Identifier of an I/O device in the channel subsystem, example: fe.1.23ab", ++ "type": "str" ++ }, ++ { ++ "name": "subch_id", ++ "description": "Read-only identifier of an I/O device in the channel subsystem, example: fe.1.23ab", ++ "type": "str" ++ }, ++ { ++ "default-value": 2, ++ "name": "max_revision", ++ "type": "uint32" ++ }, ++ { ++ "default-value": true, ++ "name": "ioeventfd", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": 0, ++ "name": "memaddr", ++ "type": "uint64" ++ }, ++ { ++ "default-value": true, ++ "name": "indirect_desc", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": false, ++ "name": "iommu_platform", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "name": "memdev", ++ "type": "link" ++ }, ++ { ++ "default-value": true, ++ "name": "event_idx", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": true, ++ "name": "x-early-migration", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": 0, ++ "name": "node", ++ "type": "uint32" ++ }, ++ { ++ "name": "requested-size", ++ "type": "size" ++ }, ++ { ++ "default-value": true, ++ "name": "any_layout", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": false, ++ "name": "x-disable-legacy-check", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": true, ++ "name": "queue_reset", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": true, ++ "name": "notify_on_empty", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": false, ++ "name": "packed", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "name": "block-size", ++ "type": "size" ++ }, ++ { ++ "default-value": false, ++ "name": "prealloc", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": true, ++ "name": "use-started", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": false, ++ "name": "in_order", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "name": "size", ++ "type": "size" ++ }, ++ { ++ "default-value": true, ++ "name": "use-disabled-flag", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "default-value": true, ++ "name": "dynamic-memslots", ++ "description": "on/off", ++ "type": "bool" ++ }, ++ { ++ "name": "virtio-backend", ++ "type": "child" ++ } ++ ], ++ "id": "libvirt-30" ++} ++ ++{ ++ "execute": "device-list-properties", ++ "arguments": { ++ "typename": "virtio-iommu-pci" ++ }, ++ "id": "libvirt-31" ++} ++ + { + "return": [ + { +@@ -29774,7 +29928,7 @@ + "type": "child" + } + ], +- "id": "libvirt-30" ++ "id": "libvirt-31" + } + + { +@@ -29782,7 +29936,7 @@ + "arguments": { + "typename": "virtio-blk-ccw" + }, +- "id": "libvirt-31" ++ "id": "libvirt-32" + } + + { +@@ -30065,7 +30219,7 @@ + "type": "bool" + } + ], +- "id": "libvirt-31" ++ "id": "libvirt-32" + } + + { +@@ -30073,7 +30227,7 @@ + "arguments": { + "typename": "memory-backend-file" + }, +- "id": "libvirt-32" ++ "id": "libvirt-33" + } + + { +@@ -30163,7 +30317,7 @@ + "type": "bool" + } + ], +- "id": "libvirt-32" ++ "id": "libvirt-33" + } + + { +@@ -30171,7 +30325,7 @@ + "arguments": { + "typename": "memory-backend-memfd" + }, +- "id": "libvirt-33" ++ "id": "libvirt-34" + } + + { +@@ -30250,12 +30404,12 @@ + "type": "int" + } + ], +- "id": "libvirt-33" ++ "id": "libvirt-34" + } + + { + "execute": "query-machines", +- "id": "libvirt-34" ++ "id": "libvirt-35" + } + + { +@@ -30530,7 +30684,7 @@ + "default-ram-id": "s390.ram" + } + ], +- "id": "libvirt-34" ++ "id": "libvirt-35" + } + + { +@@ -30538,7 +30692,7 @@ + "arguments": { + "typename": "none-machine" + }, +- "id": "libvirt-35" ++ "id": "libvirt-36" + } + + { +@@ -30653,12 +30807,12 @@ + "type": "bool" + } + ], +- "id": "libvirt-35" ++ "id": "libvirt-36" + } + + { + "execute": "query-cpu-definitions", +- "id": "libvirt-36" ++ "id": "libvirt-37" + } + + { +@@ -31368,32 +31522,32 @@ + "deprecated": false + } + ], +- "id": "libvirt-36" ++ "id": "libvirt-37" + } + + { + "execute": "query-tpm-models", +- "id": "libvirt-37" ++ "id": "libvirt-38" + } + + { + "return": [], +- "id": "libvirt-37" ++ "id": "libvirt-38" + } + + { + "execute": "query-tpm-types", +- "id": "libvirt-38" ++ "id": "libvirt-39" + } + + { + "return": [], +- "id": "libvirt-38" ++ "id": "libvirt-39" + } + + { + "execute": "query-command-line-options", +- "id": "libvirt-39" ++ "id": "libvirt-40" + } + + { +@@ -32646,12 +32800,12 @@ + "option": "drive" + } + ], +- "id": "libvirt-39" ++ "id": "libvirt-40" + } + + { + "execute": "query-migrate-capabilities", +- "id": "libvirt-40" ++ "id": "libvirt-41" + } + + { +@@ -32745,7 +32899,7 @@ + "capability": "mapped-ram" + } + ], +- "id": "libvirt-40" ++ "id": "libvirt-41" + } + + { +@@ -32756,7 +32910,7 @@ + "name": "host" + } + }, +- "id": "libvirt-41" ++ "id": "libvirt-42" + } + + { +@@ -32828,7 +32982,7 @@ + } + } + }, +- "id": "libvirt-41" ++ "id": "libvirt-42" + } + + { +-- +2.49.0 diff --git a/libvirt-virsh-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch b/libvirt-virsh-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch new file mode 100644 index 0000000..05f149e --- /dev/null +++ b/libvirt-virsh-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch @@ -0,0 +1,71 @@ +From 4452c8f1b0a9e953615d15d02ada49c1834c72d5 Mon Sep 17 00:00:00 2001 +Message-ID: <4452c8f1b0a9e953615d15d02ada49c1834c72d5.1747908717.git.jdenemar@redhat.com> +From: Martin Kletzander +Date: Tue, 25 Feb 2025 15:22:35 +0100 +Subject: [PATCH] virsh: Add support for VIR_DOMAIN_GUEST_INFO_LOAD + +Resolves: https://issues.redhat.com/browse/RHEL-71883 +Signed-off-by: Martin Kletzander +Reviewed-by: Peter Krempa +(cherry picked from commit 71e75ce09203aa2489803426ae368d1693ee925b) + +https://issues.redhat.com/browse/RHEL-88447 + +Signed-off-by: Martin Kletzander +--- + docs/manpages/virsh.rst | 8 +++++++- + tools/virsh-domain.c | 6 ++++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst +index aea920b7a7..2bb1313a48 100644 +--- a/docs/manpages/virsh.rst ++++ b/docs/manpages/virsh.rst +@@ -2927,7 +2927,7 @@ Success is always reported in this case. + + You can limit the types of information that are returned by specifying one or + more flags. Available information types flags are *--user*, *--os*, +-*--timezone*, *--hostname*, *--filesystem*, *--disk* and *--interface*. ++*--timezone*, *--hostname*, *--filesystem*, *--disk*, *--interface* and *--load*. + If an explicitly requested information type is not supported by the guest agent + at that point, the processes will provide an exit code of 1. + +@@ -3006,6 +3006,12 @@ returned: + * ``if..addr..addr`` - the IP address of addr + * ``if..addr..prefix`` - the prefix of IP address of addr + ++*--load* returns: ++* ``load.1m`` - average load in guest for last 1 minute ++* ``load.5m`` - average load in guest for last 5 minutes ++* ``load.15m`` - average load in guest for last 15 minutes ++ ++ + guestvcpus + ---------- + +diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c +index e4923284af..0f30a65fd9 100644 +--- a/tools/virsh-domain.c ++++ b/tools/virsh-domain.c +@@ -13066,6 +13066,10 @@ static const vshCmdOptDef opts_guestinfo[] = { + .type = VSH_OT_BOOL, + .help = N_("report interface information"), + }, ++ {.name = "load", ++ .type = VSH_OT_BOOL, ++ .help = N_("report load averages information"), ++ }, + {.name = NULL} + }; + +@@ -13093,6 +13097,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) + types |= VIR_DOMAIN_GUEST_INFO_DISKS; + if (vshCommandOptBool(cmd, "interface")) + types |= VIR_DOMAIN_GUEST_INFO_INTERFACES; ++ if (vshCommandOptBool(cmd, "load")) ++ types |= VIR_DOMAIN_GUEST_INFO_LOAD; + + if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) + return false; +-- +2.49.0 diff --git a/libvirt-virsh-Introduce-new-hypervisor-cpu-models-command.patch b/libvirt-virsh-Introduce-new-hypervisor-cpu-models-command.patch new file mode 100644 index 0000000..86c9466 --- /dev/null +++ b/libvirt-virsh-Introduce-new-hypervisor-cpu-models-command.patch @@ -0,0 +1,160 @@ +From 1d5f1c125cbe567b5586ff661e6b030f7f7f4151 Mon Sep 17 00:00:00 2001 +Message-ID: <1d5f1c125cbe567b5586ff661e6b030f7f7f4151.1747908718.git.jdenemar@redhat.com> +From: David Judkovics +Date: Thu, 20 Mar 2025 01:28:24 -0400 +Subject: [PATCH] virsh: Introduce new hypervisor-cpu-models command +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add new virsh command 'hypervisor-cpu-models'. Command pulls from the +existing domcapabilities XML and uses xpath to parse CPU model strings. +By default, only models reported as usable by the hypervisor on the +host system are printed. User may specify "--all" to also print +models which are not supported on the host. + +Signed-off-by: David Judkovics +Signed-off-by: Boris Fiuczynski +Signed-off-by: Collin Walling +Reviewed-by: Ján Tomko +(cherry picked from commit 65eeaf12d0780d20fcd7b76479d892c50f56a78c) + +https://issues.redhat.com/browse/RHEL-11435 + +Signed-off-by: Boris Fiuczynski +--- + docs/manpages/virsh.rst | 25 ++++++++++++++ + tools/virsh-host.c | 75 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 100 insertions(+) + +diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst +index 2bb1313a48..4d86caecd6 100644 +--- a/docs/manpages/virsh.rst ++++ b/docs/manpages/virsh.rst +@@ -1032,6 +1032,31 @@ listed in the XML description. If *--migratable* is specified, features that + block migration will not be included in the resulting CPU. + + ++hypervisor-cpu-models ++--------------------- ++ ++**Syntax:** ++ ++:: ++ ++ hypervisor-cpu-models [--virttype virttype] [--emulator emulator] ++ [--arch arch] [--machine machine] [--all] ++ ++Print the list of CPU models known by the hypervisor for the specified architecture. ++It is not guaranteed that a listed CPU will run on the host. To determine CPU ++model compatibility with the host, see ``virsh hypervisor-cpu-baseline`` and ++``virsh hypervisor-cpu-compare``. ++ ++The *virttype* option specifies the virtualization type (usable in the 'type' ++attribute of the top level element from the domain XML). *emulator* ++specifies the path to the emulator, *arch* specifies the CPU architecture, and ++*machine* specifies the machine type. ++ ++By default, only the models that are claimed to be "usable" by the hypervisor ++on the host are reported. The option *--all* will report every CPU model known ++to the hypervisor, including ones that are not supported on the hypervisor (e.g. ++newer generation models). ++ + DOMAIN COMMANDS + =============== + +diff --git a/tools/virsh-host.c b/tools/virsh-host.c +index 2fe64e415f..eac782f2d4 100644 +--- a/tools/virsh-host.c ++++ b/tools/virsh-host.c +@@ -1751,6 +1751,75 @@ cmdHypervisorCPUBaseline(vshControl *ctl, + } + + ++/* ++ * "hypervisor-cpu-models" command ++ */ ++static const vshCmdInfo info_hypervisor_cpu_models = { ++ .help = N_("Hypervisor reported CPU models"), ++ .desc = N_("Get the CPU models reported by the hypervisor."), ++}; ++ ++static const vshCmdOptDef opts_hypervisor_cpu_models[] = { ++ {.name = "virttype", ++ .type = VSH_OT_STRING, ++ .completer = virshDomainVirtTypeCompleter, ++ .help = N_("virtualization type (/domain/@type)"), ++ }, ++ {.name = "emulator", ++ .type = VSH_OT_STRING, ++ .help = N_("path to emulator binary (/domain/devices/emulator)"), ++ }, ++ {.name = "arch", ++ .type = VSH_OT_STRING, ++ .completer = virshArchCompleter, ++ .help = N_("CPU architecture (/domain/os/type/@arch)"), ++ }, ++ {.name = "machine", ++ .type = VSH_OT_STRING, ++ .help = N_("machine type (/domain/os/type/@machine)"), ++ }, ++ {.name = "all", ++ .type = VSH_OT_BOOL, ++ .help = N_("include all CPU models known to the hypervisor for the architecture") ++ }, ++ {.name = NULL} ++}; ++ ++static bool ++cmdHypervisorCPUModelNames(vshControl *ctl, ++ const vshCmd *cmd) ++{ ++ g_autofree char *caps_xml = NULL; ++ const char *virttype = NULL; ++ const char *emulator = NULL; ++ const char *arch = NULL; ++ const char *machine = NULL; ++ const char *xpath = NULL; ++ virshControl *priv = ctl->privData; ++ ++ if (vshCommandOptString(ctl, cmd, "virttype", &virttype) < 0 || ++ vshCommandOptString(ctl, cmd, "emulator", &emulator) < 0 || ++ vshCommandOptString(ctl, cmd, "arch", &arch) < 0 || ++ vshCommandOptString(ctl, cmd, "machine", &machine) < 0) ++ return false; ++ ++ if (vshCommandOptBool(cmd, "all")) ++ xpath = "//cpu//model[@usable]/text()"; ++ else ++ xpath = "//cpu//model[@usable='yes']/text()"; ++ ++ caps_xml = virConnectGetDomainCapabilities(priv->conn, emulator, arch, ++ machine, virttype, 0); ++ ++ if (!caps_xml) { ++ vshError(ctl, "%s", _("failed to get hypervisor CPU model names")); ++ return false; ++ } ++ ++ return virshDumpXML(ctl, caps_xml, "domcapabilities", xpath, false); ++} ++ ++ + const vshCmdDef hostAndHypervisorCmds[] = { + {.name = "allocpages", + .handler = cmdAllocpages, +@@ -1818,6 +1887,12 @@ const vshCmdDef hostAndHypervisorCmds[] = { + .info = &info_hypervisor_cpu_compare, + .flags = 0 + }, ++ {.name = "hypervisor-cpu-models", ++ .handler = cmdHypervisorCPUModelNames, ++ .opts = opts_hypervisor_cpu_models, ++ .info = &info_hypervisor_cpu_models, ++ .flags = 0 ++ }, + {.name = "maxvcpus", + .handler = cmdMaxvcpus, + .opts = opts_maxvcpus, +-- +2.49.0 diff --git a/libvirt.spec b/libvirt.spec index b883d64..af5f413 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: 10%{?dist}%{?extra_release} +Release: 11%{?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/ @@ -419,6 +419,20 @@ Patch119: libvirt-qemu-Validate-virtio-mem-ccw.patch Patch120: libvirt-qemu-Allow-virtio-mem-on-CCW.patch Patch121: libvirt-qemuxmlconftest-Introduce-memory-hotplug-virtio-mem-ccw-s390x.xml.patch Patch122: libvirt-qemu_domain_address-fix-CCW-virtio-mem-hotplug.patch +Patch123: libvirt-Add-load-average-information-type-into-virDomainGetGuestInfo.patch +Patch124: libvirt-qemu_agent-Add-qemuAgentGetLoadAvg.patch +Patch125: libvirt-qemu-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch +Patch126: libvirt-virsh-Add-support-for-VIR_DOMAIN_GUEST_INFO_LOAD.patch +Patch127: libvirt-qemu_capabilities-Fetch-caps-for-virtio-mem-ccw-too.patch +Patch128: libvirt-cpu_map-Add-avx10-CPU-features.patch +Patch129: libvirt-cpu_map-Add-GraniteRapids-v2-CPU-model.patch +Patch130: libvirt-cpu_map-Add-sha512-sm3-and-sm4-CPU-features.patch +Patch131: libvirt-virsh-Introduce-new-hypervisor-cpu-models-command.patch +Patch132: libvirt-qemu-remove-nonsensical-sanity-check-in-processNetdevStreamDisconnectedEvent.patch +Patch133: libvirt-qemu-make-processNetDevStreamDisconnectedEvent-reusable.patch +Patch134: libvirt-qemu-respond-to-NETDEV_VHOST_USER_DISCONNECTED-event.patch +Patch135: libvirt-qemu-put-vhost-user-code-that-s-special-for-passt-in-a-helper-function.patch +Patch136: libvirt-qemu-make-passt-vhostuser-reconnect-behave-identically-to-passt-user.patch Requires: libvirt-daemon = %{version}-%{release} @@ -2744,6 +2758,22 @@ exit 0 %endif %changelog +* Thu May 22 2025 Jiri Denemark - 10.10.0-11 +- Add load average information type into virDomainGetGuestInfo (RHEL-88447) +- qemu_agent: Add qemuAgentGetLoadAvg() (RHEL-88447) +- qemu: Add support for VIR_DOMAIN_GUEST_INFO_LOAD (RHEL-88447) +- virsh: Add support for VIR_DOMAIN_GUEST_INFO_LOAD (RHEL-88447) +- qemu_capabilities: Fetch caps for virtio-mem-ccw too (RHEL-87532) +- cpu_map: Add avx10* CPU features (RHEL-87796) +- cpu_map: Add GraniteRapids-v2 CPU model (RHEL-87796) +- cpu_map: Add sha512, sm3, and sm4 CPU features (RHEL-87796) +- virsh: Introduce new hypervisor-cpu-models command (RHEL-11435) +- qemu: remove nonsensical sanity check in processNetdevStreamDisconnectedEvent() (RHEL-80169) +- qemu: make processNetDevStreamDisconnectedEvent() reusable (RHEL-80169) +- qemu: respond to NETDEV_VHOST_USER_DISCONNECTED event (RHEL-80169) +- qemu: put vhost-user code that's special for passt in a helper function (RHEL-80169) +- qemu: make passt+vhostuser reconnect behave identically to passt+user (RHEL-80169) + * Thu Apr 17 2025 Jiri Denemark - 10.10.0-10 - esxConnectListAllDomains: Don't propagate failure to lookup a single domain (RHEL-80606) - conf: parse interface/source/@dev for all interface types (with backend type='passt') (RHEL-82539)