Skip to content

Commit fa0dd8a

Browse files
author
Kelven Yang
committed
Allow cluster management confliction detection to handle quick manageemnt server restarts
1 parent 045b6ac commit fa0dd8a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

server/src/com/cloud/cluster/ClusterManagerImpl.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,14 +934,22 @@ private void checkConflicts() throws ConfigurationException {
934934
String peerIP = peer.getServiceIP().trim();
935935
if(_clusterNodeIP.equals(peerIP)) {
936936
if("127.0.0.1".equals(_clusterNodeIP)) {
937-
String msg = "Detected another management node with localhost IP is already running, please check your cluster configuration";
938-
s_logger.error(msg);
939-
throw new ConfigurationException(msg);
937+
if(pingManagementNode(peer.getMsid())) {
938+
String msg = "Detected another management node with localhost IP is already running, please check your cluster configuration";
939+
s_logger.error(msg);
940+
throw new ConfigurationException(msg);
941+
} else {
942+
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";
943+
s_logger.info(msg);
944+
}
940945
} else {
941-
if(!pingManagementNode(peer.getMsid())) {
942-
String msg = "Detected that another management node with the same IP " + peer.getServiceIP() + " is already running";
946+
if(pingManagementNode(peer.getMsid())) {
947+
String msg = "Detected that another management node with the same IP " + peer.getServiceIP() + " is already running, please check your cluster configuration";
943948
s_logger.error(msg);
944949
throw new ConfigurationException(msg);
950+
} else {
951+
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";
952+
s_logger.info(msg);
945953
}
946954
}
947955
}

utils/src/com/cloud/utils/exception/ExceptionUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
public class ExceptionUtil {
2424
public static String toString(Throwable th) {
2525
final StringWriter writer = new StringWriter();
26+
writer.append("Exception: " + th.getClass().getName() + "\n");
2627
writer.append("Message: ");
2728
writer.append(th.getMessage());
2829
writer.append("\n Stack: ");
2930
th.printStackTrace(new PrintWriter(writer));
3031
return writer.toString();
3132
}
32-
3333
}

0 commit comments

Comments
 (0)