Search in sources :

Example 66 with LUNs

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

the class GetLunsByVgIdQueryTest method setUpLunsFromDeviceList.

private static List<LUNs> setUpLunsFromDeviceList() {
    List<LUNs> luns = setUpLuns(false);
    for (LUNs lun : luns) {
        HashMap<String, Boolean> pathsDictionary = new HashMap<>();
        pathsDictionary.put(PHYSICAL_DEVICE_FIELD, true);
        lun.setPathsDictionary(pathsDictionary);
    }
    return luns;
}
Also used : HashMap(java.util.HashMap) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 67 with LUNs

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

the class GetLunsByVgIdQueryTest method setUpLuns.

private static List<LUNs> setUpLuns(boolean withDummyLun) {
    List<LUNs> luns = new ArrayList<>();
    for (String GUID : GUIDS) {
        LUNs lun = new LUNs();
        lun.setLUNId(GUID);
        luns.add(lun);
    }
    if (withDummyLun) {
        LUNs dummyLun = new LUNs();
        dummyLun.setLUNId(DUMMY_LUN_ID);
        luns.add(dummyLun);
    }
    return luns;
}
Also used : ArrayList(java.util.ArrayList) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 68 with LUNs

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

the class BlockStorageDiscardFunctionalityHelperTest method testGetLunsThatBreakDiscardAfterDeleteSupportDiscardAfterDeleteBreaks.

@Test
public void testGetLunsThatBreakDiscardAfterDeleteSupportDiscardAfterDeleteBreaks() {
    storageDomain.setDiscardAfterDelete(true);
    LUNs lunThatBreaksDiscardSupport = createLunWithDiscardSupport(0L);
    assertGetLunsThatBreakDiscardAfterDeleteSupportContainsExpectedLuns(Arrays.asList(createLunWithDiscardSupport(1024L), lunThatBreaksDiscardSupport), Collections.singletonList(lunThatBreaksDiscardSupport));
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test)

Example 69 with LUNs

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

the class BackendStorageDomainsResource method mapVolumeGroupFcp.

protected void mapVolumeGroupFcp(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) {
            LogicalUnit unit = map(lun);
            vg.getLogicalUnits().getLogicalUnits().add(unit);
        }
    }
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 70 with LUNs

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

the class BackendStorageDomainsResource method addExistingSAN.

private Response addExistingSAN(StorageDomain model, StorageType storageType, Guid hostId) {
    getEntity(VDS.class, QueryType.GetVdsByVdsId, new IdQueryParameters(hostId), "Host: id=" + hostId);
    List<LUNs> existingLuns = getDeviceList(hostId, storageType);
    List<StorageServerConnections> existingStorageServerConnections = getLunsWithInitializedStorageType(existingLuns, storageType);
    List<org.ovirt.engine.core.common.businessentities.StorageDomain> existingStorageDomains = getExistingBlockStorageDomain(hostId, storageType, existingStorageServerConnections);
    StorageDomainStatic storageDomainToImport = getMatchingStorageDomain(asGuid(model.getId()), existingStorageDomains);
    if (storageDomainToImport == null) {
        throw new WebFaultException(new WebApplicationException(), "Storage Domain id " + model.getId() + " Does not exists", Status.NOT_FOUND);
    }
    StorageDomainMapper.map(model, storageDomainToImport);
    StorageDomainManagementParameter parameters = new StorageDomainManagementParameter(storageDomainToImport);
    parameters.setVdsId(hostId);
    return performCreate(ActionType.AddExistingBlockStorageDomain, parameters, ID_RESOLVER);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) WebApplicationException(javax.ws.rs.WebApplicationException) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) StorageDomain(org.ovirt.engine.api.model.StorageDomain) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Aggregations

LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)105 ArrayList (java.util.ArrayList)40 Test (org.junit.Test)33 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)26 Guid (org.ovirt.engine.core.compat.Guid)18 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)17 List (java.util.List)16 HashMap (java.util.HashMap)14 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)13 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 VM (org.ovirt.engine.core.common.businessentities.VM)7 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)7 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)7 Map (java.util.Map)6 LUNStorageServerConnectionMap (org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)6 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)5 Pair (org.ovirt.engine.core.common.utils.Pair)5 GetDeviceListVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters)5 HashSet (java.util.HashSet)4