Search in sources :

Example 21 with StorageServerConnectionParametersBase

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

the class StorageListModel method importFileStorageConnect.

public void importFileStorageConnect() {
    Frontend.getInstance().runAction(ActionType.AddStorageServerConnection, new StorageServerConnectionParametersBase(fileConnection, hostId, false), result -> {
        StorageListModel storageListModel = (StorageListModel) result.getState();
        ActionReturnValue returnVal = result.getReturnValue();
        boolean success = returnVal != null && returnVal.getSucceeded();
        if (success) {
            storageListModel.fileConnection.setId((String) returnVal.getActionReturnValue());
            if (storageModel.getRole() == StorageDomainType.Data) {
                // $NON-NLS-1$
                checkFileDomainAttachedToDc("OnImportFile", storageListModel.fileConnection);
            } else {
                getExistingStorageDomainList();
            }
        } else {
            postImportFileStorage(storageListModel.context, false, storageListModel.storageModel, ConstantsManager.getInstance().getConstants().failedToRetrieveExistingStorageDomainInformationMsg());
        }
    }, this);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)

Example 22 with StorageServerConnectionParametersBase

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

the class DataCenterGuideModel method saveNewPosixStorage.

private void saveNewPosixStorage() {
    StorageModel model = (StorageModel) getWindow();
    PosixStorageModel posixModel = (PosixStorageModel) model.getCurrentStorageItem();
    VDS host = model.getHost().getSelectedItem();
    hostId = host.getId();
    // Create storage connection.
    StorageServerConnections connection = new StorageServerConnections();
    connection.setConnection(path);
    connection.setStorageType(posixModel.getType());
    connection.setVfsType(posixModel.getVfsType().getEntity());
    connection.setMountOptions(posixModel.getMountOptions().getEntity());
    this.connection = connection;
    ArrayList<ActionType> actionTypes = new ArrayList<>();
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    actionTypes.add(ActionType.AddStorageServerConnection);
    actionTypes.add(posixModel.getAddStorageDomainVdcAction());
    parameters.add(new StorageServerConnectionParametersBase(this.connection, host.getId(), false));
    StorageDomainManagementParameter parameter = new StorageDomainManagementParameter(storageDomain);
    parameter.setVdsId(host.getId());
    StoragePool dataCenter = model.getDataCenter().getSelectedItem();
    parameter.setStoragePoolId(dataCenter.getId());
    parameters.add(parameter);
    IFrontendActionAsyncCallback callback1 = result -> {
        DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
        ActionReturnValue actionReturnValue = result.getReturnValue();
        dataCenterGuideModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
        dataCenterGuideModel.connection.setId((String) actionReturnValue.getActionReturnValue());
    };
    IFrontendActionAsyncCallback callback2 = result -> {
        DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
        ActionReturnValue actionReturnValue = result.getReturnValue();
        dataCenterGuideModel.storageId = actionReturnValue.getActionReturnValue();
        // Attach storage to data center as necessary.
        StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
        StoragePool selectedDataCenter = storageModel.getDataCenter().getSelectedItem();
        if (!selectedDataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
            dataCenterGuideModel.attachStorageToDataCenter(dataCenterGuideModel.storageId, selectedDataCenter.getId());
        }
        dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
    };
    IFrontendActionAsyncCallback failureCallback = result -> {
        DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
        dataCenterGuideModel.cleanConnection(dataCenterGuideModel.connection, dataCenterGuideModel.hostId);
        dataCenterGuideModel.onFinish(dataCenterGuideModel.context, false, dataCenterGuideModel.storageModel);
    };
    Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(new IFrontendActionAsyncCallback[] { callback1, callback2 })), failureCallback, this);
}
Also used : PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) RegexValidation(org.ovirt.engine.ui.uicommonweb.validation.RegexValidation) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) GuideModel(org.ovirt.engine.ui.uicommonweb.models.GuideModel) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) NewEditStorageModelBehavior(org.ovirt.engine.ui.uicommonweb.models.storage.NewEditStorageModelBehavior) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) MoveHost(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHost) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) ClusterModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel) NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) ITaskTarget(org.ovirt.engine.ui.uicompat.ITaskTarget) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) TaskContext(org.ovirt.engine.ui.uicompat.TaskContext) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) FrontendMultipleActionAsyncResult(org.ovirt.engine.ui.uicompat.FrontendMultipleActionAsyncResult) Task(org.ovirt.engine.ui.uicompat.Task) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) MoveHostData(org.ovirt.engine.ui.uicommonweb.models.hosts.MoveHostData) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) Timer(com.google.gwt.user.client.Timer) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) ActionType(org.ovirt.engine.core.common.action.ActionType) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) 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) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) ArrayList(java.util.ArrayList) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback)

Example 23 with StorageServerConnectionParametersBase

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

the class UpdateStorageServerConnectionCommandTest method createCommand.

@Override
protected UpdateStorageServerConnectionCommand<StorageServerConnectionParametersBase> createCommand() {
    parameters = new StorageServerConnectionParametersBase();
    parameters.setVdsId(Guid.newGuid());
    return new UpdateStorageServerConnectionCommand<>(parameters, null);
}
Also used : StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)

Aggregations

StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)23 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)13 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)13 Guid (org.ovirt.engine.core.compat.Guid)9 VDS (org.ovirt.engine.core.common.businessentities.VDS)8 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 List (java.util.List)7 Set (java.util.Set)7 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)7 ActionType (org.ovirt.engine.core.common.action.ActionType)7 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)7 StorageDomainStatus (org.ovirt.engine.core.common.businessentities.StorageDomainStatus)7 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)7 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)7 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)7 GetDeviceListQueryParameters (org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters)7 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)7 QueryType (org.ovirt.engine.core.common.queries.QueryType)7 Frontend (org.ovirt.engine.ui.frontend.Frontend)7