Skip to content

Commit

Permalink
Merge pull request #5202 from chloerh/sndbuf
Browse files Browse the repository at this point in the history
Add network case of element sndbuf
  • Loading branch information
Yingshun authored Oct 23, 2023
2 parents 0732f90 + 393883c commit a900fde
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- virtual_network.elements_and_attributes.sndbuf:
type = element_sndbuf
start_vm = no
timeout = 240
outside_ip = 'www.redhat.com'
vm_ping_outside = pass
variants sndbuf:
- 0:
- 1600:
- 1800:
iface_attrs = {'type_name': 'network', 'source': {'network': 'default'}, 'model': 'virtio', 'tune': {'sndbuf': ${sndbuf}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import logging

from virttest import virsh
from virttest.libvirt_xml import vm_xml
from virttest.utils_libvirt import libvirt_vmxml
from virttest.utils_test import libvirt

from provider.virtual_network import network_base

VIRSH_ARGS = {'ignore_status': False, 'debug': True}

LOG = logging.getLogger('avocado.' + __name__)


def run(test, params, env):
"""
Test 'sndbuf' element of interface
"""
vm_name = params.get('main_vm')
vm = env.get_vm(vm_name)
outside_ip = params.get('outside_ip')
iface_attrs = eval(params.get('iface_attrs', '{}'))
sndbuf = int(params.get('sndbuf'))

vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name)
bkxml = vmxml.copy()

try:
vmxml.del_device('interface', by_tag=True)
libvirt_vmxml.modify_vm_device(vmxml, 'interface', iface_attrs)
LOG.debug(f'VMXML of {vm_name}:\n{virsh.dumpxml(vm_name).stdout_text}')

vm.start()
session = vm.wait_for_serial_login()

libvirt.check_qemu_cmd_line(f'"sndbuf":{sndbuf}')

ips = {'outside_ip': outside_ip}
network_base.ping_check(params, ips, session, force_ipv4=True)
session.close()

finally:
bkxml.sync()
1 change: 1 addition & 0 deletions spell.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ SMT
snaplist
snapname
snapshotname
sndbuf
socat
socketscount
sourse
Expand Down

0 comments on commit a900fde

Please sign in to comment.