Skip to content

Improve mtu to create guest xml via the framework#6807

Merged
Yingshun merged 1 commit intoautotest:masterfrom
yiqianwei:LIBVIRTAT-22318
Mar 19, 2026
Merged

Improve mtu to create guest xml via the framework#6807
Yingshun merged 1 commit intoautotest:masterfrom
yiqianwei:LIBVIRTAT-22318

Conversation

@yiqianwei
Copy link
Copy Markdown
Contributor

@yiqianwei yiqianwei commented Feb 14, 2026

1.Add some parameters to allow the framework provide guest xml
2.Call cancel_if_ovs_bridge to cancel test when host using linux bridge
3.Add "only Linux" to limit guest type

ID: LIBVIRTAT-22318

Summary by CodeRabbit

  • Tests
    • MTU network test gains Libvirt VM lifecycle controls on Linux: VM creation, non-reboot runs, VM termination, and firmware-specific termination options.
    • Added pre-condition logic to skip MTU tests when Open vSwitch or incompatible bridge backends are detected, or when certain tap/save actions are requested.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f08ad0df-2d61-434c-8838-1faa0740ad6f

📥 Commits

Reviewing files that changed from the base of the PR and between 7c616a3 and b3ac726.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/virtual_network/mtu.cfg
  • libvirt/tests/src/virtual_network/mtu.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • libvirt/tests/src/virtual_network/mtu.py
  • libvirt/tests/cfg/virtual_network/mtu.cfg

Walkthrough

Adds Libvirt VM lifecycle flags to libvirt/tests/cfg/virtual_network/mtu.cfg under the virtual_network.mtu section: only = Linux, create_vm_libvirt = yes, use_no_reboot = yes, kill_vm_libvirt = yes, and ovmf.kill_vm_libvirt_options = --nvram. In libvirt/tests/src/virtual_network/mtu.py the module provider.virtual_network.network_base is imported and OVS-related pre-checks are added: detect OVS test scenarios (based on net_type == 'openvswitch', check == 'ovswitch_net', or 'openvswitch' in add_pkg), cancel the test when an OVS test runs on a Linux Bridge backend, and call network_base.cancel_if_ovs_bridge(params, test) for network/bridge types or when net_type is unset but create_tap is true or check is one of save, managedsave, hotplug_save.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ 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 'Improve mtu to create guest xml via the framework' accurately summarizes the main objective: enabling the mtu test to create guest XML through the test framework instead of manually. The changes in both files directly support this goal—adding framework parameters in the config file and implementing network gating logic in the test code.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

@yiqianwei
Copy link
Copy Markdown
Contributor Author

