Merge "OVN Metadata agent gets OVSDB updates for only its Chassis"
This commit is contained in:
commit
6e80cb5aab
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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…
x
Reference in New Issue
Block a user