Search in sources :

Example 6 with GraphicsInfo

use of org.ovirt.engine.core.common.businessentities.GraphicsInfo in project ovirt-engine by oVirt.

the class ConfigureConsoleOptionsQuery method determineHost.

private String determineHost() {
    GraphicsInfo graphicsInfo = getCachedVm().getGraphicsInfos().get(getParameters().getOptions().getGraphicsType());
    String result = graphicsInfo.getIp();
    // if we don't have display ip, we try management network of host
    if (StringUtils.isBlank(result) || "0".equals(result)) {
        QueryReturnValue returnValue = backend.runInternalQuery(QueryType.GetManagementInterfaceAddressByVmId, new IdQueryParameters(getCachedVm().getId()));
        result = returnValue.getReturnValue();
    }
    return result;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 7 with GraphicsInfo

use of org.ovirt.engine.core.common.businessentities.GraphicsInfo in project ovirt-engine by oVirt.

the class BackendVmsResourceTest method setUpEntityExpectations.

static org.ovirt.engine.core.common.businessentities.VM setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.VM entity, VmStatistics statistics, int index, Guid vmId) {
    entity.setId(vmId);
    entity.setClusterId(GUIDS[2]);
    entity.setName(NAMES[index]);
    entity.setVmDescription(DESCRIPTIONS[index]);
    entity.setCpuPerSocket(4);
    entity.setNumOfSockets(2);
    entity.setUsageMemPercent(20);
    entity.getGraphicsInfos().put(GraphicsType.VNC, new GraphicsInfo());
    entity.setNumOfMonitors(2);
    entity.setVmType(VmType.Server);
    entity.setRunOnVdsName(NAMES[NAMES.length - 1]);
    entity.setOrigin(index == 0 ? OriginType.HOSTED_ENGINE : OriginType.OVIRT);
    entity.setBootSequence(null);
    entity.getStaticData().setSmallIconId(GUIDS[2]);
    entity.getStaticData().setLargeIconId(GUIDS[3]);
    setUpStatisticalEntityExpectations(entity, statistics);
    return entity;
}
Also used : GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 8 with GraphicsInfo

use of org.ovirt.engine.core.common.businessentities.GraphicsInfo in project ovirt-engine by oVirt.

the class GetSignedWebsocketProxyTicketQuery method executeQueryCommandChecked.

private void executeQueryCommandChecked() throws IOException {
    final GraphicsInfo graphicsInfo = getGraphicsInfo();
    final Map<String, Object> ticketModel = createTicket(graphicsInfo);
    final String jsonTicket = new ObjectMapper().writeValueAsString(ticketModel);
    final String encodedTicket = URLEncoder.encode(jsonTicket, StandardCharsets.UTF_8.name());
    final String signedTicket = Backend.getInstance().runInternalQuery(QueryType.SignString, new SignStringParameters(encodedTicket)).getReturnValue();
    setReturnValue(signedTicket);
}
Also used : GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) SignStringParameters(org.ovirt.engine.core.common.queries.SignStringParameters) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 9 with GraphicsInfo

use of org.ovirt.engine.core.common.businessentities.GraphicsInfo in project ovirt-engine by oVirt.

the class VmDynamicDaoImpl method setGraphicsToEntity.

private static void setGraphicsToEntity(ResultSet rs, VmDynamic entity) throws SQLException {
    GraphicsInfo graphicsInfo = new GraphicsInfo();
    graphicsInfo.setIp(rs.getString("spice_ip"));
    graphicsInfo.setPort((Integer) rs.getObject("spice_port"));
    graphicsInfo.setTlsPort((Integer) rs.getObject("spice_tls_port"));
    if (graphicsInfo.getPort() != null || graphicsInfo.getTlsPort() != null) {
        entity.getGraphicsInfos().put(GraphicsType.SPICE, graphicsInfo);
    }
    graphicsInfo = new GraphicsInfo();
    graphicsInfo.setIp(rs.getString("vnc_ip"));
    graphicsInfo.setPort((Integer) rs.getObject("vnc_port"));
    if (graphicsInfo.getPort() != null) {
        entity.getGraphicsInfos().put(GraphicsType.VNC, graphicsInfo);
    }
}
Also used : GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 10 with GraphicsInfo

use of org.ovirt.engine.core.common.businessentities.GraphicsInfo in project ovirt-engine by oVirt.

the class VmMapperTest method getInverse.

@Override
protected org.ovirt.engine.core.common.businessentities.VM getInverse(VmStatic to) {
    VmStatistics statistics = new VmStatistics();
    statistics.setCpuUser(10.0);
    statistics.setCpuSys(20.0);
    VmDynamic dynamic = new VmDynamic();
    dynamic.setStatus(VMStatus.Up);
    dynamic.setBootSequence(to.getDefaultBootSequence());
    dynamic.getGraphicsInfos().put(GraphicsType.SPICE, new GraphicsInfo());
    org.ovirt.engine.core.common.businessentities.VM ret = new org.ovirt.engine.core.common.businessentities.VM(to, dynamic, statistics);
    ret.setUsageMemPercent(50);
    return ret;
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) VmStatistics(org.ovirt.engine.core.common.businessentities.VmStatistics) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Aggregations

GraphicsInfo (org.ovirt.engine.core.common.businessentities.GraphicsInfo)20 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)8 VM (org.ovirt.engine.core.common.businessentities.VM)7 Map (java.util.Map)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)2 Entry (java.util.Map.Entry)2 Vm (org.ovirt.engine.api.model.Vm)2 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)2 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)2 ConsoleOptions (org.ovirt.engine.core.common.console.ConsoleOptions)2 ConfigureConsoleOptionsParams (org.ovirt.engine.core.common.queries.ConfigureConsoleOptionsParams)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 QueryType (org.ovirt.engine.core.common.queries.QueryType)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 FrontendUrlUtils (org.ovirt.engine.ui.frontend.utils.FrontendUrlUtils)2 BaseCommandTarget (org.ovirt.engine.ui.uicommonweb.BaseCommandTarget)2 ConsoleUtils (org.ovirt.engine.ui.uicommonweb.ConsoleUtils)2 DynamicMessages (org.ovirt.engine.ui.uicommonweb.DynamicMessages)2