Browse Source

Merge "Add wait event for metadataagent sb_idl" into stable/ussuri

changes/72/825472/1
Zuul 4 months ago committed by Gerrit Code Review
parent
commit
40c51d8105
  1. 17
      neutron/agent/ovn/metadata/agent.py

17
neutron/agent/ovn/metadata/agent.py

@ -14,6 +14,7 @@
import collections
import re
import threading
import uuid
from neutron_lib import constants as n_const
@ -184,6 +185,18 @@ class MetadataAgent(object):
self._process_monitor = external_process.ProcessMonitor(
config=self.conf,
resource_type='metadata')
self._sb_idl = None
self._post_fork_event = threading.Event()
@property
def sb_idl(self):
if not self._sb_idl:
self._post_fork_event.wait()
return self._sb_idl
@sb_idl.setter
def sb_idl(self, val):
self._sb_idl = val
def _load_config(self):
self.chassis = self._get_own_chassis_name()
@ -228,6 +241,7 @@ class MetadataAgent(object):
# Chassis table.
# Open the connection to OVN SB database.
self.has_chassis_private = False
self._post_fork_event.clear()
try:
self.sb_idl = ovsdb.MetadataAgentOvnSbIdl(
chassis=self.chassis, tables=tables + ('Chassis_Private', ),
@ -238,6 +252,9 @@ class MetadataAgent(object):
chassis=self.chassis, tables=tables,
events=events + (ChassisCreateEvent(self), )).start()
# Now IDL connections can be safely used.
self._post_fork_event.set()
# Do the initial sync.
self.sync()

Loading…
Cancel
Save