Search in sources :

Example 6 with VmOperationParameterBase

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

the class DetachUserFromVmFromPoolCommand method restoreVmFromBaseSnapshot.

private void restoreVmFromBaseSnapshot(VM vm) {
    if (snapshotDao.exists(vm.getId(), SnapshotType.STATELESS)) {
        log.info("Deleting snapshots for stateless vm '{}'", vm.getId());
        VmOperationParameterBase restoreParams = new VmOperationParameterBase(vm.getId());
        // setting RestoreStatelessVm to run in new transaction so it could rollback internally if needed,
        // but still not affect this command, in order to keep permissions changes even on restore failure
        restoreParams.setTransactionScopeOption(TransactionScopeOption.RequiresNew);
        runInternalAction(ActionType.RestoreStatelessVm, restoreParams, getContext().withCompensationContext(null));
    }
}
Also used : VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase)

Example 7 with VmOperationParameterBase

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

the class BackendVmResource method reorderMacAddresses.

@Override
public Response reorderMacAddresses(Action action) {
    getEntity(org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), "VM: id=" + guid, true);
    final VmOperationParameterBase params = new VmOperationParameterBase(guid);
    final Response response = doAction(ActionType.ReorderVmNics, params, action);
    return response;
}
Also used : Response(javax.ws.rs.core.Response) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase)

Example 8 with VmOperationParameterBase

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

the class VmInterfaceCreatingManager method doNicManipulation.

@Override
protected void doNicManipulation(final ArrayList<ActionParametersBase> createVnicParameters, final ArrayList<ActionParametersBase> updateVnicParameters, final ArrayList<ActionParametersBase> removeVnicParameters, final boolean isAddingNewVm, final Guid id, final UnitVmModel unitVmModel) {
    Frontend.getInstance().runMultipleActions(ActionType.AddVmInterface, createVnicParameters, addInterfaceResult -> Frontend.getInstance().runMultipleActions(ActionType.UpdateVmInterface, updateVnicParameters, updateInterfaceResult -> Frontend.getInstance().runMultipleActions(ActionType.RemoveVmInterface, removeVnicParameters, removeInterfaceResult -> {
        if (isAddingNewVm) {
            VmOperationParameterBase reorderParams = new VmOperationParameterBase(id);
            Frontend.getInstance().runAction(ActionType.ReorderVmNics, reorderParams, reorderResult -> getCallback().vnicCreated(id, unitVmModel));
        } else {
            getCallback().vnicCreated(id, unitVmModel);
        }
    }, this), this), this);
}
Also used : ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) AddVmInterfaceParameters(org.ovirt.engine.core.common.action.AddVmInterfaceParameters) Guid(org.ovirt.engine.core.compat.Guid) RemoveVmInterfaceParameters(org.ovirt.engine.core.common.action.RemoveVmInterfaceParameters) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ArrayList(java.util.ArrayList) VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase)

Aggregations

VmOperationParameterBase (org.ovirt.engine.core.common.action.VmOperationParameterBase)8 ArrayList (java.util.ArrayList)4 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)4 VM (org.ovirt.engine.core.common.businessentities.VM)3 List (java.util.List)1 Response (javax.ws.rs.core.Response)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 AddVmInterfaceParameters (org.ovirt.engine.core.common.action.AddVmInterfaceParameters)1 RemoveVmInterfaceParameters (org.ovirt.engine.core.common.action.RemoveVmInterfaceParameters)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 AsyncQuery (org.ovirt.engine.ui.frontend.AsyncQuery)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1