Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions libvirt/tests/cfg/virtual_network/qemu/vlan.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
- virtual_network.qemu_test.vlan: image_copy
type = vlan
# subnet should not be used by host
create_vm_libvirt = yes
kill_vm_libvirt = yes
master_images_clone = img1
main_vm = avocado-vt-vm1
subnet = "192.168"
vlan_num = 5
file_size = 10
maximal = 4094
listen_cmd = "nc -l %s > %s"
send_cmd = "nc %s %s < %s"
vms += " vm2"
cmd_type = ip
stop_firewall_cmd = "systemctl stop firewalld || service firewalld stop"
load_8021q_cmd = "modprobe 8021q"
msg_pattern = '8021q: Invalid VLAN id'
RHEL.7, ALT.7, RHEL.6:
msg_pattern = 'RTNETLINK answers: Numerical result out of range'
Windows:
Comment on lines +18 to +21
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Negative-test message pattern is brittle across distros/kernels.

ip link add typically returns a RTNETLINK error; the kernel log line '8021q: Invalid VLAN id' may not appear in stderr. Recommend matching RTNETLINK text (covers RHEL 8/9) or, better, let the test assert on non-zero exit only.

Option A (regex broaden):

-    msg_pattern = '8021q: Invalid VLAN id'
+    # ip(8) stderr varies; match common RTNETLINK failures
+    msg_pattern = 'RTNETLINK answers: (Invalid argument|Numerical result out of range)'

You can keep the RHEL.6/7 override or remove it, since the broadened default already covers those.

🤖 Prompt for AI Agents
In libvirt/tests/cfg/virtual_network/qemu/vlan.cfg around lines 18-21, the
current negative-test message pattern '8021q: Invalid VLAN id' is brittle across
distros/kernels; change the test to either (A) broaden the msg_pattern to match
the more common RTNETLINK output (e.g. a regex matching 'RTNETLINK answers:.*out
of range' which covers RHEL6/7/8/9) and remove the special-case overrides if
redundant, or (B) make the assertion check only for a non-zero exit status from
`ip link add` instead of relying on stderr/kernel log text; implement the chosen
approach so the test is robust across kernels.

# two windows VM, need more time to boot and login
only virtio_net
login_timeout = 720
vlan_num = 1
win_vlan_id = 900
cdroms += " virtio"
driver_verifier = netkvm
set_vlan_cmd = powershell -command "Set-NetAdapter -Name '%s' -VlanID ${win_vlan_id} -Confirm:$False"
Win2016, Win2019, Win8..1, Win2012..r2:
driver_verifier += " ndis"
variants:
- @vlan_connective_test:
- vlan_scalability_test:
only Linux
do_maximal_test = yes
Loading