From 57a6e9773ea208cb68c187b60c654176eff9818c Mon Sep 17 00:00:00 2001 From: Akash Kulhalli Date: Wed, 10 Jun 2026 16:24:14 +0530 Subject: [PATCH] qemuhotplugtest: test setvcpus async downscale Add async unplug coverage for the setvcpus count-based path. The test downscales an x86 domain by multiple hotpluggable vCPU entities, verifying the pending XML before completion, the final XML after DEVICE_DELETED processing, and one vcpu-removed event for each removed vCPU. Signed-off-by: Akash Kulhalli Reviewed-by: Peter Krempa --- tests/qemuhotplugtest.c | 22 ++- ...x86-modern-bulk-downscale-async-domain.xml | 42 +++++ ...6-modern-bulk-downscale-async-monitor.json | 159 ++++++++++++++++++ ...odern-bulk-downscale-async-result-conf.xml | 42 +++++ ...odern-bulk-downscale-async-result-live.xml | 50 ++++++ ...lk-downscale-async-result-pending-live.xml | 50 ++++++ 6 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-domain.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-monitor.json create mode 100644 tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-result-conf.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-result-live.xml create mode 100644 tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-result-pending-live.xml diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index d6924202e6..60940a5df7 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -758,7 +758,7 @@ testQemuHotplugCpuAsync(const struct testQemuHotplugCpuAsyncParams *async, } -static int G_GNUC_UNUSED +static int testQemuHotplugCpuGroupAsync(const void *opaque) { return testQemuHotplugCpuAsync(opaque, true); @@ -1180,6 +1180,26 @@ mymain(void) DO_TEST_CPU_INDIVIDUAL_ASYNC("ppc64", "ppc64-modern-individual-del-async", "16-23", "vcpu16", "16-23"); + do { + const char *aliases[] = { "vcpu7", "vcpu6", "vcpu5", "vcpu4" }; + const struct testQemuHotplugCpuAsyncParams async = { + .test = "x86-modern-bulk-downscale-async", + .newcpus = 4, + .conn = conn, + .deviceDeletedAliases = aliases, + .ndeviceDeletedAliases = G_N_ELEMENTS(aliases), + .removedVcpus = "4-7", + .arch = "x86_64", + .capsLatestFiles = capsLatestFiles, + .capsCache = capsCache, + .schemaCache = schemaCache, + }; + + if (virTestRun("hotplug vcpus group async x86-modern-bulk-downscale-async", + testQemuHotplugCpuGroupAsync, &async) < 0) + ret = -1; + } while (0); + qemuTestDriverFree(&driver); virObjectUnref(data.vm); return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; diff --git a/tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-domain.xml b/tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-domain.xml new file mode 100644 index 0000000000..513735211b --- /dev/null +++ b/tests/qemuhotplugtestcpus/x86-modern-bulk-downscale-async-domain.xml @@ -0,0 +1,42 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 8 + + + + + + + + + + + + hvm + + + + qemu64 + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + + + +