add with_topology: hotplug/unplug vCPUs with explicit sockets/cores/threads topology! - #33
Open
Anushree-Mathur wants to merge 1 commit into
Open
Conversation
…ogy!
What the test does:
1. Defines the VM with an explicit CPU topology
(topology_sockets/cores/threads) and a capped vcpu_max_num before
the VM starts, instead of relying on set_vm_vcpus() topology
correction.
2. If numa=yes is also set, redistributes the pre-existing NUMA cells
to match the new vcpu_max_num: CPU ranges are recalculated
(cpus_per_cell = vcpu_max / num_cells) and each cell receives an
equal share of the total guest memory
(cell_memory_kib = mem_MiB * 1024 / num_cells).
3. Starts the VM and verifies the initial vcpu count matches
vcpu_current_num.
4. Hotplugs vCPUs live (virsh setvcpus --live) to vcpu_plug_num,
waits for the new CPUs to come online in the guest, and verifies
the count.
5. Unplugs back to vcpu_unplug_num (first bumps to vcpu_max_num to
ensure all added vCPUs are hotpluggable, then reduces), and
verifies the final count.
Steps 3-5 are repeated test_itr times (default 1).
libvirt/tests/cfg/libvirt_vcpu_plug_unplug.cfg:
Add with_topology variant with three sub-variants for ppc64le/ppc64:
- threads_2: sockets=1, cores=4, threads=2, vcpu_max=8
- threads_4: sockets=1, cores=2, threads=4, vcpu_max=8
- threads_8: sockets=1, cores=2, threads=8, vcpu_max=16
Parameters match subtests.cfg authoritative definitions exactly.
libvirt/tests/src/libvirt_vcpu_plug_unplug.py:
Read topology_required/topology_sockets/cores/threads params.
When topology_required=yes, set vcpu/current_vcpu directly and
inject <topology> into the <cpu> element via VMCPUXML, then sync.
When numa=yes is also set, re-read the inactive XML, recalculate
all NUMA cell CPU ranges and per-cell memory, and sync again.
This avoids the stale per-cell copy bug (inflating total guest RAM
by num_cells x) that caused QEMU OOM on start.
All non-topology variants reach set_vm_vcpus() unchanged via the
else branch.
Signed-off-by: Anushree-Mathur <anushree.mathur@linux.ibm.com>
Signed-off-by: Anushree-Mathur <anushree.mathur@linux.ibm.com>
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What the test does:
libvirt/tests/cfg/libvirt_vcpu_plug_unplug.cfg:
Add with_topology variant with three sub-variants for ppc64le/ppc64:
With all above threads scenarios it will vcpu plug unplug for specified iterations!
libvirt/tests/src/libvirt_vcpu_plug_unplug.py:
Read topology_required/topology_sockets/cores/threads params.
When topology_required=yes, set vcpu/current_vcpu directly and
inject into the element via VMCPUXML, then sync.
When numa=yes is also set, re-read the inactive XML, recalculate
all NUMA cell CPU ranges and per-cell memory, and sync again.
Signed-off-by: Anushree-Mathur <anushree.mathur@linux.ibm.com>