Skip to content

Improve resolve_vm_hostname_by_resolvectl to create guest xml by the framework#6803

Open
yiqianwei wants to merge 1 commit intoautotest:masterfrom
yiqianwei:LIBVIRTAT-22316
Open

Improve resolve_vm_hostname_by_resolvectl to create guest xml by the framework#6803
yiqianwei wants to merge 1 commit intoautotest:masterfrom
yiqianwei:LIBVIRTAT-22316

Conversation

@yiqianwei
Copy link
Contributor

@yiqianwei yiqianwei commented Feb 12, 2026

1.Add some parameters to allow the framework provide guest xml
2.Set nettype to network for guest xml
3.Add "only Linux" to limit guest type

ID: LIBVIRTAT-22316

Summary by CodeRabbit

  • Tests
    • Enhanced test configurations with additional Linux-targeted VM and networking options (network selection, VM lifecycle controls, image handling, and reboot behavior) for richer virtual network coverage.
    • Centralized test variable structure to simplify primary VM selection and improve maintainability and clarity.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 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: 40833a35-4685-44a4-859b-6e4d4e261f7a

📥 Commits

Reviewing files that changed from the base of the PR and between 7e5dc8a and eb1732d.

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

Walkthrough

The libvirt virtual network test configuration libvirt/tests/cfg/virtual_network/resolve_vm_hostname_by_resolvectl.cfg was updated with new keys: only_linux, nettype_nic1, netdst_nic1, create_vm_libvirt, kill_vm_libvirt, kill_vm_libvirt_options (set to --nvram), ovmf, master_images_clone, remove_image_image1, and use_no_reboot. These options were added alongside existing parameters (start_vm, vms, timeout) without removing or altering existing control-flow entries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 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 accurately describes the main change: adding configuration parameters to enable framework-based guest XML creation for the resolve_vm_hostname_by_resolvectl test, which aligns with the raw summary of adding multiple new configuration options.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@yiqianwei
Copy link
Contributor Author

