Skip to content

Conversation

@Anushree-Mathur
Copy link
Contributor

@Anushree-Mathur Anushree-Mathur commented Jan 5, 2026

Support for kqemu was dropped in libvirt by commit 8e91a400c, so it is failing as expected. I have added the condition to cancel this testcase if libvirt version is greater than 2.19.2!
Reference link to confirm dropping kqemu support : https://lists.libvirt.org/archives/list/devel%40lists.libvirt.org/thread/PXHESERQAWL2NFDGZWDYY4I4M567YXDX/?utm_source=chatgpt.com
Signed-off-by: Anushree-Mathur anushree.mathur@linux.ibm.com

Summary by CodeRabbit

  • Tests
    • Added a pre-check to skip test scenarios that reference "kqemu" on libvirt 2.19.2 and newer, preventing incompatible test runs in updated environments.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Warning

Rate limit exceeded

@Anushree-Mathur has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a9b599f and 316c2c1.

📒 Files selected for processing (1)
  • libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py

Walkthrough

A pre-check was added to the virsh_maxvcpus test that skips the test when libvirt version is 2.19.2 or newer and the virsh_maxvcpus option contains "kqemu". The new pre-check is placed before the option variable is initialized, which can raise a NameError at runtime. No other changes to control flow, error handling, or exported entities are present.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: handling kqemu test case by skipping it in libvirt 2.19.2 onwards due to dropped support.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py:
- Around line 118-121: Fix the indentation of the nested if so the line with
test.cancel uses 4-space indent (align under the inner if), and move the entire
libvirt_version.version_compare / "kqemu" check to immediately after parameter
retrieval (i.e., right after option = params.get("virsh_maxvcpus_options")) to
avoid expensive setup; update the test.cancel message to clearly reference the
libvirt version constraint only (e.g., mention libvirt 2.19.2) and ensure you
use libvirt_version.version_compare and option/test.cancel as the referenced
symbols.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5944e17 and c6cd59c.

📒 Files selected for processing (1)
  • libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6652
File: libvirt/tests/cfg/virtual_network/passt/passt_function.cfg:106-106
Timestamp: 2025-11-24T10:44:47.801Z
Learning: In libvirt/tests/cfg/virtual_network/passt/passt_function.cfg, passt test cases have only one interface, so running `dhcpcd` without specifying an interface is safe and doesn't cause network disruption.
Learnt from: hholoubk
Repo: autotest/tp-libvirt PR: 6579
File: libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py:95-97
Timestamp: 2025-09-24T08:01:27.899Z
Learning: In the libvirt test framework used in tp-libvirt, VM cleanup including destroying running VMs is handled by the teardown method (test_obj.teardown_iommu_test()) called in the finally block, so explicit VM destroy calls on timeout are not necessary according to the maintainers.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Python 3.12
  • GitHub Check: Python 3.9
  • GitHub Check: Python 3.11
  • GitHub Check: Python 3.8

Comment on lines 118 to 121
# Checking libvirt version before running maxvcpus with kqemu
if libvirt_version.version_compare(2, 19, 2):
if "kqemu" in option:
test.cancel("kqemu is not supported in qemu 0.12 and libvirt 2.19.2 onwards")
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix indentation error on line 121.

Line 121 has incorrect indentation with 8 spaces instead of the expected 4 spaces after the if statement on line 120. This violates Python's PEP 8 style guidelines and will be flagged by linters.

🔎 Proposed fix for indentation
 # Checking libvirt version before running maxvcpus with kqemu
 if libvirt_version.version_compare(2, 19, 2):
     if "kqemu" in option:
-                test.cancel("kqemu is not supported in qemu 0.12 and libvirt 2.19.2 onwards")
+            test.cancel("kqemu is not supported in qemu 0.12 and libvirt 2.19.2 onwards")

Consider moving this check earlier to avoid unnecessary setup.

The kqemu version check is currently placed after the expensive domcapabilities XML parsing (lines 79-110). Moving this check to right after the parameter retrieval (around line 32) would skip unnecessary work when the test will be canceled anyway.

🔎 Suggested placement

Move the check to after line 32, right after retrieving the option parameter:

# get the params from subtests.
# params for general.
option = params.get("virsh_maxvcpus_options")
status_error = params.get("status_error")
connect_arg = params.get("connect_arg", "")

# Checking libvirt version before running maxvcpus with kqemu
if libvirt_version.version_compare(2, 19, 2):
    if "kqemu" in option:
        test.cancel("kqemu is not supported in qemu 0.12 and libvirt 2.19.2 onwards")

Consider clarifying the error message.

The message "kqemu is not supported in qemu 0.12 and libvirt 2.19.2 onwards" mentions both qemu 0.12 and libvirt 2.19.2, which could be confusing. Consider simplifying to focus on the libvirt version constraint that's being checked.

🔎 Suggested message improvement
-            test.cancel("kqemu is not supported in qemu 0.12 and libvirt 2.19.2 onwards")
+            test.cancel("kqemu is not supported in libvirt 2.19.2 and later versions")
🤖 Prompt for AI Agents
In @libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py around lines 118-121, Fix
the indentation of the nested if so the line with test.cancel uses 4-space
indent (align under the inner if), and move the entire
libvirt_version.version_compare / "kqemu" check to immediately after parameter
retrieval (i.e., right after option = params.get("virsh_maxvcpus_options")) to
avoid expensive setup; update the test.cancel message to clearly reference the
libvirt version constraint only (e.g., mention libvirt 2.19.2) and ensure you
use libvirt_version.version_compare and option/test.cancel as the referenced
symbols.

