Search in sources :

Example 1 with Console

use of com.xensource.xenapi.Console in project cloudstack by apache.

the class CitrixResourceBase method getVncUrl.

public String getVncUrl(final Connection conn, final VM vm) {
    VM.Record record;
    Console c;
    try {
        record = vm.getRecord(conn);
        final Set<Console> consoles = record.consoles;
        if (consoles.isEmpty()) {
            s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription);
            return null;
        }
        final Iterator<Console> i = consoles.iterator();
        while (i.hasNext()) {
            c = i.next();
            if (c.getProtocol(conn) == Types.ConsoleProtocol.RFB) {
                return c.getLocation(conn);
            }
        }
    } catch (final XenAPIException e) {
        final String msg = "Unable to get console url due to " + e.toString();
        s_logger.warn(msg, e);
        return null;
    } catch (final XmlRpcException e) {
        final String msg = "Unable to get console url due to " + e.getMessage();
        s_logger.warn(msg, e);
        return null;
    }
    return null;
}
Also used : VM(com.xensource.xenapi.VM) Console(com.xensource.xenapi.Console) XenAPIException(com.xensource.xenapi.Types.XenAPIException) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Aggregations

Console (com.xensource.xenapi.Console)1 XenAPIException (com.xensource.xenapi.Types.XenAPIException)1 VM (com.xensource.xenapi.VM)1 XmlRpcException (org.apache.xmlrpc.XmlRpcException)1