Browse Source

Fix oslo.config duplicate option failure

Recent changes are causing this failure when starting
the octavia-api process with the OVN Octavia provider
driver enabled:

  duplicate option: host: oslo_config.cfg.DuplicateOptError:
    duplicate option: host

The issue is that the networking-ovn code imported by the
OVN Octavia provider driver winds-up importing
neutron.common.config, which re-registers config options,
causing the problem.

Since there are a couple of backports implicated, and
a revert is not desired for them, workaround the problem
with two changes:

1. Move an import of the hash_ring_manager code to inside
   the class where it's required.

2. Remove the import of the neutron.service code by changing
   how we determine which worker class we are dealing with.

Closes-bug: #1932093

Change-Id: Iffdc4c385be38ea1b91efe34ac31d0b3ccc305f5
changes/17/796517/6
Brian Haley 1 month ago
parent
commit
1c5597da99
  1. 5
      networking_ovn/ovsdb/impl_idl_ovn.py
  2. 3
      networking_ovn/ovsdb/ovsdb_monitor.py
  3. 1
      networking_ovn/ovsdb/worker.py

5
networking_ovn/ovsdb/impl_idl_ovn.py

@ -33,7 +33,6 @@ from networking_ovn.common import exceptions as ovn_exc
from networking_ovn.common import utils
from networking_ovn.ovsdb import commands as cmd
from networking_ovn.ovsdb import ovsdb_monitor
from networking_ovn.ovsdb import worker
LOG = log.getLogger(__name__)
@ -158,7 +157,7 @@ class OvsdbNbOvnIdl(nb_impl_idl.OvnNbApiIdlImpl, Backend):
@classmethod
def from_worker(cls, worker_class, driver=None):
args = (cfg.get_ovn_nb_connection(), 'OVN_Northbound')
if worker_class == worker.MaintenanceWorker:
if hasattr(worker_class, 'need_import_workaround'):
idl_ = ovsdb_monitor.BaseOvnIdl.from_server(*args)
else:
idl_ = ovsdb_monitor.OvnNbIdl.from_server(*args, driver=driver)
@ -728,7 +727,7 @@ class OvsdbSbOvnIdl(sb_impl_idl.OvnSbApiIdlImpl, Backend):
@classmethod
def from_worker(cls, worker_class, driver=None):
args = (cfg.get_ovn_sb_connection(), 'OVN_Southbound')
if worker_class == worker.MaintenanceWorker:
if hasattr(worker_class, 'need_import_workaround'):
idl_ = ovsdb_monitor.BaseOvnSbIdl.from_server(*args)
else:
idl_ = ovsdb_monitor.OvnSbIdl.from_server(*args, driver=driver)

3
networking_ovn/ovsdb/ovsdb_monitor.py

@ -29,7 +29,6 @@ from ovsdbapp.backend.ovs_idl import idlutils
from networking_ovn.common import config as ovn_config
from networking_ovn.common import constants as ovn_const
from networking_ovn.common import exceptions
from networking_ovn.common import hash_ring_manager
from networking_ovn.common import utils
from networking_ovn.db import hash_ring as db_hash_ring
from networking_ovn.ovsdb import backports
@ -434,6 +433,8 @@ class OvnIdl(BaseOvnIdl):
class OvnIdlDistributedLock(BaseOvnIdl):
def __init__(self, driver, remote, schema):
# pylint: disable=import-outside-toplevel
from networking_ovn.common import hash_ring_manager
super(OvnIdlDistributedLock, self).__init__(remote, schema)
self.driver = driver
self.notify_handler = OvnDbNotifyHandler(driver)

1
networking_ovn/ovsdb/worker.py

@ -17,6 +17,7 @@ from neutron_lib import worker
class MaintenanceWorker(worker.BaseWorker):
need_import_workaround = True
def start(self):
super(MaintenanceWorker, self).start()

Loading…
Cancel
Save