Search in sources :

Example 1 with RemoveVmParameters

use of org.ovirt.engine.core.common.action.RemoveVmParameters 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)

Example 2 with RemoveVmParameters

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

the class VmListModel method onRemove.

private void onRemove() {
    final ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    final ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Entry<Guid, EntityModel> entry : vmsRemoveMap.entrySet()) {
        list.add(new RemoveVmParameters(entry.getKey(), false, (Boolean) entry.getValue().getEntity()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveVm, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : RemoveVmParameters(org.ovirt.engine.core.common.action.RemoveVmParameters) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Guid(org.ovirt.engine.core.compat.Guid) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with RemoveVmParameters

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

the class BackendVmResource method remove.

@Override
public Response remove() {
    get();
    boolean force = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, FORCE, true, false);
    RemoveVmParameters params = new RemoveVmParameters(guid, force);
    // If detach only is set we do not remove the VM disks
    boolean detachOnly = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, DETACH_ONLY, true, false);
    if (detachOnly) {
        params.setRemoveDisks(false);
    }
    return performAction(ActionType.RemoveVm, params);
}
Also used : RemoveVmParameters(org.ovirt.engine.core.common.action.RemoveVmParameters)

Example 4 with RemoveVmParameters

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

the class UpdateVmVersionCommand method buildRemoveVmParameters.

private RemoveVmParameters buildRemoveVmParameters() {
    RemoveVmParameters parameters = new RemoveVmParameters(getVmId(), false);
    parameters.setParentCommand(getActionType());
    parameters.setParentParameters(getParameters());
    parameters.setEntityInfo(getParameters().getEntityInfo());
    parameters.setRemovePermissions(false);
    return parameters;
}
Also used : RemoveVmParameters(org.ovirt.engine.core.common.action.RemoveVmParameters)

Example 5 with RemoveVmParameters

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

the class HostedEngineImporter method removedHEVM.

private boolean removedHEVM(VM vm) {
    RemoveVmParameters parameters = new RemoveVmParameters(vm.getId(), true);
    parameters.setRemoveDisks(false);
    return backend.runInternalAction(ActionType.RemoveVm, parameters).getSucceeded();
}
Also used : RemoveVmParameters(org.ovirt.engine.core.common.action.RemoveVmParameters)

Aggregations

RemoveVmParameters (org.ovirt.engine.core.common.action.RemoveVmParameters)5 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 RemoveVmFromPoolParameters (org.ovirt.engine.core.common.action.RemoveVmFromPoolParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1