Source:
<code>private static void mapDiskImageToDiskFields(DiskImage entity, Disk model) { if (entity.getImageId() != null) { model.setImageId(entity.getImageId().toString()); } model.setProvisionedSize(entity.getSize()); model.setActualSize( entity.getDiskStorageType() == org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.CINDER <START> ? null : entity.getActualSizeInBytes()); <END> 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.getImageStatus() != null) { DiskStatus status = map(entity.getImageStatus()); model.setStatus(StatusUtils.create(status == null ? null : status.value())); } 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()); 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()); } }</code><technical_language>If disks actual size sense backend return "Integer", "null". check type avoid populating it, introducing a business logic rule in RESTAPI</technical_language>

Target:
private static void mapDiskImageToDiskFields(DiskImage entity, Disk model) { if (entity.getImageId() != null) { model.setImageId(entity.getImageId().toString()); } model.setProvisionedSize(entity.getSize()); if (entity.getActualSizeInBytes() != null) { model.setActualSize(entity.getActualSizeInBytes()); } 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.getImageStatus() != null) { DiskStatus status = map(entity.getImageStatus()); model.setStatus(StatusUtils.create(status == null ? null : status.value())); } 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()); 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()); } }