Re: [ovs-dev] [PATCH v2] tnl-ports: Remove netdevs in netdev_hash when deleted

2017-06-14 Thread fukaige


> -Original Message-
> From: Ben Pfaff [mailto:b...@ovn.org]
> Sent: Thursday, June 15, 2017 5:25 AM
> To: fukaige
> Cc: d...@openvswitch.org; Zhaoshenglong
> Subject: Re: [PATCH v2] tnl-ports: Remove netdevs in netdev_hash when
> deleted
> 
> On Wed, Jun 14, 2017 at 01:44:37PM +0800, fukaige wrote:
> > 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.
> 
> Thanks for the patch.
> 
> This has multiple patch rejects.  Is it against current master?  Please rebase
> it and repost.
> 

It is against branch-2.5. I will rebase it against current master and repost.

> Thanks again!
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] tnl-ports: Remove netdevs in netdev_hash when deleted

2017-06-14 Thread Ben Pfaff
On Wed, Jun 14, 2017 at 01:44:37PM +0800, fukaige wrote:
> 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.

Thanks for the patch.

This has multiple patch rejects.  Is it against current master?  Please
rebase it and repost.

Thanks again!
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] tnl-ports: Remove netdevs in netdev_hash when deleted

2017-06-13 Thread fukaige
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|1|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 
2a51cf9f2841
2017-05-11T03:45:25.368Z|00036|connmgr|INFO|br-eth: added service controller 
"punix:/var/run/openvswitch/br-eth.mgmt"

Signed-off-by: fukaige 
---
 lib/tnl-ports.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/lib/tnl-ports.c b/lib/tnl-ports.c
index bcf4b94..75b5909 100644
--- a/lib/tnl-ports.c
+++ b/lib/tnl-ports.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "classifier.h"
 #include "dynamic-string.h"
@@ -33,6 +34,7 @@
 #include "ovs-thread.h"
 #include "unixctl.h"
 #include "util.h"
+#include "rtnetlink.h"
 
 static struct ovs_mutex mutex = OVS_MUTEX_INITIALIZER;
 static struct classifier cls;   /* Tunnel ports. */
@@ -463,11 +465,19 @@ tnl_port_map_run(void)
 ovs_mutex_unlock();
 }
 
+static void
+rtnetlink_del_cb(const struct rtnetlink_change *change, void *aux OVS_UNUSED)
+{
+if(change->nlmsg_type == RTM_DELLINK)
+tnl_port_map_delete_ipdev(change->ifname);
+}
+
 void
 tnl_port_map_init(void)
 {
 classifier_init(, flow_segment_u64s);
 list_init(_list);
 list_init(_list);
+rtnetlink_notifier_create(rtnetlink_del_cb, NULL);
 unixctl_command_register("tnl/ports/show", "-v", 0, 1, tnl_port_show, 
NULL);
 }
-- 
1.8.3.1


___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev