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);
}
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;
}
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;
}
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;
}
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());
}
Aggregations