use of org.ovirt.engine.core.common.action.GraphicsParameters in project ovirt-engine by oVirt.
the class AddVmCommand method addGraphicsDevice.
private void addGraphicsDevice() {
for (GraphicsDevice graphicsDevice : getParameters().getGraphicsDevices().values()) {
if (graphicsDevice == null) {
continue;
}
graphicsDevice.setVmId(getVmId());
backend.runInternalAction(ActionType.AddGraphicsDevice, new GraphicsParameters(graphicsDevice));
}
}
use of org.ovirt.engine.core.common.action.GraphicsParameters in project ovirt-engine by oVirt.
the class AddVmTemplateCommand method addGraphicsDevice.
/**
* Add graphics based on parameters.
*/
private void addGraphicsDevice() {
for (GraphicsDevice graphicsDevice : getParameters().getGraphicsDevices().values()) {
if (graphicsDevice == null) {
continue;
}
graphicsDevice.setVmId(getVmTemplateId());
GraphicsParameters parameters = new GraphicsParameters(graphicsDevice).setVm(false);
backend.runInternalAction(ActionType.AddGraphicsDevice, parameters);
}
}
use of org.ovirt.engine.core.common.action.GraphicsParameters in project ovirt-engine by oVirt.
the class UpdateVmCommand method addOrUpdateGraphicsDevice.
private void addOrUpdateGraphicsDevice(GraphicsDevice device) {
GraphicsDevice existingGraphicsDevice = getGraphicsDevOfType(device.getGraphicsType());
device.setVmId(getVmId());
backend.runInternalAction(existingGraphicsDevice == null ? ActionType.AddGraphicsDevice : ActionType.UpdateGraphicsDevice, new GraphicsParameters(device));
}
use of org.ovirt.engine.core.common.action.GraphicsParameters in project ovirt-engine by oVirt.
the class UpdateVmTemplateCommand method updateGraphicsDevice.
private void updateGraphicsDevice() {
for (GraphicsType type : getParameters().getGraphicsDevices().keySet()) {
GraphicsDevice vmGraphicsDevice = getGraphicsDevOfType(type);
if (vmGraphicsDevice == null) {
if (getParameters().getGraphicsDevices().get(type) != null) {
getParameters().getGraphicsDevices().get(type).setVmId(getVmTemplateId());
GraphicsParameters parameters = new GraphicsParameters(getParameters().getGraphicsDevices().get(type));
parameters.setVm(false);
backend.runInternalAction(ActionType.AddGraphicsDevice, parameters);
}
} else {
if (getParameters().getGraphicsDevices().get(type) == null) {
GraphicsParameters parameters = new GraphicsParameters(vmGraphicsDevice);
parameters.setVm(false);
backend.runInternalAction(ActionType.RemoveGraphicsDevice, parameters);
} else {
getParameters().getGraphicsDevices().get(type).setVmId(getVmTemplateId());
GraphicsParameters parameters = new GraphicsParameters(getParameters().getGraphicsDevices().get(type));
parameters.setVm(false);
backend.runInternalAction(ActionType.UpdateGraphicsDevice, parameters);
}
}
}
}
use of org.ovirt.engine.core.common.action.GraphicsParameters in project ovirt-engine by oVirt.
the class BackendGraphicsConsoleHelper method remove.
public static Response remove(BackendResource resource, Guid guid, String consoleId) {
List<GraphicsDevice> devices = DisplayHelper.getGraphicsDevicesForEntity(resource, guid, false);
if (devices == null) {
throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
}
org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = asGraphicsType(consoleId);
return devices.stream().filter(device -> device.getGraphicsType().equals(graphicsType)).findFirst().map(device -> resource.performAction(ActionType.RemoveGraphicsAndVideoDevices, new GraphicsParameters(device))).orElseThrow(() -> new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()));
}
Aggregations