def start(self): # 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) proxy.run() # Open the connection to OVN SB database. self.sb_idl = ovsdb.MetadataAgentOvnSbIdl( chassis=self.chassis, events=[ PortBindingChassisCreatedEvent(self), PortBindingChassisDeletedEvent(self), ChassisCreateEvent(self), SbGlobalUpdateEvent(self) ]).start() # Do the initial sync. self.sync() # Register the agent with its corresponding Chassis self.register_metadata_agent() proxy.wait()
def start(self): # 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() tables = ('Encap', 'Port_Binding', 'Datapath_Binding', 'SB_Global', 'Chassis') events = (PortBindingChassisCreatedEvent(self), PortBindingChassisDeletedEvent(self), SbGlobalUpdateEvent(self)) # TODO(lucasagomes): Remove this in the future. Try to register # the Chassis_Private table, if not present, fallback to the normal # 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', ), events=events + (ChassisPrivateCreateEvent(self), )).start() self.has_chassis_private = True except AssertionError: self.sb_idl = ovsdb.MetadataAgentOvnSbIdl( 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() # Register the agent with its corresponding Chassis self.register_metadata_agent() proxy.wait()