Search in sources :

Example 16 with GraphicsInfo

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

the class VmDynamicDaoImpl method createFullParametersMapper.

/**
 * Note: we intentionally don't update lease_info here because it
 * should only be updated using {@link #updateVmLeaseInfo(Guid, Map)}
 */
@Override
protected MapSqlParameterSource createFullParametersMapper(VmDynamic vm) {
    GraphicsInfo spice = vm.getGraphicsInfos().get(GraphicsType.SPICE);
    GraphicsInfo vnc = vm.getGraphicsInfos().get(GraphicsType.VNC);
    return createIdParameterMapper(vm.getId()).addValue("app_list", vm.getAppList()).addValue("guest_cur_user_name", vm.getGuestCurrentUserName()).addValue("console_cur_user_name", vm.getConsoleCurrentUserName()).addValue("console_user_id", vm.getConsoleUserId()).addValue("guest_os", vm.getGuestOs()).addValue("migrating_to_vds", vm.getMigratingToVds()).addValue("run_on_vds", vm.getRunOnVds()).addValue("status", vm.getStatus()).addValue("vm_host", vm.getVmHost()).addValue("vm_ip", vm.getIp()).addValue("vm_fqdn", vm.getFqdn()).addValue("last_start_time", vm.getLastStartTime()).addValue("boot_time", vm.getBootTime()).addValue("downtime", vm.getDowntime()).addValue("last_stop_time", vm.getLastStopTime()).addValue("acpi_enable", vm.getAcpiEnable()).addValue("session", vm.getSession()).addValue("boot_sequence", vm.getBootSequence()).addValue("utc_diff", vm.getUtcDiff()).addValue("client_ip", vm.getClientIp()).addValue("guest_requested_memory", vm.getGuestRequestedMemory()).addValue("exit_status", vm.getExitStatus().getValue()).addValue("pause_status", vm.getPauseStatus().getValue()).addValue("exit_message", vm.getExitMessage()).addValue("guest_agent_nics_hash", vm.getGuestAgentNicsHash()).addValue("last_watchdog_event", vm.getLastWatchdogEvent()).addValue("last_watchdog_action", vm.getLastWatchdogAction()).addValue("is_run_once", vm.isRunOnce()).addValue("volatile_run", vm.isVolatileRun()).addValue("cpu_name", vm.getCpuName()).addValue("guest_agent_status", vm.getGuestAgentStatus().getValue()).addValue("current_cd", vm.getCurrentCd()).addValue("reason", vm.getStopReason()).addValue("exit_reason", vm.getExitReason().getValue()).addValue("guest_cpu_count", vm.getGuestCpuCount()).addValue("emulated_machine", vm.getEmulatedMachine()).addValue("spice_port", spice != null ? spice.getPort() : null).addValue("spice_tls_port", spice != null ? spice.getTlsPort() : null).addValue("spice_ip", spice != null ? spice.getIp() : null).addValue("vnc_port", vnc != null ? vnc.getPort() : null).addValue("vnc_ip", vnc != null ? vnc.getIp() : null).addValue("guest_timezone_name", vm.getGuestOsTimezoneName()).addValue("guest_timezone_offset", vm.getGuestOsTimezoneOffset()).addValue("guestos_arch", vm.getGuestOsArch().getValue()).addValue("guestos_codename", vm.getGuestOsCodename()).addValue("guestos_distribution", vm.getGuestOsDistribution()).addValue("guestos_kernel_version", vm.getGuestOsKernelVersion()).addValue("guestos_type", vm.getGuestOsType().name()).addValue("guestos_version", vm.getGuestOsVersion()).addValue("guest_containers", toGuestContainersString(vm));
}
Also used : GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 17 with GraphicsInfo

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

the class ConfigureConsoleOptionsQuery method fillCommonPart.

