use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class StorageDomainValidatorFreeSpaceTest method createParams.
@Parameterized.Parameters
public static Collection<Object[]> createParams() {
List<Object[]> params = new ArrayList<>();
for (StorageType storageType : StorageType.values()) {
if (storageType.isConcreteStorageType() && !storageType.isCinderDomain()) {
List<VolumeType> volumeTypes = storageType.isFileDomain() ? Arrays.asList(VolumeType.Preallocated, VolumeType.Sparse) : Collections.singletonList(VolumeType.Preallocated);
for (VolumeType volumeType : volumeTypes) {
for (VolumeFormat volumeFormat : new VolumeFormat[] { VolumeFormat.COW, VolumeFormat.RAW }) {
DiskImage disk = new DiskImage();
disk.setVolumeFormat(volumeFormat);
disk.setVolumeType(volumeType);
disk.getSnapshots().add(disk);
disk.setSizeInGigabytes(200);
// GB
disk.setActualSize(100);
StorageDomain sd = new StorageDomain();
sd.setStorageType(storageType);
// GB
sd.setAvailableDiskSize(107);
params.add(new Object[] { disk, sd, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.COW || volumeType == VolumeType.Sparse, volumeFormat == VolumeFormat.RAW && volumeType == VolumeType.Sparse });
}
}
}
}
return params;
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class AbstractDiskModel method volumeType_SelectedItemChanged.
protected void volumeType_SelectedItemChanged() {
if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) {
return;
}
VolumeType volumeType = getVolumeType().getSelectedItem();
StorageType storageType = getStorageDomain().getSelectedItem().getStorageType();
updateShareable(volumeType, storageType);
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class DiskModel method diskToModel.
public static DiskModel diskToModel(Disk disk) {
DiskModel diskModel = new DiskModel();
diskModel.getAlias().setEntity(disk.getDiskAlias());
if (disk.getDiskStorageType() == DiskStorageType.IMAGE) {
DiskImage diskImage = (DiskImage) disk;
EntityModel<Integer> sizeEntity = new EntityModel<>();
sizeEntity.setEntity((int) diskImage.getSizeInGigabytes());
diskModel.setSize(sizeEntity);
ListModel<VolumeType> volumeList = new ListModel<>();
volumeList.setItems(diskImage.getVolumeType() == VolumeType.Preallocated ? new ArrayList<>(Arrays.asList(new VolumeType[] { VolumeType.Preallocated })) : AsyncDataProvider.getInstance().getVolumeTypeList());
volumeList.setSelectedItem(diskImage.getVolumeType());
diskModel.setVolumeType(volumeList);
}
diskModel.setDisk(disk);
return diskModel;
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class ImportVmFromExportDomainPopupView method addAllocationColumn.
protected void addAllocationColumn() {
ArrayList<String> allocationTypes = new ArrayList<>();
allocationTypes.add(constants.thinAllocation());
allocationTypes.add(constants.preallocatedAllocation());
customSelectionCellFormatType = new CustomSelectionCell(allocationTypes);
customSelectionCellFormatType.setStyle(EMPTY_STYLE);
AbstractColumn<DiskImage, String> allocationColumn = new AbstractColumn<DiskImage, String>(customSelectionCellFormatType) {
@Override
public String getValue(DiskImage disk) {
ImportDiskData importData = importModel.getDiskImportData(disk.getId());
if (importData == null) {
return "";
}
return new EnumRenderer<VolumeType>().render(VolumeType.forValue(importData.getSelectedVolumeType().getValue()));
}
@Override
public SafeHtml getTooltip(DiskImage object) {
return SafeHtmlUtils.fromSafeConstant(constants.importAllocationModifiedCollapse());
}
};
allocationColumn.setFieldUpdater((index, disk, value) -> {
VolumeType tempVolumeType = VolumeType.Sparse;
if (value.equals(constants.thinAllocation())) {
tempVolumeType = VolumeType.Sparse;
} else if (value.equals(constants.preallocatedAllocation())) {
tempVolumeType = VolumeType.Preallocated;
}
ImportDiskData importData = importModel.getDiskImportData(disk.getId());
if (importData != null) {
importData.setSelectedVolumeType(tempVolumeType);
}
});
// $NON-NLS-1$
diskTable.addColumn(allocationColumn, constants.allocationDisk(), "150px");
}
use of org.ovirt.engine.core.common.businessentities.storage.VolumeType in project ovirt-engine by oVirt.
the class MemoryStorageHandler method updateDiskVolumeType.
private void updateDiskVolumeType(StorageType storageType, DiskImage disk) {
VolumeType volumeType = storageType.isFileDomain() ? VolumeType.Sparse : VolumeType.Preallocated;
disk.setVolumeType(volumeType);
}
Aggregations