Search in sources :

Example 11 with DisplayType

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

the class VmHandler method autoSelectGraphicsDevice.

public void autoSelectGraphicsDevice(Guid srcEntityId, VmStatic parametersStaticData, Cluster cluster, Map<GraphicsType, GraphicsDevice> graphicsDevices, Version compatibilityVersion) {
    if (// if not set by user in params
    graphicsDevices.isEmpty() && cluster != null) {
        // and Cluster is known
        DisplayType defaultDisplayType = parametersStaticData.getDefaultDisplayType();
        int osId = parametersStaticData.getOsId();
        List<GraphicsType> sourceGraphics = vmDeviceUtils.getGraphicsTypesOfEntity(srcEntityId);
        // otherwise choose the first supported graphics device
        if (!vmValidationUtils.isGraphicsAndDisplaySupported(osId, compatibilityVersion, sourceGraphics, defaultDisplayType)) {
            GraphicsType defaultGraphicsType = null;
            List<Pair<GraphicsType, DisplayType>> pairs = osRepository.getGraphicsAndDisplays(osId, compatibilityVersion);
            for (Pair<GraphicsType, DisplayType> pair : pairs) {
                if (pair.getSecond().equals(defaultDisplayType)) {
                    defaultGraphicsType = pair.getFirst();
                    break;
                }
            }
            if (defaultGraphicsType != null) {
                for (GraphicsType graphicsType : GraphicsType.values()) {
                    // reset graphics devices
                    graphicsDevices.put(graphicsType, null);
                }
                VmDeviceType vmDisplayType = defaultGraphicsType.getCorrespondingDeviceType();
                GraphicsDevice defaultGraphicsDevice = new GraphicsDevice(vmDisplayType);
                graphicsDevices.put(defaultGraphicsType, defaultGraphicsDevice);
            }
        }
    }
}
Also used : GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) VmDeviceType(org.ovirt.engine.core.common.utils.VmDeviceType) Pair(org.ovirt.engine.core.common.utils.Pair)

Example 12 with DisplayType

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

the class AddUnmanagedVmsCommand method executeCommand.

@Override
protected void executeCommand() {
    if (!getParameters().getVmIds().isEmpty()) {
        int defaultOsId = getDefaultOsId(getCluster().getArchitecture());
        DisplayType defaultDisplayType = getDefaultDisplayType(defaultOsId, getCluster().getCompatibilityVersion());
        // Query VDSM for VMs info, and creating a proper VMStatic to be used when importing them
        long fetchTime = System.nanoTime();
        Map<String, Object>[] vmsInfo = getVmsInfo();
        for (Map<String, Object> vmInfo : vmsInfo) {
            convertVm(defaultOsId, defaultDisplayType, fetchTime, vmInfo);
        }
    }
    setSucceeded(true);
}
Also used : DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) Map(java.util.Map)

Example 13 with DisplayType

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

the class UnitVmModel method upgradeGraphicsRelatedModels.

private void upgradeGraphicsRelatedModels() {
    DisplayType display = getDisplayType().getSelectedItem();
    GraphicsTypes graphics = getGraphicsType().getSelectedItem();
    if (display == null || graphics == null) {
        return;
    }
    if (display != DisplayType.qxl || !graphics.getBackingGraphicsTypes().contains(GraphicsType.SPICE)) {
        getUsbPolicy().setSelectedItem(UsbPolicy.DISABLED);
        getIsSmartcardEnabled().setEntity(false);
    }
    handleQxlClusterLevel();
    getUsbPolicy().setIsChangeable(graphics.getBackingGraphicsTypes().contains(GraphicsType.SPICE));
    getIsSmartcardEnabled().setIsChangeable(graphics.getBackingGraphicsTypes().contains(GraphicsType.SPICE));
    getVncKeyboardLayout().setIsAvailable(graphics.getBackingGraphicsTypes().contains(GraphicsType.VNC));
    updateNumOfMonitors();
}
Also used : DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType)

Example 14 with DisplayType

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

the class UnitVmModel method initDisplayModels.

public void initDisplayModels(List<Pair<GraphicsType, DisplayType>> graphicsAndDisplays) {
    // get supported display types
    Set<DisplayType> displayTypes = new LinkedHashSet<>();
    for (Pair<GraphicsType, DisplayType> graphicsTypeDisplayTypePair : graphicsAndDisplays) {
        if (graphicsTypeDisplayTypePair.getSecond() != DisplayType.none) {
            displayTypes.add(graphicsTypeDisplayTypePair.getSecond());
        }
    }
    // set items and set selected one
    DisplayType selectedDisplayType = getDisplayType().getSelectedItem();
    if (displayTypes.contains(selectedDisplayType)) {
        getDisplayType().setItems(displayTypes, selectedDisplayType);
    } else if (displayTypes.size() > 0) {
        getDisplayType().setItems(displayTypes, displayTypes.iterator().next());
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType)

Aggregations

DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)14 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)8 Pair (org.ovirt.engine.core.common.utils.Pair)6 GraphicsDevice (org.ovirt.engine.core.common.businessentities.GraphicsDevice)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 Set (java.util.Set)3 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)3 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)3 VmDeviceType (org.ovirt.engine.core.common.utils.VmDeviceType)3 Version (org.ovirt.engine.core.compat.Version)3 Collection (java.util.Collection)2 List (java.util.List)2 VmDeviceGeneralType (org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType)2 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)2 VmInterfaceType (org.ovirt.engine.core.common.businessentities.network.VmInterfaceType)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 VmDeviceCommonUtils (org.ovirt.engine.core.common.utils.VmDeviceCommonUtils)2 Guid (org.ovirt.engine.core.compat.Guid)2