public void parseClusterOutput(final String output,
final StringBuffer clusterStatusOutput,
final Host host,
final CountDownLatch firstTime,
final Application.RunMode runMode) {
final ClusterStatus clusterStatus0 = this.clusterStatus;
clStatusLock();
if (crmStatusCanceledByUser || clusterStatus0 == null) {
clStatusUnlock();
firstTime.countDown();
return;
}
if (output == null || "".equals(output)) {
clusterStatus0.setOnlineNode(host.getName(), "no");
setCrmStatus(host, false);
firstTime.countDown();
} else {
// TODO: if we get ERROR:... show it somewhere
clusterStatusOutput.append(output);
/* removes the string from the output. */
int s = clusterStatusOutput.indexOf(RESET_STRING);
while (s >= 0) {
clusterStatusOutput.delete(s, s + RESET_STRING_LEN);
s = clusterStatusOutput.indexOf(RESET_STRING);
}
if (clusterStatusOutput.length() > 12) {
final String e = clusterStatusOutput.substring(clusterStatusOutput.length() - 12);
if (e.trim().equals("---done---")) {
final int i = clusterStatusOutput.lastIndexOf("---start---");
if (i >= 0) {
if (clusterStatusOutput.indexOf("is stopped") >= 0) {
/* TODO: heartbeat's not running. */
} else {
final String status = clusterStatusOutput.substring(i);
clusterStatusOutput.delete(0, clusterStatusOutput.length());
if (CLUSTER_STATUS_ERROR.equals(status)) {
final boolean oldStatus = host.isCrmStatusOk();
clusterStatus0.setOnlineNode(host.getName(), "no");
setCrmStatus(host, false);
if (oldStatus) {
crmGraph.repaint();
}
} else {
if (clusterStatus0.parseStatus(status)) {
LOG.debug1("processClusterOutput: host: " + host.getName());
final ServicesInfo ssi = servicesInfo;
rscDefaultsInfo.setParameters(clusterStatus0.getRscDefaultsValuePairs());
ssi.setGlobalConfig(clusterStatus0);
ssi.setAllResources(clusterStatus0, runMode);
if (firstTime.getCount() == 1) {
/* one more time so that id-refs work.*/
ssi.setAllResources(clusterStatus0, runMode);
}
treeMenuController.repaintMenuTree();
clusterHostsInfo.updateTable(ClusterHostsInfo.MAIN_TABLE);
}
final String online = clusterStatus0.isOnlineNode(host.getName());
if ("yes".equals(online)) {
setCrmStatus(host, true);
setCrmStatus();
} else {
setCrmStatus(host, false);