Search in sources :

Example 16 with StorageServerConnectionParametersBase

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

the class FileStorageHelper method runConnectionStorageToDomain.

@Override
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) {
    Pair<Boolean, EngineFault> result;
    StorageServerConnections connection = storageServerConnectionDao.get(storageDomain.getStorage());
    if (connection != null) {
        ActionReturnValue returnValue = backend.runInternalAction(ActionType.forValue(type), new StorageServerConnectionParametersBase(connection, vdsId, false));
        result = new Pair<>(returnValue.getSucceeded(), returnValue.getFault());
    } else {
        result = new Pair<>(false, null);
        log.warn("Did not connect host '{}' to storage domain '{}' because connection for connectionId '{}' is null.", vdsId, storageDomain.getStorageName(), storageDomain.getStorage());
    }
    return result;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EngineFault(org.ovirt.engine.core.common.errors.EngineFault) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)

Example 17 with StorageServerConnectionParametersBase

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

the class BackendStorageServerConnectionsResource method getAddParams.

private StorageServerConnectionParametersBase getAddParams(StorageServerConnections entity, Guid hostId) {
    StorageServerConnectionParametersBase params = new StorageServerConnectionParametersBase(entity, hostId, false);
    params.setVdsId(hostId);
    return params;
}
Also used : StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)

Example 18 with StorageServerConnectionParametersBase

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

the class BackendStorageServerConnectionResource method remove.

@Override
public Response remove() {
    get();
    StorageServerConnections connection = new StorageServerConnections();
    connection.setId(id);
    String host = ParametersHelper.getParameter(httpHeaders, uriInfo, HOST);
    Guid hostId = Guid.Empty;
    if (host != null) {
        hostId = getHostId(host);
    }
    StorageServerConnectionParametersBase parameters = new StorageServerConnectionParametersBase(connection, hostId, false);
    return performAction(ActionType.RemoveStorageServerConnection, parameters);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) Guid(org.ovirt.engine.core.compat.Guid)

Example 19 with StorageServerConnectionParametersBase

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

the class SanStorageModelBase method connectTargets.

private void connectTargets() {
    VDS host = getContainer().getHost().getSelectedItem();
    if (host == null) {
        return;
    }
    ArrayList<ActionType> actionTypes = new ArrayList<>();
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    ArrayList<IFrontendActionAsyncCallback> callbacks = new ArrayList<>();
    final SanStorageModelBase sanStorageModel = this;
    IFrontendActionAsyncCallback loginCallback = result -> sanStorageModel.postLogin(result.getReturnValue(), sanStorageModel);
    for (int i = 0; i < targetsToConnect.size(); i++) {
        SanTargetModel model = targetsToConnect.get(i);
        StorageServerConnections connection = new StorageServerConnections();
        connection.setStorageType(StorageType.ISCSI);
        // $NON-NLS-1$
        connection.setUserName(getUseUserAuth().getEntity() ? getUserName().getEntity() : "");
        // $NON-NLS-1$
        connection.setPassword(getUseUserAuth().getEntity() ? getPassword().getEntity() : "");
        connection.setIqn(model.getName());
        connection.setConnection(model.getAddress());
        connection.setPort(String.valueOf(model.getPort()));
        connection.setPortal(model.getPortal());
        actionTypes.add(ActionType.ConnectStorageToVds);
        parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
        callbacks.add(loginCallback);
    }
    Object target = getWidgetModel() != null ? getWidgetModel() : getContainer();
    Frontend.getInstance().runMultipleActions(actionTypes, parameters, callbacks, null, target);
}
Also used : NotEmptyValidation(org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation) QueryType(org.ovirt.engine.core.common.queries.QueryType) Guid(org.ovirt.engine.core.compat.Guid) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) IEventListener(org.ovirt.engine.ui.uicompat.IEventListener) Event(org.ovirt.engine.ui.uicompat.Event) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GetDeviceListQueryParameters(org.ovirt.engine.core.common.queries.GetDeviceListQueryParameters) ValueEventArgs(org.ovirt.engine.ui.uicommonweb.models.hosts.ValueEventArgs) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) HashSet(java.util.HashSet) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) DiscoverSendTargetsQueryParameters(org.ovirt.engine.core.common.queries.DiscoverSendTargetsQueryParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) IntegerValidation(org.ovirt.engine.ui.uicommonweb.validation.IntegerValidation) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) IValidation(org.ovirt.engine.ui.uicommonweb.validation.IValidation) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Set(java.util.Set) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Stream(java.util.stream.Stream) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) EventDefinition(org.ovirt.engine.ui.uicompat.EventDefinition) VDS(org.ovirt.engine.core.common.businessentities.VDS) LunStatus(org.ovirt.engine.core.common.businessentities.storage.LunStatus) ObservableCollection(org.ovirt.engine.ui.uicompat.ObservableCollection) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) ActionType(org.ovirt.engine.core.common.action.ActionType) VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback)

Example 20 with StorageServerConnectionParametersBase

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

the class StorageListModel method cancelImportConfirm.

private void cancelImportConfirm() {
    cancelConfirm();
    getWindow().stopProgress();
    if (fileConnection != null) {
        Frontend.getInstance().runAction(ActionType.DisconnectStorageServerConnection, new StorageServerConnectionParametersBase(fileConnection, hostId, false), result -> {
            StorageListModel storageListModel = (StorageListModel) result.getState();
            cleanConnection(storageListModel.fileConnection, storageListModel.hostId);
            storageListModel.fileConnection = null;
        }, this);
    }
}
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