[ovs-dev] [PATCH 2/3] vswitchd: Remove port from datapath if it becomes non-operational

Ansis Atteka aatteka at nicira.com
Sat Apr 7 01:07:57 UTC 2012


If kernel module rejects config changes then vswitchd sets the ofport
column to -1, but does not remove the non-operational port from the
datapath. This patch fixes this problem.

ovs-vsctl add-br ovsbr
ovs-vsctl add-port ovsbr p1
ovs-vsctl add-port ovsbr p2
ovs-vsctl set Interface p1 options:remote_ip=2.1.1.1 options:key=123 type=gre
ovs-vsctl set Interface p2 options:remote_ip=1.1.1.1 options:key=123 type=gre
ovs-vsctl set Interface p2 options:remote_ip=2.1.1.1 options:key=123 type=gre
ovs-dpctl show #observe that p2 does not appear here anymore

Signed-off-by: Ansis Atteka <aatteka at nicira.com>
---
 vswitchd/bridge.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 35d8723..5aa5c89 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1208,6 +1208,11 @@ bridge_add_ofproto_ports(struct bridge *br)
                     /* We already reported a related error, don't bother
                      * duplicating it. */
                 }
+                if (!ofproto_port_query_by_name(br->ofproto, port->name,
+                                                &ofproto_port)) {
+                    ofproto_port_del(br->ofproto, ofproto_port.ofp_port);
+                    ofproto_port_destroy(&ofproto_port);
+                }
                 iface_clear_db_record(iface->cfg);
                 iface_destroy(iface);
             }
-- 
1.7.9.1




More information about the dev mailing list