mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6314: Use SSH commands for Xen VR execution
Instead of XAPI, which would make XenServer unnecessary busy.
This commit is contained in:
parent
c312078aac
commit
f29e4e21eb
|
|
@ -170,6 +170,7 @@ import com.cloud.utils.Ternary;
|
|||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.utils.ssh.SSHCmdHelper;
|
||||
import com.cloud.utils.ssh.SshHelper;
|
||||
import com.cloud.vm.DiskProfile;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.PowerState;
|
||||
|
|
@ -558,10 +559,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
|
||||
@Override
|
||||
public ExecutionResult executeInVR(String routerIP, String script, String args, int timeout) {
|
||||
Connection conn = getConnection();
|
||||
String rc = callHostPluginAsync(conn, "vmops", "routerProxy", timeout, "args", script + " " + routerIP + " " + args);
|
||||
// Fail case would be start with "fail#"
|
||||
return new ExecutionResult(rc.startsWith("succ#"), rc.substring(5));
|
||||
Pair<Boolean, String> result;
|
||||
try {
|
||||
result = SshHelper.sshExecute(_host.ip, 22, _username, null, _password.peek(), "/opt/cloud/bin/router_proxy.sh " + script + " " + routerIP + " " + args,
|
||||
60000, 60000, timeout * 1000);
|
||||
} catch (Exception e) {
|
||||
return new ExecutionResult(false, e.getMessage());
|
||||
}
|
||||
return new ExecutionResult(result.first(), result.second());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -197,20 +197,6 @@ def setLinkLocalIP(session, args):
|
|||
txt = 'success'
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def routerProxy(session, args):
|
||||
sargs = args['args']
|
||||
cmd = sargs.split(' ')
|
||||
cmd.insert(0, "/opt/cloud/bin/router_proxy.sh")
|
||||
cmd.insert(0, "/bin/bash")
|
||||
try:
|
||||
txt = util.pread2(cmd)
|
||||
txt = 'succ#' + txt
|
||||
except:
|
||||
logging.debug("routerProxy command " + sargs + " failed " )
|
||||
txt = 'fail#' + txt
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def createFile(session, args):
|
||||
file_path = args['filepath']
|
||||
|
|
@ -1495,7 +1481,6 @@ if __name__ == "__main__":
|
|||
XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi,
|
||||
"getgateway": getgateway, "preparemigration": preparemigration,
|
||||
"setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver,
|
||||
"routerProxy": routerProxy,
|
||||
"createFile": createFile, "deleteFile": deleteFile,
|
||||
"network_rules":network_rules,
|
||||
"can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,
|
||||
|
|
|
|||
Loading…
Reference in New Issue