Re: [PATCH] qemu_monitor_json: Implement logic for setting iothread.thread-pool-{min, max}
On Thu, Jun 30, 2022 at 02:48:01PM +0200, Michal Privoznik wrote: When virDomainSetIOThreadParams() API is called, well its QEMU impl: qemuDomainSetIOThreadParams() then typed params are parsed by qemuDomainIOThreadParseParams() into this qemuMonitorIOThreadInfo struct. In the struct we have a pair for every IOThread attribute we can tune through monitor. The struct is then passed to qemuMonitorJSONSetIOThread() which looks at the bool and if set then the corresponding attribute is set to given value. Each attribute is thus changed in a separate call. While this works for attributes independent of each other ("poll-max-ns", "poll-grow", "poll-shrink"), it does not always work for the other attributes ("thread-pool-min" and "thread-pool-max"). The limitation here is that the lower boundary (minimum) has to be lower (or equal to) the upper boundary (maximum) at all times. This means, that in some cases we might need to set attributes in reversed order to meet the constraint. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/339 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander signature.asc Description: PGP signature
Re: [PATCH RFC v2 3/3] qemu_driver: use qemuMonitorQueryStats to extract halt poll time
On Wed, Jul 06, 2022 at 04:56:28AM +0530, Amneesh Singh wrote: Related: https://gitlab.com/libvirt/libvirt/-/issues/276 This patch uses qemuMonitorQueryStats to query "halt_poll_success_ns" and "halt_poll_fail_ns" for every vCPU. The respective values for each vCPU are then added together. Signed-off-by: Amneesh Singh --- src/qemu/qemu_driver.c | 70 +- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 97c6ed95..30170d5c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18052,15 +18052,69 @@ qemuDomainGetStatsCpuCgroup(virDomainObj *dom, } static int -qemuDomainGetStatsCpuHaltPollTime(virDomainObj *dom, - virTypedParamList *params) +qemuDomainGetStatsCpuHaltPollTime(virQEMUDriver *driver, + virDomainObj *dom, + virTypedParamList *params, + unsigned int privflags) { unsigned long long haltPollSuccess = 0; unsigned long long haltPollFail = 0; -pid_t pid = dom->pid; +qemuDomainObjPrivate *priv = dom->privateData; +bool queryStatsCap = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_STATS); -if (virHostCPUGetHaltPollTime(pid, &haltPollSuccess, &haltPollFail) < 0) -return 0; +if (queryStatsCap && HAVE_JOB(privflags) && virDomainObjIsActive(dom) && driver->privileged) { Why is there a check for whether the driver is privileged? I thought this can also work with a session mode. +size_t i; +qemuMonitorQueryStatsTargetType target = QEMU_MONITOR_QUERY_STATS_TARGET_VCPU; +qemuMonitorQueryStatsProvider *provider = NULL; +g_autoptr(GPtrArray) providers = NULL; +g_autoptr(GPtrArray) queried_stats = NULL; +provider = qemuMonitorQueryStatsProviderNew( +target, +QEMU_MONITOR_QUERY_STATS_PROVIDER_KVM, +QEMU_MONITOR_QUERY_STATS_VCPU_NAME_HALT_POLL_SUCCESS_NS, +QEMU_MONITOR_QUERY_STATS_VCPU_NAME_HALT_POLL_FAIL_NS, +-1); + +if (!provider) +return 0; In this case you can still do the callback. Basically don't put it in an "else" branch, just get a new condition checking if the stats were gathered or not (if need be you can get a new variable for that). + +providers = g_ptr_array_new_full(1, (GDestroyNotify) qemuMonitorQueryStatsProviderFree); +g_ptr_array_add(providers, provider); + +qemuDomainObjEnterMonitor(driver, dom); +queried_stats = qemuMonitorQueryStats(priv->mon, target, NULL, providers); +qemuDomainObjExitMonitor(dom); + +if (!queried_stats) +return 0; + +for (i = 0; i < queried_stats->len; i++) { +unsigned long long curHaltPollSuccess, curHaltPollFail; +GHashTable *cur_table = queried_stats->pdata[i]; +virJSONValue *success_obj, *fail_obj; +const char *success_str = qemuMonitorQueryStatsVcpuNameTypeToString( +QEMU_MONITOR_QUERY_STATS_VCPU_NAME_HALT_POLL_SUCCESS_NS); +const char *fail_str = qemuMonitorQueryStatsVcpuNameTypeToString( +QEMU_MONITOR_QUERY_STATS_VCPU_NAME_HALT_POLL_FAIL_NS); + +success_obj = g_hash_table_lookup(cur_table, success_str); +fail_obj = g_hash_table_lookup(cur_table, fail_str); + If you want it could be nicer to have an extra function for this since it looks like it'll be repeated. Also have a look if the enums can't be defined elsewhere/differently so that you can end up with something like this: virJSONValue *success_obj = qemuStatsGet(QEMU_STATS_NAME_HALT_POLL_SUCCESS_NS); +if (!(success_obj && fail_obj)) +return 0; + This checks if they both exist (although I would prefer (!success_obj || !fail_obj) as it is more readable and for me it is similar to how I would say that in a sentence) but does not check that they really are a number. +ignore_value(virJSONValueGetNumberUlong(success_obj, &curHaltPollSuccess)); +ignore_value(virJSONValueGetNumberUlong(fail_obj, &curHaltPollFail)); + That's why you should also check that the virJSONValueGetNumberUlong does not return -1. That's why it makes you use the return value. Also these are another cases where you can execute the fallback instead. Thanks for taking the time to polish this. signature.asc Description: PGP signature
Re: [PATCH 00/11] Test case cleanups
On a Thursday in 2022, Peter Krempa wrote: These patches originate from my upcoming series bumping minimum qemu version to 4.2 and are valid even without the qemu version bump. Peter Krempa (11): test: domaincaps: Remove old test data qemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig' qemuxml2argvtest: Drop 'qemu-4.1' versions of hyperv tests qemuxml2argvtest: Convert 'cpu-eoi-(disabled|enabled)' cases to VIR_TEST_CAPS_LATEST qemuxml2argvtest: Remove qemu-4.0 versions of cpu feature test cases qemuxml2argvtest: Convert 'net-user' case to _LATEST qemuxml2argvtest: Make 'qemu-ns' test case more stable qemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting fake host cpu qemu: Remove qemu-4.0 version of 'cpu-translation' test case qemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case qemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 191 --- .../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 204 [...] .../qemu-ns.x86_64-latest.xml | 1 - tests/qemuxml2xmltest.c | 1 - 43 files changed, 41 insertions(+), 3578 deletions(-) Reviewed-by: Ján Tomko Jano signature.asc Description: PGP signature
Re: [PATCH 07/11] qemuxml2argvtest: Make 'qemu-ns' test case more stable
On a Thursday in 2022, Peter Krempa wrote: The test was showing that the 'blockdev' capability is properly added despite although we didn't detect it yet. Unfortunately this test d/despite / or d/although / Jano can't be carried over once we bump minimum qemu version to qemu-4.2. Make the test case future-proof by removing the qemu-4.0.0 version which would become pointless and use only already deprecated capability flags so that the test output does not change. Signed-off-by: Peter Krempa --- .../qemu-ns.x86_64-4.0.0.args | 38 --- tests/qemuxml2argvdata/qemu-ns.xml| 1 - tests/qemuxml2argvtest.c | 1 - .../qemu-ns.x86_64-latest.xml | 1 - 4 files changed, 41 deletions(-) delete mode 100644 tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args signature.asc Description: PGP signature
[PATCH 06/11] qemuxml2argvtest: Convert 'net-user' case to _LATEST
The tested net device has the same syntax with latest qemu so there's no need to have a version-locked test for it. Signed-off-by: Peter Krempa --- .../net-user.x86_64-4.0.0.args| 35 - .../net-user.x86_64-latest.args | 38 +++ tests/qemuxml2argvtest.c | 2 +- 3 files changed, 39 insertions(+), 36 deletions(-) delete mode 100644 tests/qemuxml2argvdata/net-user.x86_64-4.0.0.args create mode 100644 tests/qemuxml2argvdata/net-user.x86_64-latest.args diff --git a/tests/qemuxml2argvdata/net-user.x86_64-4.0.0.args b/tests/qemuxml2argvdata/net-user.x86_64-4.0.0.args deleted file mode 100644 index 2389919eb7..00 --- a/tests/qemuxml2argvdata/net-user.x86_64-4.0.0.args +++ /dev/null @@ -1,35 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --m 214 \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \ --device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \ --netdev user,id=hostnet0 \ --device rtl8139,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55,bus=pci.0,addr=0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/net-user.x86_64-latest.args b/tests/qemuxml2argvdata/net-user.x86_64-latest.args new file mode 100644 index 00..87423d4cad --- /dev/null +++ b/tests/qemuxml2argvdata/net-user.x86_64-latest.args @@ -0,0 +1,38 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/tmp/lib/domain--1-QEMUGuest1 \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=QEMUGuest1,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \ +-accel tcg \ +-cpu qemu64 \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ +-overcommit mem-lock=off \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-no-acpi \ +-boot strict=on \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \ +-netdev user,id=hostnet0 \ +-device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 71ea3b4e0d..324475475e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1592,7 +1592,7 @@ mymain(void) DO_TEST_NOCAPS("net-vhostuser-multiq"); DO_TEST_FAILURE_NOCAPS("net-vhostuser-fail"); DO_TEST_NOCAPS("net-user"); -DO_TEST_CAPS_ARCH_VER_FULL("net-user", "x86_64", "4.0.0", ARG_FLAGS, FLAG_SLIRP_HELPER); +DO_TEST_CAPS_ARCH_LATEST_FULL("net-user", "x86_64", ARG_FLAGS, FLAG_SLIRP_HELPER); DO_TEST_NOCAPS("net-user-addr"); DO_TEST_NOCAPS("net-virtio"); DO_TEST("net-virtio-device", -- 2.36.1
[PATCH 07/11] qemuxml2argvtest: Make 'qemu-ns' test case more stable
The test was showing that the 'blockdev' capability is properly added despite although we didn't detect it yet. Unfortunately this test can't be carried over once we bump minimum qemu version to qemu-4.2. Make the test case future-proof by removing the qemu-4.0.0 version which would become pointless and use only already deprecated capability flags so that the test output does not change. Signed-off-by: Peter Krempa --- .../qemu-ns.x86_64-4.0.0.args | 38 --- tests/qemuxml2argvdata/qemu-ns.xml| 1 - tests/qemuxml2argvtest.c | 1 - .../qemu-ns.x86_64-latest.xml | 1 - 4 files changed, 41 deletions(-) delete mode 100644 tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args diff --git a/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args b/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args deleted file mode 100644 index 284f32d6a1..00 --- a/tests/qemuxml2argvdata/qemu-ns.x86_64-4.0.0.args +++ /dev/null @@ -1,38 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -NS=ns \ -BAR='' \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --m 214 \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \ --device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ua-disk,bootindex=1,prop1=propval1,prop2=-321,prop3=123,prop4=on,prop5=off \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --unknown parameter \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/qemu-ns.xml b/tests/qemuxml2argvdata/qemu-ns.xml index 36bf582dec..dc98421226 100644 --- a/tests/qemuxml2argvdata/qemu-ns.xml +++ b/tests/qemuxml2argvdata/qemu-ns.xml @@ -30,7 +30,6 @@ - diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 324475475e..e14ed8b882 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2036,7 +2036,6 @@ mymain(void) QEMU_CAPS_LAST, ARG_END); -DO_TEST_CAPS_VER("qemu-ns", "4.0.0"); DO_TEST_CAPS_LATEST("qemu-ns"); DO_TEST_NOCAPS("qemu-ns-no-env"); DO_TEST_NOCAPS("qemu-ns-alt"); diff --git a/tests/qemuxml2xmloutdata/qemu-ns.x86_64-latest.xml b/tests/qemuxml2xmloutdata/qemu-ns.x86_64-latest.xml index a8998ae582..b788038f29 100644 --- a/tests/qemuxml2xmloutdata/qemu-ns.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/qemu-ns.x86_64-latest.xml @@ -46,7 +46,6 @@ - -- 2.36.1
[PATCH 09/11] qemu: Remove qemu-4.0 version of 'cpu-translation' test case
The cpu commandline is identical with the '-latest' version so there's no need for a separate case. Signed-off-by: Peter Krempa --- .../cpu-translation.x86_64-4.0.0.args | 33 --- tests/qemuxml2argvtest.c | 1 - 2 files changed, 34 deletions(-) delete mode 100644 tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args diff --git a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args b/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args deleted file mode 100644 index 09141106d5..00 --- a/tests/qemuxml2argvdata/cpu-translation.x86_64-4.0.0.args +++ /dev/null @@ -1,33 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --cpu Haswell,pclmulqdq=on,ds-cpl=on,tsc-adjust=on,fxsr-opt=on,lahf-lm=on,cmp-legacy=on,nodeid-msr=on,perfctr-core=on,perfctr-nb=on,kvm-pv-eoi=on,kvm-pv-unhalt=on \ --m 214 \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-fade-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 74a1baa018..a99b44bf2d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2125,7 +2125,6 @@ mymain(void) DO_TEST_CAPS_VER("cpu-host-model-cmt", "4.0.0"); DO_TEST_CAPS_VER("cpu-tsc-frequency", "4.0.0"); -DO_TEST_CAPS_VER("cpu-translation", "4.0.0"); DO_TEST_CAPS_LATEST("cpu-translation"); DO_TEST_NOCAPS("memtune"); -- 2.36.1
[PATCH 11/11] qemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case
The capabilities for that version were not updated from the development version and thus would fail our upcoming minimum version change. Fake the data to report 4.2.0. Signed-off-by: Peter Krempa --- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies | 4 ++-- tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies index bd4a6bf41e..5321348322 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies @@ -17,8 +17,8 @@ { "return": { "qemu": { - "micro": 50, - "minor": 1, + "micro": 0, + "minor": 2, "major": 4 }, "package": "v4.1.0-2221-g36609b4fa3" diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 833bf955f9..162ace7b2b 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -162,7 +162,7 @@ - 4001050 + 4002000 0 61700242 v4.1.0-2221-g36609b4fa3 -- 2.36.1
[PATCH 08/11] qemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting fake host cpu
Make it obvious that the fake cpu does not apply to the test cases based on real capabilities. Signed-off-by: Peter Krempa --- tests/qemuxml2argvtest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e14ed8b882..74a1baa018 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2120,12 +2120,13 @@ mymain(void) DO_TEST("cpu-Haswell3", QEMU_CAPS_KVM); DO_TEST("cpu-Haswell-noTSX", QEMU_CAPS_KVM); DO_TEST_NOCAPS("cpu-host-model-cmt"); -DO_TEST_CAPS_VER("cpu-host-model-cmt", "4.0.0"); DO_TEST("cpu-tsc-frequency", QEMU_CAPS_KVM); +qemuTestSetHostCPU(&driver, driver.hostarch, NULL); + +DO_TEST_CAPS_VER("cpu-host-model-cmt", "4.0.0"); DO_TEST_CAPS_VER("cpu-tsc-frequency", "4.0.0"); DO_TEST_CAPS_VER("cpu-translation", "4.0.0"); DO_TEST_CAPS_LATEST("cpu-translation"); -qemuTestSetHostCPU(&driver, driver.hostarch, NULL); DO_TEST_NOCAPS("memtune"); DO_TEST_NOCAPS("memtune-unlimited"); -- 2.36.1
[PATCH 10/11] qemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case
The capabilities for that version were not updated from the development version and thus would fail our upcoming minimum version change. Fake the data to report 4.2.0. Signed-off-by: Peter Krempa --- tests/qemucapabilitiesdata/caps_4.2.0.ppc64.replies | 4 ++-- tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.replies index d0b21ef123..4ed901c3de 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.replies +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.replies @@ -17,8 +17,8 @@ { "return": { "qemu": { - "micro": 50, - "minor": 1, + "micro": 0, + "minor": 2, "major": 4 }, "package": "v4.1.0-2198-g9e583f2" diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml index 1586f28ca5..7c5275210b 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -159,7 +159,7 @@ - 4001050 + 4002000 0 42900242 v4.1.0-2198-g9e583f2 -- 2.36.1
[PATCH 03/11] qemuxml2argvtest: Drop 'qemu-4.1' versions of hyperv tests
The version-locked version of the test data is identical to the 'latest' version so we can remove them. Signed-off-by: Peter Krempa --- .../hyperv-off.x86_64-4.0.0.args | 31 --- .../hyperv-panic.x86_64-4.0.0.args| 31 --- .../qemuxml2argvdata/hyperv.x86_64-4.0.0.args | 31 --- tests/qemuxml2argvtest.c | 3 -- 4 files changed, 96 deletions(-) delete mode 100644 tests/qemuxml2argvdata/hyperv-off.x86_64-4.0.0.args delete mode 100644 tests/qemuxml2argvdata/hyperv-panic.x86_64-4.0.0.args delete mode 100644 tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args diff --git a/tests/qemuxml2argvdata/hyperv-off.x86_64-4.0.0.args b/tests/qemuxml2argvdata/hyperv-off.x86_64-4.0.0.args deleted file mode 100644 index be484daf84..00 --- a/tests/qemuxml2argvdata/hyperv-off.x86_64-4.0.0.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --m 214 \ --overcommit mem-lock=off \ --smp 6,sockets=6,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/hyperv-panic.x86_64-4.0.0.args b/tests/qemuxml2argvdata/hyperv-panic.x86_64-4.0.0.args deleted file mode 100644 index 512f59169c..00 --- a/tests/qemuxml2argvdata/hyperv-panic.x86_64-4.0.0.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --cpu qemu64,hv-crash \ --m 214 \ --overcommit mem-lock=off \ --smp 6,sockets=6,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args b/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args deleted file mode 100644 index 1efbc95985..00 --- a/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args +++ /dev/null @@ -1,31 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --cpu 'qemu64,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x2fff,hv-vpindex=on,hv-runtime=on,hv-synic=on,hv-stimer=on,hv-reset=on,hv-vendor-id=KVM Hv,hv-frequencies=on,hv-reenlightenment=on,hv-tlbflush=on,hv-ipi=on,hv-evmcs=on' \ --m 214 \ --overcommit mem-lock=off \ --smp 6,sockets=6,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3cbb428ee1..bdfb47f0e5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest
[PATCH 05/11] qemuxml2argvtest: Remove qemu-4.0 versions of cpu feature test cases
The cpu feature formatting doesn't change between the versions thus we can just keep the '-latest' versions. Signed-off-by: Peter Krempa --- .../eoi-disabled.x86_64-4.0.0.args| 32 --- .../eoi-enabled.x86_64-4.0.0.args | 32 --- .../kvmclock+eoi-disabled.x86_64-4.0.0.args | 32 --- .../pv-spinlock-disabled.x86_64-4.0.0.args| 32 --- .../pv-spinlock-enabled.x86_64-4.0.0.args | 32 --- tests/qemuxml2argvtest.c | 5 --- 6 files changed, 165 deletions(-) delete mode 100644 tests/qemuxml2argvdata/eoi-disabled.x86_64-4.0.0.args delete mode 100644 tests/qemuxml2argvdata/eoi-enabled.x86_64-4.0.0.args delete mode 100644 tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-4.0.0.args delete mode 100644 tests/qemuxml2argvdata/pv-spinlock-disabled.x86_64-4.0.0.args delete mode 100644 tests/qemuxml2argvdata/pv-spinlock-enabled.x86_64-4.0.0.args diff --git a/tests/qemuxml2argvdata/eoi-disabled.x86_64-4.0.0.args b/tests/qemuxml2argvdata/eoi-disabled.x86_64-4.0.0.args deleted file mode 100644 index 14080eabed..00 --- a/tests/qemuxml2argvdata/eoi-disabled.x86_64-4.0.0.args +++ /dev/null @@ -1,32 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --cpu qemu64,kvm-pv-eoi=off \ --m 214 \ --overcommit mem-lock=off \ --smp 6,sockets=6,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/eoi-enabled.x86_64-4.0.0.args b/tests/qemuxml2argvdata/eoi-enabled.x86_64-4.0.0.args deleted file mode 100644 index f7ad06a1b5..00 --- a/tests/qemuxml2argvdata/eoi-enabled.x86_64-4.0.0.args +++ /dev/null @@ -1,32 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --cpu qemu64,kvm-pv-eoi=on \ --m 214 \ --overcommit mem-lock=off \ --smp 6,sockets=6,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-4.0.0.args b/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-4.0.0.args deleted file mode 100644 index d1c15c4202..00 --- a/tests/qemuxml2argvdata/kvmclock+eoi-disabled.x86_64-4.0.0.args +++ /dev/null @@ -1,32 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-QEMUGuest1 \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=QEMUGuest1,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-4.0,usb=off,dump-guest-core=off \ --accel tcg \ --cpu qemu64,kvmclock=off,kvm-pv-eoi=off \ --m 214 \ --overcommit mem-lock=off \ --smp 6,sockets=6,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --boot strict=on \ --device piix3-usb-uhci,id=usb
[PATCH 04/11] qemuxml2argvtest: Convert 'cpu-eoi-(disabled|enabled)' cases to VIR_TEST_CAPS_LATEST
The tested feature doesn't change across versions so we can use the modern testing infrastructure. Signed-off-by: Peter Krempa --- ...ed.args => cpu-eoi-disabled.x86_64-latest.args} | 14 -- tests/qemuxml2argvdata/cpu-eoi-disabled.xml| 2 +- ...led.args => cpu-eoi-enabled.x86_64-latest.args} | 14 -- tests/qemuxml2argvdata/cpu-eoi-enabled.xml | 2 +- tests/qemuxml2argvtest.c | 6 -- tests/qemuxml2xmloutdata/cpu-eoi-disabled.xml | 2 +- tests/qemuxml2xmloutdata/cpu-eoi-enabled.xml | 2 +- 7 files changed, 24 insertions(+), 18 deletions(-) rename tests/qemuxml2argvdata/{cpu-eoi-disabled.args => cpu-eoi-disabled.x86_64-latest.args} (53%) rename tests/qemuxml2argvdata/{cpu-eoi-enabled.args => cpu-eoi-enabled.x86_64-latest.args} (53%) diff --git a/tests/qemuxml2argvdata/cpu-eoi-disabled.args b/tests/qemuxml2argvdata/cpu-eoi-disabled.x86_64-latest.args similarity index 53% rename from tests/qemuxml2argvdata/cpu-eoi-disabled.args rename to tests/qemuxml2argvdata/cpu-eoi-disabled.x86_64-latest.args index b252446464..dfb4a53bfd 100644 --- a/tests/qemuxml2argvdata/cpu-eoi-disabled.args +++ b/tests/qemuxml2argvdata/cpu-eoi-disabled.x86_64-latest.args @@ -6,15 +6,15 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i386 \ +/usr/bin/qemu-system-x86_64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \ -accel tcg \ -cpu qemu32,kvm-pv-eoi=off \ -m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ -overcommit mem-lock=off \ -smp 6,sockets=6,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ @@ -26,6 +26,8 @@ QEMU_AUDIO_DRV=none \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --usb \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/cpu-eoi-disabled.xml b/tests/qemuxml2argvdata/cpu-eoi-disabled.xml index 657de0482a..c93e75e3e5 100644 --- a/tests/qemuxml2argvdata/cpu-eoi-disabled.xml +++ b/tests/qemuxml2argvdata/cpu-eoi-disabled.xml @@ -21,7 +21,7 @@ restart destroy -/usr/bin/qemu-system-i386 +/usr/bin/qemu-system-x86_64 diff --git a/tests/qemuxml2argvdata/cpu-eoi-enabled.args b/tests/qemuxml2argvdata/cpu-eoi-enabled.x86_64-latest.args similarity index 53% rename from tests/qemuxml2argvdata/cpu-eoi-enabled.args rename to tests/qemuxml2argvdata/cpu-eoi-enabled.x86_64-latest.args index 849593269d..155d5ecef7 100644 --- a/tests/qemuxml2argvdata/cpu-eoi-enabled.args +++ b/tests/qemuxml2argvdata/cpu-eoi-enabled.x86_64-latest.args @@ -6,15 +6,15 @@ LOGNAME=test \ XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \ XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-i386 \ +/usr/bin/qemu-system-x86_64 \ -name guest=QEMUGuest1,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc,usb=off,dump-guest-core=off \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \ -accel tcg \ -cpu qemu32,kvm-pv-eoi=on \ -m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \ -overcommit mem-lock=off \ -smp 6,sockets=6,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ @@ -26,6 +26,8 @@ QEMU_AUDIO_DRV=none \ -rtc base=utc \ -no-shutdown \ -boot strict=on \ --usb \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x2"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/cpu-eoi-enabled.xml b/tests/qemuxml2argvdata/cpu-eoi-enabled.xml index bc8934f260..1c24398f42 100644 --- a/tests/qemuxml2argvdata/cpu-eoi-enabled
[PATCH 02/11] qemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig'
Prior to qemu-3.2 we'd have to disable the 'pconfig' feature explicitly which is no longer needed with new qemu. Remove the version locked to qemu-3.1 as the 'latest' case sufficiently handles what we want to test. Signed-off-by: Peter Krempa --- ...u-Icelake-Server-pconfig.x86_64-3.1.0.args | 33 --- tests/qemuxml2argvtest.c | 1 - ...pu-Icelake-Server-pconfig.x86_64-3.1.0.xml | 32 -- tests/qemuxml2xmltest.c | 1 - 4 files changed, 67 deletions(-) delete mode 100644 tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.args delete mode 100644 tests/qemuxml2xmloutdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.xml diff --git a/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.args b/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.args deleted file mode 100644 index 5c9a0fd9d2..00 --- a/tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.args +++ /dev/null @@ -1,33 +0,0 @@ -LC_ALL=C \ -PATH=/bin \ -HOME=/tmp/lib/domain--1-test \ -USER=test \ -LOGNAME=test \ -XDG_DATA_HOME=/tmp/lib/domain--1-test/.local/share \ -XDG_CACHE_HOME=/tmp/lib/domain--1-test/.cache \ -XDG_CONFIG_HOME=/tmp/lib/domain--1-test/.config \ -QEMU_AUDIO_DRV=none \ -/usr/bin/qemu-system-x86_64 \ --name guest=test,debug-threads=on \ --S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-test/master-key.aes \ --machine pc-i440fx-3.1,usb=off,dump-guest-core=off \ --accel kvm \ --cpu Icelake-Server,pconfig=off,intel-pt=off \ --m 214 \ --overcommit mem-lock=off \ --smp 1,sockets=1,cores=1,threads=1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ --mon chardev=charmonitor,id=monitor,mode=control \ --rtc base=utc \ --no-shutdown \ --no-acpi \ --boot strict=on \ --device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2 \ --sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ --msg timestamp=on diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4ca1131377..3cbb428ee1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3424,7 +3424,6 @@ mymain(void) DO_TEST_CAPS_LATEST("vhost-user-vga"); DO_TEST_CAPS_LATEST("vhost-user-gpu-secondary"); -DO_TEST_CAPS_VER("cpu-Icelake-Server-pconfig", "3.1.0"); DO_TEST_CAPS_LATEST("cpu-Icelake-Server-pconfig"); DO_TEST_CAPS_ARCH_LATEST("aarch64-default-cpu-kvm-virt-4.2", "aarch64"); diff --git a/tests/qemuxml2xmloutdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.xml b/tests/qemuxml2xmloutdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.xml deleted file mode 100644 index 0a2d113339..00 --- a/tests/qemuxml2xmloutdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.xml +++ /dev/null @@ -1,32 +0,0 @@ - - test - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219100 - 219100 - 1 - -hvm - - - -Icelake-Server - - - - destroy - restart - destroy - -/usr/bin/qemu-system-x86_64 - - - - - - - - - - - - diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 60114e3673..71bce98c17 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1353,7 +1353,6 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-graphics", "x86_64"); DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-graphics", "x86_64"); -DO_TEST_CAPS_VER("cpu-Icelake-Server-pconfig", "3.1.0"); DO_TEST_CAPS_LATEST("cpu-Icelake-Server-pconfig"); DO_TEST_CAPS_ARCH_LATEST("aarch64-default-cpu-kvm-virt-4.2", "aarch64"); -- 2.36.1
[PATCH 01/11] test: domaincaps: Remove old test data
Remove the test data for qemu-2.11, qemu-2.12 and qemu-3.0 which are no longer supported. Signed-off-by: Peter Krempa --- .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 191 --- .../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 204 tests/domaincapsdata/qemu_2.11.0.s390x.xml| 219 - tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 191 --- .../domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 212 .../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 222 - .../qemu_2.12.0-virt.aarch64.xml | 172 - tests/domaincapsdata/qemu_2.12.0.aarch64.xml | 166 - tests/domaincapsdata/qemu_2.12.0.ppc64.xml| 136 --- tests/domaincapsdata/qemu_2.12.0.s390x.xml| 219 - tests/domaincapsdata/qemu_2.12.0.x86_64.xml | 212 .../domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 208 .../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 220 - tests/domaincapsdata/qemu_3.0.0.ppc64.xml | 138 --- tests/domaincapsdata/qemu_3.0.0.s390x.xml | 226 -- tests/domaincapsdata/qemu_3.0.0.x86_64.xml| 208 16 files changed, 3144 deletions(-) delete mode 100644 tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.11.0.s390x.xml delete mode 100644 tests/domaincapsdata/qemu_2.11.0.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.aarch64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.ppc64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.s390x.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0.ppc64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0.s390x.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0.x86_64.xml diff --git a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml deleted file mode 100644 index ea9737d9ce..00 --- a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml +++ /dev/null @@ -1,191 +0,0 @@ - - /usr/bin/qemu-system-x86_64 - kvm - pc-q35-2.11 - x86_64 - - - - - bios - efi - - - /usr/share/AAVMF/AAVMF_CODE.fd - /usr/share/AAVMF/AAVMF32_CODE.fd - /usr/share/OVMF/OVMF_CODE.fd - -rom -pflash - - -yes -no - - -yes -no - - - - - - -off - - - - -on -off - - - - Skylake-Client - Intel - - - - - - - - - - - - qemu64 - qemu32 - phenom - pentium3 - pentium2 - pentium - n270 - kvm64 - kvm32 - coreduo - core2duo - athlon - Westmere - Skylake-Server - Skylake-Client - SandyBridge - Penryn - Opteron_G5 - Opteron_G4 - Opteron_G3 - Opteron_G2 - Opteron_G1 - Nehalem - IvyBridge - Haswell - Haswell-noTSX - EPYC - Conroe - Broadwell - Broadwell-noTSX - 486 - - - - - file - anonymous - - - - - -disk -cdrom -floppy -lun - - -fdc -scsi -virtio -usb -sata - - -virtio -virtio-transitional -virtio-non-transitional - - - - -sdl -vnc -spice -egl-headless - - - - -vga -cirrus -vmvga -qxl -virtio -none - - - - -subsystem - - -default -mandatory -requisite -optional - - -usb -pci -scsi - - - -default -vfio - - - - -virtio -virtio-transitional -virtio-non-transitional - - -random -egd - - - - -path -handle - - - - -tpm-tis - - -passthrough -emulator - - - - - - - - - - - - diff --git a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml deleted file mode 100644 index 6830f9..00 --- a/tests/domaincapsdata/qemu_2
[PATCH 00/11] Test case cleanups
These patches originate from my upcoming series bumping minimum qemu version to 4.2 and are valid even without the qemu version bump. Peter Krempa (11): test: domaincaps: Remove old test data qemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig' qemuxml2argvtest: Drop 'qemu-4.1' versions of hyperv tests qemuxml2argvtest: Convert 'cpu-eoi-(disabled|enabled)' cases to VIR_TEST_CAPS_LATEST qemuxml2argvtest: Remove qemu-4.0 versions of cpu feature test cases qemuxml2argvtest: Convert 'net-user' case to _LATEST qemuxml2argvtest: Make 'qemu-ns' test case more stable qemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting fake host cpu qemu: Remove qemu-4.0 version of 'cpu-translation' test case qemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case qemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 191 --- .../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 204 tests/domaincapsdata/qemu_2.11.0.s390x.xml| 219 - tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 191 --- .../domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 212 .../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 222 - .../qemu_2.12.0-virt.aarch64.xml | 172 - tests/domaincapsdata/qemu_2.12.0.aarch64.xml | 166 - tests/domaincapsdata/qemu_2.12.0.ppc64.xml| 136 --- tests/domaincapsdata/qemu_2.12.0.s390x.xml| 219 - tests/domaincapsdata/qemu_2.12.0.x86_64.xml | 212 .../domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 208 .../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 220 - tests/domaincapsdata/qemu_3.0.0.ppc64.xml | 138 --- tests/domaincapsdata/qemu_3.0.0.s390x.xml | 226 -- tests/domaincapsdata/qemu_3.0.0.x86_64.xml| 208 .../caps_4.2.0.aarch64.replies| 4 +- .../caps_4.2.0.aarch64.xml| 2 +- .../caps_4.2.0.ppc64.replies | 4 +- .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 2 +- ...u-Icelake-Server-pconfig.x86_64-3.1.0.args | 33 --- tests/qemuxml2argvdata/cpu-eoi-disabled.args | 31 --- ...gs => cpu-eoi-disabled.x86_64-latest.args} | 12 +- tests/qemuxml2argvdata/cpu-eoi-disabled.xml | 2 +- tests/qemuxml2argvdata/cpu-eoi-enabled.args | 31 --- ...rgs => cpu-eoi-enabled.x86_64-latest.args} | 13 +- tests/qemuxml2argvdata/cpu-eoi-enabled.xml| 2 +- .../cpu-translation.x86_64-4.0.0.args | 33 --- .../eoi-enabled.x86_64-4.0.0.args | 32 --- .../hyperv-panic.x86_64-4.0.0.args| 31 --- .../qemuxml2argvdata/hyperv.x86_64-4.0.0.args | 31 --- .../kvmclock+eoi-disabled.x86_64-4.0.0.args | 32 --- .../net-user.x86_64-4.0.0.args| 35 --- ...4.0.0.args => net-user.x86_64-latest.args} | 18 +- .../pv-spinlock-disabled.x86_64-4.0.0.args| 32 --- .../pv-spinlock-enabled.x86_64-4.0.0.args | 32 --- tests/qemuxml2argvdata/qemu-ns.xml| 1 - tests/qemuxml2argvtest.c | 24 +- ...pu-Icelake-Server-pconfig.x86_64-3.1.0.xml | 32 --- tests/qemuxml2xmloutdata/cpu-eoi-disabled.xml | 2 +- tests/qemuxml2xmloutdata/cpu-eoi-enabled.xml | 2 +- .../qemu-ns.x86_64-latest.xml | 1 - tests/qemuxml2xmltest.c | 1 - 43 files changed, 41 insertions(+), 3578 deletions(-) delete mode 100644 tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.11.0.s390x.xml delete mode 100644 tests/domaincapsdata/qemu_2.11.0.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.aarch64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.ppc64.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.s390x.xml delete mode 100644 tests/domaincapsdata/qemu_2.12.0.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0.ppc64.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0.s390x.xml delete mode 100644 tests/domaincapsdata/qemu_3.0.0.x86_64.xml delete mode 100644 tests/qemuxml2argvdata/cpu-Icelake-Server-pconfig.x86_64-3.1.0.args delete mode 100644 tests/qemuxml2argvdata/cpu-eoi-disabled.args rename tests/qemuxml2argvdata/{hyperv-off.x86_64-4.0.0.args => cpu-eoi-disabled.x86_64-latest.args} (60%) delete mode 100644 tests/qemuxml2argvdata/cpu-eoi-enabled.args rename tes
Re: [PATCH 0/3] conf: Separate domain post parse code into domain_postparse.c
On a Thursday in 2022, Michal Privoznik wrote: *** BLURB HERE *** Michal Prívozník (3): domain_conf: Unexport virDomainDefPostParseDeviceIteratorData conf: Separate domain post parse code into domain_postparse.c domain_postparse: Move error messages onto single line po/POTFILES |1 + src/conf/domain_conf.c | 1446 +- src/conf/domain_conf.h | 10 - src/conf/domain_postparse.c | 1466 +++ src/conf/domain_postparse.h | 37 + src/conf/domain_validate.c | 11 +- src/conf/meson.build|1 + src/libvirt_private.syms|5 +- src/libxl/xen_xl.c |1 + src/libxl/xen_xm.c |1 + src/lxc/lxc_native.c|1 + src/qemu/qemu_driver.c |1 + src/qemu/qemu_process.c |1 + src/vmx/vmx.c |1 + 14 files changed, 1525 insertions(+), 1458 deletions(-) create mode 100644 src/conf/domain_postparse.c create mode 100644 src/conf/domain_postparse.h Reviewed-by: Ján Tomko Jano signature.asc Description: PGP signature
Re: [PATCH RFC v2 2/3] qemu_capabilities: add "query-stats" QMP command to the QEMU capabilities
On Wed, Jul 06, 2022 at 04:56:27AM +0530, Amneesh Singh wrote: Related: https://gitlab.com/libvirt/libvirt/-/issues/276 This patch adds "query-stats" to the QEMU capabilities. Signed-off-by: Amneesh Singh --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2c3be3ec..81fc597a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -671,6 +671,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "chardev.qemu-vdagent", /* QEMU_CAPS_CHARDEV_QEMU_VDAGENT */ "display-dbus", /* QEMU_CAPS_DISPLAY_DBUS */ "iothread.thread-pool-max", /* QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX */ + "query-stats", /* QEMU_CAPS_QUERY_STATS */ ); @@ -1225,6 +1226,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = { { "query-dirty-rate", QEMU_CAPS_QUERY_DIRTY_RATE }, { "sev-inject-launch-secret", QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET }, { "calc-dirty-rate", QEMU_CAPS_CALC_DIRTY_RATE }, +{ "query-stats", QEMU_CAPS_QUERY_STATS }, }; struct virQEMUCapsStringFlags virQEMUCapsMigration[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6f35ba14..29e55b3a 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -650,6 +650,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_CHARDEV_QEMU_VDAGENT, /* -chardev qemu-vdagent */ QEMU_CAPS_DISPLAY_DBUS, /* -display dbus */ QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX, /* -object iothread.thread-pool-max */ +QEMU_CAPS_QUERY_STATS, /*accepts query-stats */ missing space after /* with that Reviewed-by: Martin Kletzander QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; -- 2.36.1 signature.asc Description: PGP signature
Re: [PATCH RFC v2 1/3] qemu_monitor: add qemuMonitorQueryStats
On Wed, Jul 06, 2022 at 04:56:26AM +0530, Amneesh Singh wrote: Related: https://gitlab.com/libvirt/libvirt/-/issues/276 This patch adds an API for the "query-stats" QMP command. The query returns a JSON containing the statistics based on the target, which can either be vCPU or VM, and the providers. The API deserializes the query result into an array of GHashMaps, which can later be used to extract all the query statistics. GHashMaps are used to avoid traversing the entire array to find the statistics you are looking for. This would be a singleton array if the target is a VM since the returned JSON is also a singleton array in that case. Signed-off-by: Amneesh Singh --- src/qemu/qemu_monitor.c | 106 src/qemu/qemu_monitor.h | 56 +++ src/qemu/qemu_monitor_json.c | 130 +++ src/qemu/qemu_monitor_json.h | 6 ++ 4 files changed, 298 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index fda5d2f3..528aed49 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4541,3 +4541,109 @@ qemuMonitorMigrateRecover(qemuMonitor *mon, return qemuMonitorJSONMigrateRecover(mon, uri); } + +VIR_ENUM_IMPL(qemuMonitorQueryStatsTarget, + QEMU_MONITOR_QUERY_STATS_TARGET_LAST, + "vm", + "vcpu", +); + +VIR_ENUM_IMPL(qemuMonitorQueryStatsVmName, + QEMU_MONITOR_QUERY_STATS_VM_NAME_LAST, +); + +VIR_ENUM_IMPL(qemuMonitorQueryStatsVcpuName, + QEMU_MONITOR_QUERY_STATS_VCPU_NAME_LAST, + "halt_poll_success_ns", + "halt_poll_fail_ns" +); + As we discussed these two can be joined together and the code will look much nicer. I don't think we need to differentiate between those, definitely not now sice the former one is not even used yet. +VIR_ENUM_IMPL(qemuMonitorQueryStatsProvider, + QEMU_MONITOR_QUERY_STATS_PROVIDER_LAST, + "kvm", +); + +const char * +qemuMonitorQueryStatsNameTypeToString(qemuMonitorQueryStatsTargetType target, + int type) With the merged enums this function will not be needed at all, and there are other similar cases, but since you suggested yourself you know it very well too ;) +{ +switch (target) { +case QEMU_MONITOR_QUERY_STATS_TARGET_VM: +return qemuMonitorQueryStatsVmNameTypeToString(type); +case QEMU_MONITOR_QUERY_STATS_TARGET_VCPU: +return qemuMonitorQueryStatsVcpuNameTypeToString(type); + +/* unreachable */ +case QEMU_MONITOR_QUERY_STATS_TARGET_LAST: +; +} + +return NULL; +} + +void +qemuMonitorQueryStatsProviderFree(qemuMonitorQueryStatsProvider *provider) +{ +virBitmapFree(provider->names); +g_free(provider); +} + +qemuMonitorQueryStatsProvider * +qemuMonitorQueryStatsProviderNew(qemuMonitorQueryStatsTargetType target, + qemuMonitorQueryStatsProviderType provider_type, + ...) +{ +g_autoptr(qemuMonitorQueryStatsProvider) provider = NULL; +va_list name_list; +int stat; + +provider = g_new0(qemuMonitorQueryStatsProvider, 1); +provider->provider = provider_type; +provider->names = NULL; + +va_start(name_list, provider_type); +stat = va_arg(name_list, int); I have a suspicion that sizeof(enum ...) is guaranteed to equal sizeof(int) everywhere. But you should just be able to do va_arg(name_list, qemuMonitorQueryStats) + +if (stat != -1) { and instead of -1 you can pass and check the _LAST value. +size_t sz = 0; + +switch (target) { +case QEMU_MONITOR_QUERY_STATS_TARGET_VM: +sz = QEMU_MONITOR_QUERY_STATS_VM_NAME_LAST; +break; +case QEMU_MONITOR_QUERY_STATS_TARGET_VCPU: +sz = QEMU_MONITOR_QUERY_STATS_VCPU_NAME_LAST; +break; +case QEMU_MONITOR_QUERY_STATS_TARGET_LAST: +break; +} + +provider->names = virBitmapNew(sz); + +while (stat != -1) { +if (virBitmapSetBit(provider->names, stat) < 0) +return NULL; +stat = va_arg(name_list, int); +} +} + +va_end(name_list); + +return g_steal_pointer(&provider); +} + +GPtrArray * +qemuMonitorQueryStats(qemuMonitor *mon, + qemuMonitorQueryStatsTargetType target, + char **vcpus, + GPtrArray *providers) +{ +VIR_DEBUG("target=%u vcpus=%p providers=%p", target, vcpus, providers); + +QEMU_CHECK_MONITOR_NULL(mon); + +if (target != QEMU_MONITOR_QUERY_STATS_TARGET_VCPU && !vcpus) I think you meant: if (target != QEMU_MONITOR_QUERY_STATS_TARGET_VCPU && vcpus) +return NULL; + +return qemuMonitorJSONQueryStats(mon, target, vcpus, providers); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 95267ec6..26df9c63 100644 --- a/src/qemu/qemu_monitor
Re: [PATCH] docs: Fix syntax error for defaultiothread
On 7/6/22 08:20, Han Han wrote: > Signed-off-by: Han Han > --- > docs/formatdomain.rst | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Michal Privoznik Michal
Re: [PATCH] schemas: rng: Make secret optional in storage vol
On 7/6/22 04:42, Han Han wrote: > For a qcow2 storage volume with luks encryption created by qemu-img, its > dumped storage vol XML has no secret element in encryption: > > ... > > > ... > > > That will cause a failure in rng validation. Fix that validation failure. > > Signed-off-by: Han Han > --- > src/conf/schemas/storagecommon.rng | 24 +--- > 1 file changed, 13 insertions(+), 11 deletions(-) Reviewed-by: Michal Privoznik Michal
Re: [PATCH] virt-xml-validate: Fix incorrect wildcards for XML roots
On 7/6/22 04:02, Han Han wrote: > To match the XML roots domainCapabilities and storagepoolCapabilities, > the wildcards should be *domainCap* and *storagepoolCap*. > > Fixes: 7b0e2e4a55 > Signed-off-by: Han Han > --- > tools/virt-xml-validate.in | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Michal Privoznik Michal
[PATCH 2/3] conf: Separate domain post parse code into domain_postparse.c
The domain post parse functions currently live in domain_conf.c which thus grows always larger. Mimic what we've done for the validation code and move the post parse code into a separate file: domain_postparse.c. I've started by moving every function with PostParse in its name into the new file and then compile hunting for helper functions only to move them as well. In the end, I've moved virDomainDefPostParse symbol in libvirt_private.syms into a new section. And while virDomainDeviceDefPostParseOne() is made 'public' in domain_postparse.h too, I'm not exporting it because it has no caller outside src/conf/ and it's unlikely it ever will. Signed-off-by: Michal Privoznik --- po/POTFILES |1 + src/conf/domain_conf.c | 1453 +- src/conf/domain_conf.h |4 - src/conf/domain_postparse.c | 1483 +++ src/conf/domain_postparse.h | 37 + src/conf/meson.build|1 + src/libvirt_private.syms|5 +- src/libxl/xen_xl.c |1 + src/libxl/xen_xm.c |1 + src/lxc/lxc_native.c|1 + src/qemu/qemu_driver.c |1 + src/qemu/qemu_process.c |1 + src/vmx/vmx.c |1 + 13 files changed, 1533 insertions(+), 1457 deletions(-) create mode 100644 src/conf/domain_postparse.c create mode 100644 src/conf/domain_postparse.h diff --git a/po/POTFILES b/po/POTFILES index faaba53c8f..9621efb0d3 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -32,6 +32,7 @@ src/conf/domain_addr.c src/conf/domain_capabilities.c src/conf/domain_conf.c src/conf/domain_event.c +src/conf/domain_postparse.c src/conf/domain_validate.c src/conf/interface_conf.c src/conf/netdev_bandwidth_conf.c diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c67fcd337d..b639022396 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -33,6 +33,7 @@ #include "datatypes.h" #include "domain_addr.h" #include "domain_conf.h" +#include "domain_postparse.h" #include "domain_validate.h" #include "viralloc.h" #include "virxml.h" @@ -1796,49 +1797,6 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root, } -/** - * virDomainDefCheckUnsupportedMemoryHotplug: - * @def: domain definition - * - * Returns -1 if the domain definition would enable memory hotplug via the - * tunable and reports an error. Otherwise returns 0. - */ -static int -virDomainDefCheckUnsupportedMemoryHotplug(virDomainDef *def) -{ -/* memory hotplug tunables are not supported by this driver */ -if (virDomainDefHasMemoryHotplug(def)) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("memory hotplug tunables are not " - "supported by this hypervisor driver")); -return -1; -} - -return 0; -} - - -/** - * virDomainDeviceDefCheckUnsupportedMemoryDevice: - * @dev: device definition - * - * Returns -1 if the device definition describes a memory device and reports an - * error. Otherwise returns 0. - */ -static int -virDomainDeviceDefCheckUnsupportedMemoryDevice(virDomainDeviceDef *dev) -{ -/* This driver doesn't yet know how to handle memory devices */ -if (dev->type == VIR_DOMAIN_DEVICE_MEMORY) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("memory devices are not supported by this driver")); -return -1; -} - -return 0; -} - - bool virDomainObjTaint(virDomainObj *obj, virDomainTaintFlags taint) { @@ -4733,204 +4691,6 @@ virDomainDefHasDeviceAddress(virDomainDef *def, } -static int -virDomainDefRejectDuplicateControllers(virDomainDef *def) -{ -int max_idx[VIR_DOMAIN_CONTROLLER_TYPE_LAST]; -virBitmap *bitmaps[VIR_DOMAIN_CONTROLLER_TYPE_LAST] = { NULL }; -virDomainControllerDef *cont; -size_t nbitmaps = 0; -int ret = -1; -size_t i; - -memset(max_idx, -1, sizeof(max_idx)); - -for (i = 0; i < def->ncontrollers; i++) { -cont = def->controllers[i]; -if (cont->idx > max_idx[cont->type]) -max_idx[cont->type] = cont->idx; -} - -/* multiple USB controllers with the same index are allowed */ -max_idx[VIR_DOMAIN_CONTROLLER_TYPE_USB] = -1; - -for (i = 0; i < VIR_DOMAIN_CONTROLLER_TYPE_LAST; i++) { -if (max_idx[i] >= 0) -bitmaps[i] = virBitmapNew(max_idx[i] + 1); -nbitmaps++; -} - -for (i = 0; i < def->ncontrollers; i++) { -cont = def->controllers[i]; - -if (max_idx[cont->type] == -1) -continue; - -if (virBitmapIsBitSet(bitmaps[cont->type], cont->idx)) { -virReportError(VIR_ERR_XML_ERROR, - _("Multiple '%s' controllers with index '%d'"), - virDomainControllerTypeToString(cont->type), - cont->idx); -goto cleanup; -} -ignore_value(virBitmapSetBit(bitmaps[cont->type], cont->idx)); -
[PATCH 3/3] domain_postparse: Move error messages onto single line
Our coding style suggests 80 chars per line with error messages being exception (for easier git-grep). Apply this exception onto the newly created domain_postparse.c file. Signed-off-by: Michal Privoznik --- src/conf/domain_postparse.c | 49 - 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c index 18f06dcca8..df59de2d0d 100644 --- a/src/conf/domain_postparse.c +++ b/src/conf/domain_postparse.c @@ -57,16 +57,14 @@ virDomainDefPostParseMemory(virDomainDef *def, * properly. */ if (hotplugMemory > def->mem.total_memory) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("Total size of memory devices exceeds the total " - "memory size")); + _("Total size of memory devices exceeds the total memory size")); return -1; } } if (virDomainDefGetMemoryInitial(def) == 0) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("Memory size must be specified via or in the " - " configuration")); + _("Memory size must be specified via or in the configuration")); return -1; } @@ -77,16 +75,14 @@ virDomainDefPostParseMemory(virDomainDef *def, if ((def->mem.max_memory || def->mem.memory_slots) && !(def->mem.max_memory && def->mem.memory_slots)) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("both maximum memory size and " - "memory slot count must be specified")); + _("both maximum memory size and memory slot count must be specified")); return -1; } if (def->mem.max_memory && def->mem.max_memory < virDomainDefGetMemoryTotal(def)) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("maximum memory size must be equal or greater than " - "the actual memory size")); + _("maximum memory size must be equal or greater than the actual memory size")); return -1; } @@ -102,8 +98,7 @@ virDomainDefPostParseOs(virDomainDef *def) if (def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SECURE_BOOT] == VIR_TRISTATE_BOOL_NO) { virReportError(VIR_ERR_XML_DETAIL, "%s", - _("firmware feature 'enrolled-keys' cannot be enabled when " - "firmware feature 'secure-boot' is disabled")); + _("firmware feature 'enrolled-keys' cannot be enabled when firmware feature 'secure-boot' is disabled")); return -1; } @@ -165,8 +160,7 @@ virDomainDefPostParseTimer(virDomainDef *def) timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK) { if (timer->tickpolicy) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("timer %s doesn't support setting of " - "timer tickpolicy"), + _("timer %s doesn't support setting of timer tickpolicy"), virDomainTimerNameTypeToString(timer->name)); return -1; } @@ -177,24 +171,21 @@ virDomainDefPostParseTimer(virDomainDef *def) timer->catchup.limit != 0 || timer->catchup.slew != 0)) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("setting of timer catchup policies is only " - "supported with tickpolicy='catchup'")); + _("setting of timer catchup policies is only supported with tickpolicy='catchup'")); return -1; } if (timer->name != VIR_DOMAIN_TIMER_NAME_TSC) { if (timer->frequency != 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("timer %s doesn't support setting of " - "timer frequency"), + _("timer %s doesn't support setting of timer frequency"), virDomainTimerNameTypeToString(timer->name)); return -1; } if (timer->mode) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("timer %s doesn't support setting of " - "timer mode"), + _("timer %s doesn't support setting of timer mode"), virDomainTimerNameTypeToString(timer->name)); return -1; } @@ -204,8 +195,7 @@ virDomainDefPostParseTimer(virDomainDef *def) timer->name != VIR_DOMAIN_TIMER_NAME_RTC) { if (timer->track != VIR_DOMAIN_TIMER_TRACK_NONE) { virReport
[PATCH 0/3] conf: Separate domain post parse code into domain_postparse.c
*** BLURB HERE *** Michal Prívozník (3): domain_conf: Unexport virDomainDefPostParseDeviceIteratorData conf: Separate domain post parse code into domain_postparse.c domain_postparse: Move error messages onto single line po/POTFILES |1 + src/conf/domain_conf.c | 1446 +- src/conf/domain_conf.h | 10 - src/conf/domain_postparse.c | 1466 +++ src/conf/domain_postparse.h | 37 + src/conf/domain_validate.c | 11 +- src/conf/meson.build|1 + src/libvirt_private.syms|5 +- src/libxl/xen_xl.c |1 + src/libxl/xen_xm.c |1 + src/lxc/lxc_native.c|1 + src/qemu/qemu_driver.c |1 + src/qemu/qemu_process.c |1 + src/vmx/vmx.c |1 + 14 files changed, 1525 insertions(+), 1458 deletions(-) create mode 100644 src/conf/domain_postparse.c create mode 100644 src/conf/domain_postparse.h -- 2.35.1
[PATCH 1/3] domain_conf: Unexport virDomainDefPostParseDeviceIteratorData
The virDomainDefPostParseDeviceIteratorData struct is exported in domain_conf.h because it's used in both domain_conf.c and domain_validate.c. However, the latter usage is not warranted, it's just a shortcut so that we don't have to introduce a similar struct just for domain_validate.c. Well, do the extra step and introduce a separate structure for domain_validate.c. This allows us to move post parse code later on. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 7 +++ src/conf/domain_conf.h | 6 -- src/conf/domain_validate.c | 11 +-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2c2f23242e..c67fcd337d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6031,6 +6031,13 @@ virDomainDeviceDefPostParseOne(virDomainDeviceDef *dev, } +struct virDomainDefPostParseDeviceIteratorData { +virDomainXMLOption *xmlopt; +void *parseOpaque; +unsigned int parseFlags; +}; + + static int virDomainDefPostParseDeviceIterator(virDomainDef *def, virDomainDeviceDef *dev, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4c8c42b7eb..543b343be9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3302,12 +3302,6 @@ struct _virDomainXMLOption { }; G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainXMLOption, virObjectUnref); -struct virDomainDefPostParseDeviceIteratorData { -virDomainXMLOption *xmlopt; -void *parseOpaque; -unsigned int parseFlags; -}; - bool virDomainSCSIDriveAddressIsUsed(const virDomainDef *def, const virDomainDeviceDriveAddress *addr); diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 57d4e63a26..814922cd46 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1889,13 +1889,20 @@ virDomainDefValidateInternal(const virDomainDef *def, } +struct virDomainDefValidateDeviceIteratorData { +virDomainXMLOption *xmlopt; +void *parseOpaque; +unsigned int parseFlags; +}; + + static int virDomainDefValidateDeviceIterator(virDomainDef *def, virDomainDeviceDef *dev, virDomainDeviceInfo *info G_GNUC_UNUSED, void *opaque) { -struct virDomainDefPostParseDeviceIteratorData *data = opaque; +struct virDomainDefValidateDeviceIteratorData *data = opaque; return virDomainDeviceDefValidate(dev, def, data->parseFlags, data->xmlopt, data->parseOpaque); @@ -1924,7 +1931,7 @@ virDomainDefValidate(virDomainDef *def, virDomainXMLOption *xmlopt, void *parseOpaque) { -struct virDomainDefPostParseDeviceIteratorData data = { +struct virDomainDefValidateDeviceIteratorData data = { .xmlopt = xmlopt, .parseFlags = parseFlags, .parseOpaque = parseOpaque, -- 2.35.1