ironic_inspector/plugins/base_physnet.py
def before_update(self, introspection_data, node_info, **kwargs):
        """Process introspection data and patch port physical network."""
        inventory = utils.get_inventory(introspection_data)

        ironic_ports = node_info.ports()

        for iface in inventory['interfaces']:
            if iface['name'] not in introspection_data['all_interfaces']:
                continue

            mac_address = iface['mac_address']
            port = ironic_ports.get(mac_address)
            if not port:
                LOG.debug("Skipping physical network processing for interface "
                          "%s, matching port not found in Ironic.",
                          mac_address,
                          node_info=node_info, data=introspection_data)
                continue

            # Determine the physical network for this port.
            # Port not touched in here.
            physnet = self.get_physnet(port, iface['name'], introspection_data)
            if physnet is None:
                LOG.debug("Skipping physical network processing for interface "
                          "%s, no physical network mapping",
                          mac_address,
                          node_info=node_info, data=introspection_data)
                continue

            patch = self._get_physnet_patch(physnet, port)
            if patch is None:
                LOG.debug("Skipping physical network processing for interface "
                          "%s, no update required",
                          mac_address,
                          node_info=node_info, data=introspection_data)
                continue

            try:
                node_info.patch_port(port, [patch])
            except exceptions.BadRequestException as e:
                LOG.warning("Failed to update port %(uuid)s: %(error)s",
                            {'uuid': port.id, 'error': e},
                            node_info=node_info)
Process introspection data and patch port physical network.
Process introspection data and patch port physical network.
Process introspection data and patch port physical network .
def before_update(self, introspection_data, node_info, **kwargs):
        inventory = utils.get_inventory(introspection_data)
        ironic_ports = node_info.ports()
        for iface in inventory['interfaces']:
            if iface['name'] not in introspection_data['all_interfaces']:
                continue
            mac_address = iface['mac_address']
            port = ironic_ports.get(mac_address)
            if not port:
                LOG.debug("Skipping physical network processing for interface "
                          "%s, matching port not found in Ironic.",
                          mac_address,
                          node_info=node_info, data=introspection_data)
                continue
            physnet = self.get_physnet(port, iface['name'], introspection_data)
            if physnet is None:
                LOG.debug("Skipping physical network processing for interface "
                          "%s, no physical network mapping",
                          mac_address,
                          node_info=node_info, data=introspection_data)
                continue
            patch = self._get_physnet_patch(physnet, port)
            if patch is None:
                LOG.debug("Skipping physical network processing for interface "
                          "%s, no update required",
                          mac_address,
                          node_info=node_info, data=introspection_data)
                continue
            try:
                node_info.patch_port(port, [patch])
            except exceptions.BadRequestException as e:
                LOG.warning("Failed to update port %(uuid)s: %(error)s",
                            {'uuid': port.id, 'error': e},
                            node_info=node_info)
def before_update ( self , introspection_data , node_info , ** kwargs ) : inventory = utils . get_inventory ( introspection_data ) ironic_ports = node_info . ports ( ) for iface in inventory [ 'interfaces' ] : if iface [ 'name' ] not in introspection_data [ 'all_interfaces' ] : continue mac_address = iface [ 'mac_address' ] port = ironic_ports . get ( mac_address ) if not port : LOG . debug ( "Skipping physical network processing for interface " "%s, matching port not found in Ironic." , mac_address , node_info = node_info , data = introspection_data ) continue physnet = self . get_physnet ( port , iface [ 'name' ] , introspection_data ) if physnet is None : LOG . debug ( "Skipping physical network processing for interface " "%s, no physical network mapping" , mac_address , node_info = node_info , data = introspection_data ) continue patch = self . _get_physnet_patch ( physnet , port ) if patch is None : LOG . debug ( "Skipping physical network processing for interface " "%s, no update required" , mac_address , node_info = node_info , data = introspection_data ) continue try : node_info . patch_port ( port , [ patch ] ) except exceptions . BadRequestException as e : LOG . warning ( "Failed to update port %(uuid)s: %(error)s" , { 'uuid' : port . id , 'error' : e } , node_info = node_info )
Process introspection data and patch port physical network.
Process introspection data and patch port physical network .
"""Process introspection data and patch port physical network.""" # Determine the physical network for this port. # Port not touched in here.
self
introspection_data
node_info