Examples of GetVncPortAnswer


Examples of com.cloud.agent.api.GetVncPortAnswer

    protected ConsoleProxyDao _cpDao;
    public int getVncPort(VMInstanceVO vm) {
        if (vm.getHostId() == null) {
            return -1;
        }
        GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getHostName()));
        return (answer == null || !answer.getResult()) ? -1 : answer.getPort();
    }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

        if(cmd.isReauthenticating()) {
            ConsoleAccessAuthenticationAnswer authenticationAnswer = new ConsoleAccessAuthenticationAnswer(cmd, true);
            authenticationAnswer.setReauthenticating(true);

            s_logger.info("Re-authentication request, ask host " + vm.getHostId() + " for new console info");
          GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new
              GetVncPortCommand(vm.getId(), vm.getInstanceName()));

            if (answer != null && answer.getResult()) {
              Ternary<String, String, String> parsedHostInfo = ConsoleProxyServlet.parseHostInfo(answer.getAddress());
             
            if(parsedHostInfo.second() != null  && parsedHostInfo.third() != null) {
             
                    s_logger.info("Re-authentication result. vm: " + vm.getId() + ", tunnel url: " + parsedHostInfo.second()
                      + ", tunnel session: " + parsedHostInfo.third());
             
              authenticationAnswer.setTunnelUrl(parsedHostInfo.second());
              authenticationAnswer.setTunnelSession(parsedHostInfo.third());
            } else {
                    s_logger.info("Re-authentication result. vm: " + vm.getId() + ", host address: " + parsedHostInfo.first()
                          + ", port: " + answer.getPort());
             
              authenticationAnswer.setHost(parsedHostInfo.first());
              authenticationAnswer.setPort(answer.getPort());
            }
            } else {
                s_logger.warn("Re-authentication request failed");
             
              authenticationAnswer.setSuccess(false);
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Trying to retrieve VNC port from agent about VM " + vm.getHostName());
        }

        GetVncPortAnswer answer = (GetVncPortAnswer)_agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getInstanceName()));
        if (answer != null && answer.getResult()) {
            return new Pair<String, Integer>(answer.getAddress(), answer.getPort());
        }

        return new Pair<String, Integer>(null, -1);
    }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

        }
    }

    @Override
    public Answer getVncPort(GetVncPortCommand cmd) {
        return new GetVncPortAnswer(cmd, 0);
    }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Trying to retrieve VNC port from agent about VM " + vm.getHostName());
        }

        GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getInstanceName()));
        if (answer != null && answer.getResult()) {
            return new Pair<String, Integer>(answer.getAddress(), answer.getPort());
        }

        return new Pair<String, Integer>(null, -1);
    }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

        if(cmd.isReauthenticating()) {
            ConsoleAccessAuthenticationAnswer authenticationAnswer = new ConsoleAccessAuthenticationAnswer(cmd, true);
            authenticationAnswer.setReauthenticating(true);

            s_logger.info("Re-authentication request, ask host " + vm.getHostId() + " for new console info");
            GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new
                    GetVncPortCommand(vm.getId(), vm.getInstanceName()));

            if (answer != null && answer.getResult()) {
                Ternary<String, String, String> parsedHostInfo = ConsoleProxyServlet.parseHostInfo(answer.getAddress());

                if(parsedHostInfo.second() != null  && parsedHostInfo.third() != null) {

                    s_logger.info("Re-authentication result. vm: " + vm.getId() + ", tunnel url: " + parsedHostInfo.second()
                            + ", tunnel session: " + parsedHostInfo.third());

                    authenticationAnswer.setTunnelUrl(parsedHostInfo.second());
                    authenticationAnswer.setTunnelSession(parsedHostInfo.third());
                } else {
                    s_logger.info("Re-authentication result. vm: " + vm.getId() + ", host address: " + parsedHostInfo.first()
                            + ", port: " + answer.getPort());

                    authenticationAnswer.setHost(parsedHostInfo.first());
                    authenticationAnswer.setPort(answer.getPort());
                }
            } else {
                s_logger.warn("Re-authentication request failed");

                authenticationAnswer.setSuccess(false);
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

  }
 
  protected GetVncPortAnswer execute(GetVncPortCommand cmd) {
    try {
      Integer vncPort = OvmVm.getVncPort(_conn, cmd.getName());
      return new GetVncPortAnswer(cmd, _ip, vncPort);
    } catch (Exception e) {
      s_logger.debug("get vnc port for " + cmd.getName() + " failed", e);
      return new GetVncPortAnswer(cmd, e.getMessage());
    }
  }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

    }
  }

    @Override
    public Answer getVncPort(GetVncPortCommand cmd) {
          return new GetVncPortAnswer(cmd, 0);
    }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

        if (s_logger.isTraceEnabled()) {
            s_logger.trace("Trying to retrieve VNC port from agent about VM " + vm.getHostName());
        }

        GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getInstanceName()));
        if (answer != null && answer.getResult()) {
            return new Pair<String, Integer>(answer.getAddress(), answer.getPort());
        }

        return new Pair<String, Integer>(null, -1);
    }
View Full Code Here

Examples of com.cloud.agent.api.GetVncPortAnswer

    protected GetVncPortAnswer execute(GetVncPortCommand cmd) {
        try {
            Connect conn = LibvirtConnection.getConnection();
            Integer vncPort = getVncPort(conn, cmd.getName());
            return new GetVncPortAnswer(cmd, _privateIp, 5900 + vncPort);
        } catch (Exception e) {
            return new GetVncPortAnswer(cmd, e.toString());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.