use of org.ovirt.engine.core.common.businessentities.storage.DiskInterface in project ovirt-engine by oVirt.
the class AbstractDiskModel method updateReadOnlyChangeability.
protected void updateReadOnlyChangeability() {
if (getVm() == null) {
// read-only is a characteristic of a VM device, not a disk
getIsReadOnly().setIsAvailable(false);
getIsReadOnly().setEntity(false);
getIsReadOnly().setIsChangeable(false);
return;
}
DiskInterface diskInterface = getDiskInterface().getSelectedItem();
if (diskInterface == DiskInterface.IDE) {
getIsReadOnly().setEntity(false);
return;
}
boolean isDirectLUN = getDiskStorageType().getEntity() == DiskStorageType.LUN;
boolean isScsiPassthrough = getIsScsiPassthrough().getEntity();
if (diskInterface == DiskInterface.VirtIO_SCSI && isDirectLUN && isScsiPassthrough) {
getIsReadOnly().setChangeProhibitionReason(constants.cannotEnableReadonlyWhenScsiPassthroughEnabled());
getIsReadOnly().setIsChangeable(false);
getIsReadOnly().setEntity(false);
return;
}
if (isVmAttachedToPool() && !getIsNew()) {
getIsReadOnly().setIsChangeable(false);
} else {
getIsReadOnly().setIsChangeable(isEditEnabled());
}
if (!getIsNew()) {
getIsReadOnly().setEntity(getDiskVmElement().isReadOnly());
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskInterface 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;
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskInterface in project ovirt-engine by oVirt.
the class StoragesTree method getNodeItem.
@Override
protected TreeItem getNodeItem(DiskModel diskModel) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
DiskImage disk = (DiskImage) diskModel.getDisk();
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.diskImage()), "30px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "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>(), disk.getDiskVmElements().iterator().next().getDiskInterface(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskStorageType>(), disk.getDiskStorageType(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DateLabel(), disk.getCreationDate(), "100px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(getEntityId(diskModel));
return treeItem;
}
Aggregations