我有一个开源的xenserver产品(来自xenserver.org)。我需要从Java代码远程访问VM。例如,远程重启。我找到了SDK的“API快速入门”http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/sdk.html,但我不知道如何连接到远程服务器。代码中应该包含哪个IP?:
Connection connection = new Connection(new URL("https://what_ip?"));
System.out.println(connection.getAPIVersion());
System.out.println(connection.getSessionReference());
发布于 2014-03-20 14:37:24
您只需要Xenserver虚拟机管理程序的IP。您不需要任何端口来建立连接。
您可以使用此代码与xenserver虚拟机管理程序建立连接。
import com.xensource.xenapi.APIVersion;
import com.xensource.xenapi.Connection;
import com.xensource.xenapi.Session;
try{
Connectionn conn = new Connection(new URL(xenservIP));
Session.loginWithPassword(conn, xenservUsername,xenservPassword, APIVersion.latest().toString());
} catch(BadServerResponse | SessionAuthenticationFailed | XenAPIException | XmlRpcException | MalformedURLException) {// Your code}
发布于 2014-03-12 21:07:40
无需阅读xenserver文档,我就会告诉您,您需要使用xenserver.org提供给您的公共IP或子域。并且您需要使用您的身份验证参数创建一个会话: user/password。这个论坛可以帮助你:
http://discussions.citrix.com/topic/349096-xenserver-java-remote-access/
https://stackoverflow.com/questions/22352327
复制相似问题