Improve resolve_vm_hostname_by_resolvectl to create guest xml by the framework#6803
Improve resolve_vm_hostname_by_resolvectl to create guest xml by the framework#6803yiqianwei wants to merge 1 commit intoautotest:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe libvirt virtual network test configuration Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
|
Test results: |
|
Hi @yanglei-rh, Could you help to review this patch? thanks |
05dac93 to
7e5dc8a
Compare
| main_vm = avocado-vt-vm1 | ||
| vms = ${main_vm} vm2 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| nettype_nic1 = network | ||
| netdst_nic1 = default |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Could you explain why we need to set the
nettypeandnetdstinstead 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 | --norebootAs 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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Hi @YongxueHong This is standard syntax. The first
--networkis a command-line switch, and the secondnetwork=defaultis 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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>
7e5dc8a to
eb1732d
Compare
|
Test results: |
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