示例#1
0
    def _update_sea(self, sea_dev, virt_adpts_list):
        """
        This method will update the passed in SEA to include all virtual
        adapters passed in.  NOTE: This does not touch the SEA's primary VEA.

        :param sea_dev: SharedEthernetAdapter DOM object representing SEA to
                        be updated on the system.
        :param virt_adpts_list: List of virtual adapters (VEAs) to be attached
                                to the SEA when done.
        """
        cmds = utils.change_sea_virt_adapters_cmd(seaname=sea_dev.name,
                                                  pveaname=sea_dev.
                                                  get_primary_vea().name,
                                                  virt_list=virt_adpts_list)

        self._pvmops.run_vios_command(cmds)
示例#2
0
    def _delete_vea_on_vios(self, vios, vea_dev, sea_dev, virt_adpts_list):
        """
        This method will remove the given VEA from the given SEA on the
        system and delete it.

        :param vios: VioServer DOM object representing VIOS this is being
                     removed from.
        :param vea_dev: VirtualEthernetAdapter DOM object
        :param sea_dev: SharedEthernetAdapter DOM object
        :param virt_adpts_list: List of VEA devnames that should remain on the
                                SEA
        """
        # Run the first two commands in a loop in case the rmdev fails.
        # Running the first command repeatedly isn't a problem because
        # it's setting the SEA to what we want, and that doesn't change.
        # If this fails, it'll be on the rmdev.
        for x in range(RMDEV_ATTEMPTS):
            try:
                cmds = \
                    (utils.change_sea_virt_adapters_cmd(seaname=sea_dev.name,
                                                        pveaname=sea_dev.
                                                        get_primary_vea().name,
                                                        virt_list=
                                                        virt_adpts_list)
                        + ' && ' +
                        utils.remove_virtual_device(vea_dev.name)
                        + ' && ' +
                        utils.remove_virtual_slot_cmd(lpar_id=vea_dev.
                                                      vio_server.lpar_id,
                                                      slot_num=vea_dev.slot))
                self._pvmops.run_vios_command(cmds)

                # If we got here, all is well
                break
            except Exception as e:
                ras.trace(LOG, __name__, ras.TRACE_ERROR,
                          ras.msg('error', 'VETH_FAILTOREMOVE') %
                          {'slotnum': vea_dev.slot} + '(' + _('%s') % e + ')')

                # Sleep before we try again
                if x < (RMDEV_ATTEMPTS - 1):
                    time.sleep(1)
                else:
                    # This was our last attempt.  Re-raise the exception.
                    raise