@Anushree-Mathur Anushree-Mathur force-pushed the kqemu branch 2 times, most recently from 865ff9d to a9b599f Compare January 5, 2026 09:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Fix all issues with AI Agents 🤖
In @libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py:
- Around line 28-35: The NameError arises because option is referenced before
assignment; move the libvirt version check that uses option (the call to
libvirt_version.version_compare(...) and the subsequent if "kqemu" in option
block that calls test.cancel(...)) to after you retrieve option from params via
option = params.get("virsh_maxvcpus_options"); also fix the cancel message text
to read "kqemu is not supported in libvirt 2.19.2 and qemu 0.12 onwards" so it’s
grammatically correct.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6cd59c and a9b599f.

📒 Files selected for processing (1)
  • libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: hholoubk
Repo: autotest/tp-libvirt PR: 6579
File: libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py:95-97
Timestamp: 2025-09-24T08:01:27.899Z
Learning: In the libvirt test framework used in tp-libvirt, VM cleanup including destroying running VMs is handled by the teardown method (test_obj.teardown_iommu_test()) called in the finally block, so explicit VM destroy calls on timeout are not necessary according to the maintainers.
Learnt from: qiankehan
Repo: autotest/tp-libvirt PR: 6652
File: libvirt/tests/cfg/virtual_network/passt/passt_function.cfg:106-106
Timestamp: 2025-11-24T10:44:47.801Z
Learning: In libvirt/tests/cfg/virtual_network/passt/passt_function.cfg, passt test cases have only one interface, so running `dhcpcd` without specifying an interface is safe and doesn't cause network disruption.
🪛 Ruff (0.14.10)
libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py

30-30: Undefined name option

(F821)

Comment on lines 28 to 35
# Checking libvirt version before running maxvcpus with kqemu
if libvirt_version.version_compare(2, 19, 2):
if "kqemu" in option:
test.cancel("kqemu is not supported libvirt 2.19.2 and qemu 0.12 onwards")

# get the params from subtests.
# params for general.
option = params.get("virsh_maxvcpus_options")
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

option is used before it's defined — causes NameError at runtime.

The variable option is referenced on line 30 before it's assigned on line 35. This will crash the test with NameError: name 'option' is not defined.

Move the version check to immediately after the parameter retrieval.

🔎 Proposed fix
 def run(test, params, env):
     """
     Test the command virsh maxvcpus

     (1) Call virsh maxvcpus
     (2) Call virsh -c remote_uri maxvcpus
     (3) Call virsh maxvcpus with an unexpected option
     """

-    # Checking libvirt version before running maxvcpus with kqemu
-    if libvirt_version.version_compare(2, 19, 2):
-        if "kqemu" in option:
-            test.cancel("kqemu is not supported libvirt 2.19.2 and qemu 0.12 onwards")
-
     # get the params from subtests.
     # params for general.
     option = params.get("virsh_maxvcpus_options")
     status_error = params.get("status_error")
     connect_arg = params.get("connect_arg", "")

+    # Checking libvirt version before running maxvcpus with kqemu
+    if libvirt_version.version_compare(2, 19, 2):
+        if "kqemu" in option:
+            test.cancel("kqemu is not supported in libvirt 2.19.2 onwards")
+
     # params for transport connect.
     local_ip = params.get("local_ip", "ENTER.YOUR.LOCAL.IP")

Also note: the message has a minor grammar issue — "is not supported libvirt" should be "is not supported in libvirt".

🧰 Tools
🪛 Ruff (0.14.10)

30-30: Undefined name option

(F821)

🤖 Prompt for AI Agents
In @libvirt/tests/src/virsh_cmd/host/virsh_maxvcpus.py around lines 28-35, The
NameError arises because option is referenced before assignment; move the
libvirt version check that uses option (the call to
libvirt_version.version_compare(...) and the subsequent if "kqemu" in option
block that calls test.cancel(...)) to after you retrieve option from params via
option = params.get("virsh_maxvcpus_options"); also fix the cancel message text
to read "kqemu is not supported in libvirt 2.19.2 and qemu 0.12 onwards" so it’s
grammatically correct.

@Anushree-Mathur
Copy link
Contributor Author

Before applying the patch :

JOB LOG    : /home/Anu/tests/results/job-2026-01-05T04.08-9d65184/job.log
 (1/4) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
 (1/4) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (42.96 s)
 (2/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu: STARTED
 (2/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu: FAIL: Run command failed (4.37 s)
 (3/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu1: STARTED
 (3/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu1: FAIL: Run command failed (4.39 s)
 (4/4) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
 (4/4) io-github-autotest-libvirt.remove_guest.without_disk: PASS (4.49 s)
RESULTS    : PASS 2 | ERROR 0 | FAIL 2 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0

 

After applying the patch :

 (1/4) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: STARTED
 (1/4) io-github-autotest-qemu.unattended_install.import.import.default_install.aio_native: PASS (43.02 s)
 (2/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu: STARTED
 (2/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu: CANCEL: kqemu is not supported libvirt 2.19.2 and qemu 0.12 onwards (4.08 s)
 (3/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu1: STARTED
 (3/4) type_specific.io-github-autotest-libvirt.virsh.maxvcpus.connect_to_local.with_option.with_kqemu1: CANCEL: kqemu is not supported libvirt 2.19.2 and qemu 0.12 onwards (4.07 s)
 (4/4) io-github-autotest-libvirt.remove_guest.without_disk: STARTED
 (4/4) io-github-autotest-libvirt.remove_guest.without_disk: PASS (4.46 s)
RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 2

Support for kqemu was dropped in libvirt by commit 8e91a400c,
so it is failing as expected. I have added the condition to cancel
this testcase if libvirt version is greater than 2.19.2!
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