예제 #1
0
        def check_net_and_ip(port):
            # If the port is not bound to any chassis it is not relevant
            if not port.chassis:
                return False

            is_in_network = utils.get_network_name_from_datapath(
                port.datapath) == network
            return (port.mac and is_in_network
                    and (ip_address in port.mac[0].split(' ')))
예제 #2
0
 def get_network_port_bindings_by_ip(self, network, ip_address):
     rows = self.db_list_rows('Port_Binding').execute(check_error=True)
     # TODO(twilson) It would be useful to have a db_find that takes a
     # comparison function
     # TODO(dalvarez): Remove the comparison to r.datapath.uuid in Y cycle
     # when we are sure that all namespaces will be created with the
     # Neutron network UUID and not anymore with the OVN datapath UUID.
     return [
         r for r in rows
         if (r.mac and (str(r.datapath.uuid) == network
                        or utils.get_network_name_from_datapath(r.datapath)
                        == network)) and ip_address in r.mac[0].split(' ')
     ]
예제 #3
0
        def check_net_and_ip(port):
            # If the port is not bound to any chassis it is not relevant
            if not port.chassis:
                return False

            # TODO(dalvarez): Remove the comparison to port.datapath.uuid in Y
            # cycle when we are sure that all namespaces will be created with
            # the Neutron network UUID and not anymore with the OVN datapath
            # UUID.
            is_in_network = lambda port: (str(port.datapath.uuid) == network or
                                          utils.get_network_name_from_datapath(
                                              port.datapath) == network)

            return port.mac and is_in_network(port) and (
                ip_address in port.mac[0].split(' '))
예제 #4
0
파일: agent.py 프로젝트: rutu-k/neutron
 def run(self, event, row, old):
     # Check if the port has been bound/unbound to our chassis and update
     # the metadata namespace accordingly.
     resync = False
     if row.type not in OVN_VIF_PORT_TYPES:
         return
     with _SYNC_STATE_LOCK.read_lock():
         try:
             net_name = ovn_utils.get_network_name_from_datapath(
                     row.datapath)
             LOG.info(self.LOG_MSG, row.logical_port, net_name)
             self.agent.update_datapath(str(row.datapath.uuid), net_name)
         except ConfigException:
             # We're now in the reader lock mode, we need to exit the
             # context and then use writer lock
             resync = True
     if resync:
         self.agent.resync()
예제 #5
0
파일: agent.py 프로젝트: rutu-k/neutron
    def ensure_all_networks_provisioned(self):
        """Ensure that all datapaths are provisioned.

        This function will make sure that all datapaths with ports bound to
        our chassis have its namespace, VETH pair and OVS port created and
        metadata proxy is up and running.

        :return: A list with the namespaces that are currently serving
        metadata
        """
        # Retrieve all VIF ports in our Chassis
        ports = self.sb_idl.get_ports_on_chassis(self.chassis)
        nets = {(str(p.datapath.uuid),
            ovn_utils.get_network_name_from_datapath(p.datapath))
            for p in self._vif_ports(ports)}
        namespaces = []
        # Make sure that all those datapaths are serving metadata
        for datapath, net_name in nets:
            netns = self.provision_datapath(datapath, net_name)
            if netns:
                namespaces.append(netns)

        return namespaces