From 3c6dda6d7febfbd34ba36dbb7552f22ef9c2941b Mon Sep 17 00:00:00 2001 From: Yalan Zhang Date: Fri, 20 Dec 2024 01:18:58 -0500 Subject: [PATCH] Update the expected result for update portgroup Per bug https://issues.redhat.com/browse/RHEL-7299, the expected result for update interface portgroup is changed. It is not supported to update the portgroup now. Signed-off-by: Yalan Zhang --- .../update_device/update_iface_portgroup.cfg | 2 ++ .../update_device/update_iface_portgroup.py | 31 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/libvirt/tests/cfg/virtual_network/update_device/update_iface_portgroup.cfg b/libvirt/tests/cfg/virtual_network/update_device/update_iface_portgroup.cfg index d4748a4aa6..a9835c0fa9 100644 --- a/libvirt/tests/cfg/virtual_network/update_device/update_iface_portgroup.cfg +++ b/libvirt/tests/cfg/virtual_network/update_device/update_iface_portgroup.cfg @@ -7,6 +7,8 @@ pg_b = {'name': 'engineering', 'bandwidth_inbound': {'average': '200', 'peak': '300', 'burst': '256'}, 'bandwidth_outbound': {'average': '100', 'peak': '200', 'burst': '128'}} pg_attrs = {'portgroups': [${pg_a}, ${pg_b}]} update_attrs = {'portgroup': 'engineering'} + err_msg = cannot modify network device portgroup attribute + status_error = yes variants net_type: - nat: net_attrs = ${pg_attrs} diff --git a/libvirt/tests/src/virtual_network/update_device/update_iface_portgroup.py b/libvirt/tests/src/virtual_network/update_device/update_iface_portgroup.py index fc05f9089b..c4c46e551c 100644 --- a/libvirt/tests/src/virtual_network/update_device/update_iface_portgroup.py +++ b/libvirt/tests/src/virtual_network/update_device/update_iface_portgroup.py @@ -33,6 +33,8 @@ def run(test, params, env): pg_a = eval(params.get('pg_a', '{}')) pg_b = eval(params.get('pg_b', '{}')) update_attrs = eval(params.get('update_attrs', '{}')) + status_error = params.get('status_error', '') + err_msg = params.get('err_msg', '') net_name = 'default' if 'name' not in net_attrs else net_name iface_attrs = eval(params.get('iface_attrs', '{}')) @@ -72,7 +74,7 @@ def run(test, params, env): mac = iface.mac_address vm.start() - network_base.get_iface_xml_inst(vm_name, 'on vm after vm start') + iface_original = network_base.get_iface_xml_inst(vm_name, 'on vm after vm start') tap_device = libvirt.get_ifname_host(vm_name, mac) LOG.debug(f'tap device on host with mac {mac} is: {tap_device}.') @@ -90,22 +92,19 @@ def run(test, params, env): iface.xmltreefile.write() LOG.debug(f'Update iface with xml: {iface}') - virsh.update_device(vm_name, iface.xml, **VIRSH_ARGS) - - # Check updated iface xml - iface_update = network_base.get_iface_xml_inst(vm_name, 'after update') - if iface_update.source.get( - 'portgroup') != update_attrs['source']['portgroup']: - test.fail('Update iface xml portgroup failed') - - # Check rules - if not utils_net.check_class_rules( - tap_device, '1:1', pg_b['bandwidth_inbound']): - test.fail('class rule check failed-') - if not utils_net.check_filter_rules( - tap_device, pg_b['bandwidth_outbound']): - test.fail('filter rule check failed-') + up_result = virsh.update_device(vm_name, iface.xml, debug=True) + libvirt.check_exit_status(up_result, status_error) + if err_msg: + libvirt.check_result(up_result, err_msg) + + iface_update = network_base.get_iface_xml_inst(vm_name, + 'after update-device') + LOG.debug(f'Check if the live interface xml changed:') + if iface_update != iface_original: + test.fail(f'Interface xml changed after unsuccessful update.\n' + f'Should be:\n{iface_original}\n' + f'Actually is:\n{iface_update}') finally: bkxml.sync() bk_net_xml.sync()