-
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.
viommu: Add a case for file transfers
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
Showing
2 changed files
with
69 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,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'}} |
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,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() |