mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3495
CS used to access vnc server in xenserver dom0 to get VM console, now CS moves to use XenServer console API. getvncport plugin is not needed any more.
remove the code related to getvncport in XenServer
This commit is contained in:
parent
e80fdcda94
commit
4333209af3
|
|
@ -2477,10 +2477,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
try {
|
||||
Set<VM> vms = VM.getByNameLabel(conn, cmd.getName());
|
||||
if(vms.size() == 1) {
|
||||
int vncport = getVncPort(conn, vms.iterator().next());
|
||||
String consoleurl;
|
||||
consoleurl = "consoleurl=" +getVncUrl(conn, vms.iterator().next()) + "&" +"sessionref="+ conn.getSessionReference();
|
||||
return new GetVncPortAnswer(cmd, consoleurl, vncport);
|
||||
return new GetVncPortAnswer(cmd, consoleurl, -1);
|
||||
} else {
|
||||
return new GetVncPortAnswer(cmd, "There are " + vms.size() + " VMs named " + cmd.getName());
|
||||
}
|
||||
|
|
@ -3371,47 +3370,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
return new ReadyAnswer(cmd);
|
||||
}
|
||||
|
||||
//
|
||||
// using synchronized on VM name in the caller does not prevent multiple
|
||||
// commands being sent against
|
||||
// the same VM, there will be a race condition here in finally clause and
|
||||
// the main block if
|
||||
// there are multiple requests going on
|
||||
//
|
||||
// Therefore, a lazy solution is to add a synchronized guard here
|
||||
protected int getVncPort(Connection conn, VM vm) {
|
||||
VM.Record record;
|
||||
try {
|
||||
record = vm.getRecord(conn);
|
||||
Set<Console> consoles = record.consoles;
|
||||
if (consoles.isEmpty()) {
|
||||
s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription);
|
||||
return -1;
|
||||
}
|
||||
consoles.iterator();
|
||||
} catch (XenAPIException e) {
|
||||
String msg = "Unable to get vnc-port due to " + e.toString();
|
||||
s_logger.warn(msg, e);
|
||||
return -1;
|
||||
} catch (XmlRpcException e) {
|
||||
String msg = "Unable to get vnc-port due to " + e.getMessage();
|
||||
s_logger.warn(msg, e);
|
||||
return -1;
|
||||
}
|
||||
String hvm = "true";
|
||||
if (record.HVMBootPolicy.isEmpty()) {
|
||||
hvm = "false";
|
||||
}
|
||||
|
||||
String vncport = callHostPlugin(conn, "vmops", "getvncport", "domID", record.domid.toString(), "hvm", hvm, "version", _host.product_version);
|
||||
if (vncport == null || vncport.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
vncport = vncport.replace("\n", "");
|
||||
return NumbersUtil.parseInt(vncport, -1);
|
||||
}
|
||||
|
||||
protected String getVncUrl(Connection conn, VM vm) {
|
||||
VM.Record record;
|
||||
Console c;
|
||||
|
|
|
|||
|
|
@ -73,34 +73,7 @@ def setup_iscsi(session, args):
|
|||
txt = ''
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def getvncport(session, args):
|
||||
domid = args['domID']
|
||||
hvm = args['hvm']
|
||||
version = args['version']
|
||||
if hvm == 'true':
|
||||
path1 = "/local/domain/" + domid + "/qemu-pid"
|
||||
path2 = "/local/domain/" + domid + "/console/vnc-port"
|
||||
else:
|
||||
if version[:3] == '6.0' or version[:3] == '6.1' or version[:3] == '6.2':
|
||||
path1 = "/local/domain/" + domid + "/vncterm-pid"
|
||||
path2 = "/local/domain/" + domid + "/console/vnc-port"
|
||||
else:
|
||||
path1 = "/local/domain/" + domid + "/serial/0/vncterm-pid"
|
||||
path2 = "/local/domain/" + domid + "/serial/0/vnc-port"
|
||||
try:
|
||||
cmd = ["xenstore-read", path1]
|
||||
pid = util.pread2(cmd)
|
||||
pid = pid.strip()
|
||||
cmd = ["ps", pid]
|
||||
util.pread2(cmd)
|
||||
cmd = ["xenstore-read", path2]
|
||||
vncport = util.pread2(cmd)
|
||||
vncport = vncport.strip()
|
||||
return vncport
|
||||
except:
|
||||
return ''
|
||||
|
||||
|
||||
@echo
|
||||
def getgateway(session, args):
|
||||
mgmt_ip = args['mgmtIP']
|
||||
|
|
@ -1663,7 +1636,7 @@ def bumpUpPriority(session, args):
|
|||
|
||||
if __name__ == "__main__":
|
||||
XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats,
|
||||
"getvncport": getvncport, "getgateway": getgateway, "preparemigration": preparemigration,
|
||||
"getgateway": getgateway, "preparemigration": preparemigration,
|
||||
"setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver,
|
||||
"savePassword": savePassword,
|
||||
"saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "routerProxy": routerProxy,
|
||||
|
|
|
|||
|
|
@ -61,34 +61,7 @@ def setup_iscsi(session, args):
|
|||
txt = ''
|
||||
return '> DONE <'
|
||||
|
||||
@echo
|
||||
def getvncport(session, args):
|
||||
domid = args['domID']
|
||||
hvm = args['hvm']
|
||||
version = args['version']
|
||||
if hvm == 'true':
|
||||
path1 = "/local/domain/" + domid + "/qemu-pid"
|
||||
path2 = "/local/domain/" + domid + "/console/vnc-port"
|
||||
else:
|
||||
if version[:3] == '6.0':
|
||||
path1 = "/local/domain/" + domid + "/vncterm-pid"
|
||||
path2 = "/local/domain/" + domid + "/console/vnc-port"
|
||||
else:
|
||||
path1 = "/local/domain/" + domid + "/serial/0/vncterm-pid"
|
||||
path2 = "/local/domain/" + domid + "/serial/0/vnc-port"
|
||||
try:
|
||||
cmd = ["xenstore-read", path1]
|
||||
pid = util.pread2(cmd)
|
||||
pid = pid.strip()
|
||||
cmd = ["ps", pid]
|
||||
util.pread2(cmd)
|
||||
cmd = ["xenstore-read", path2]
|
||||
vncport = util.pread2(cmd)
|
||||
vncport = vncport.strip()
|
||||
return vncport
|
||||
except:
|
||||
return ''
|
||||
|
||||
|
||||
@echo
|
||||
def getgateway(session, args):
|
||||
mgmt_ip = args['mgmtIP']
|
||||
|
|
@ -1498,7 +1471,7 @@ def getDomRVersion(session, args):
|
|||
|
||||
if __name__ == "__main__":
|
||||
XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats,
|
||||
"getvncport": getvncport, "getgateway": getgateway, "preparemigration": preparemigration,
|
||||
"getgateway": getgateway, "preparemigration": preparemigration,
|
||||
"setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver,
|
||||
"ipassoc": ipassoc, "savePassword": savePassword,
|
||||
"saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule,
|
||||
|
|
|
|||
Loading…
Reference in New Issue