Example #1
0
    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()
Example #2
0
    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()
Example #3
0
    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._post_fork_event.clear()
        self.sb_idl = ovsdb.MetadataAgentOvnSbIdl(
            tables=('Port_Binding', 'Datapath_Binding', 'Chassis'),
            chassis=self.chassis).start()

        # Now IDL connections can be safely used.
        self._post_fork_event.set()
Example #4
0
 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(
         tables=('Port_Binding', 'Datapath_Binding')).start()