From 9e74ea11e8b6c06288f91c393b882e32a2524235 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Tue, 19 Dec 2023 11:15:06 +0000 Subject: [PATCH] [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 --- neutron/agent/ovn/agent/ovn_neutron_agent.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/neutron/agent/ovn/agent/ovn_neutron_agent.py b/neutron/agent/ovn/agent/ovn_neutron_agent.py index 26c72bfeb6a..db027b43c4b 100644 --- a/neutron/agent/ovn/agent/ovn_neutron_agent.py +++ b/neutron/agent/ovn/agent/ovn_neutron_agent.py @@ -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')