[OVN] The OVN agent exposes the ``load_config`` method.

Now the ``OVNNeutronAgent.load_config`` method is public and accessible
by the OVN agent extensions.

This patch also makes use of the property ``ovs_idl``, that implicitly
loads the OVS IDL if it is not done previously.

Related-Bug: #2017871
Change-Id: I356c16d753b524736673a665a6590ae903be5682
This commit is contained in:
Rodolfo Alonso Hernandez 2023-12-19 11:15:06 +00:00
parent 5ce17647c6
commit 9e74ea11e8
1 changed files with 7 additions and 6 deletions

View File

@ -67,6 +67,8 @@ class OVNNeutronAgent(service.Service):
@property
def ovs_idl(self):
if not self.ext_manager_api.ovs_idl:
self.ext_manager_api.ovs_idl = self._load_ovs_idl()
return self.ext_manager_api.ovs_idl
@property
@ -85,15 +87,15 @@ class OVNNeutronAgent(service.Service):
def sb_post_fork_event(self):
return self.ext_manager_api.sb_post_fork_event
def _load_config(self, ovs_idl):
self.chassis = ovsdb.get_own_chassis_name(ovs_idl)
def load_config(self):
self.chassis = ovsdb.get_own_chassis_name(self.ovs_idl)
try:
self.chassis_id = uuid.UUID(self.chassis)
except ValueError:
# OVS system-id could be a non UUID formatted string.
self.chassis_id = uuid.uuid5(OVN_MONITOR_UUID_NAMESPACE,
self.chassis)
self.ovn_bridge = ovsdb.get_ovn_bridge(ovs_idl)
self.ovn_bridge = ovsdb.get_ovn_bridge(self.ovs_idl)
LOG.info("Loaded chassis name %s (UUID: %s) and ovn bridge %s.",
self.chassis, self.chassis_id, self.ovn_bridge)
@ -134,10 +136,9 @@ class OVNNeutronAgent(service.Service):
def start(self):
self.ext_manager_api.ovs_idl = self._load_ovs_idl()
# Before executing "_load_config", it is needed to create the OVS IDL.
self._load_config(self.ext_manager_api.ovs_idl)
self.load_config()
# Before executing "_load_sb_idl", is is needed to execute
# "_load_config" to populate self.chassis.
# "load_config" to populate self.chassis.
self.ext_manager_api.sb_idl = self._load_sb_idl()
self.ext_manager_api.nb_idl = self._load_nb_idl()
LOG.info('Starting OVN Neutron Agent')