Search in sources :

Example 1 with GraphicsDevice

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));
    }
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) GraphicsParameters(org.ovirt.engine.core.common.action.GraphicsParameters)

Example 2 with 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);
    }
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) GraphicsParameters(org.ovirt.engine.core.common.action.GraphicsParameters)

Example 3 with GraphicsDevice

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;
}
Also used : GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) ArrayList(java.util.ArrayList)

Example 4 with GraphicsDevice

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()));
        }
    }
}
Also used : GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) DisplayType(org.ovirt.engine.api.model.DisplayType)

Example 5 with GraphicsDevice

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));
}
Also used : GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) GraphicsParameters(org.ovirt.engine.core.common.action.GraphicsParameters)

Aggregations

GraphicsDevice (org.ovirt.engine.core.common.businessentities.GraphicsDevice)26 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)12 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)11 GraphicsParameters (org.ovirt.engine.core.common.action.GraphicsParameters)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 WebApplicationException (javax.ws.rs.WebApplicationException)4 GraphicsConsole (org.ovirt.engine.api.model.GraphicsConsole)4 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)4 Guid (org.ovirt.engine.core.compat.Guid)4 Map (java.util.Map)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)3 VmRngDevice (org.ovirt.engine.core.common.businessentities.VmRngDevice)3 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)3 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)3 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 VmDeviceType (org.ovirt.engine.core.common.utils.VmDeviceType)3 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2