Skip to content

Commit

Permalink
Merge pull request autotest#5251 from Yingshun/nodedev_vdpa
Browse files Browse the repository at this point in the history
virtual_network: Add a nodedev test for vdpa device
  • Loading branch information
chloerh authored Nov 14, 2023
2 parents 82d8853 + 19a1127 commit 1b87a15
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 40 deletions.
13 changes: 0 additions & 13 deletions libvirt/tests/cfg/virtual_interface/iface_nodedev_info.cfg

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- virtual_network.nodedev.vdpa_interface:
type = nodedev_vdpa_interface
start_vm = no
only x86_64

func_supported_since_libvirt_ver = (7, 3, 0)
func_supported_since_qemu_kvm_ver = (6, 0, 0)
dev_dict = {'path': 'vdpa0', 'name': 'vdpa_vdpa0', 'driver_name': 'vhost_vdpa', 'cap_type': 'vdpa'}
variants test_target:
- simulator:
- mellanox:
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,6 @@ def check_environment(params):
libvirt_version.is_libvirt_feature_supported(params)
utils_misc.is_qemu_function_supported(params)

def setup_test(dev_type):
"""
Setup test environment for a specific interface if needed
:param dev_type: interface type
:return: An object of special test environment
"""
test_env_obj = None
if dev_type == 'vdpa':
test_env_obj = setup_vdpa()

return test_env_obj

def teardown_test(dev_type):
"""
Default cleanup
:param dev_type: interface type
"""
if dev_type == 'vdpa':
teardown_vdpa()

def setup_vdpa():
"""
Setup vDPA environment
Expand Down Expand Up @@ -84,7 +62,8 @@ def check_nodedev_info(dev_dict):
if dev_name not in result.stdout_text:
test.fail("Failed to list %s device!" % dev_name)

test.log.info("TEST_STEP2: Check device info using virsh nodedev-dumpxml.")
test.log.info("TEST_STEP2: Check device info using virsh "
"nodedev-dumpxml.")
dev_xml = nodedev_xml.NodedevXML.new_from_dumpxml(dev_name)
test.log.debug("Nodedev xml: {}".format(dev_xml))
if not all([getattr(dev_xml, attr).endswith(value) for attr, value in
Expand All @@ -96,16 +75,17 @@ def check_nodedev_info(dev_dict):
test.fail("Failed to validate node device xml!")

check_environment(params)

# Variable assignment
dev_type = params.get('dev_type', '')
dev_dict = eval(params.get('dev_dict', '{}'))

test_obj = None
try:
# Execute test
test.log.info("TEST_CASE: %s", check_nodedev_info.__doc__.split('\n')[0])
test_obj = setup_test(dev_type)
test.log.info("TEST_CASE: %s",
check_nodedev_info.__doc__.split('\n')[0])
test_obj = setup_vdpa()
check_nodedev_info(dev_dict)

finally:
teardown_test(dev_type)
teardown_vdpa()

0 comments on commit 1b87a15

Please sign in to comment.