When tunnel key add/del event fires, the corresponding network_id
does not necessarily exists due to race condition.
So mask it.
(15612) accepted ('127.0.0.1', 45714)
127.0.0.1 - - [25/Jun/2013 12:18:18] "DELETE
/v1.0/networks/462be334-3160-48ae-9ef8-a456dc866f8f HTTP/1.1" 200 115
0.000393
(15612) accepted ('127.0.0.1', 45715)
127.0.0.1 - - [25/Jun/2013 12:18:18] "DELETE
/v1.0/tunnels/networks/462be334-3160-48ae-9ef8-a456dc866f8f/key
HTTP/1.1" 200 115 0.000260
hub: uncaught exception: Traceback (most recent call last):
File "/opt/stack/ryu/ryu/lib/hub.py", line 50, in _launch
func(*args, **kwargs)
File "/opt/stack/ryu/ryu/base/app_manager.py", line 104, in _event_loop
handler(ev)
File "/opt/stack/ryu/ryu/app/gre_tunnel.py", line 233, in
tunnel_key_del_handler
for (dpid, port_no) in self.nw.list_ports(network_id):
File "/opt/stack/ryu/ryu/controller/network.py", line 325, in list_ports
return self.networks.list_ports(network_id)
File "/opt/stack/ryu/ryu/controller/network.py", line 103, in list_ports
raise NetworkNotFound(network_id=network_id)
NetworkNotFound: no such network id 462be334-3160-48ae-9ef8-a456dc866f8f
Signed-off-by: Isaku Yamahata <[email protected]>
---
Changes v2 -> v3:
- use list_ports_noraise()
---
ryu/app/gre_tunnel.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ryu/app/gre_tunnel.py b/ryu/app/gre_tunnel.py
index f58a024..ef585b0 100644
--- a/ryu/app/gre_tunnel.py
+++ b/ryu/app/gre_tunnel.py
@@ -221,13 +221,14 @@ class PortSet(app_manager.RyuApp):
@handler.set_ev_cls(tunnels.EventTunnelKeyAdd)
def tunnel_key_add_handler(self, ev):
- for (dpid, port_no) in self.nw.list_ports(ev.network_id):
- self._vm_port_mac_handler(dpid, port_no, ev.network_id, True)
+ network_id = ev.network_id
+ for (dpid, port_no) in self.nw.list_ports_noraise(network_id):
+ self._vm_port_mac_handler(dpid, port_no, network_id, True)
@handler.set_ev_cls(tunnels.EventTunnelKeyDel)
def tunnel_key_del_handler(self, ev):
network_id = ev.network_id
- for (dpid, port_no) in self.nw.list_ports(network_id):
+ for (dpid, port_no) in self.nw.list_ports_noraise(network_id):
self._vm_port_mac_handler(dpid, port_no, network_id, False)
if self.nw.has_network(network_id):
self._tunnel_key_del(ev.tunnel_key)
--
1.7.10.4
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel