]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
handle the case of all nodes being sick for one service
authorAndrew Tridgell <tridge@samba.org>
Wed, 6 Jun 2007 06:49:59 +0000 (16:49 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 6 Jun 2007 06:49:59 +0000 (16:49 +1000)
(This used to be ctdb commit eca2590e60b4522b13c34e2c6cb8013aa55be323)

ctdb/takeover/ctdb_takeover.c

index 2a539b1f97ff76b622e8f2a566be9878c05960ab..a90a1a08c9c127a0d9d4188a4b4daa0bbec735d5 100644 (file)
@@ -432,6 +432,28 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
                                        break;
                                }
                        }
+                       
+                       /* if no enabled node can take it, then we
+                          might as well use any connected node. It
+                          probably means that some subsystem (such as
+                          NFS) is sick on all nodes. Best we can do
+                          is to keep the other services up. */
+                       if (j == i) {
+                               for (j=(i+1)%nodemap->num;
+                                    j != i;
+                                    j=(j+1)%nodemap->num) {
+                                       if ((nodemap->nodes[j].flags & NODE_FLAGS_CONNECTED) &&
+                                           ctdb_same_subnet(ctdb->nodes[j]->public_address, 
+                                                            ctdb->nodes[i]->public_address, 
+                                                            ctdb->nodes[j]->public_netmask_bits)) {
+                                               ctdb->nodes[i]->takeover_vnn = nodemap->nodes[j].vnn;
+                                               DEBUG(0,("All available nodes disabled for %s - using a connected node\n",
+                                                        ctdb->nodes[i]->public_address));
+                                               break;
+                                       }
+                               }
+                       }
+                       
                        if (j == i) {
                                DEBUG(0,(__location__ " No node available on same network to take %s\n",
                                         ctdb->nodes[i]->public_address));