Skip to content

Adding testcases for cpu_modes along with vcpu plug-unplug!#6898

Open
Anushree-Mathur wants to merge 1 commit into
autotest:masterfrom
Anushree-Mathur:cpu_modes
Open

Adding testcases for cpu_modes along with vcpu plug-unplug!#6898
Anushree-Mathur wants to merge 1 commit into
autotest:masterfrom
Anushree-Mathur:cpu_modes

Conversation

@Anushree-Mathur

@Anushree-Mathur Anushree-Mathur commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Add cpu_mode parameter to enable testing vcpu hotplug/unplug operations with different CPU modes (host-model, host-passthrough, custom) across various NUMA and hugepages configurations. This allows comprehensive testing of CPU hotplug functionality with different CPU configurations combined with memory topology variants.

Additionally, normalize CPU model names to lowercase when using host-model to ensure consistent behavior across latest QEMU/libvirt versions.

It is adding 10 more testcases.

Signed-off-by: Anushree-Mathur anushree.mathur@linux.ibm.com

Summary by CodeRabbit

  • Tests
    • Expanded vCPU plug/unplug test coverage with additional CPU mode scenarios
    • Enhanced test logic to validate CPU configuration during vCPU hot-plug and unplug operations

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Anushree-Mathur, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4233c069-0306-4f03-ad10-e10fe3798450

📥 Commits

Reviewing files that changed from the base of the PR and between 16c7ac4 and 9e94262.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/libvirt_vcpu_plug_unplug.cfg
  • libvirt/tests/src/libvirt_vcpu_plug_unplug.py

Walkthrough

The pull request extends the libvirt_vcpu_plug_unplug test with CPU mode support. In the configuration file, a new with_cpu_mode variant block is added under positive tests, containing two sub-variants (host_model and host_passthrough) that each set cpu_mode, restrict to live testing, configure 5 iterations, and define vCPU max/current/plug/unplug counts. In the test script, a cpu_mode parameter is read from params, and when present, the VM's CPU XML element is retrieved or created, its mode is set, and for host-model the existing CPU model name is lowercased before the configuration is written back. The run() docstring is also updated to document the new test steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding test cases that combine CPU mode variations with vCPU plug-unplug operations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Anushree-Mathur

Copy link
Copy Markdown
Contributor Author

(01/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(01/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (93.42 s)
(02/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(02/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (313.82 s)
(03/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(03/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (7.19 s)
(04/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(04/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (93.57 s)
(05/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(05/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (313.98 s)
(06/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(06/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (7.15 s)
(07/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(07/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (92.52 s)
(08/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(08/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (315.05 s)
(09/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(09/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (7.18 s)
(10/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(10/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (93.06 s)
(11/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(11/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (314.35 s)
(12/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(12/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (7.24 s)
(13/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(13/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (89.96 s)
(14/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(14/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (312.14 s)
(15/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(15/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (5.93 s)
(16/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(16/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (88.59 s)
(17/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(17/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (313.43 s)
(18/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(18/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (5.94 s)
(19/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
(19/21) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (92.93 s)
(20/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: STARTED
(20/21) type_specific.io-github-autotest-libvirt.libvirt_vcpu_plug_unplug.positive_test.vcpu_set.live.with_cpu_mode.host-model: PASS (291.99 s)
(21/21) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
(21/21) io-github-autotest-libvirt.remove_guest.without_disk: PASS (7.17 s)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libvirt/tests/src/libvirt_vcpu_plug_unplug.py`:
- Around line 309-313: The code references xcepts.LibvirtXMLNotFoundError on
line 311 and VMCPUXML on line 313, but neither symbol is imported at the top of
the file. Add the missing imports: import the xcepts module (or the specific
LibvirtXMLNotFoundError exception from it) and import the VMCPUXML class. These
imports must be added to the imports section at the beginning of the
libvirt_vcpu_plug_unplug.py file to prevent NameError exceptions when the
exception handling code path is executed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4391f7bd-9edb-4cf2-bd06-910eed334919

📥 Commits

Reviewing files that changed from the base of the PR and between c96ab65 and 16c7ac4.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/libvirt_vcpu_plug_unplug.cfg
  • libvirt/tests/src/libvirt_vcpu_plug_unplug.py

Comment thread libvirt/tests/src/libvirt_vcpu_plug_unplug.py
Add cpu_mode parameter to enable testing vcpu hotplug/unplug operations with
different CPU modes (host-model, host-passthrough, custom) across various
NUMA and hugepages configurations. This allows comprehensive testing of CPU
hotplug functionality with different CPU configurations combined with memory
topology variants.

Additionally, normalize CPU model names to lowercase when using host-model
to ensure consistent behavior across latest QEMU/libvirt versions.

It is adding 10 more testcases.
Signed-off-by: Anushree-Mathur <anushree.mathur@linux.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant