Search in sources :

Example 11 with LogicalUnit

use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.

the class BackendStorageDomainResource method refreshLuns.

@Override
public Response refreshLuns(Action action) {
    List<LogicalUnit> incomingLuns;
    if (action.isSetLogicalUnits()) {
        incomingLuns = action.getLogicalUnits().getLogicalUnits();
    } else {
        incomingLuns = Collections.emptyList();
    }
    ExtendSANStorageDomainParameters params = createParameters(guid, incomingLuns, false);
    return performAction(ActionType.RefreshLunsSize, params);
}
Also used : LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) ExtendSANStorageDomainParameters(org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters)

Example 12 with LogicalUnit

use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.

the class StorageLogicalUnitMapper method map.

@Mapping(from = StorageServerConnections.class, to = LogicalUnit.class)
public static LogicalUnit map(StorageServerConnections entity, LogicalUnit template) {
    LogicalUnit model = template != null ? template : new LogicalUnit();
    model.setAddress(entity.getConnection());
    model.setTarget(entity.getIqn());
    model.setPort(Integer.parseInt(entity.getPort()));
    model.setUsername(entity.getUserName());
    if (entity.getConnection() != null && entity.getPort() != null && entity.getPortal() != null) {
        model.setPortal(entity.getConnection() + ":" + entity.getPort() + "," + entity.getPortal());
    }
    return model;
}
Also used : LogicalUnit(org.ovirt.engine.api.model.LogicalUnit)

Example 13 with LogicalUnit

use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.

the class StorageLogicalUnitMapper method map.

@Mapping(from = LUNs.class, to = HostStorage.class)
public static HostStorage map(LUNs entity, HostStorage template) {
    HostStorage model = template != null ? template : new HostStorage();
    model.setId(entity.getLUNId());
    model.setType(StorageDomainMapper.map(entity.getLunType(), null));
    model.setLogicalUnits(new LogicalUnits());
    model.getLogicalUnits().getLogicalUnits().add(map(entity, (LogicalUnit) null));
    return model;
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) HostStorage(org.ovirt.engine.api.model.HostStorage)

Example 14 with LogicalUnit

use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.

the class BackendHostResource method mapTargets.

private Action mapTargets(Action action, List<StorageServerConnections> targets) {
    if (targets != null) {
        Action.IscsiTargetsList iscsiTargets = new Action.IscsiTargetsList();
        IscsiDetailss iscsiDetailss = new IscsiDetailss();
        for (StorageServerConnections cnx : targets) {
            LogicalUnit logicalUnit = map(cnx);
            // The iscsiTargets property is replaced by discoveredTargets. The property is preserved
            // for backward compatibility, and should be removed in version 5 of the API.
            iscsiTargets.getIscsiTargets().add(logicalUnit.getTarget());
            iscsiDetailss.getIscsiDetailss().add(mapLogicalUnitToIscsiDetails(logicalUnit));
        }
        action.setIscsiTargets(iscsiTargets);
        action.setDiscoveredTargets(iscsiDetailss);
    }
    return action;
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) IscsiDetailss(org.ovirt.engine.api.model.IscsiDetailss)

Example 15 with LogicalUnit

use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.

the class StorageLogicalUnitMapperTest method testOneWayMapping.

@Test
public void testOneWayMapping() {
    LUNs model = new LUNs();
    model.setVendorId("vendor_id_1");
    model.setProductId("product_id_1");
    model.setLunMapping(5);
    model.setSerial("some_serial");
    model.setVolumeGroupId("volume_group_id_1");
    model.setStorageDomainId(Guid.Empty);
    model.setDiskId(Guid.Empty);
    model.setStatus(org.ovirt.engine.core.common.businessentities.storage.LunStatus.Free);
    LogicalUnit entity = StorageLogicalUnitMapper.map(model, (LogicalUnit) null);
    assertEquals("vendor_id_1", entity.getVendorId());
    assertEquals("product_id_1", entity.getProductId());
    assertEquals("some_serial", entity.getSerial());
    assertEquals(Integer.valueOf(5), entity.getLunMapping());
    assertEquals("volume_group_id_1", entity.getVolumeGroupId());
    assertEquals(entity.getStorageDomainId(), Guid.Empty.toString());
    assertEquals(entity.getDiskId(), Guid.Empty.toString());
    assertEquals(LunStatus.FREE, entity.getStatus());
}
Also used : LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test)

Aggregations

LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)16 LogicalUnits (org.ovirt.engine.api.model.LogicalUnits)7 Test (org.junit.Test)4 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)4 Action (org.ovirt.engine.api.model.Action)3 VolumeGroup (org.ovirt.engine.api.model.VolumeGroup)3 ArrayList (java.util.ArrayList)2 HostStorage (org.ovirt.engine.api.model.HostStorage)2 StorageDomain (org.ovirt.engine.api.model.StorageDomain)2 ExtendSANStorageDomainParameters (org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters)2 ReduceSANStorageDomainDevicesCommandParameters (org.ovirt.engine.core.common.action.ReduceSANStorageDomainDevicesCommandParameters)2 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)2 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Response (javax.ws.rs.core.Response)1 Disk (org.ovirt.engine.api.model.Disk)1 Host (org.ovirt.engine.api.model.Host)1 IscsiDetailss (org.ovirt.engine.api.model.IscsiDetailss)1 StorageType (org.ovirt.engine.api.model.StorageType)1