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;
}
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);
}
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;
}
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);
}
}
}
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;
}
Aggregations