Search in sources :

Example 1 with DiskStorageType

use of org.ovirt.engine.core.common.businessentities.storage.DiskStorageType in project ovirt-engine by oVirt.

the class InstanceImageLineModel method getDisk.

public Disk getDisk() {
    AbstractDiskModel diskModel = getDiskModel().getEntity();
    if (diskModel == null) {
        return null;
    }
    if (diskModel.getDisk() != null) {
        return diskModel.getDisk();
    }
    DiskStorageType diskStorageType = diskModel.getDiskStorageType().getEntity();
    if (diskStorageType == DiskStorageType.IMAGE) {
        return diskModel.getDiskImage();
    }
    if (diskStorageType == DiskStorageType.LUN) {
        return diskModel.getLunDisk();
    }
    return null;
}
Also used : DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)

Example 2 with DiskStorageType

use of org.ovirt.engine.core.common.businessentities.storage.DiskStorageType in project ovirt-engine by oVirt.

the class VmDiskListModelBase method setItems.

@SuppressWarnings("rawtypes")
@Override
public void setItems(Collection<Disk> value) {
    Collection<Disk> disks = value != null ? value : new ArrayList<Disk>();
    ArrayList<Disk> filteredDisks = new ArrayList<>();
    DiskStorageType diskStorageType = getDiskViewType().getEntity();
    for (Disk disk : disks) {
        if (diskStorageType == null || diskStorageType == disk.getDiskStorageType()) {
            filteredDisks.add(disk);
        }
    }
    super.setItems(filteredDisks);
}
Also used : ArrayList(java.util.ArrayList) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 3 with DiskStorageType

use of org.ovirt.engine.core.common.businessentities.storage.DiskStorageType in project ovirt-engine by oVirt.

the class DiskValidator method isSparsifySupported.

public ValidationResult isSparsifySupported() {
    if (disk.getDiskStorageType() != DiskStorageType.IMAGE) {
        return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_BY_DISK_STORAGE_TYPE, getDiskAliasVarReplacement(), ReplacementUtils.createSetVariableString("diskStorageType", disk.getDiskStorageType()));
    }
    if (((DiskImage) disk).getImage().getVolumeType() == VolumeType.Preallocated) {
        return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_FOR_PREALLOCATED, getDiskAliasVarReplacement());
    }
    StorageDomain diskStorageDomain = Injector.get(StorageDomainDao.class).get(((DiskImage) disk).getStorageIds().get(0));
    StorageType domainStorageType = diskStorageDomain.getStorageType();
    if (!domainStorageType.isFileDomain() && !domainStorageType.isBlockDomain()) {
        return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_BY_STORAGE_TYPE, getDiskAliasVarReplacement(), getStorageDomainNameVarReplacement(diskStorageDomain), ReplacementUtils.createSetVariableString("storageType", domainStorageType));
    }
    if (domainStorageType.isBlockDomain() && disk.isWipeAfterDelete()) {
        return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPARSIFY_NOT_SUPPORTED_BY_UNDERLYING_STORAGE_WHEN_WAD_IS_ENABLED, getStorageDomainNameVarReplacement(diskStorageDomain), getDiskAliasVarReplacement());
    }
    return ValidationResult.VALID;
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) StorageDomainDao(org.ovirt.engine.core.dao.StorageDomainDao) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 4 with DiskStorageType

use of org.ovirt.engine.core.common.businessentities.storage.DiskStorageType in project ovirt-engine by oVirt.

the class AbstractDiskModel method updatePassDiscardAvailability.

protected void updatePassDiscardAvailability() {
    if (!AsyncDataProvider.getInstance().isPassDiscardFeatureSupported(getDataCenter().getSelectedItem().getCompatibilityVersion())) {
        getPassDiscard().setIsAvailable(false);
        return;
    }
    if (getIsFloating()) {
        getPassDiscard().setIsAvailable(false);
    } else {
        DiskInterface selectedInterface = getDiskInterface().getSelectedItem();
        DiskStorageType selectedDiskStorageType = getDiskStorageType().getEntity();
        boolean isApplicableInterface = selectedInterface == DiskInterface.VirtIO_SCSI || selectedInterface == DiskInterface.IDE;
        boolean isApplicableDiskStorageType = selectedDiskStorageType == DiskStorageType.LUN || selectedDiskStorageType == DiskStorageType.IMAGE;
        boolean isApplicableStorageType = selectedDiskStorageType == DiskStorageType.LUN || (getStorageDomain().getSelectedItem() != null && getStorageDomain().getSelectedItem().getStorageType().isInternal());
        if (isApplicableInterface && isApplicableDiskStorageType && isApplicableStorageType) {
            getPassDiscard().setIsAvailable(true);
            if (!getIsNew()) {
                getPassDiscard().setEntity(getDiskVmElement().isPassDiscard());
            }
        } else {
            // Reset PassDiscard's availability and value.
            getPassDiscard().setIsAvailable(false);
            getPassDiscard().setEntity(false);
        }
    }
}
Also used : DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface)

Example 5 with DiskStorageType

use of org.ovirt.engine.core.common.businessentities.storage.DiskStorageType in project ovirt-engine by oVirt.

the class DisksTree method getRootItem.

@Override
protected TreeItem getRootItem(DiskImage disk) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(1);
    // $NON-NLS-1$
    panel.setWidth("100%");
    DiskVmElement dve = disk.getDiskVmElements().iterator().next();
    // $NON-NLS-1$
    addItemToPanel(panel, new Image(resources.diskImage()), "25px");
    // $NON-NLS-1$
    addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
    // $NON-NLS-1$
    addItemToPanel(panel, dve.isReadOnly() ? new Image(resources.readOnlyDiskIcon()) : new Image(), "60px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Long>(SizeConverter.SizeUnit.BYTES), disk.getActualSizeInBytes(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<ImageStatus>(), disk.getImageStatus(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<VolumeType>(), disk.getVolumeType(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<DiskInterface>(), dve.getDiskInterface(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<DiskStorageType>(), disk.getDiskStorageType(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getCreationDate(), "140px");
    TreeItem treeItem = new TreeItem(panel);
    treeItem.setUserObject(disk.getId());
    return treeItem;
}
Also used : TreeItem(com.google.gwt.user.client.ui.TreeItem) ImageStatus(org.ovirt.engine.core.common.businessentities.storage.ImageStatus) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Image(com.google.gwt.user.client.ui.Image) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) StringValueLabel(org.ovirt.engine.ui.common.widget.label.StringValueLabel) FullDateTimeLabel(org.ovirt.engine.ui.webadmin.widget.label.FullDateTimeLabel) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface)

Aggregations

DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)7 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 DiskInterface (org.ovirt.engine.core.common.businessentities.storage.DiskInterface)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 ImageStatus (org.ovirt.engine.core.common.businessentities.storage.ImageStatus)2 VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)2 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)2 DateLabel (com.google.gwt.user.client.ui.DateLabel)1 ArrayList (java.util.ArrayList)1 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)1 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)1 StorageDomainDao (org.ovirt.engine.core.dao.StorageDomainDao)1 FullDateTimeLabel (org.ovirt.engine.ui.webadmin.widget.label.FullDateTimeLabel)1