-
Notifications
You must be signed in to change notification settings - Fork 190
Add Power10 compat mode tests with vcpu plug_unplug! #6899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -240,6 +240,8 @@ def check_setvcpus_result(cmd_result, expect_error): | |
| with_stress = "yes" == params.get("run_stress", "no") | ||
| iterations = int(params.get("test_itr", 1)) | ||
| topology_correction = "yes" == params.get("topology_correction", "no") | ||
| compat_mode = params.get("compat_mode") | ||
| cpu_model = params.get("cpu_model") | ||
| # Init expect vcpu count values | ||
| expect_vcpu_num = {'max_config': vcpu_max_num, 'max_live': vcpu_max_num, | ||
| 'cur_config': vcpu_current_num, | ||
|
|
@@ -298,6 +300,21 @@ def check_setvcpus_result(cmd_result, expect_error): | |
| vmxml.set_agent_channel() | ||
| else: | ||
| vmxml.remove_agent_channels() | ||
| if compat_mode: | ||
| logging.info("Setting compatibility mode with CPU model: %s", cpu_model) | ||
|
|
||
| try: | ||
| cpu_xml = vmxml.cpu | ||
| except xcepts.LibvirtXMLNotFoundError: | ||
| logging.debug("No CPU element found, creating new one") | ||
| cpu_xml = VMCPUXML() | ||
|
Comment on lines
+307
to
+310
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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 The exception handler at line 308 references 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 (F821) [error] 310-310: Undefined name (F821) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| # Force mode to host-model when explicit compat model is provided | ||
| cpu_xml.mode = "host-model" | ||
| cpu_xml.model = cpu_model | ||
| vmxml.cpu = cpu_xml | ||
| logging.info("CPU mode set to 'host-model' with model '%s'", cpu_model) | ||
|
|
||
| vmxml.sync() | ||
|
|
||
| vmxml.set_vm_vcpus(vm_name, vcpu_max_num, vcpu_current_num, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use explicit yes/no parsing for
compat_modeto 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
🤖 Prompt for AI Agents