Search in sources :

Example 1 with RemoveVmFromPoolParameters

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

the class PoolVmListModel method onDetach.

public void onDetach() {
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    boolean latchChecked = !model.validate();
    if (model.getProgress() != null || latchChecked) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VM vm = (VM) item;
        list.add(new RemoveVmFromPoolParameters(vm.getId(), true, true));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveVmFromPool, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : RemoveVmFromPoolParameters(org.ovirt.engine.core.common.action.RemoveVmFromPoolParameters) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with RemoveVmFromPoolParameters

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

the class UpdateVmVersionCommand method buildRemoveVmFromPoolParameters.

private RemoveVmFromPoolParameters buildRemoveVmFromPoolParameters() {
    RemoveVmFromPoolParameters parameters = new RemoveVmFromPoolParameters(getVmId(), false, false);
    parameters.setTransactionScopeOption(TransactionScopeOption.RequiresNew);
    return parameters;
}
Also used : RemoveVmFromPoolParameters(org.ovirt.engine.core.common.action.RemoveVmFromPoolParameters)

Example 3 with RemoveVmFromPoolParameters

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

the class RemoveVmPoolCommand method removeVm.

private boolean removeVm(VM vm) {
    RemoveVmFromPoolParameters removeVmFromPoolParameters = new RemoveVmFromPoolParameters(vm.getId(), false, false);
    removeVmFromPoolParameters.setTransactionScopeOption(TransactionScopeOption.Suppress);
    ActionReturnValue result = runInternalActionWithTasksContext(ActionType.RemoveVmFromPool, removeVmFromPoolParameters);
    if (!result.getSucceeded()) {
        return false;
    }
    result = runInternalAction(ActionType.RemoveVm, new RemoveVmParameters(vm.getId(), false), createRemoveVmStepContext(vm));
    if (!result.getSucceeded()) {
        return false;
    }
    vmsRemoved.add(vm.getId());
    return true;
}
Also used : RemoveVmFromPoolParameters(org.ovirt.engine.core.common.action.RemoveVmFromPoolParameters) RemoveVmParameters(org.ovirt.engine.core.common.action.RemoveVmParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Aggregations

RemoveVmFromPoolParameters (org.ovirt.engine.core.common.action.RemoveVmFromPoolParameters)3 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 RemoveVmParameters (org.ovirt.engine.core.common.action.RemoveVmParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1