예제 #1
0
 def _update_port(self, port):
     """Invoked to indicate that a port has been updated within Neutron."""
     LOG.info(
         _LI("Neutron API indicated port update for %(mac)s.  " "Checking if hosted by this system."),
         {"mac": port.get("mac_address")},
     )
     self.updated_ports.append(port)
예제 #2
0
 def _update_port(self, port):
     """Invoked to indicate that a port has been updated within Neutron."""
     LOG.info(
         _LI('Neutron API indicated port update for %(mac)s.  '
             'Checking if hosted by this system.'),
         {'mac': port.get('mac_address')})
     self.updated_ports.append(port)
예제 #3
0
def main():
    # Read in the command line args
    n_config.init(sys.argv[1:])
    n_config.setup_logging()

    # Build then run the agent
    agent = SharedEthernetNeutronAgent()
    LOG.info(_LI("Shared Ethernet Agent initialized and running"))
    agent.rpc_loop()
예제 #4
0
    def _update_req(self, request, lpar_uuids):
        """Attempts to provision a given UpdateVLANRequest.

        :param request: The UpdateVLANRequest.
        :return: True if the request was successfully processed.  False if it
                 was not able to process.
        """
        # Pull the ProvisionRequest off the VLAN Update call.
        p_req = request.p_req
        client_adpts = []

        try:
            if p_req.lpar_uuid in lpar_uuids:
                # Get the adapters just for the VM that the request is for.
                client_adpts = utils.list_cnas(self.adapter, self.host_uuid,
                                               lpar_uuid=p_req.lpar_uuid)
                cna = utils.find_cna_for_mac(p_req.mac_address, client_adpts)
                if cna:
                    # If the PVID does not match, update the CNA.
                    if cna.pvid != p_req.segmentation_id:
                        utils.update_cna_pvid(cna, p_req.segmentation_id)
                    LOG.info(_LI("Sending update device for %s"),
                             p_req.mac_address)
                    self.agent.update_device_up(p_req.rpc_device)
                    self._remove_request(request)
                    return

        except Exception as e:
            LOG.warn(_LW("An error occurred while attempting to update the "
                         "PVID of the virtual NIC."))
            LOG.exception(e)

        # Increment the request count.
        request.attempt_count += 1
        if request.attempt_count >= ACONF.pvid_update_loops:
            # If it had been on the system...this is an error.
            if p_req.lpar_uuid in lpar_uuids:
                self._mark_failed(p_req, client_adpts)

            # Remove the request from the overall queue
            self._remove_request(request)