public VolumeType getVolumeType() { return getImage().getVolumeType(); }
private boolean isImageDiskPreallocated(Disk disk) { return disk.getDiskStorageType() == DiskStorageType.IMAGE && ((DiskImage) disk).getImage().getVolumeType() == VolumeType.Preallocated; }
public VolumeType getVolumeType(VolumeFormat volumeFormat, StorageType storageType, VM vm, Image diskImage) { switch (volumeFormat) { case COW: return VolumeType.Sparse; case RAW: default: boolean copyPreallocatedFileBasedDiskSupported = vm != null ? isCopyPreallocatedFileBasedDiskSupported(vm.getCompatibilityVersion()) : false; // if diskImage provided it means that we want to use the source image volume type, // otherwise we set the volume type as sparse by default for file-based storage domain VolumeType fileBasedVolumeType; if (copyPreallocatedFileBasedDiskSupported) { fileBasedVolumeType = diskImage != null ? diskImage.getVolumeType() : VolumeType.Sparse; } else { fileBasedVolumeType = VolumeType.Sparse; } return storageType.isFileDomain() ? fileBasedVolumeType : VolumeType.Preallocated; } }
@Override protected MapSqlParameterSource createFullParametersMapper(Image entity) { return createIdParameterMapper(entity.getId()) .addValue("creation_date", entity.getCreationDate()) .addValue("it_guid", entity.getTemplateImageId()) .addValue("size", entity.getSize()) .addValue("ParentId", entity.getParentId()) .addValue("imageStatus", entity.getStatus()) .addValue("lastModified", entity.getLastModified()) .addValue("vm_snapshot_id", entity.getSnapshotId()) .addValue("volume_type", entity.getVolumeType()) .addValue("volume_format", entity.getVolumeFormat()) .addValue("qcow_compat", entity.getQcowCompat()) .addValue("image_group_id", entity.getDiskId()) .addValue("active", entity.isActive()) .addValue("volume_classification", entity.getVolumeClassification().getValue()); }