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