Skip to content

Commit f29e4e2

Browse files
author
Sheng Yang
committed
CLOUDSTACK-6314: Use SSH commands for Xen VR execution
Instead of XAPI, which would make XenServer unnecessary busy.
1 parent c312078 commit f29e4e2

2 files changed

Lines changed: 9 additions & 19 deletions

File tree

‎plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
import com.cloud.utils.exception.CloudRuntimeException;
171171
import com.cloud.utils.net.NetUtils;
172172
import com.cloud.utils.ssh.SSHCmdHelper;
173+
import com.cloud.utils.ssh.SshHelper;
173174
import com.cloud.vm.DiskProfile;
174175
import com.cloud.vm.VirtualMachine;
175176
import com.cloud.vm.VirtualMachine.PowerState;
@@ -558,10 +559,14 @@ public Answer executeRequest(Command cmd) {
558559

559560
@Override
560561
public ExecutionResult executeInVR(String routerIP, String script, String args, int timeout) {
561-
Connection conn = getConnection();
562-
String rc = callHostPluginAsync(conn, "vmops", "routerProxy", timeout, "args", script + " " + routerIP + " " + args);
563-
// Fail case would be start with "fail#"
564-
return new ExecutionResult(rc.startsWith("succ#"), rc.substring(5));
562+
Pair<Boolean, String> result;
563+
try {
564+
result = SshHelper.sshExecute(_host.ip, 22, _username, null, _password.peek(), "/opt/cloud/bin/router_proxy.sh " + script + " " + routerIP + " " + args,
565+
60000, 60000, timeout * 1000);
566+
} catch (Exception e) {
567+
return new ExecutionResult(false, e.getMessage());
568+
}
569+
return new ExecutionResult(result.first(), result.second());
565570
}
566571

567572
@Override

‎scripts/vm/hypervisor/xenserver/vmops‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,6 @@ def setLinkLocalIP(session, args):
197197
txt = 'success'
198198
return txt
199199

200-
@echo
201-
def routerProxy(session, args):
202-
sargs = args['args']
203-
cmd = sargs.split(' ')
204-
cmd.insert(0, "/opt/cloud/bin/router_proxy.sh")
205-
cmd.insert(0, "/bin/bash")
206-
try:
207-
txt = util.pread2(cmd)
208-
txt = 'succ#' + txt
209-
except:
210-
logging.debug("routerProxy command " + sargs + " failed " )
211-
txt = 'fail#' + txt
212-
return txt
213-
214200
@echo
215201
def createFile(session, args):
216202
file_path = args['filepath']
@@ -1495,7 +1481,6 @@ if __name__ == "__main__":
14951481
XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi,
14961482
"getgateway": getgateway, "preparemigration": preparemigration,
14971483
"setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver,
1498-
"routerProxy": routerProxy,
14991484
"createFile": createFile, "deleteFile": deleteFile,
15001485
"network_rules":network_rules,
15011486
"can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,

0 commit comments

Comments
 (0)