use of org.ovirt.engine.api.model.DisplayType in project ovirt-engine by oVirt.
the class DisplayHelper method setGraphicsToParams.
/**
* Set data about graphics from (REST) Template to parameters.
*
* @param display - display that contains graphics data
* @param params - parameters to be updated with graphics data
*/
public static void setGraphicsToParams(Display display, HasGraphicsDevices params) {
if (display != null && display.isSetType()) {
DisplayType newDisplayType = display.getType();
if (newDisplayType != null) {
for (GraphicsType graphicsType : GraphicsType.values()) {
// reset graphics devices
params.getGraphicsDevices().put(graphicsType, null);
}
GraphicsType newGraphicsType = DisplayMapper.map(newDisplayType, null);
params.getGraphicsDevices().put(newGraphicsType, new GraphicsDevice(newGraphicsType.getCorrespondingDeviceType()));
}
}
}
use of org.ovirt.engine.api.model.DisplayType in project ovirt-engine by oVirt.
the class DisplayMapper method fillDisplayInParams.
/**
* For backwards compatibility. Derives graphics type (backend) from display (rest).
*/
public static void fillDisplayInParams(Vm vm, RunVmOnceParams params) {
if (params == null) {
return;
}
if (vm.isSetDisplay() && vm.getDisplay().isSetType()) {
DisplayType displayType = vm.getDisplay().getType();
if (displayType != null) {
org.ovirt.engine.core.common.businessentities.DisplayType display = mapDisplayType(displayType, null);
if (display != null) {
Set<GraphicsType> graphics = new HashSet<>();
switch(display) {
case qxl:
graphics.add(GraphicsType.SPICE);
break;
case vga:
case cirrus:
graphics.add(GraphicsType.VNC);
break;
}
params.setRunOnceGraphics(graphics);
}
}
}
}
use of org.ovirt.engine.api.model.DisplayType in project ovirt-engine by oVirt.
the class BackendVmResourceTest method testStartWithModifiedGraphics.
private void testStartWithModifiedGraphics(GraphicsType graphicsType) throws Exception {
setUpWindowsGetEntityExpectations(1, false);
setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "RunOnceGraphics" }, new Object[] { GUIDS[0], Collections.singleton(graphicsType) }));
Action action = new Action();
action.setVm(new Vm());
action.getVm().setDisplay(new Display());
DisplayType display = (graphicsType == GraphicsType.VNC) ? DisplayType.VNC : DisplayType.SPICE;
action.getVm().getDisplay().setType(display);
verifyActionResponse(resource.start(action));
}
Aggregations