Search in sources :

Example 71 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageDomainCommand method connectStorage.

protected Pair<Boolean, Integer> connectStorage() {
    String connectionId = getStorageDomain().getStorage();
    StorageServerConnections connection = storageServerConnectionDao.get(connectionId);
    Map<String, String> result = (Map<String, String>) runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(getParameters().getVdsId(), Guid.Empty, connection.getStorageType(), new ArrayList<>(Collections.singletonList(connection)))).getReturnValue();
    return new Pair<>(storageHelperDirector.getItem(connection.getStorageType()).isConnectSucceeded(result, Collections.singletonList(connection)), Integer.parseInt(result.values().iterator().next()));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) StorageServerConnectionManagementVDSParameters(org.ovirt.engine.core.common.vdscommands.StorageServerConnectionManagementVDSParameters) ArrayList(java.util.ArrayList) Map(java.util.Map) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 72 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageDomainCommon method checkStorageConnection.

protected boolean checkStorageConnection(String storageDomainConnection) {
    List<StorageDomain> domains = null;
    StorageServerConnections connection = storageServerConnectionDao.get(storageDomainConnection);
    if (connection == null) {
        return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST);
    }
    if (connection.getStorageType().isFileDomain()) {
        domains = getStorageDomainsByConnId(connection.getId());
        if (domains.size() > 0) {
            String domainNames = domains.stream().map(StorageDomain::getName).collect(Collectors.joining(","));
            return prepareFailureMessageForDomains(domainNames);
        }
    }
    return true;
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections)

Example 73 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageDomainsResource method connectStorageToHost.

private void connectStorageToHost(Guid hostId, StorageType storageType, LogicalUnit unit) {
    StorageServerConnections cnx = StorageDomainHelper.getConnection(storageType, unit.getAddress(), unit.getTarget(), unit.getUsername(), unit.getPassword(), unit.getPort());
    performAction(ActionType.ConnectStorageToVds, new StorageServerConnectionParametersBase(cnx, hostId, false));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)

Example 74 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendStorageDomainsResource method mapVolumeGroupIscsi.

protected void mapVolumeGroupIscsi(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) {
    VolumeGroup vg = model.getStorage().getVolumeGroup();
    List<LUNs> luns = getLunsByVgId(vg.getId());
    if (luns != null && !luns.isEmpty()) {
        vg.setLogicalUnits(new LogicalUnits());
        for (LUNs lun : luns) {
            List<StorageServerConnections> lunConnections = lun.getLunConnections();
            if (lunConnections != null) {
                for (StorageServerConnections cnx : lunConnections) {
                    LogicalUnit unit = map(lun);
                    unit = map(cnx, unit);
                    vg.getLogicalUnits().getLogicalUnits().add(unit);
                }
            }
        }
    }
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 75 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class BackendIscsiBondStorageConnectionsResource method add.

@Override
public Response add(StorageConnection conn) {
    StorageServerConnections entity = StorageDomainMapper.map(conn, null);
    IscsiBond iscsiBond = getIscsiBond();
    iscsiBond.getStorageConnectionIds().add(entity.getId());
    return performAction(ActionType.EditIscsiBond, new EditIscsiBondParameters(iscsiBond));
}
Also used : EditIscsiBondParameters(org.ovirt.engine.core.common.action.EditIscsiBondParameters) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)181 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)43 Guid (org.ovirt.engine.core.compat.Guid)39 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)33 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)32 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)19 List (java.util.List)18 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)14 HashSet (java.util.HashSet)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 Set (java.util.Set)10 StorageConnection (org.ovirt.engine.api.model.StorageConnection)10 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)10 QueryType (org.ovirt.engine.core.common.queries.QueryType)10