});
}
} else {
drbdFailed = true;
if (drbdLoadedChanged) {
final MyButton drbdLoadButton = drbdLoadButtons.get(i);
application.invokeLater(new Runnable() {
@Override
public void run() {
drbdLoadedInfo.setText(Tools.getString("Dialog.Cluster.Init.DrbdIsNotLoaded"));
drbdLoadedInfo.setForeground(Color.RED);
drbdLoadButton.setVisible(true);
}
});
}
}
final boolean csAisIsInstalled = h.getOpenaisVersion() != null || h.getCorosyncVersion() != null;
final boolean csAisRunning = h.isCorosyncRunning() || h.isOpenaisRunning();
final boolean csAisIsRc = h.isCorosyncInRc() || h.isOpenaisInRc();
final boolean csAisIsConf = h.corosyncOrOpenaisConfigExists();
final boolean heartbeatIsInstalled = h.getHeartbeatVersion() != null;
final boolean heartbeatIsRunning = h.isHeartbeatRunning();
final boolean heartbeatIsRc = h.isHeartbeatInRc();
final boolean heartbeatIsConf = h.heartbeatConfigExists();
if (!csAisRunning && h.hasCorosyncInitScript() && h.hasOpenaisInitScript()) {
needOpenaisButton = true;
}
boolean hbChanged = false;
boolean csAisChanged = false;
if (lastPmStartedExists) {
if (lastPacemakerStarted[i] != csAisRunning) {
oneChanged = true;
csAisChanged = true;
lastPacemakerStarted[i] = csAisRunning;
}
if (lastPacemakerInRc[i] != csAisIsRc) {
oneChanged = true;
csAisChanged = true;
lastPacemakerInRc[i] = csAisIsRc;
}
if (lastPacemakerConfigured[i] != csAisIsConf) {
oneChanged = true;
csAisChanged = true;
lastPacemakerConfigured[i] = csAisIsConf;
}
if (lastPacemakerInstalled[i] != csAisIsInstalled) {
oneChanged = true;
csAisChanged = true;
lastPacemakerInstalled[i] = csAisIsInstalled;
}
if (lastHeartbeatStarted[i] != heartbeatIsRunning) {
oneChanged = true;
hbChanged = true;
lastHeartbeatStarted[i] = heartbeatIsRunning;
}
if (lastHeartbeatInRc[i] != heartbeatIsRc) {
oneChanged = true;
hbChanged = true;
lastHeartbeatInRc[i] = heartbeatIsRc;
}
if (lastHeartbeatConfigured[i] != heartbeatIsConf) {
oneChanged = true;
hbChanged = true;
lastHeartbeatConfigured[i] = heartbeatIsConf;
}
if (lastHeartbeatInstalled[i] != heartbeatIsInstalled) {
oneChanged = true;
hbChanged = true;
lastHeartbeatInstalled[i] = heartbeatIsInstalled;
}
} else {
oneChanged = true;
csAisChanged = true;
lastPacemakerStarted[i] = csAisRunning;
lastPacemakerInRc[i] = csAisIsRc;
lastPacemakerConfigured[i] = csAisIsConf;
lastPacemakerInstalled[i] = csAisIsInstalled;
hbChanged = true;
lastHeartbeatStarted[i] = heartbeatIsRunning;
lastHeartbeatInRc[i] = heartbeatIsRc;
lastHeartbeatConfigured[i] = heartbeatIsConf;
lastHeartbeatInstalled[i] = heartbeatIsInstalled;
}
/* Corosync/Openais */
final JLabel pmStartedInfo = pacemakerStartedLabels.get(i);
final MyButton csAisStartButton = startPacemakerButtons.get(i);
String is = "Corosync";
if (!useCorosync(h) && h.getOpenaisVersion() != null) {
is = "OpenAIS";
}
final String initScript = is;
boolean csAisFailed = false;
if (csAisRunning) {
if (csAisChanged || hbChanged) {
application.invokeLater(new Runnable() {
@Override
public void run() {
pmStartedInfo.setText(
initScript + Tools.getString("Dialog.Cluster.Init.CsAisIsRunning"));
pmStartedInfo.setForeground(Color.BLACK);
if (csAisIsRc) {
csAisStartButton.setVisible(false);
pmStartedInfo.setText(
initScript + Tools.getString("Dialog.Cluster.Init.CsAisIsRc"));
} else if (heartbeatIsRunning || heartbeatIsRc) {
csAisStartButton.setText(COROSYNC_AIS_BUTTON_SWITCH_TEXT);
csAisStartButton.setVisible(true);
} else {
csAisStartButton.setText(Tools.getString("Dialog.Cluster.Init.CsAisButtonRc"));
csAisStartButton.setVisible(true);
}
}
});
}
} else {
csAisFailed = true;
if (csAisChanged || hbChanged) {
application.invokeLater(new Runnable() {
@Override
public void run() {
if (heartbeatIsRunning || heartbeatIsRc) {
csAisStartButton.setText(COROSYNC_AIS_BUTTON_SWITCH_TEXT);
} else {
csAisStartButton.setText(Tools.getString("Dialog.Cluster.Init.StartCsAisButton"));
}
if (!csAisIsInstalled) {
pmStartedInfo.setText(initScript
+ Tools.getString("Dialog.Cluster.Init.CsAisIsNotInstalled"));
csAisStartButton.setEnabled(false);
} else if (!csAisIsConf) {
pmStartedInfo.setText(initScript
+ Tools.getString("Dialog.Cluster.Init.CsAisIsNotConfigured"));
csAisStartButton.setEnabled(false);
} else {
pmStartedInfo.setText(
initScript + Tools.getString("Dialog.Cluster.Init.CsAisIsStopped"));
if (heartbeatIsRunning) {
csAisStartButton.setEnabled(false);
} else {
guiData.setAccessible(csAisStartButton, AccessMode.OP);
}
}
csAisStartButton.setVisible(true);
pmStartedInfo.setForeground(Color.RED);
}
});
}
}
/* Heartbeat */
final JLabel hbStartedInfo = heartbeatStartedLabels.get(i);
final MyButton hbStartButton = startHeartbeatButtons.get(i);
boolean hbFailed = false;
if (heartbeatIsRunning) {
if (hbChanged || csAisChanged) {
application.invokeLater(new Runnable() {
@Override
public void run() {
hbStartedInfo.setText(Tools.getString("Dialog.Cluster.Init.HbIsRunning"));
hbStartedInfo.setForeground(Color.BLACK);
if (heartbeatIsRc) {
hbStartButton.setVisible(false);
hbStartedInfo.setText(Tools.getString("Dialog.Cluster.Init.HbIsRc"));
} else if (csAisRunning || csAisIsRc) {
hbStartButton.setText(HEARTBEAT_BUTTON_SWITCH_TEXT);
hbStartButton.setVisible(true);
} else {
hbStartButton.setText(Tools.getString("Dialog.Cluster.Init.HbButtonRc"));
hbStartButton.setVisible(true);
}
}
});
}
} else {
hbFailed = true;
if (hbChanged || csAisChanged) {
application.invokeLater(new Runnable() {
@Override
public void run() {
if (csAisRunning || csAisIsRc) {
hbStartButton.setText(HEARTBEAT_BUTTON_SWITCH_TEXT);
} else {
hbStartButton.setText(Tools.getString("Dialog.Cluster.Init.StartHbButton"));
}
if (!heartbeatIsInstalled) {
hbStartedInfo.setText(Tools.getString("Dialog.Cluster.Init.HbIsNotInstalled"));
hbStartButton.setEnabled(false);
} else if (!heartbeatIsConf) {
hbStartedInfo.setText(Tools.getString("Dialog.Cluster.Init.HbIsNotConfigured"));
hbStartButton.setEnabled(false);
} else {
hbStartedInfo.setText(Tools.getString("Dialog.Cluster.Init.HbIsStopped"));
if (csAisRunning) {
hbStartButton.setEnabled(false);
} else {
guiData.setAccessible(hbStartButton, AccessMode.OP);
}
}
hbStartButton.setVisible(true);
hbStartedInfo.setForeground(Color.RED);
}
});
}
}