use of org.ovirt.engine.api.model.OpenStackVolumeType in project ovirt-engine by oVirt.
the class V3OpenStackVolumeTypeInAdapter method adapt.
@Override
public OpenStackVolumeType adapt(V3OpenStackVolumeType from) {
OpenStackVolumeType to = new OpenStackVolumeType();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOpenstackVolumeProvider()) {
to.setOpenstackVolumeProvider(adaptIn(from.getOpenstackVolumeProvider()));
}
if (from.isSetProperties()) {
to.setProperties(new Properties());
to.getProperties().getProperties().addAll(adaptIn(from.getProperties().getProperties()));
}
return to;
}
use of org.ovirt.engine.api.model.OpenStackVolumeType in project ovirt-engine by oVirt.
the class BackendOpenStackVolumeTypeResource method get.
@Override
public OpenStackVolumeType get() {
Guid storageDomainId = BackendOpenStackStorageProviderHelper.getStorageDomainId(this, providerId);
IdQueryParameters parameters = new IdQueryParameters(storageDomainId);
List<CinderVolumeType> volumeTypes = getBackendCollection(CinderVolumeType.class, QueryType.GetCinderVolumeTypesByStorageDomainId, parameters);
return volumeTypes.stream().filter(v -> v.getId().equals(id)).findFirst().map(v -> addLinks(populate(map(v), v))).orElseGet(this::notFound);
}
use of org.ovirt.engine.api.model.OpenStackVolumeType in project ovirt-engine by oVirt.
the class DiskMapper method mapDiskImageToDiskFields.
private static void mapDiskImageToDiskFields(DiskImage entity, Disk model) {
if (entity.getImageId() != null) {
model.setImageId(entity.getImageId().toString());
}
model.setProvisionedSize(entity.getSize());
if (entity.hasActualSize()) {
model.setActualSize(entity.getActualSizeInBytes());
if (entity.isAllowSnapshot()) {
model.setTotalSize((long) entity.getActualDiskWithSnapshotsSizeInBytes());
}
}
if (entity.getSnapshotId() != null) {
model.setSnapshot(new Snapshot());
model.getSnapshot().setId(entity.getSnapshotId().toString());
}
if (entity.getVolumeFormat() != null) {
model.setFormat(map(entity.getVolumeFormat(), null));
}
if (entity.getQcowCompat() != null) {
model.setQcowVersion(mapQcowCompat(entity.getQcowCompat()));
}
if (entity.getImageStatus() != null) {
model.setStatus(mapDiskStatus(entity.getImageStatus()));
}
model.setSparse(VolumeType.Sparse == entity.getVolumeType());
if (entity.getStorageIds() != null && entity.getStorageIds().size() > 0) {
if (!model.isSetStorageDomains()) {
model.setStorageDomains(new StorageDomains());
}
for (Guid id : entity.getStorageIds()) {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(id.toString());
model.getStorageDomains().getStorageDomains().add(storageDomain);
}
}
if (entity.getQuotaId() != null) {
Quota quota = new Quota();
quota.setId(entity.getQuotaId().toString());
// Add DataCenter to the quota, so links are properly created
if (entity.getStoragePoolId() != null) {
quota.setDataCenter(new DataCenter());
quota.getDataCenter().setId(entity.getStoragePoolId().toString());
}
model.setQuota(quota);
}
if (entity.getDiskProfileId() != null) {
DiskProfile diskProfile = new DiskProfile();
diskProfile.setId(entity.getDiskProfileId().toString());
model.setDiskProfile(diskProfile);
}
if (entity.getCinderVolumeType() != null) {
OpenStackVolumeType volumeType = model.getOpenstackVolumeType();
if (volumeType == null) {
volumeType = new OpenStackVolumeType();
model.setOpenstackVolumeType(volumeType);
}
volumeType.setName(entity.getCinderVolumeType());
}
}
Aggregations