when we have a public ip address mismatch (i.e. we hold addresses we
authorRonnie Sahlberg <sahlberg@ronnie>
Mon, 24 Sep 2007 00:52:26 +0000 (10:52 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Mon, 24 Sep 2007 00:52:26 +0000 (10:52 +1000)
shouldnt   or we are not holding addresses wqe should)
we must first freeze the local node before we set the recovery mode

(This used to be ctdb commit a77a77e8b5180f6a4a1f3d7d4ff03811f3b71b56)

ctdb/server/ctdb_recoverd.c

index 703690f05367b5a3d22935c0293c4c418121a4ae..223181033a5ba4ca91f29b34bc1467708b39264d 100644 (file)
@@ -1561,12 +1561,30 @@ again:
                        if (ips->ips[j].pnn == pnn) {
                                if (!ctdb_sys_have_ip(ips->ips[j].sin)) {
                                        DEBUG(0,("Public address '%s' is missing and we should serve this ip\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
-                                       ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
+                                       ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
+                                       if (ret != 0) {
+                                               DEBUG(0,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
+                                               goto again;
+                                       }
+                                       ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
+                                       if (ret != 0) {
+                                               DEBUG(0,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
+                                               goto again;
+                                       }
                                }
                        } else {
                                if (ctdb_sys_have_ip(ips->ips[j].sin)) {
                                        DEBUG(0,("We are still serving a public address '%s' that we should not be serving.\n", inet_ntoa(ips->ips[j].sin.sin_addr)));
-                                       ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
+                                       ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
+                                       if (ret != 0) {
+                                               DEBUG(0,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
+                                               goto again;
+                                       }
+                                       ret = ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
+                                       if (ret != 0) {
+                                               DEBUG(0,(__location__ " Failed to activate recovery mode due to public ip address mismatches\n"));
+                                               goto again;
+                                       }
                                }
                        }
                }