private void fillCommonPart(ConsoleOptions options) {
    GraphicsInfo graphicsInfo = getCachedVm().getGraphicsInfos().get(options.getGraphicsType());
    options.setHost(determineHost());
    options.setPort(graphicsInfo.getPort());
    options.setSmartcardEnabled(getCachedVm().isSmartcardEnabled());
    if (getParameters().isSetTicket()) {
        options.setTicket(generateTicket());
    }
    options.setToggleFullscreenHotKey(Config.getValue(ConfigValues.ConsoleToggleFullScreenKeys));
    options.setReleaseCursorHotKey(Config.getValue(ConfigValues.ConsoleReleaseCursorKeys));
    options.setRemapCtrlAltDelete(Config.getValue(ConfigValues.RemapCtrlAltDelDefault));
    options.setFullScreen(Config.getValue(ConfigValues.FullScreenWebadminDefault));
    fillRemoteViewerVersions(options);
    final String engineHost = EngineLocalConfig.getInstance().getHost() + ':' + (EngineLocalConfig.getInstance().isProxyEnabled() ? EngineLocalConfig.getInstance().getProxyHttpsPort() : EngineLocalConfig.getInstance().getHttpsPort());
    options.setOvirtHost(engineHost);
    final String ssoToken = getSessionDataContainer().getSsoAccessToken(getParameters().getSessionId());
    options.setSsoToken(ssoToken);
    options.setAdminConsole(!getParameters().isFiltered());
    final QueryReturnValue caCertificateReturnValue = getCACertificate();
    if (!caCertificateReturnValue.getSucceeded()) {
        getQueryReturnValue().setExceptionString("No CA found!");
        getQueryReturnValue().setSucceeded(false);
        return;
    }
    options.setTrustStore(caCertificateReturnValue.getReturnValue());
    options.setCustomHttpsCertificateUsed(!Objects.equals(EngineLocalConfig.getInstance().getPKITrustStorePath(), EngineLocalConfig.getInstance().getHttpsPKITrustStorePath()));
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 18 with GraphicsInfo

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

the class ConfigureConsoleOptionsQuery method fillSpice.

/**
 * Fills SPICE specific data to options.
 *
 * If SPICE root certificate validation is enabled but the root certificate cannot be retrieved,
 * the query fails (succeeded flag is set to false).
 *
 * @param options to be filled
 */
private void fillSpice(ConsoleOptions options) {
    GraphicsInfo graphicsInfo = getCachedVm().getGraphicsInfos().get(options.getGraphicsType());
    options.setSmartcardEnabled(getCachedVm().isSmartcardEnabled());
    options.setNumberOfMonitors(getCachedVm().getNumOfMonitors());
    if (graphicsInfo.getTlsPort() != null) {
        options.setSecurePort(graphicsInfo.getTlsPort());
    }
    if (Config.getValue(ConfigValues.SSLEnabled)) {
        String spiceSecureChannels = Config.getValue(ConfigValues.SpiceSecureChannels, cachedVm.getCompatibilityVersion().toString());
        if (!StringUtils.isBlank(spiceSecureChannels)) {
            options.setSslChanels(spiceSecureChannels);
        }
        String cipherSuite = Config.getValue(ConfigValues.CipherSuite);
        if (!StringUtils.isBlank(cipherSuite)) {
            options.setCipherSuite(cipherSuite);
        }
    }
    options.setHostSubject(Config.getValue(ConfigValues.EnableSpiceRootCertificateValidation) ? getVdsCertificateSubject() : null);
    options.setSpiceProxy(determineSpiceProxy());
}
Also used : GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 19 with GraphicsInfo

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

the class GetSignedWebsocketProxyTicketQuery method getGraphicsInfo.

private GraphicsInfo getGraphicsInfo() {
    final VM vm = vmDao.get(getParameters().getVmId(), getUserID(), getParameters().isFiltered());
    if (vm == null) {
        throw new EngineException(EngineError.VMCantBeObtained, String.format("vmid=%s", getParameters().getVmId()));
    }
    final GraphicsInfo graphicsInfo = vm.getGraphicsInfos().get(getParameters().getGraphicsType());
    if (graphicsInfo == null) {
        throw new EngineException(EngineError.GraphicsConsoleCantBeObtained, String.format("vmid=%s console=%s", getParameters().getVmId(), getParameters().getGraphicsType()));
    }
    return graphicsInfo;
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) EngineException(org.ovirt.engine.core.common.errors.EngineException) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 20 with GraphicsInfo

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

the class VmMapperTest method testDisplayPort.

@Test
public void testDisplayPort() {
    org.ovirt.engine.core.common.businessentities.VM entity = new org.ovirt.engine.core.common.businessentities.VM();
    entity.setStatus(VMStatus.Up);
    entity.getGraphicsInfos().put(GraphicsType.SPICE, new GraphicsInfo());
    entity.getGraphicsInfos().get(GraphicsType.SPICE).setPort(5900).setTlsPort(9999);
    Vm model = VmMapper.map(entity, (Vm) null);
    entity.getGraphicsInfos().put(GraphicsType.SPICE, new GraphicsInfo());
    entity.getGraphicsInfos().get(GraphicsType.SPICE).setPort(null).setTlsPort(null);
    model = VmMapper.map(entity, (Vm) null);
    assertNull(model.getDisplay().getPort());
    assertNull(model.getDisplay().getSecurePort());
}
Also used : Vm(org.ovirt.engine.api.model.Vm) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) Test(org.junit.Test)

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