use of com.cloud.legacymodel.ExecutionResult in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResource method createFileInVR.
@Override
public ExecutionResult createFileInVR(final String routerIp, final String path, final String filename, final String content) {
final File permKey = new File("/root/.ssh/id_rsa.cloud");
String error = null;
logger.debug("Creating file in VR " + filename);
try {
SshHelper.scpTo(routerIp, 3922, "root", permKey, null, path, content.getBytes(), filename, null);
} catch (final Exception e) {
logger.warn("Fail to create file " + path + filename + " in VR " + routerIp, e);
error = e.getMessage();
}
return new ExecutionResult(error == null, error);
}
use of com.cloud.legacymodel.ExecutionResult in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResource method executeInVR.
@Override
public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout) {
final Script command = new Script(this.routerProxyPath, timeout * 1000, 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().trim();
}
logger.debug("Executing script in VR " + script);
return new ExecutionResult(command.getExitValue() == 0, details);
}
use of com.cloud.legacymodel.ExecutionResult in project cosmic by MissionCriticalCloud.
the class CitrixResourceBase method createFileInVR.
@Override
public ExecutionResult createFileInVR(final String routerIp, final String path, final String filename, final String content) {
final Connection conn = getConnection();
final String hostPath = "/tmp/";
s_logger.debug("Copying VR with ip " + routerIp + " config file into host " + this._host.getIp());
try {
SshHelper.scpTo(this._host.getIp(), 22, this._username, null, this._password.peek(), hostPath, content.getBytes(Charset.defaultCharset()), filename, null);
} catch (final Exception e) {
s_logger.warn("scp VR config file into host " + this._host.getIp() + " failed with exception " + e.getMessage().toString());
}
final String rc = callHostPlugin(conn, "vmops", "createFileInDomr", "domrip", routerIp, "srcfilepath", hostPath + filename, "dstfilepath", path);
s_logger.debug("VR Config file " + filename + " got created in VR, ip " + routerIp + " with content \n" + content);
return new ExecutionResult(rc.startsWith("succ#"), rc.substring(5));
}
Aggregations