[OVS] Workaround when OpenFlow controller restarts

When a new OF controller is added or when new OF protocols are added to
a bridge, the OF controller is restarted. When that happens, the os-ken
``OfctlService`` instance removes the OF controller datapath and waits
for an update event that will add a new one. During this time no OF
controllers (datapaths) will be registered and any request will be
rejected with a ``InvalidDatapath`` exception.

This patch is a temporary workaround that prevents any command from
being executed just after those two described operations, providing
time to OVS to send the OF updates.

Conflicts:
	neutron/agent/common/ovs_lib.py

Related-Bug: #1948642
Change-Id: I03878a2e650d5f0d0167e0f7daa351b12bae8725
(cherry picked from commit 0194856da1)
This commit is contained in:
Rodolfo Alonso Hernandez 2021-10-26 09:21:33 +00:00 committed by yatin
parent 670fe9728a
commit f35a0a06e5
1 changed files with 10 additions and 0 deletions

View File

@ -246,6 +246,10 @@ class OVSBridge(BaseOVS):
def set_controller(self, controllers):
self.ovsdb.set_controller(self.br_name,
controllers).execute(check_error=True)
# TODO(ralonsoh): this is a workaround for LP#1948642. When a new
# controller is added, os-ken ``OfctlService`` needs to receive the
# update event and register this new datapath.
time.sleep(1)
def del_controller(self):
self.ovsdb.del_controller(self.br_name).execute(check_error=True)
@ -271,6 +275,12 @@ class OVSBridge(BaseOVS):
self.ovsdb.db_add(
'Bridge', self.br_name,
'protocols', *diff).execute(check_error=True)
# TODO(ralonsoh): this is a workaround for LP#1948642. When the OF
# protocols are changed, the OF controller is restarted. This
# sleep will provide time to os-ken ``OfctlService`` to receive
# the update events of the restarted controllers and set them as
# enabled.
time.sleep(1)
def use_at_least_protocol(self, protocol):
"""Calls to ovs-ofctl will use a protocol version >= 'protocol'"""