dpset: Fix iteration error when disconnecting switches

When disconnecting switches, dpset will fail to unregister ports,
because size of values in the port state dictionary might be
changed when doing the iteration.
This patch fixes to copy the values list and fixes this problem.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
IWASE Yusuke 2016-10-19 13:36:14 +09:00 committed by FUJITA Tomonori
parent 022406507a
commit e80a36317a
1 changed files with 1 additions and 1 deletions

View File

@ -218,7 +218,7 @@ class DPSet(app_manager.RyuApp):
# Now datapath is already dead, so port status change event doesn't
# interfere us.
ev = EventDP(dp, False)
for port in self.port_state.get(dp.id, {}).values():
for port in list(self.port_state.get(dp.id, {}).values()):
self._port_deleted(dp, port)
ev.ports.append(port)