Test results:
(1/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.yes.q35: PASS (145.30 s)
(2/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.no.q35: PASS (122.99 s)
(3/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.omitted.q35: PASS (123.08 s)
(4/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.1.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.localonly_no.q35: PASS (14.27 s)

@yiqianwei
Copy link
Contributor Author

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

@yiqianwei yiqianwei changed the title Enables resolve_vm_hostname_by_resolvectl test case to be supported u… Improve resolve_vm_hostname_by_resolvectl to create guest xml by the framework Feb 13, 2026
Comment on lines +14 to +15
main_vm = avocado-vt-vm1
vms = ${main_vm} vm2
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, the param main_vm has been defined in the virttest/shared/cfg/base.cfg:
https://github.com/avocado-framework/avocado-vt/blob/54b01f9cda9c06115696955c114035afaed77cda/virttest/shared/cfg/base.cfg#L32-L33

May I know the purpose of this change? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, main_vm = avocado-vt-vm1 already has a default definition in base.cfg.
I agree with your suggestion to remove the duplicate definition on line 14.

Comment on lines +4 to +5
nettype_nic1 = network
netdst_nic1 = default
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why we need to set the nettype and netdst instead of the default value? Thanks

BTW, I checked the command, it looks a little bit weird:

[stdlog] 2026-03-04 01:25:49,714 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --disk path=/home/kvm_autotest_root/images/rhel102-64-virtio-scsi-ovmf_avocado-vt-vm1.qcow2,bus=scsi,size=20,format=qcow2,cache=none
[stdlog] 2026-03-04 01:25:49,714 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --network=network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1
[stdlog] 2026-03-04 01:25:49,714 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --noreboot

As you can see, the network commandline: --network=network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1, from my understanding, it should be --network network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1, but I am not sure if it is the correct command format. Thanks.
CC @yanglei-rh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you explain why we need to set the nettype and netdst instead of the default value? Thanks

If this parameter is not set, the default is to use bridge, not network, as shown below:

[stdlog] 2026-03-05 02:40:45,019 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --network=bridge=virbr0,model=virtio,mac=52:54:00:20:3f:99,driver_queues=1 

BTW, I checked the command, it looks a little bit weird:

[stdlog] 2026-03-04 01:25:49,714 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --disk path=/home/kvm_autotest_root/images/rhel102-64-virtio-scsi-ovmf_avocado-vt-vm1.qcow2,bus=scsi,size=20,format=qcow2,cache=none
[stdlog] 2026-03-04 01:25:49,714 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --network=network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1
[stdlog] 2026-03-04 01:25:49,714 avocado.virttest.libvirt_vm libvirt_vm       L2231 INFO |     --noreboot

As you can see, the network commandline: --network=network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1, from my understanding, it should be --network network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1, but I am not sure if it is the correct command format. Thanks. CC @yanglei-rh

Regarding the formatting issue:
Both command formats are correct, both formats are supported, and they generate the same XML:

--network=network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1 
--network network=default,model=virtio,mac=52:54:00:a5:02:9b,driver_queues=1 

cc @yanglei-rh

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @YongxueHong This is standard syntax. The first --network is a command-line switch, and the second network=default is a sub-attribute (key-value pair) within this switch, used to specify which virtual network to connect to.

@yiqianwei I think this is what @YongxueHong wants to confirm.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @YongxueHong This is standard syntax. The first --network is a command-line switch, and the second network=default is a sub-attribute (key-value pair) within this switch, used to specify which virtual network to connect to.

@yiqianwei I think this is what @YongxueHong wants to confirm.

Hi @yanglei-rh
Thanks for the clarification. I have one last question I want to confirm: Which format is the standard syntax between --network=network=xxx and --network network=xxx? or they are same?

Because of my understanding of the other similar tools, I rarely see such format that it will jion the sub-attribute with equal(=) symbol instead of whitespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI. @yanglei-rh @yiqianwei
[stdlog] 2026-03-08 23:44:06,360 avocado.utils.process process L0834 INFO | Command '/usr/bin/virt-install --connect=qemu:///system --hvm --accelerate --name 'avocado-vt-vm1' --machine q35 --memory=14336 --vcpu=16 --import --vnc --serial pty --memballoon model=virtio --controller type=scsi,model=virtio-scsi --disk path=/home/kvm_autotest_root/images/rhel102-64-virtio-scsi-ovmf_avocado-vt-vm1.qcow2,bus=scsi,size=20,format=qcow2,cache=none --network network=default,model=virtio,mac=52:54:00:96:ff:7d,driver_queues=1 --noreboot --boot loader=/usr/share/OVMF/OVMF_CODE.secboot.fd,loader.readonly=yes,loader.type=pflash,loader.secure=no,nvram.template=/usr/share/OVMF/OVMF_VARS.fd --noautoconsole' finished with 0 after 1.154160513s

Copy link
Contributor

Choose a reason for hiding this comment

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

According to man page usage example is --network network=xxx, but they are all supported usage.

…framework

1.Add some parameters to allow the framework provide guest xml
2.Set nettype to network for guest xml
3.Add "only Linux" to limit guest type

ID: LIBVIRTAT-22316

Signed-off-by: Yiqian Wei <yiwei@redhat.com>
@yiqianwei
Copy link
Contributor Author

Test results:
(1/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.yes.q35: PASS (113.10 s)
(2/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.no.q35: PASS (89.70 s)
(3/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.omitted.q35: PASS (89.35 s)
(4/4) Host_RHEL.m10.u2.ovmf.qcow2.virtio_scsi.up.virtio_net.Guest.RHEL.10.2.x86_64.io-github-autotest-libvirt.virtual_network.resolve_vm_hostname_by_resolvectl.localonly_no.q35: PASS (17.09 s)

Copy link
Contributor

@YongxueHong YongxueHong left a comment

Choose a reason for hiding this comment

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

LGTM.

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.

3 participants