Search in sources :

Example 1 with VolumeGroup

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit)

Example 2 with VolumeGroup

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;
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) V3VolumeGroup(org.ovirt.engine.api.v3.types.V3VolumeGroup)

Example 3 with VolumeGroup

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);
                }
            }
        }
    }
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 4 with VolumeGroup

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);
        }
    }
}
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 5 with VolumeGroup

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) VolumeGroup(org.ovirt.engine.api.model.VolumeGroup) HostStorage(org.ovirt.engine.api.model.HostStorage)

Aggregations

VolumeGroup (org.ovirt.engine.api.model.VolumeGroup)7 LogicalUnits (org.ovirt.engine.api.model.LogicalUnits)4 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)3 HostStorage (org.ovirt.engine.api.model.HostStorage)2 StorageDomain (org.ovirt.engine.api.model.StorageDomain)2 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)2 StorageType (org.ovirt.engine.api.model.StorageType)1 V3VolumeGroup (org.ovirt.engine.api.v3.types.V3VolumeGroup)1 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)1