-
Notifications
You must be signed in to change notification settings - Fork 183
memory_invalid_value: Add libvirt version-based test cancellation for 0 memory size numa node #6718
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?
Conversation
WalkthroughThe change moves a top-level libvirt version constraint into the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
a759127 to
60145d5
Compare
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.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libvirt/tests/cfg/memory/memory_allocation/memory_invalid_value.cfg(1 hunks)libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py(2 hunks)
🧰 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.
🪛 Ruff (0.14.8)
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py
72-72: Use of possibly insecure function; consider using ast.literal_eval
(S307)
⏰ 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
🔇 Additional comments (2)
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py (2)
81-84: Version check logic is correct.The version checking logic appropriately cancels the test when libvirt version is >= 11.8.0, which aligns with the PR objective. The test will run on versions 9.0.0 through 11.7.x, where 0-memory NUMA nodes are expected to be invalid.
Note: After fixing the typo in line 72, update line 82 to reference the corrected variable name
func_not_supported_since_libvirt_ver.After fixing the typo in line 72, apply this corresponding change:
- if func_not_suppored_since_libvirt_ver: - if libvirt_version.version_compare(*func_not_suppored_since_libvirt_ver): - test.cancel("Test is not supported since libvirt version:%s" % str(func_not_suppored_since_libvirt_ver)) + if func_not_supported_since_libvirt_ver: + if libvirt_version.version_compare(*func_not_supported_since_libvirt_ver): + test.cancel("Test is not supported since libvirt version:%s" % str(func_not_supported_since_libvirt_ver))
85-86: Improved control flow with version checks before setup.The reordering to execute
setup_test()andrun_test()after version validation is correct. This ensures that test setup and execution only occur when the libvirt version falls within the supported range, improving efficiency and preventing unnecessary operations.
libvirt/tests/cfg/memory/memory_allocation/memory_invalid_value.cfg
Outdated
Show resolved
Hide resolved
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py
Outdated
Show resolved
Hide resolved
… 0 memory size numa node Since libvirt 11.8.0, 0 memory size numa node is supported, requiring test cancellation for versions >= 11.8.0 Signed-off-by: Liang Cong <lcong@redhat.com>
60145d5 to
4d6bb74
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py (1)
72-72: Consider usingast.literal_eval()for safer tuple parsing.The static analysis tool flags
eval()as potentially insecure (S307). While parameters originate from controlled configuration files and the same pattern exists at lines 76-77, usingast.literal_eval()is safer for parsing literal structures like tuples.If you decide to address this, consider applying the change consistently to all
eval()calls in this file for uniformity.+import ast + from virttest import virsh- func_not_supported_since_libvirt_ver = eval(params.get("func_not_supported_since_libvirt_ver", "()")) + func_not_supported_since_libvirt_ver = ast.literal_eval(params.get("func_not_supported_since_libvirt_ver", "()"))
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libvirt/tests/cfg/memory/memory_allocation/memory_invalid_value.cfg(1 hunks)libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- libvirt/tests/cfg/memory/memory_allocation/memory_invalid_value.cfg
🧰 Additional context used
🧠 Learnings (3)
📓 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.
📚 Learning: 2025-11-24T10:44:47.801Z
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.
Applied to files:
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py
📚 Learning: 2025-09-24T08:01:27.899Z
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.
Applied to files:
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py
🪛 Ruff (0.14.8)
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py
72-72: Use of possibly insecure function; consider using ast.literal_eval
(S307)
⏰ 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.11
- GitHub Check: Python 3.9
- GitHub Check: Python 3.12
- GitHub Check: Python 3.8
🔇 Additional comments (1)
libvirt/tests/src/memory/memory_allocation/memory_invalid_value.py (1)
81-84: LGTM!The version check logic correctly implements the dual-bound version constraint:
- Line 81 ensures minimum version support via
is_libvirt_feature_supported(params)(which internally handles cancellation based onfunc_supported_since_libvirt_ver)- Lines 82-84 add the upper bound check, cancelling tests for libvirt versions ≥ 11.8.0 where NUMA nodes with 0 memory size became valid
The PR test output confirms the expected behavior.
Since libvirt 11.8.0, 0 memory size numa node is supported, requiring test cancellation for versions >= 11.8.0
Test result:
(1/1) type_specific.io-github-autotest-libvirt.memory.allocation.invalid_value.numa.zero: STARTED
(1/1) type_specific.io-github-autotest-libvirt.memory.allocation.invalid_value.numa.zero: CANCEL: Test is not supported since libvirt version:(11, 8, 0) (8.36 s)
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.