[SCM] CTDB repository - branch master updated - ctdb-2.0-7-gd8f0103
Amitay Isaacs
amitay at samba.org
Sun Nov 18 21:53:47 MST 2012
The branch, master has been updated
via d8f010355b715e49709836e057a5d0f110919897 (commit)
via 9275a69a414482f1053ae14528d5972575b9214e (commit)
from 54e24a151d2163954e5a2a1c0f41a2b5c19ae44b (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d8f010355b715e49709836e057a5d0f110919897
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Nov 16 20:21:15 2012 +1100
Eventscripts: 10.interface should list configured interfaces
The current code lists available interfaces. If IPs are configured in
some other way than the public addresses file (e.g. ctdb addip) and their
interfaces default to being marked down then, since down interfaces are
not available, these interfaces can never be marked up.
The configured interfaces should be listed instead.
Signed-off-by: Martin Schwenke <martin at meltin.net>
commit 9275a69a414482f1053ae14528d5972575b9214e
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Nov 16 19:43:14 2012 +1100
ctdbd: Make the link status of new interfaces more flexible
Neither up nor down is a good default value for the link status of a
new interface. Up means that IPs can be assigned to interfaces before
the true state is known and they can move away quickly if the interface
is actually down. Down means that IPs can't be assigned to an interface
for a variable amount of time - until a monitor cycle occurs - and this
can result in imbalanced IPs.
This is a neat compromise. Before the startup event completes, IPs
can't be assigned to interfaces because all interfaces begin in a down
state. As soon as the startup event completes, IPs can be allocated
to any interface that has been marked up by the eventscript. Later,
during normal operation, newly added IPs can be assigned to new
interfaces immediately. The IPs will still move away if an interface
is noticed to be down in the next monitor cycle, but that is the
exception rather than the rule.
Signed-off-by: Martin Schwenke <martin at meltin.net>
-----------------------------------------------------------------------
Summary of changes:
config/events.d/10.interface | 6 +++---
server/ctdb_takeover.c | 15 ++++++++++++++-
2 files changed, 17 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index 80b1368..7a85892 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -41,9 +41,9 @@ get_all_interfaces ()
[ "$CTDB_PUBLIC_INTERFACE" ] && all_interfaces="$CTDB_PUBLIC_INTERFACE $all_interfaces"
[ "$CTDB_NATGW_PUBLIC_IFACE" ] && all_interfaces="$CTDB_NATGW_PUBLIC_IFACE $all_interfaces"
- # For all but the 1st line, get the 2nd last field with commas
- # changes to spaces.
- ctdb_ifaces=$(ctdb -Y ip -v | sed -e '1d' -e 's/:[^:]*:$//' -e 's/^.*://' -e 's/,/ /g')
+ # Get the configured interfaces for each IP. That is, for all but
+ # the 1st line, get the last field with commas changed to spaces.
+ ctdb_ifaces=$(ctdb -Y ip -v | sed -e '1d' -e 's/:$//' -e 's/^.*://' -e 's/,/ /g')
# Add $ctdb_interfaces and uniquify
all_interfaces=$(echo $all_interfaces $ctdb_ifaces | tr ' ' '\n' | sort -u)
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index d324e3f..5345251 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -65,7 +65,20 @@ static int ctdb_add_local_iface(struct ctdb_context *ctdb, const char *iface)
CTDB_NO_MEMORY_FATAL(ctdb, i);
i->name = talloc_strdup(i, iface);
CTDB_NO_MEMORY(ctdb, i->name);
- i->link_up = false;
+ /*
+ * If link_up defaults to true then IPs can be allocated to a
+ * node during the first recovery. However, then an interface
+ * could have its link marked down during the startup event,
+ * causing the IP to move almost immediately. If link_up
+ * defaults to false then, during normal operation, IPs added
+ * to a new interface can't be assigned until a monitor cycle
+ * has occurred and marked the new interfaces up. This makes
+ * IP allocation unpredictable. The following is a neat
+ * compromise: early in startup link_up defaults to false, so
+ * IPs can't be assigned, and after startup IPs can be
+ * assigned immediately.
+ */
+ i->link_up = ctdb->done_startup;
DLIST_ADD(ctdb->ifaces, i);
--
CTDB repository
More information about the samba-cvs
mailing list