Browse Source

Merge "[OVN] Reduce the number of watched tables in MetadataProxyHandler"

changes/56/707356/1
Zuul 1 week ago
parent
commit
75f6f624bc
3 changed files with 12 additions and 12 deletions
  1. +1
    -2
      neutron/agent/ovn/metadata/agent.py
  2. +6
    -4
      neutron/agent/ovn/metadata/ovsdb.py
  3. +5
    -6
      neutron/agent/ovn/metadata/server.py

+ 1
- 2
neutron/agent/ovn/metadata/agent.py View File

@@ -171,8 +171,7 @@ class MetadataAgent(object):
self._load_config()

# Launch the server that will act as a proxy between the VM's and Nova.
proxy = metadata_server.UnixDomainMetadataProxy(self.conf,
self.chassis)
proxy = metadata_server.UnixDomainMetadataProxy(self.conf)
proxy.run()

# Open the connection to OVN SB database.

+ 6
- 4
neutron/agent/ovn/metadata/ovsdb.py View File

@@ -27,17 +27,19 @@ class MetadataAgentOvnSbIdl(ovsdb_monitor.OvnIdl):

SCHEMA = 'OVN_Southbound'

def __init__(self, chassis, events=None):
def __init__(self, chassis=None, events=None, tables=None):
connection_string = config.get_ovn_sb_connection()
ovsdb_monitor._check_and_set_ssl_files(self.SCHEMA)
helper = self._get_ovsdb_helper(connection_string)
tables = ('Chassis', 'Encap', 'Port_Binding', 'Datapath_Binding',
'SB_Global')
if tables is None:
tables = ('Chassis', 'Encap', 'Port_Binding', 'Datapath_Binding',
'SB_Global')
for table in tables:
helper.register_table(table)
super(MetadataAgentOvnSbIdl, self).__init__(
None, connection_string, helper)
self.tables['Chassis'].condition = [['name', '==', chassis]]
if chassis and 'Chassis' in tables:
self.tables['Chassis'].condition = [['name', '==', chassis]]
if events:
self.notify_handler.watch_events(events)


+ 5
- 6
neutron/agent/ovn/metadata/server.py View File

@@ -44,9 +44,8 @@ MODE_MAP = {

class MetadataProxyHandler(object):

def __init__(self, conf, chassis=''):
def __init__(self, conf):
self.conf = conf
self.chassis = chassis
self.subscribe()

def subscribe(self):
@@ -57,7 +56,8 @@ class MetadataProxyHandler(object):
def post_fork_initialize(self, resource, event, trigger, payload=None):
# We need to open a connection to OVN SouthBound database for
# each worker so that we can process the metadata requests.
self.sb_idl = ovsdb.MetadataAgentOvnSbIdl(chassis=self.chassis).start()
self.sb_idl = ovsdb.MetadataAgentOvnSbIdl(
tables=('Port_Binding', 'Datapath_Binding')).start()

@webob.dec.wsgify(RequestClass=webob.Request)
def __call__(self, req):
@@ -162,9 +162,8 @@ class MetadataProxyHandler(object):

class UnixDomainMetadataProxy(object):

def __init__(self, conf, chassis=''):
def __init__(self, conf):
self.conf = conf
self.chassis = chassis
agent_utils.ensure_directory_exists_without_file(
cfg.CONF.metadata_proxy_socket)

@@ -189,7 +188,7 @@ class UnixDomainMetadataProxy(object):
def run(self):
self.server = agent_utils.UnixDomainWSGIServer(
'networking-ovn-metadata-agent')
self.server.start(MetadataProxyHandler(self.conf, self.chassis),
self.server.start(MetadataProxyHandler(self.conf),
self.conf.metadata_proxy_socket,
workers=self.conf.metadata_workers,
backlog=self.conf.metadata_backlog,

Loading…
Cancel
Save