Search in sources :

Example 66 with ActionReturnValue

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

the class DataCenterGuideModel method onSaveSanStorage.

private void onSaveSanStorage() {
    ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
    if (confirmationModel != null && !confirmationModel.validate()) {
        return;
    }
    cancelConfirm();
    getWindow().startProgress();
    StorageModel model = (StorageModel) getWindow();
    SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
    VDS host = model.getHost().getSelectedItem();
    boolean force = sanModel.isForce();
    HashSet<String> lunIds = new HashSet<>();
    for (LunModel lun : sanModel.getAddedLuns()) {
        lunIds.add(lun.getLunId());
    }
    AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain);
    params.setVdsId(host.getId());
    params.setLunIds(new HashSet<>(lunIds));
    params.setForce(force);
    Frontend.getInstance().runAction(ActionType.AddSANStorageDomain, params, result -> {
        DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
        StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
        StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
        if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
            ActionReturnValue returnValue = result.getReturnValue();
            Guid storageId = returnValue.getActionReturnValue();
            dataCenterGuideModel.attachStorageToDataCenter(storageId, dataCenter.getId());
        }
        dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
    }, this);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Guid(org.ovirt.engine.core.compat.Guid) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) HashSet(java.util.HashSet)

Example 67 with ActionReturnValue

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

the class EditNetworkModel method executeSave.

@Override
public void executeSave() {
    Frontend.getInstance().runAction(ActionType.UpdateNetwork, new AddNetworkStoragePoolParameters(getSelectedDc().getId(), getNetwork()), result -> {
        ActionReturnValue retVal = result.getReturnValue();
        postSaveAction(null, retVal != null && retVal.getSucceeded());
    }, null);
}
Also used : AddNetworkStoragePoolParameters(org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 68 with ActionReturnValue

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

the class EditNetworkQoSModel method executeSave.

@Override
public void executeSave() {
    QosParametersBase<NetworkQoS> parameters = new QosParametersBase<>();
    parameters.setQos(networkQoS);
    Frontend.getInstance().runAction(ActionType.UpdateNetworkQoS, parameters, result -> {
        ActionReturnValue retVal = result.getReturnValue();
        boolean succeeded = false;
        if (retVal != null && retVal.getSucceeded()) {
            succeeded = true;
        }
        postSaveAction(succeeded);
    });
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 69 with ActionReturnValue

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

the class QosModel method executeSave.

protected void executeSave() {
    final QosParametersBase<T> parameters = getParameters();
    parameters.setQos(getQos());
    Frontend.getInstance().runAction(getAction(), parameters, result -> {
        ActionReturnValue retVal = result.getReturnValue();
        boolean succeeded = false;
        if (retVal != null && retVal.getSucceeded()) {
            succeeded = true;
            getQos().setId((Guid) retVal.getActionReturnValue());
        }
        postSaveAction(succeeded);
    });
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 70 with ActionReturnValue

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

Aggregations

ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)293 ArrayList (java.util.ArrayList)57 Guid (org.ovirt.engine.core.compat.Guid)55 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)50 Test (org.junit.Test)37 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)27 ActionType (org.ovirt.engine.core.common.action.ActionType)26 EngineException (org.ovirt.engine.core.common.errors.EngineException)25 VDS (org.ovirt.engine.core.common.businessentities.VDS)23 HashSet (java.util.HashSet)16 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 ExecutionException (java.util.concurrent.ExecutionException)13 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)13 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)13 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)12 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)12 List (java.util.List)11 ChangeVDSClusterParameters (org.ovirt.engine.core.common.action.ChangeVDSClusterParameters)11 VM (org.ovirt.engine.core.common.businessentities.VM)11 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)11