Skip to content

Commit fb6ac48

Browse files
committed
Improve libvirt_vm.add_nic to support ovs virtualport attribute
It should be a design flaw; when netdst is ovs, attribute virtualport_type needs to be added Signed-off-by: Lei Yang <leiyang@redhat.com>
1 parent 37b7568 commit fb6ac48

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

virttest/libvirt_vm.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@
2828
error_context,
2929
kernel_interface,
3030
libvirt_xml,
31+
openvswitch,
3132
storage,
3233
test_setup,
3334
utils_logfile,
3435
utils_misc,
36+
utils_net,
3537
utils_package,
3638
utils_selinux,
3739
virsh,
@@ -939,7 +941,12 @@ def add_nic(help_text, nic_params):
939941
else:
940942
# newer libvirt (--network=mynet,model=virtio,mac=00:11)
941943
if nettype != "user":
944+
br_name = utils_net.find_bridge_manager(netdst)
945+
if br_name is None:
946+
raise exceptions.TestError(f"Bridge '{netdst}' does not exist")
942947
result += "=%s" % netdst
948+
if isinstance(br_name, openvswitch.OpenVSwitchSystem):
949+
result += ",virtualport_type=openvswitch"
943950
if nettype and nic_model: # only supported along with nettype
944951
result += ",model=%s" % nic_model
945952
if nettype and mac:

0 commit comments

Comments
 (0)