Search in sources :

Example 1 with VmOperationParameterBase

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

the class VmListModel method cancelMigration.

private void cancelMigration() {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VM a = (VM) item;
        list.add(new VmOperationParameterBase(a.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.CancelMigrateVm, list, result -> {
    }, null);
}
Also used : VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with VmOperationParameterBase

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

the class VmListModel method cancelConversion.

private void cancelConversion() {
    List<ActionParametersBase> parameters = new ArrayList<>();
    for (VM vm : getSelectedItems()) {
        parameters.add(new VmOperationParameterBase(vm.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.CancelConvertVm, parameters);
}
Also used : VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with VmOperationParameterBase

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

the class VmListModel method pause.

private void pause() {
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VM a = (VM) item;
        list.add(new VmOperationParameterBase(a.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.HibernateVm, list, result -> {
    }, null);
}
Also used : VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 4 with VmOperationParameterBase

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

the class SpiceConsoleModel method invokeConsole.

public void invokeConsole() {
    // we attempt to perform SSO (otherwise an error will be thrown)
    if (!getConfigurator().getIsAdmin() && getEntity().getStatus() == VMStatus.Up && SsoMethod.GUEST_AGENT.equals(getEntity().getSsoMethod())) {
        getLogger().info(// $NON-NLS-1$
        "SpiceConsoleManager::Connect: Attempting to perform SSO on Desktop " + getEntity().getName());
        Frontend.getInstance().runAction(ActionType.VmLogon, new VmOperationParameterBase(getEntity().getId()), result -> {
            final ActionReturnValue logonCommandReturnValue = result.getReturnValue();
            boolean isLogonSucceeded = logonCommandReturnValue != null && logonCommandReturnValue.getSucceeded();
            if (isLogonSucceeded) {
                invokeClient();
            } else {
                if (logonCommandReturnValue != null && logonCommandReturnValue.getFault().getError() == EngineError.nonresp) {
                    UICommand okCommand = new UICommand("SpiceWithoutAgentOK", new // $NON-NLS-1$
                    BaseCommandTarget() {

                        @Override
                        public void executeCommand(UICommand uiCommand) {
                            logSsoOnDesktopFailedAgentNonResp(getLogger(), logonCommandReturnValue != null ? logonCommandReturnValue.getDescription() : // $NON-NLS-1$
                            "");
                            invokeClient();
                            getParentModel().setWindow(null);
                        }
                    });
                    UICommand cancelCommand = new UICommand("SpiceWithoutAgentCancel", new // $NON-NLS-1$
                    BaseCommandTarget() {

                        @Override
                        public void executeCommand(UICommand uiCommand) {
                            getParentModel().setWindow(null);
                        }
                    });
                    createConnectWithoutAgentConfirmationPopup(okCommand, cancelCommand);
                } else {
                    logSsoOnDesktopFailed(getLogger(), logonCommandReturnValue != null ? logonCommandReturnValue.getDescription() : // $NON-NLS-1$
                    "");
                }
            }
        }, this);
    } else {
        invokeClient();
    }
}
Also used : VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 5 with VmOperationParameterBase

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

the class ProcessDownVmCommand method removeVmStatelessImages.

private void removeVmStatelessImages() {
    if (snapshotDao.exists(getVmId(), SnapshotType.STATELESS) && getVmPoolType() != VmPoolType.MANUAL) {
        log.info("Deleting snapshot for stateless vm '{}'", getVmId());
        runInternalAction(ActionType.RestoreStatelessVm, new VmOperationParameterBase(getVmId()), ExecutionHandler.createDefaultContextForTasks(getContext(), getLock()));
    }
}
Also used : 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