use of org.ovirt.engine.api.model.VolumeGroup in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method getIscsi.
protected StorageDomain getIscsi() {
StorageDomain model = getModel(0);
model.getStorage().setType(StorageType.ISCSI);
model.getStorage().setAddress(null);
model.getStorage().setPath(null);
model.getStorage().setVolumeGroup(new VolumeGroup());
model.getStorage().getVolumeGroup().setLogicalUnits(new LogicalUnits());
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().add(new LogicalUnit());
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setId(LUN);
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setTarget(TARGET);
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setAddress(ADDRESSES[0]);
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setPort(PORT);
model.getStorage().setOverrideLuns(false);
return model;
}
use of org.ovirt.engine.api.model.VolumeGroup in project ovirt-engine by oVirt.
the class V3VolumeGroupInAdapter method adapt.
@Override
public VolumeGroup adapt(V3VolumeGroup from) {
VolumeGroup to = new VolumeGroup();
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetLogicalUnits()) {
to.setLogicalUnits(new LogicalUnits());
to.getLogicalUnits().getLogicalUnits().addAll(adaptIn(from.getLogicalUnits()));
}
if (from.isSetName()) {
to.setName(from.getName());
}
return to;
}
use of org.ovirt.engine.api.model.VolumeGroup 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);
}
}
}
}
}
use of org.ovirt.engine.api.model.VolumeGroup 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);
}
}
}
use of org.ovirt.engine.api.model.VolumeGroup in project ovirt-engine by oVirt.
the class StorageDomainMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.StorageDomain.class, to = StorageDomain.class)
public static StorageDomain map(org.ovirt.engine.core.common.businessentities.StorageDomain entity, StorageDomain template) {
StorageDomain model = template != null ? template : new StorageDomain();
model.setId(entity.getId().toString());
model.setName(entity.getStorageName());
model.setDescription(entity.getDescription());
model.setComment(entity.getComment());
model.setType(map(entity.getStorageDomainType(), null));
model.setWarningLowSpaceIndicator(entity.getWarningLowSpaceIndicator());
model.setCriticalSpaceActionBlocker(entity.getCriticalSpaceActionBlocker());
model.setMaster(entity.getStorageDomainType() == org.ovirt.engine.core.common.businessentities.StorageDomainType.Master);
if (entity.getStatus() != null) {
model.setStatus(mapStorageDomainStatus(entity.getStatus()));
}
if (entity.getExternalStatus() != null) {
model.setExternalStatus(ExternalStatusMapper.map(entity.getExternalStatus()));
}
model.setStorage(new HostStorage());
model.getStorage().setType(map(entity.getStorageType(), null));
if (entity.getStorageType() == org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI || entity.getStorageType() == org.ovirt.engine.core.common.businessentities.storage.StorageType.FCP) {
model.getStorage().setVolumeGroup(new VolumeGroup());
model.getStorage().getVolumeGroup().setId(entity.getStorage());
}
if (entity.getAvailableDiskSize() != null) {
model.setAvailable(SizeConverter.convert(entity.getAvailableDiskSize().longValue(), SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
}
if (entity.getUsedDiskSize() != null) {
model.setUsed(SizeConverter.convert(entity.getUsedDiskSize().longValue(), SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
}
model.setCommitted(SizeConverter.convert(entity.getCommittedDiskSize(), SizeConverter.SizeUnit.GiB, SizeConverter.SizeUnit.BYTES).longValue());
if (entity.getStorageFormat() != null) {
model.setStorageFormat(StorageFormatMapper.map(entity.getStorageFormat(), null));
}
model.setWipeAfterDelete(entity.getWipeAfterDelete());
model.setDiscardAfterDelete(entity.getDiscardAfterDelete());
model.setSupportsDiscard(entity.getSupportsDiscard());
// Not supported by sysfs since kernel version 4.12, and thus deprecated.
model.setSupportsDiscardZeroesData(false);
model.setBackup(entity.isBackup());
return model;
}
Aggregations