-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds: VIRT-302078 - Do netperf stress test for iommu enabled interface VIRT-301971 - Do netperf stress test for nat network interface Signed-off-by: Yingshun Cui <[email protected]>
- Loading branch information
Showing
5 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
- vIOMMU.netperf: | ||
type = viommu_netperf | ||
vms = avocado-vt-vm1 | ||
net_name = network_conn | ||
ip_attrs = {"netmask": "255.255.255.0", "address": "192.168.144.1", "dhcp_ranges": {"attrs": {"end": "192.168.144.254", "start": "192.168.144.2"}}} | ||
iface_attrs = {"source": {"network": "${net_name}"}, "type_name": "network", "model": "virtio"} | ||
network_attrs = {"name": "${net_name}", "forward": {"mode": "nat"}, "ips": [${ip_attrs}]} | ||
start_vm = "no" | ||
variants: | ||
- virtio: | ||
only q35, aarch64 | ||
func_supported_since_libvirt_ver = (8, 3, 0) | ||
iommu_dict = {'model': 'virtio'} | ||
- intel: | ||
only q35 | ||
start_vm = "yes" | ||
enable_guest_iommu = "yes" | ||
iommu_dict = {'model': 'intel', 'driver': {'intremap': 'on', 'caching_mode': 'on', 'eim': 'on', 'iotlb': 'on', 'aw_bits': '48'}} | ||
- smmuv3: | ||
only aarch64 | ||
func_supported_since_libvirt_ver = (5, 5, 0) | ||
iommu_dict = {'model': 'smmuv3'} | ||
variants: | ||
- e1000e: | ||
only q35 | ||
iface_model = 'e1000e' | ||
iface_dict = {'type_name': 'network', 'model': '${iface_model}', 'source': {'network': 'default'}} | ||
- virtio_interface: | ||
interface_driver_name = "vhost" | ||
interface_driver = {'driver_attr': {'name': '${interface_driver_name}', 'iommu': 'on'}} | ||
iface_dict = {'type_name': 'network', 'model': 'virtio', 'driver': ${interface_driver}, 'source': {'network': 'default'}} | ||
variants: | ||
- guest2guest: | ||
vms = avocado-vt-vm1 vm2 | ||
netperf_client = avocado-vt-vm1 | ||
netperf_server = vm2 | ||
- host2guest: | ||
netperf_client = ${local_ip} | ||
netperf_server = ${main_vm} | ||
- guest2host: | ||
netperf_client = ${main_vm} | ||
netperf_server = ${local_ip} | ||
UDP_STREAM: | ||
extra_cmd_opts = "-- -R 1" | ||
variants: | ||
- TCP_STREAM: | ||
test_protocol = TCP_STREAM | ||
- UDP_STREAM: | ||
test_protocol = UDP_STREAM |
27 changes: 27 additions & 0 deletions
27
libvirt/tests/cfg/virtual_network/connectivity/netperf_nat_interface.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
- virtual_network.netperf.nat_interface: | ||
type = netperf_nat_interface | ||
vms = avocado-vt-vm1 | ||
start_vm = no | ||
net_name = network_conn | ||
ip_attrs = {"netmask": "255.255.255.0", "address": "192.168.144.1", "dhcp_ranges": {"attrs": {"end": "192.168.144.254", "start": "192.168.144.2"}}} | ||
iface_attrs = {"source": {"network": "${net_name}"}, "type_name": "network", "model": "virtio"} | ||
network_attrs = {"name": "${net_name}", "forward": {"mode": "nat"}, "ips": [${ip_attrs}]} | ||
|
||
variants: | ||
- guest2guest: | ||
vms = avocado-vt-vm1 vm2 | ||
netperf_client = avocado-vt-vm1 | ||
netperf_server = vm2 | ||
- host2guest: | ||
netperf_client = ${local_ip} | ||
netperf_server = ${main_vm} | ||
- guest2host: | ||
netperf_client = ${main_vm} | ||
netperf_server = ${local_ip} | ||
UDP_STREAM: | ||
extra_cmd_opts = "-- -R 1" | ||
variants: | ||
- TCP_STREAM: | ||
test_protocol = TCP_STREAM | ||
- UDP_STREAM: | ||
test_protocol = UDP_STREAM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from virttest.libvirt_xml import vm_xml | ||
from virttest.utils_libvirt import libvirt_vmxml | ||
|
||
from provider.viommu import viommu_base | ||
from provider.virtual_network import network_base | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Run netperf testing between host and vm with iommu device | ||
""" | ||
cleanup_ifaces = "yes" == params.get("cleanup_ifaces", "yes") | ||
iommu_dict = eval(params.get('iommu_dict', '{}')) | ||
|
||
vms = params.get('vms').split() | ||
vm_objs = [env.get_vm(vm_i) for vm_i in vms] | ||
|
||
test_objs = [viommu_base.VIOMMUTest(vm, test, params) for vm in vm_objs] | ||
|
||
try: | ||
test.log.info("TEST_SETUP: Update VM XML.") | ||
for test_obj in test_objs: | ||
test_obj.setup_iommu_test(iommu_dict=iommu_dict, | ||
cleanup_ifaces=cleanup_ifaces) | ||
|
||
iface_dict = test_objs[0].parse_iface_dict() | ||
if cleanup_ifaces: | ||
vmxml_lists = list(map(vm_xml.VMXML.new_from_inactive_dumpxml, vms)) | ||
[libvirt_vmxml.modify_vm_device(vmxml_i, 'interface', iface_dict) for vmxml_i in vmxml_lists] | ||
|
||
test.log.info('TEST_STEP: Start the VM(s)') | ||
[vm_inst.start() for vm_inst in vm_objs] | ||
[vm_inst.wait_for_login() for vm_inst in vm_objs] | ||
|
||
test.log.info("TEST_STEP: Run netperf testing between host(vm) and vm.") | ||
network_base.exec_netperf_test(params, env) | ||
finally: | ||
for test_obj in test_objs: | ||
test_obj.teardown_iommu_test() |
36 changes: 36 additions & 0 deletions
36
libvirt/tests/src/virtual_network/connectivity/netperf_nat_interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from provider.virtual_network import network_base | ||
|
||
from virttest import virsh | ||
|
||
from virttest.libvirt_xml import vm_xml | ||
from virttest.utils_libvirt import libvirt_network | ||
from virttest.utils_libvirt import libvirt_vmxml | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Verify the guest can work well under the netperf stress test | ||
""" | ||
vms = params.get('vms').split() | ||
vm_objs = [env.get_vm(vm_i) for vm_i in vms] | ||
network_attrs = eval(params.get('network_attrs')) | ||
iface_attrs = eval(params.get('iface_attrs')) | ||
|
||
bkxmls = list(map(vm_xml.VMXML.new_from_inactive_dumpxml, vms)) | ||
|
||
try: | ||
libvirt_network.create_or_del_network(network_attrs) | ||
test.log.debug(f'Network xml:\n' | ||
f'{virsh.net_dumpxml(network_attrs["name"]).stdout_text}') | ||
vmxml_lists = list(map(vm_xml.VMXML.new_from_inactive_dumpxml, vms)) | ||
[libvirt_vmxml.modify_vm_device(vmxml_i, 'interface', iface_attrs) | ||
for vmxml_i in vmxml_lists] | ||
|
||
test.log.info('TEST_STEP: Start the VM(s)') | ||
[vm_inst.start() for vm_inst in vm_objs] | ||
[vm_inst.wait_for_login() for vm_inst in vm_objs] | ||
network_base.exec_netperf_test(params, env) | ||
|
||
finally: | ||
[backup_xml.sync() for backup_xml in bkxmls] | ||
libvirt_network.create_or_del_network(network_attrs, is_del=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters