Search in sources :

Example 1 with VmPoolParametersBase

use of org.ovirt.engine.core.common.action.VmPoolParametersBase in project ovirt-engine by oVirt.

the class PoolListModel method onRemove.

public void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VmPool pool = (VmPool) item;
        list.add(new VmPoolParametersBase(pool.getVmPoolId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveVmPool, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : VmPoolParametersBase(org.ovirt.engine.core.common.action.VmPoolParametersBase) VmPool(org.ovirt.engine.core.common.businessentities.VmPool) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with VmPoolParametersBase

use of org.ovirt.engine.core.common.action.VmPoolParametersBase in project ovirt-engine by oVirt.

the class RemoveVmPoolCommandCallback method childCommandsExecutionEnded.

@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
    if (anyFailed) {
        setCommandEndStatus(command, true, status, childCmdIds);
    } else {
        RemoveVmPoolCommand<? extends VmPoolParametersBase> removeVmPoolCommand = (RemoveVmPoolCommand<? extends VmPoolParametersBase>) command;
        VmPool pool = DbFacade.getInstance().getVmPoolDao().get(removeVmPoolCommand.getVmPoolId());
        if (pool == null || pool.getRunningVmsCount() == 0) {
            setCommandEndStatus(command, false, status, childCmdIds);
        }
    }
}
Also used : VmPoolParametersBase(org.ovirt.engine.core.common.action.VmPoolParametersBase) VmPool(org.ovirt.engine.core.common.businessentities.VmPool)

Example 3 with VmPoolParametersBase

use of org.ovirt.engine.core.common.action.VmPoolParametersBase in project ovirt-engine by oVirt.

the class RemoveVmFromPoolRunner method removePoolIfNeeded.

/**
 * If there is no VMs left in the pool, removes the pool itself
 */
private void removePoolIfNeeded() {
    if (!isPoolRemovalEnabled()) {
        return;
    }
    Guid poolId = getPoolId();
    if (poolId == null) {
        return;
    }
    boolean allVmsRemoved = vmPoolDao.getVmPoolsMapByVmPoolId(poolId).size() == 0;
    if (!allVmsRemoved) {
        return;
    }
    VmPoolParametersBase removePoolParam = new VmPoolParametersBase(poolId);
    removePoolParam.setSessionId(getSessionId());
    Backend.getInstance().runInternalAction(ActionType.RemoveVmPool, removePoolParam, commandContext);
}
Also used : VmPoolParametersBase(org.ovirt.engine.core.common.action.VmPoolParametersBase) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

VmPoolParametersBase (org.ovirt.engine.core.common.action.VmPoolParametersBase)3 VmPool (org.ovirt.engine.core.common.businessentities.VmPool)2 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 Guid (org.ovirt.engine.core.compat.Guid)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1