Allow cluster management confliction detection to handle quick manageemnt server restarts

This commit is contained in:
Kelven Yang 2011-03-28 15:12:47 -07:00
parent 045b6ac319
commit fa0dd8a228
2 changed files with 14 additions and 6 deletions

View File

@ -934,14 +934,22 @@ public class ClusterManagerImpl implements ClusterManager {
String peerIP = peer.getServiceIP().trim();
if(_clusterNodeIP.equals(peerIP)) {
if("127.0.0.1".equals(_clusterNodeIP)) {
String msg = "Detected another management node with localhost IP is already running, please check your cluster configuration";
s_logger.error(msg);
throw new ConfigurationException(msg);
if(pingManagementNode(peer.getMsid())) {
String msg = "Detected another management node with localhost IP is already running, please check your cluster configuration";
s_logger.error(msg);
throw new ConfigurationException(msg);
} else {
String msg = "Detected another management node with localhost IP is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
s_logger.info(msg);
}
} else {
if(!pingManagementNode(peer.getMsid())) {
String msg = "Detected that another management node with the same IP " + peer.getServiceIP() + " is already running";
if(pingManagementNode(peer.getMsid())) {
String msg = "Detected that another management node with the same IP " + peer.getServiceIP() + " is already running, please check your cluster configuration";
s_logger.error(msg);
throw new ConfigurationException(msg);
} else {
String msg = "Detected that another management node with the same IP " + peer.getServiceIP() + " is considered as running in DB, however it is not pingable, we will continue cluster initialization with this management server node";
s_logger.info(msg);
}
}
}

View File

@ -23,11 +23,11 @@ import java.io.StringWriter;
public class ExceptionUtil {
public static String toString(Throwable th) {
final StringWriter writer = new StringWriter();
writer.append("Exception: " + th.getClass().getName() + "\n");
writer.append("Message: ");
writer.append(th.getMessage());
writer.append("\n Stack: ");
th.printStackTrace(new PrintWriter(writer));
return writer.toString();
}
}