Skip to content

Commit

Permalink
viommu: Add a case for file transfers
Browse files Browse the repository at this point in the history
This PR adds:
    VIRT-301880: Transfer a file between host and vm with iommu device

Signed-off-by: Yingshun Cui <[email protected]>
  • Loading branch information
Yingshun committed Aug 27, 2024
1 parent c376953 commit a8a0fcb
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
27 changes: 27 additions & 0 deletions libvirt/tests/cfg/sriov/vIOMMU/viommu_transfer_file.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- vIOMMU.transfer_file:
type = viommu_transfer_file
start_vm = "no"
disk_driver = {'name': 'qemu', 'type': 'qcow2', 'iommu': 'on'}
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'}}
42 changes: 42 additions & 0 deletions libvirt/tests/src/sriov/vIOMMU/viommu_transfer_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from virttest import utils_test

from virttest.libvirt_xml import vm_xml
from virttest.utils_libvirt import libvirt_vmxml

from provider.viommu import viommu_base


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


def run(test, params, env):
"""
Transfer a file between host and vm with iommu device
"""
cleanup_ifaces = "yes" == params.get("cleanup_ifaces", "yes")
iommu_dict = eval(params.get('iommu_dict', '{}'))

vm_name = params.get("main_vm", "avocado-vt-vm1")
vm = env.get_vm(vm_name)

test_obj = viommu_base.VIOMMUTest(vm, test, params)

try:
test.log.info("TEST_SETUP: Update VM XML.")
test_obj.setup_iommu_test(iommu_dict=iommu_dict,
cleanup_ifaces=cleanup_ifaces)

iface_dict = test_obj.parse_iface_dict()
if cleanup_ifaces:
libvirt_vmxml.modify_vm_device(
vm_xml.VMXML.new_from_dumpxml(vm.name),
"interface", iface_dict)

test.log.info("TEST_STEP: Start the VM.")
vm.start()
test.log.debug(vm_xml.VMXML.new_from_dumpxml(vm.name))

test.log.info("TEST_STEP: Transfer a file between host and vm.")
utils_test.run_file_transfer(test, params, env)
finally:
test_obj.teardown_iommu_test()

0 comments on commit a8a0fcb

Please sign in to comment.