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;
}
Aggregations