Source:
public static void autoSelectDefaultDisplayType(Guid srcEntityId, VmBase parametersStaticData, VDSGroup cluster, Map<GraphicsType, GraphicsDevice> graphicsDevices) { List<Pair<GraphicsType, DisplayType>> graphicsAndDisplays = osRepository.getGraphicsAndDisplays( parametersStaticData.getOsId(), CompatibilityVersionUtils.getEffective(parametersStaticData, cluster)); if (parametersStaticData.getOsId() == OsRepository.AUTO_SELECT_OS || (parametersStaticData.getDefaultDisplayType() != null && isDisplayTypeSupported(parametersStaticData.getDefaultDisplayType(), graphicsAndDisplays))) { return; } DisplayType defaultDisplayType = null; Map<DisplayType, Set<GraphicsType>> displayGraphicsSupport = new HashMap<>(); for (Pair<GraphicsType, DisplayType> graphicsAndDisplay : graphicsAndDisplays) { DisplayType display = graphicsAndDisplay.getSecond(); if (!displayGraphicsSupport.containsKey(display)) { displayGraphicsSupport.put(display, new HashSet<>()); } displayGraphicsSupport.get(display).add(graphicsAndDisplay.getFirst()); } for (Map.Entry<DisplayType, Set<GraphicsType>> entry : displayGraphicsSupport.entrySet()) { if (entry.getValue().containsAll(VmHandler.getResultingVmGraphics(VmDeviceUtils.getGraphicsTypesOfEntity(srcEntityId), graphicsDevices))) { defaultDisplayType = entry.getKey(); break; } } if (defaultDisplayType == null) { if (!displayGraphicsSupport.isEmpty()) { Map.Entry<DisplayType, Set<GraphicsType>> entry = displayGraphicsSupport.entrySet().iterator().next(); defaultDisplayType = entry.getKey(); } else { defaultDisplayType = DisplayType.qxl; } } parametersStaticData.setDefaultDisplayType(defaultDisplayType); }

Target:
public static void autoSelectDefaultDisplayType(Guid srcEntityId, VmBase parametersStaticData, VDSGroup cluster, Map<GraphicsType, GraphicsDevice> graphicsDevices) { if (parametersStaticData.getOsId() == OsRepository.AUTO_SELECT_OS) { return; } List<Pair<GraphicsType, DisplayType>> graphicsAndDisplays = osRepository.getGraphicsAndDisplays( parametersStaticData.getOsId(), CompatibilityVersionUtils.getEffective(parametersStaticData, cluster)); if (parametersStaticData.getDefaultDisplayType() != null && isDisplayTypeSupported(parametersStaticData.getDefaultDisplayType(), graphicsAndDisplays)) { return; } DisplayType defaultDisplayType = null; Map<DisplayType, Set<GraphicsType>> displayGraphicsSupport = new HashMap<>(); for (Pair<GraphicsType, DisplayType> graphicsAndDisplay : graphicsAndDisplays) { DisplayType display = graphicsAndDisplay.getSecond(); if (!displayGraphicsSupport.containsKey(display)) { displayGraphicsSupport.put(display, new HashSet<>()); } displayGraphicsSupport.get(display).add(graphicsAndDisplay.getFirst()); } for (Map.Entry<DisplayType, Set<GraphicsType>> entry : displayGraphicsSupport.entrySet()) { if (entry.getValue().containsAll(VmHandler.getResultingVmGraphics(VmDeviceUtils.getGraphicsTypesOfEntity(srcEntityId), graphicsDevices))) { defaultDisplayType = entry.getKey(); break; } } if (defaultDisplayType == null) { if (!displayGraphicsSupport.isEmpty()) { Map.Entry<DisplayType, Set<GraphicsType>> entry = displayGraphicsSupport.entrySet().iterator().next(); defaultDisplayType = entry.getKey(); } else { defaultDisplayType = DisplayType.qxl; } } parametersStaticData.setDefaultDisplayType(defaultDisplayType); }