Message ID | 1502694715-9660-1-git-send-email-fukaige@huawei.com |
---|---|
State | Accepted |
Headers | show |
On 08/14/2017 12:11 AM, fukaige wrote: > From: Kaige Fu <fukaige@huawei.com> > > Start a virtual machine with its backend tap device attached to a brought up linux bridge. > If we delete the linux bridge when vm is still running, we'll get the following error when > trying to create a ovs bridge with the same name. > > The reason is that ovs-router subsystem add the linux bridge into netdev_shash, but does > not remove it when the bridge is deleted in the situation. When the bridge is deleted, ovs > will receive a RTM_DELLINK msg, take this chance to remove the bridge in netdev_shash. > > ovs-vsctl: Error detected while setting up 'br-eth'. See ovs-vswitchd log for details. > > ovs-vswitchd log: > 2017-05-11T03:45:25.293Z|00026|ofproto_dpif|INFO|system@ovs-system: Datapath supports recirculation > 2017-05-11T03:45:25.293Z|00027|ofproto_dpif|INFO|system@ovs-system: MPLS label stack length probed as 1 > 2017-05-11T03:45:25.293Z|00028|ofproto_dpif|INFO|system@ovs-system: Datapath supports unique flow ids > 2017-05-11T03:45:25.293Z|00029|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_state > 2017-05-11T03:45:25.293Z|00030|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_zone > 2017-05-11T03:45:25.293Z|00031|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_mark > 2017-05-11T03:45:25.293Z|00032|ofproto_dpif|INFO|system@ovs-system: Datapath supports ct_label > 2017-05-11T03:45:25.364Z|00001|ofproto_dpif_upcall(handler226)|INFO|received packet on unassociated datapath port 0 > 2017-05-11T03:45:25.368Z|00033|netdev_linux|WARN|ethtool command ETHTOOL_GFLAGS on network device br-eth failed: No such device > 2017-05-11T03:45:25.368Z|00034|dpif|WARN|system@ovs-system: failed to add br-eth as port: No such device > 2017-05-11T03:45:25.368Z|00035|bridge|INFO|bridge br-eth: using datapath ID 00002a51cf9f2841 > 2017-05-11T03:45:25.368Z|00036|connmgr|INFO|br-eth: added service controller "punix:/var/run/openvswitch/br-eth.mgmt" > > Signed-off-by: Kaige Fu <fukaige@huawei.com> > --- > lib/route-table.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/lib/route-table.c b/lib/route-table.c > index 67fda31..4e40c37 100644 > --- a/lib/route-table.c > +++ b/lib/route-table.c > @@ -33,6 +33,7 @@ > #include "ovs-router.h" > #include "packets.h" > #include "rtnetlink.h" > +#include "tnl-ports.h" > #include "openvswitch/vlog.h" > > /* Linux 2.6.36 added RTA_MARK, so define it just in case we're building with > @@ -333,10 +334,16 @@ name_table_init(void) > > > static void > -name_table_change(const struct rtnetlink_change *change OVS_UNUSED, > +name_table_change(const struct rtnetlink_change *change, > void *aux OVS_UNUSED) > { > /* Changes to interface status can cause routing table changes that some > * versions of the linux kernel do not advertise for some reason. */ > route_table_valid = false; > + > + if (change && change->nlmsg_type == RTM_DELLINK) { > + if (change->ifname) { > + tnl_port_map_delete_ipdev(change->ifname); > + } > + } > } > Works as advertised... Tested-by: Greg Rose <gvrose8192@gmail.com> Reviewed-by: Greg Rose <gvrose8192@gmail.com>
On Thu, Aug 17, 2017 at 03:10:34PM -0700, Greg Rose wrote: > On 08/14/2017 12:11 AM, fukaige wrote: > >From: Kaige Fu <fukaige@huawei.com> > > > >Start a virtual machine with its backend tap device attached to a brought up linux bridge. > >If we delete the linux bridge when vm is still running, we'll get the following error when > >trying to create a ovs bridge with the same name. > > > >The reason is that ovs-router subsystem add the linux bridge into netdev_shash, but does > >not remove it when the bridge is deleted in the situation. When the bridge is deleted, ovs > >will receive a RTM_DELLINK msg, take this chance to remove the bridge in netdev_shash. Applied, thanks Greg and fukaige.
diff --git a/lib/route-table.c b/lib/route-table.c index 67fda31..4e40c37 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -33,6 +33,7 @@ #include "ovs-router.h" #include "packets.h" #include "rtnetlink.h" +#include "tnl-ports.h" #include "openvswitch/vlog.h" /* Linux 2.6.36 added RTA_MARK, so define it just in case we're building with @@ -333,10 +334,16 @@ name_table_init(void) static void -name_table_change(const struct rtnetlink_change *change OVS_UNUSED, +name_table_change(const struct rtnetlink_change *change, void *aux OVS_UNUSED) { /* Changes to interface status can cause routing table changes that some * versions of the linux kernel do not advertise for some reason. */ route_table_valid = false; + + if (change && change->nlmsg_type == RTM_DELLINK) { + if (change->ifname) { + tnl_port_map_delete_ipdev(change->ifname); + } + } }