Search in sources :

Example 1 with VolumeType

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;
}
Also used : VolumeFormat(org.ovirt.engine.core.common.businessentities.storage.VolumeFormat) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 2 with VolumeType

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);
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) CinderVolumeType(org.ovirt.engine.core.common.businessentities.storage.CinderVolumeType) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)

Example 3 with VolumeType

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;
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 4 with VolumeType

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");
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) CustomSelectionCell(org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell) ArrayList(java.util.ArrayList) AbstractColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractColumn) ImportDiskData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportDiskData) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 5 with VolumeType

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);
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType)

Aggregations

VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)10 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)7 ArrayList (java.util.ArrayList)4 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Image (com.google.gwt.user.client.ui.Image)2 TreeItem (com.google.gwt.user.client.ui.TreeItem)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 DiskInterface (org.ovirt.engine.core.common.businessentities.storage.DiskInterface)2 ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)2 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)2 VolumeFormat (org.ovirt.engine.core.common.businessentities.storage.VolumeFormat)2 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)2 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)2 DateLabel (com.google.gwt.user.client.ui.DateLabel)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 Quota (org.ovirt.engine.core.common.businessentities.Quota)1 DiskByDiskAliasComparator (org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator)1 CpuProfile (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile)1 DiskProfile (org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)1