use of com.cloud.utils.script.OutputInterpreter.AllLinesParser in project cloudstack by apache.
the class LibvirtComputingResource method executeInVR.
@Override
public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final Duration timeout) {
final Script command = new Script(_routerProxyPath, timeout, s_logger);
final AllLinesParser parser = new AllLinesParser();
command.add(script);
command.add(routerIp);
if (args != null) {
command.add(args);
}
String details = command.execute(parser);
if (details == null) {
details = parser.getLines();
}
return new ExecutionResult(command.getExitValue() == 0, details);
}
use of com.cloud.utils.script.OutputInterpreter.AllLinesParser in project CloudStack-archive by CloudStack-extras.
the class KVMHABase method destroyVMs.
protected void destroyVMs(String mountPath) {
/* if there are VMs using disks under this mount path, destroy them */
Script cmd = new Script("/bin/bash", _timeout);
cmd.add("-c");
cmd.add("ps axu|grep qemu|grep " + mountPath + "* |awk '{print $2}'");
AllLinesParser parser = new OutputInterpreter.AllLinesParser();
String result = cmd.execute(parser);
if (result != null) {
return;
}
String[] pids = parser.getLines().split("\n");
for (String pid : pids) {
Script.runSimpleBashScript("kill -9 " + pid);
}
}
use of com.cloud.utils.script.OutputInterpreter.AllLinesParser in project cloudstack by apache.
the class KVMHABase method destroyVMs.
protected void destroyVMs(String mountPath) {
/* if there are VMs using disks under this mount path, destroy them */
Script cmd = new Script("/bin/bash", _timeout);
cmd.add("-c");
cmd.add("ps axu|grep qemu|grep " + mountPath + "* |awk '{print $2}'");
AllLinesParser parser = new OutputInterpreter.AllLinesParser();
String result = cmd.execute(parser);
if (result != null) {
return;
}
String[] pids = parser.getLines().split("\n");
for (String pid : pids) {
Script.runSimpleBashScript("kill -9 " + pid);
}
}
Aggregations