[OVN] ovn-metadata-agent: Retry registering Chassis at startup

This patch adds a retry mechanism on the register_metadata_agent()
method from the OVN metadata agent to make it more tolerable to the
start up order of the services.

Conflicts:
    neutron/agent/ovn/metadata/agent.py

Change-Id: If0e5a64e5f692c781fb5e6a68b948b611c694ab0
Closes-Bug: #1905700
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
(cherry picked from commit 9c236db3bf)
This commit is contained in:
Lucas Alvares Gomes 2020-11-26 09:51:12 +00:00
parent 3c368c0f63
commit b2dc70ee9b
1 changed files with 13 additions and 7 deletions

View File

@ -15,6 +15,15 @@
import collections
import re
from neutron_lib import constants as n_const
from oslo_concurrency import lockutils
from oslo_log import log
from oslo_utils import uuidutils
from ovsdbapp.backend.ovs_idl import event as row_event
from ovsdbapp.backend.ovs_idl import vlog
import six
import tenacity
from neutron.agent.linux import external_process
from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_manager
@ -24,13 +33,6 @@ from neutron.agent.ovn.metadata import server as metadata_server
from neutron.common.ovn import constants as ovn_const
from neutron.common import utils
from neutron.conf.plugins.ml2.drivers.ovn import ovn_conf as config
from neutron_lib import constants as n_const
from oslo_concurrency import lockutils
from oslo_log import log
from oslo_utils import uuidutils
from ovsdbapp.backend.ovs_idl import event as row_event
from ovsdbapp.backend.ovs_idl import vlog
import six
LOG = log.getLogger(__name__)
@ -231,6 +233,10 @@ class MetadataAgent(object):
proxy.wait()
@tenacity.retry(
wait=tenacity.wait_exponential(
max=config.get_ovn_ovsdb_retry_max_interval()),
reraise=True)
def register_metadata_agent(self):
# NOTE(lucasagomes): db_add() will not overwrite the UUID if
# it's already set.