use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.
the class BackendStorageDomainsResource method getLunIds.
private Set<String> getLunIds(HostStorage storage, StorageType storageType, Guid hostId) {
List<LogicalUnit> logicalUnits = new ArrayList<>();
if (storage.isSetLogicalUnits() && storage.getLogicalUnits().isSetLogicalUnits()) {
logicalUnits = storage.getLogicalUnits().getLogicalUnits();
} else if (storage.isSetVolumeGroup() && storage.getVolumeGroup().isSetLogicalUnits() && storage.getVolumeGroup().getLogicalUnits().isSetLogicalUnits()) {
logicalUnits = storage.getVolumeGroup().getLogicalUnits().getLogicalUnits();
}
Set<String> lunIds = new HashSet<>();
for (LogicalUnit unit : logicalUnits) {
validateParameters(unit, 4, "id");
// to the target.
if ((storageType == StorageType.ISCSI) && !isConnectionAssumed(unit)) {
connectStorageToHost(hostId, storageType, unit);
}
lunIds.add(unit.getId());
}
refreshHostStorage(hostId);
return !lunIds.isEmpty() ? lunIds : null;
}
use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.
the class BackendStorageDomainResource method reduceLuns.
@Override
public Response reduceLuns(Action action) {
List<LogicalUnit> reducedLuns = action.getLogicalUnits().getLogicalUnits();
List<String> lunIds = reducedLuns.stream().map(LogicalUnit::getId).collect(toList());
ReduceSANStorageDomainDevicesCommandParameters parameters = new ReduceSANStorageDomainDevicesCommandParameters(guid, lunIds);
return performAction(ActionType.ReduceSANStorageDomainDevices, parameters);
}
use of org.ovirt.engine.api.model.LogicalUnit in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method createIscsiLunDisk.
private Disk createIscsiLunDisk() {
Disk model = getModel();
model.setLunStorage(new HostStorage());
model.getLunStorage().setType(StorageType.ISCSI);
model.getLunStorage().setLogicalUnits(new LogicalUnits());
model.getLunStorage().getLogicalUnits().getLogicalUnits().add(new LogicalUnit());
model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setId(GUIDS[0].toString());
model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setAddress(ISCSI_SERVER_ADDRESS);
model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setTarget(ISCSI_SERVER_TARGET);
model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setPort(ISCSI_SERVER_CONNECTION_PORT);
model.setProvisionedSize(null);
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 = LogicalUnit.class)
public static LogicalUnit map(LUNs entity, LogicalUnit template) {
LogicalUnit model = template != null ? template : new LogicalUnit();
model.setId(entity.getLUNId());
if (entity.getVendorId() != null && !entity.getVendorId().isEmpty()) {
model.setVendorId(entity.getVendorId());
}
if (entity.getProductId() != null && !entity.getProductId().isEmpty()) {
model.setProductId(entity.getProductId());
}
if (entity.getSerial() != null && !entity.getSerial().isEmpty()) {
model.setSerial(entity.getSerial());
}
if (entity.getLunMapping() != null) {
model.setLunMapping(entity.getLunMapping());
}
if (entity.getVolumeGroupId() != null && !entity.getVolumeGroupId().isEmpty()) {
model.setVolumeGroupId(entity.getVolumeGroupId());
}
if (entity.getStorageDomainId() != null) {
model.setStorageDomainId(entity.getStorageDomainId().toString());
}
if (entity.getDiskId() != null) {
model.setDiskId(entity.getDiskId().toString());
}
if (entity.getStatus() != null) {
model.setStatus(map(entity.getStatus(), null));
}
if (entity.getDiscardMaxSize() != null) {
model.setDiscardMaxSize(entity.getDiscardMaxSize());
}
// Not supported by sysfs since kernel version 4.12, and thus deprecated.
model.setDiscardZeroesData(false);
model.setSize(SizeConverter.convert((long) entity.getDeviceSize(), SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
model.setPaths(entity.getPathCount());
return model;
}
use of org.ovirt.engine.api.model.LogicalUnit 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);
}
}
}
Aggregations