Browse Source

Merge "OVN Metadata agent gets OVSDB updates for only its Chassis"

tags/16.0.0.0b1
Zuul Gerrit Code Review 3 months ago
parent
commit
6e80cb5aab
3 changed files with 16 additions and 11 deletions
  1. +8
    -6
      neutron/agent/ovn/metadata/agent.py
  2. +2
    -1
      neutron/agent/ovn/metadata/ovsdb.py
  3. +6
    -4
      neutron/agent/ovn/metadata/server.py

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

@@ -166,18 +166,20 @@ class MetadataAgent(object):
self.sync()

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

# Open the connection to OVS database
self.ovs_idl = ovsdb.MetadataAgentOvsIdl().start()
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.run()

# Open the connection to OVN SB database.
self.sb_idl = ovsdb.MetadataAgentOvnSbIdl(
[PortBindingChassisEvent(self), ChassisCreateEvent(self),
SbGlobalUpdateEvent(self)]).start()
chassis=self.chassis,
events=[PortBindingChassisEvent(self), ChassisCreateEvent(self),
SbGlobalUpdateEvent(self)]).start()

# Do the initial sync.
self.sync()


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

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

SCHEMA = 'OVN_Southbound'

def __init__(self, events=None):
def __init__(self, chassis, events=None):
connection_string = config.get_ovn_sb_connection()
ovsdb_monitor._check_and_set_ssl_files(self.SCHEMA)
helper = self._get_ovsdb_helper(connection_string)
@@ -37,6 +37,7 @@ class MetadataAgentOvnSbIdl(ovsdb_monitor.OvnIdl):
helper.register_table(table)
super(MetadataAgentOvnSbIdl, self).__init__(
None, connection_string, helper)
self.tables['Chassis'].condition = [['name', '==', chassis]]
if events:
self.notify_handler.watch_events(events)



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

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

class MetadataProxyHandler(object):

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

def subscribe(self):
@@ -56,7 +57,7 @@ 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().start()
self.sb_idl = ovsdb.MetadataAgentOvnSbIdl(chassis=self.chassis).start()

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

class UnixDomainMetadataProxy(object):

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

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


Loading…
Cancel
Save