Skip to content

Improve resolve_vm_hostname_by_resolvectl to create guest xml by the framework#6803

Merged
Yingshun merged 1 commit intoautotest:masterfrom
yiqianwei:LIBVIRTAT-22316
Mar 17, 2026
Merged

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

Conversation

@yiqianwei
Copy link
Copy Markdown
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
    • Expanded Linux-targeted test configurations with richer VM and networking options: network selection, VM lifecycle controls, image handling, and reboot behavior to broaden virtual network coverage.
    • Added additive configuration toggles to enable/disable VM creation, destruction, cloning, and no-reboot flows for more flexible test scenarios.
    • No public-facing interfaces were changed.

@coderabbitai
Copy link
Copy Markdown

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: 718badc3-b93b-42af-852a-d7b34209b9bb

📥 Commits

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

📒 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 to add keys: only_linux, nettype_nic1, netdst_nic1, create_vm_libvirt, kill_vm_libvirt, kill_vm_libvirt_options (--nvram), ovmf, master_images_clone (image1), clone_master, remove_image_image1, and use_no_reboot. These entries were added in addition to existing parameters (start_vm, vms, timeout) without removing or modifying 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 parameters to the resolve_vm_hostname_by_resolvectl configuration to allow the framework to create guest XML, which aligns with the objective and the file modification.
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
📝 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

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

@yiqianwei
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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.

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.

@yiqianwei Please double confirm that this case was originally intended to only test the default.

@yiqianwei
Copy link
Copy Markdown
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
Copy Markdown

@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.

Comment on lines +4 to +5
nettype_nic1 = network
netdst_nic1 = default
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.

@yiqianwei Please double confirm that this case was originally intended to only test the default.

kill_vm_libvirt = yes
ovmf:
kill_vm_libvirt_options = --nvram
master_images_clone = img1
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.

Please switch img1 to image1, and an new line clone_master = yes.

…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>
@Yingshun Yingshun merged commit 1898790 into autotest:master Mar 17, 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