Comment 12 for bug 1912844

Revision history for this message
Dan Watkins (oddbloke) wrote : Re: [Bug 1912844] Re: Bond with OVS bridging RuntimeError: duplicate mac found!

On Fri, Jan 22, 2021 at 10:51:25PM -0000, Ryan Harper wrote:
> Thanks for doing most of the digging here @Oddbloke; I suspect as with
> bond and bridges for ovs, we'll need a special case to check if a vlan
> entry is also OVS, much like we did for bonds/bridges:
>
> https://github.com/canonical/cloud-init/pull/608/files
>
> So our is_vlan change will need to see if link device is OVS and if so
> then say it's a vlan as well (since the DEVTYPE doesn't match) or
> something to that effect.

Unless I'm missing something, we don't have a network configuration to
reference in these codepaths: get_interfaces only takes a
blacklist_drivers parameter, and is_vlan only takes a devname.

So for the code to work as-architected, I believe we need to be able to
determine that this is a VLAN from examining the system (via
/sys/class/net, most likely) to be able to exclude it in get_interfaces.
As far as I (with my limited networking knowledge) can tell, we can
neither determine that this is a VLAN, nor that this is related to the
ovs-br interface by examining /sys/class/net: while the non-OVS VLAN has
a lower_ link to the bridge interface, the OVS VLAN does not.

Looking at everything in /sys/class/net/<bridge device> (with `for f in
*; do echo $f: $(cat $f); done 2>/dev/null`), here's the diff between
the two systems:

--- not-ovs 2021-01-25 13:15:34.560602978 -0500
+++ ovs 2021-01-25 13:15:23.400407103 -0500
@@ -1,26 +1,25 @@
-addr_assign_type: 2
+addr_assign_type: 3
 addr_len: 6
-address: de:ad:be:ef:12:34
+address: 56:1d:35:09:77:47
 broadcast: ff:ff:ff:ff:ff:ff
 carrier: 1
-carrier_changes: 1
+carrier_changes: 0
 carrier_down_count: 0
-carrier_up_count: 1
+carrier_up_count: 0
 dev_id: 0x0
 dev_port: 0
 dormant: 0
 duplex:
-flags: 0x1003
+flags: 0x1103
 gro_flush_timeout: 0
 ifalias:
-ifindex: 5
-iflink: 4
+ifindex: 6
+iflink: 6
 link_mode: 0
-lower_br:
 mtu: 1500
 name_assign_type: 3
 netdev_group: 0
-operstate: up
+operstate: unknown
 phys_port_id:
 phys_port_name:
 phys_switch_id:
@@ -31,4 +30,4 @@
 subsystem:
 tx_queue_len: 1000
 type: 1
-uevent: DEVTYPE=vlan INTERFACE=br.100 IFINDEX=5
+uevent: INTERFACE=ovs-br.100 IFINDEX=6

With addr_assign_type set to 3, and no DEVTYPE=vlan, and no lower_*
link, I don't see how we can tell that this is a VLAN. (I've checked
and the difference in flags is, if I did my bitmasking correctly,
whether the interface is in promiscuous mode or not.)