Registering a table handler in new app format causes exception on switch reconnect.
e.g., the error is:
Feb 15 17:40:54.970119 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: ERROR os_ken.lib.hub [-] hub: uncaught exception: Traceback (most recent call last):
Feb 15 17:40:54.970355 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/usr/local/lib/python2.7/dist-packages/os_ken/lib/hub.py", line 59, in _launch
Feb 15 17:40:54.970583 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: return func(*args, **kwargs)
Feb 15 17:40:54.970827 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/usr/local/lib/python2.7/dist-packages/os_ken/controller/controller.py", line 536, in datapath_connection_factory
Feb 15 17:40:54.971065 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: datapath.serve()
Feb 15 17:40:54.971359 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/usr/local/lib/python2.7/dist-packages/os_ken/controller/controller.py", line 454, in serve
Feb 15 17:40:54.971659 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: self._recv_loop()
Feb 15 17:40:54.971831 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/usr/local/lib/python2.7/dist-packages/os_ken/controller/controller.py", line 196, in deactivate
Feb 15 17:40:54.971965 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: method(self)
Feb 15 17:40:54.972092 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/usr/local/lib/python2.7/dist-packages/os_ken/controller/controller.py", line 355, in _recv_loop
Feb 15 17:40:54.972221 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: handler(ev)
Feb 15 17:40:54.972346 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/opt/stack/new/dragonflow/dragonflow/switch/drivers/ovs/os_ken_base_app.py", line 112, in switch_features_handler
Feb 15 17:40:54.972470 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: self.switch_backend.setup_datapath(self)
Feb 15 17:40:54.972594 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/opt/stack/new/dragonflow/dragonflow/switch/drivers/ovs/df_ovs_driver.py", line 58, in setup_datapath
Feb 15 17:40:54.972727 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: self.nb_api, self.neutron_notifier)
Feb 15 17:40:54.972925 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/opt/stack/new/dragonflow/dragonflow/switch/drivers/ovs/datapath.py", line 116, in set_up
Feb 15 17:40:54.973060 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: app.initialize()
Feb 15 17:40:54.973187 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/opt/stack/new/dragonflow/dragonflow/controller/apps/packet_log.py", line 43, in initialize
Feb 15 17:40:54.973310 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: self._packet_in_handler)
Feb 15 17:40:54.973435 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: File "/opt/stack/new/dragonflow/dragonflow/switch/drivers/ovs/os_ken_base_app.py", line 85, in register_table_handler
Feb 15 17:40:54.973558 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: existing_handler=self.table_handlers[table_id],
Feb 15 17:40:54.973694 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: RuntimeError: Cannot register handler <bound method LogPacketApp._packet_in_handler of <dragonflow.controller.apps.packet_log.LogPacketApp object at 0x7f05ca125b90>> for table 204,occupied by <bound method LogPacketApp._packet_in_handler of <dragonflow.controller.apps.packet_log.LogPacketApp object at 0x7f05ca287f10>>
Feb 15 17:40:54.973841 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: : RuntimeError: Cannot register handler <bound method LogPacketApp._packet_in_handler of <dragonflow.controller.apps.packet_log.LogPacketApp object at 0x7f05ca125b90>> for table 204,occupied by <bound method LogPacketApp._packet_in_handler of <dragonflow.controller.apps.packet_log.LogPacketApp object at 0x7f05ca287f10>>
Feb 15 17:40:56.972407 ubuntu-xenial-ovh-gra1-0002627649 df-local-controller[21733]: ERROR os_ken.controller.controller [-] Error in the datapath 00004ef1fc528744 from ('127.0.0.1', 37468): RuntimeError: Cannot register handler <bound method LogPacketApp._packet_in_handler of <dragonflow.controller.apps.packet_log.LogPacketApp object at 0x7f05ca125cd0>> for table 204,occupied by <bound method LogPacketApp._packet_in_handler of <dragonflow.controller.apps.packet_log.LogPacketApp object at 0x7f05ca287f10>>
Reviewed: https:/ /review. openstack. org/643762 /git.openstack. org/cgit/ openstack/ dragonflow/ commit/ ?id=b8fb4de2f64 1dce18e60b5c7c1 c3afe04ea8bd29
Committed: https:/
Submitter: Zuul
Branch: master
commit b8fb4de2f641dce 18e60b5c7c1c3af e04ea8bd29
Author: Omer Anson <email address hidden>
Date: Sun Mar 17 22:02:47 2019 +0200
Clear registered table handlers on datapath set_up
Datapath set_up overwrites old applications with new applications
(usually of the same type). If any of these applications registered
a table handler - upon reconnect, this table handler will already
be registered and that would raise an Exception.
This change clears table handlers of old applications. Only new-type
applications should be affected (legacy-type apps should remain the same).
Change-Id: I356758175e9816 d57d2831c34f35d f8e69cafbcf
Closes-Bug: #1820533