Add Power10 compat mode tests with vcpu plug_unplug!#6899
Add Power10 compat mode tests with vcpu plug_unplug!#6899Anushree-Mathur wants to merge 1 commit into
Conversation
Add Power10 compatibility mode testing for CPU hotplug/unplug on Power11 systems. Enables testing backward compatibility scenarios where guests run with older Power CPU models. - Add compat_mode and cpu_model parameters - Add with_power10_compat config variant - Restrict to POWER11 hosts via config filter - Test hotplug/unplug with power10 CPU model 7 testcases have been added, in which it brings up the compat mode guest then run vcpu plug_unplug on the guest having different numa or hugepages configuration. Signed-off-by: Anushree-Mathur <anushree.mathur@linux.ibm.com>
WalkthroughA new Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 243-244: The compat_mode variable at line 243 is assigned a raw
string from params.get(), which causes a false-positive when checked with if
compat_mode at line 303, since the string "no" is still truthy. Replace the
assignment of compat_mode with explicit boolean parsing using the same pattern
as other boolean flags in this file (likely params.get_bool() or equivalent), so
that string values like "no" are properly parsed as False instead of being
treated as truthy.
- Around line 307-310: Add the missing imports at the top of the
libvirt_vcpu_plug_unplug.py file to resolve the NameError exceptions. The
exception handler at line 308 references xcepts.LibvirtXMLNotFoundError which
requires importing the xcepts module, and line 310 instantiates VMCPUXML() which
requires importing the VMCPUXML class. Add both imports in the appropriate
import section of the file alongside other existing imports from the virttest
library and related modules.
🪄 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: e6b177d6-e1b8-405f-9e42-e30df56d2015
📒 Files selected for processing (2)
libvirt/tests/cfg/libvirt_vcpu_plug_unplug.cfglibvirt/tests/src/libvirt_vcpu_plug_unplug.py
| compat_mode = params.get("compat_mode") | ||
| cpu_model = params.get("cpu_model") |
There was a problem hiding this comment.
Use explicit yes/no parsing for compat_mode to avoid false-positive activation.
Line 243 stores a raw string and Line 303 checks truthiness, so "no" would still enter compat-mode logic. Parse it like other flags in this file.
Suggested fix
- compat_mode = params.get("compat_mode")
- cpu_model = params.get("cpu_model")
+ compat_mode = "yes" == params.get("compat_mode", "no")
+ cpu_model = params.get("cpu_model")🤖 Prompt for 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.
In `@libvirt/tests/src/libvirt_vcpu_plug_unplug.py` around lines 243 - 244, The
compat_mode variable at line 243 is assigned a raw string from params.get(),
which causes a false-positive when checked with if compat_mode at line 303,
since the string "no" is still truthy. Replace the assignment of compat_mode
with explicit boolean parsing using the same pattern as other boolean flags in
this file (likely params.get_bool() or equivalent), so that string values like
"no" are properly parsed as False instead of being treated as truthy.
| cpu_xml = vmxml.cpu | ||
| except xcepts.LibvirtXMLNotFoundError: | ||
| logging.debug("No CPU element found, creating new one") | ||
| cpu_xml = VMCPUXML() |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify canonical definitions/import patterns for these symbols in this repo.
rg -n "class VMCPUXML|LibvirtXMLNotFoundError" -C2
rg -n "from virttest\.libvirt_xml import xcepts|from virttest\.libvirt_xml\.vm_xml import .*VMCPUXML" -C2Repository: autotest/tp-libvirt
Length of output: 37962
🏁 Script executed:
head -50 libvirt/tests/src/libvirt_vcpu_plug_unplug.py | cat -nRepository: autotest/tp-libvirt
Length of output: 1896
🏁 Script executed:
sed -n '305,315p' libvirt/tests/src/libvirt_vcpu_plug_unplug.py | cat -nRepository: autotest/tp-libvirt
Length of output: 543
Import xcepts and VMCPUXML to fix undefined name errors.
The exception handler at line 308 references xcepts.LibvirtXMLNotFoundError, and line 310 instantiates VMCPUXML(), but neither is imported. This will raise NameError when the fallback path executes.
Fix
from virttest.libvirt_xml.vm_xml import VMXML
+from virttest.libvirt_xml import xcepts
+from virttest.libvirt_xml.vm_xml import VMCPUXMLOr combine into a single import line:
-from virttest.libvirt_xml.vm_xml import VMXML
+from virttest.libvirt_xml import xcepts
+from virttest.libvirt_xml.vm_xml import VMXML, VMCPUXML🧰 Tools
🪛 Ruff (0.15.17)
[error] 308-308: Undefined name xcepts
(F821)
[error] 310-310: Undefined name VMCPUXML
(F821)
🤖 Prompt for 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.
In `@libvirt/tests/src/libvirt_vcpu_plug_unplug.py` around lines 307 - 310, Add
the missing imports at the top of the libvirt_vcpu_plug_unplug.py file to
resolve the NameError exceptions. The exception handler at line 308 references
xcepts.LibvirtXMLNotFoundError which requires importing the xcepts module, and
line 310 instantiates VMCPUXML() which requires importing the VMCPUXML class.
Add both imports in the appropriate import section of the file alongside other
existing imports from the virttest library and related modules.
Source: Linters/SAST tools
|
I request maintainers to merge below patch first, otherwise it will be a conflict between patches! Thank you, |
|
All testcases were passing while running it on P11 system Testcases are not running on P10 lpar |
Add Power10 compatibility mode testing for CPU hotplug/unplug on Power11 systems. Enables testing backward compatibility scenarios where guests run with older Power CPU models.
7 testcases have been added, in which it brings up the compat mode guest then run vcpu plug_unplug on the guest having different numa or hugepages configuration.
Signed-off-by: Anushree-Mathur anushree.mathur@linux.ibm.com
Summary by CodeRabbit