Petr Horáček has uploaded a new change for review.

Change subject: hooks: ovs: list all attached nics in caps ports
......................................................................

hooks: ovs: list all attached nics in caps ports

Until now, when we set up a tagged OVS network, attached nic was not
listed in caps---bridge/network---ports, because of it has no assigned
tag in openvswitch database (we leave it untagged, so we are able to set
up multiple vlans over one physical interface).

Now we explicitly add attached nic to reported ports. This condition
is asserted in networkTests.

Change-Id: Ica2082907035c22e72115a684f358fcbe8a8056e
Signed-off-by: Petr Horáček <phora...@redhat.com>
---
M tests/functional/networkTests.py
M vdsm_hooks/ovs/ovs_after_get_caps.py
2 files changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/50730/1

diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index fb6dd33..55c5aa4 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -260,6 +260,7 @@
                           expected_iface)
         if network_config.get('vlan') is not None:
             self.assertTrue(isinstance(network_config.get('vlan'), int))
+        self.assertIn(physical_iface, network_config['ports'])
 
     def assertNetworkDoesntExist(self, networkName):
         netinfo = self.vdsm_net.netinfo
diff --git a/vdsm_hooks/ovs/ovs_after_get_caps.py 
b/vdsm_hooks/ovs/ovs_after_get_caps.py
index 7b6f397..4775052 100755
--- a/vdsm_hooks/ovs/ovs_after_get_caps.py
+++ b/vdsm_hooks/ovs/ovs_after_get_caps.py
@@ -83,7 +83,12 @@
                                  routes)
         net_info['iface'] = network
         net_info['bridged'] = True
-        net_info['ports'] = _list_ports(interface)
+        # port assigned to tagged network has no tag in openvswitch database
+        # (we leave it untagged, so we are able to set up multiple vlans over
+        # one physical interface). such nic is not listed by _list_ports and
+        # therefore we have to add it explicitly.
+        port = attrs.get('bond') or attrs.get('nic')
+        net_info['ports'] = list(set(_list_ports(interface).append(port)))
         net_info['stp'] = _get_stp(interface)
         ovs_networks_caps[network] = net_info
     return ovs_networks_caps
@@ -98,7 +103,12 @@
         net_info = _get_net_info(attrs, interface, dhcpv4ifaces, dhcpv6ifaces,
                                  routes)
         net_info['bridged'] = True
-        net_info['ports'] = _list_ports(interface)
+        # port assigned to tagged network has no tag in openvswitch database
+        # (we leave it untagged, so we are able to set up multiple vlans over
+        # one physical interface). such nic is not listed by _list_ports and
+        # therefore we have to add it explicitly.
+        port = attrs.get('bond') or attrs.get('nic')
+        net_info['ports'] = list(set(_list_ports(interface).append(port)))
         # TODO netinfo._bridge_options does not work here
         net_info['opts'] = {}
         net_info['stp'] = _get_stp(interface)


-- 
To view, visit https://gerrit.ovirt.org/50730
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica2082907035c22e72115a684f358fcbe8a8056e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phora...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to