Test results:
(01/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.iface.q35: PASS (70.21 s)
(02/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.network.with_iface.q35: PASS (72.25 s)
(03/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.network.no_iface.q35: PASS (68.41 s)
(04/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.br.iface.q35: PASS (127.21 s)
(05/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.br.network.with_iface.q35: PASS (127.92 s)
(06/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.ovswitch.iface.q35: PASS (128.34 s)
(07/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.ovswitch.network.with_iface.q35: PASS (128.80 s)
(08/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.save.default.q35: PASS (83.63 s)
(09/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.save.hotplug.q35: PASS (96.24 s)
(10/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.managedsave.q35: PASS (88.34 s)
(11/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.tap.managed_no.smaller.q35: PASS (106.53 s)
(12/26) Host_RHEL.m10.u1.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.tap.managed_no.larger.q35: PASS (104.81 s)

@yiqianwei
Copy link
Copy Markdown
Contributor Author

@yanglei-rh , Could you help to review this patch?

Copy link
Copy Markdown
Contributor

@nickzhq nickzhq left a comment

Choose a reason for hiding this comment

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

LGTM.

@yiqianwei
Copy link
Copy Markdown
Contributor Author

Hi @nickzhq, Add "only Linux" to limit guest type, Could you help review it again?thanks

@Yingshun
Copy link
Copy Markdown
Contributor

@yanglei-rh Can you please help review this pr? Thanks!

if not libvirt_version.version_compare(7, 0, 0):
test.cancel('This test is not supported until libvirt-7.0.0')

if net_type in ('network', 'bridge'):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @yiqianwei According to the case cfg, this case support to test with ovs bridge, why you setup cancel this scenario?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@yanglei-rh ,When the host uses an OVS bridge, skip the relevant non-OVS bridge test cases. When the host uses a Linux bridge, skip the non-Linux bridge test cases.

@yiqianwei
Copy link
Copy Markdown
Contributor Author

yiqianwei commented Mar 18, 2026

Test results:
for linux_br:
(01/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.iface.q35: PASS (49.60 s)
(02/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.network.with_iface.q35: PASS (50.06 s)
(03/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.network.no_iface.q35: PASS (47.75 s)
(04/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.br.iface.q35: PASS (72.61 s)
(05/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.br.network.with_iface.q35: PASS (72.72 s)
(06/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.ovswitch.iface.q35: CANCEL: OVS test case skipped on Linux Bridge host (9.11 s)
(07/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.ovswitch.network.with_iface.q35: CANCEL: OVS test case skipped on Linux Bridge host (9.17 s)
(08/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.save.default.q35: PASS (65.66 s)
(09/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.save.hotplug.q35: PASS (70.41 s)
(10/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.managedsave.q35: PASS (64.52 s)
(11/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.tap.managed_no.smaller.q35: PASS (50.34 s)
(12/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.tap.managed_no.larger.q35: PASS (50.63 s)
(13/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_create.macvtap_type.q35: PASS (10.66 s)
(14/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_create.bridge_type.q35: PASS (10.72 s)
(15/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_create.ovswitch.q35: CANCEL: OVS test case skipped on Linux Bridge host (9.20 s)
(16/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_define.macvtap_type.q35: PASS (10.69 s)
(17/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_define.bridge_type.q35: PASS (10.66 s)
(18/26) Host_RHEL.m9.u8.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_define.ovswitch.q35: CANCEL: OVS test case skipped on Linux Bridge host (9.17 s)

for ovs_br:
(01/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.iface.q35: CANCEL: Host does not use Linux Bridge (8.61 s)
(02/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.network.with_iface.q35: CANCEL: Host does not use Linux Bridge (8.58 s)
(03/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.vnet.network.no_iface.q35: CANCEL: Host does not use Linux Bridge (8.60 s)
(04/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.br.iface.q35: CANCEL: Host does not use Linux Bridge (8.53 s)
(05/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.br.network.with_iface.q35: CANCEL: Host does not use Linux Bridge (8.67 s)
(06/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.ovswitch.iface.q35: PASS (138.89 s)
(07/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.normal.ovswitch.network.with_iface.q35: PASS (139.24 s)
(08/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.save.default.q35: CANCEL: Host does not use Linux Bridge (8.60 s)
(09/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.save.hotplug.q35: CANCEL: Host does not use Linux Bridge (8.58 s)
(10/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.managedsave.q35: CANCEL: Host does not use Linux Bridge (8.59 s)
(11/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.tap.managed_no.smaller.q35: CANCEL: Host does not use Linux Bridge (8.59 s)
(12/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.positive_test.tap.managed_no.larger.q35: CANCEL: Host does not use Linux Bridge (8.63 s)
(13/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_create.macvtap_type.q35: PASS (10.01 s)
(14/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_create.bridge_type.q35: PASS (9.99 s)
(15/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_create.ovswitch.q35: PASS (10.58 s)
(16/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_define.macvtap_type.q35: PASS (9.93 s)
(17/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_define.bridge_type.q35: PASS (9.95 s)
(18/26) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.mtu.negative_test.not_support.network.net_define.ovswitch.q35: PASS (10.60 s)

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@libvirt/tests/src/virtual_network/mtu.py`:
- Around line 58-66: The code overwrites the earlier bridge_name and doesn't
handle exceptions from utils_net.find_bridge_manager; change the local variable
used for the lookup (e.g., use bridge_to_check or bridge_dest =
params.get('netdst','').split(',')[0]) instead of reassigning bridge_name, and
wrap the call to utils_net.find_bridge_manager(bridge_to_check) in a try/except
catching process.CmdError; on exception call test.cancel with a clear message
including the error, and keep the existing isinstance(br_backend,
utils_net.Bridge) check to cancel when appropriate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c93aec5-d68f-49fa-b2b6-192de5467a2c

📥 Commits

Reviewing files that changed from the base of the PR and between d137f7f and 7c616a3.

📒 Files selected for processing (2)
  • libvirt/tests/cfg/virtual_network/mtu.cfg
  • libvirt/tests/src/virtual_network/mtu.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • libvirt/tests/cfg/virtual_network/mtu.cfg

Comment thread libvirt/tests/src/virtual_network/mtu.py Outdated
1.Add some parameters to allow the framework provide guest xml
2.Call cancel_if_ovs_bridge to cancel test when host using linux bridge
3.Add "only Linux" to limit guest type

ID: LIBVIRTAT-22318

Signed-off-by: Yiqian Wei <yiwei@redhat.com>
@Yingshun Yingshun merged commit 2eecdf5 into autotest:master Mar 19, 2026
6 checks passed
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.

4 participants