use of org.ovirt.engine.core.common.businessentities.GraphicsDevice 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.businessentities.GraphicsDevice 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.businessentities.GraphicsDevice in project ovirt-engine by oVirt.
the class DisplayHelper method getGraphicsTypesForEntity.
public static List<GraphicsType> getGraphicsTypesForEntity(BackendResource backendResource, Guid id, Map<Guid, List<GraphicsDevice>> cache, boolean nextRun) {
List<GraphicsType> graphicsTypes = new ArrayList<>();
List<GraphicsDevice> graphicsDevices;
if (cache == null) {
graphicsDevices = getGraphicsDevicesForEntity(backendResource, id, nextRun);
} else {
graphicsDevices = cache.get(id);
}
if (graphicsDevices != null) {
for (GraphicsDevice graphicsDevice : graphicsDevices) {
graphicsTypes.add(graphicsDevice.getGraphicsType());
}
}
return graphicsTypes;
}
use of org.ovirt.engine.core.common.businessentities.GraphicsDevice 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.core.common.businessentities.GraphicsDevice 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));
}
Aggregations