Search in sources :

Example 11 with DiskInterface

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

Example 12 with DiskInterface

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

Example 13 with DiskInterface

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;
}
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) DateLabel(com.google.gwt.user.client.ui.DateLabel) VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DiskInterface(org.ovirt.engine.core.common.businessentities.storage.DiskInterface) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

DiskInterface (org.ovirt.engine.core.common.businessentities.storage.DiskInterface)13 HashMap (java.util.HashMap)5 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)5 GetControllerIndices (org.ovirt.engine.core.vdsbroker.architecture.GetControllerIndices)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 VM (org.ovirt.engine.core.common.businessentities.VM)4 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)4 Arrays (java.util.Arrays)3 Collection (java.util.Collection)3 Collections (java.util.Collections)3 Comparator (java.util.Comparator)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Entry (java.util.Map.Entry)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 StringUtils (org.apache.commons.lang.StringUtils)3