[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.45

2012-07-12 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  95efb0cffb19a4311d706b2fd7031834a2711022 (commit)
   via  32d6d39626df46a1c0bb21554497685279ead88a (commit)
   via  0c6d9b84b12d32cb8f563f441377eaf2c9648b99 (commit)
   via  e609b63bc3dd2eb838fbf11997a49730c89a6a5e (commit)
  from  8c3aed36615e083e0b91efd70380b7711f9f9f7e (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit 95efb0cffb19a4311d706b2fd7031834a2711022
Author: Martin Schwenke 
Date:   Thu Jul 12 14:03:58 2012 +1000

New version 1.2.45

Signed-off-by: Martin Schwenke 

commit 32d6d39626df46a1c0bb21554497685279ead88a
Author: Ronnie Sahlberg 
Date:   Wed Jun 20 15:10:05 2012 +1000

When we find an ip we shouldnt host, just release it

Dont call a full blown clusterwide ipreallocation,  just release it locally

commit 0c6d9b84b12d32cb8f563f441377eaf2c9648b99
Author: Ronnie Sahlberg 
Date:   Wed Jun 20 10:08:11 2012 +1000

When we release an ip, get the interface name from the kernel

instead of using the interface where ctdb thinks the ip is hosted at.
The difference is that this now allows us to handle cases where we want to 
release an ip   but ctdbd does not know which interface the ip is assigned on.
(user has used 'ip addr add...'  and manually assigned an ip to the wrong 
interface)

commit e609b63bc3dd2eb838fbf11997a49730c89a6a5e
Author: Ronnie Sahlberg 
Date:   Wed Jun 20 13:32:02 2012 +1000

Add new command to find which interface is located on

---

Summary of changes:
 common/system_common.c |   84 
 include/ctdb_private.h |1 +
 packaging/RPM/ctdb.spec.in |4 ++-
 server/ctdb_recoverd.c |8 +++-
 server/ctdb_takeover.c |   15 
 tools/ctdb.c   |   22 +++
 6 files changed, 124 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/common/system_common.c b/common/system_common.c
index f28045f..6ee615f 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -73,3 +73,87 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *_addr)
close(s);
return ret == 0;
 }
+
+
+/* find which interface an ip address is currently assigned to */
+char *ctdb_sys_find_ifname(ctdb_sock_addr *addr)
+{
+   int s;
+   int size;
+   struct ifconf ifc;
+   char *ptr;
+
+   s = socket(AF_INET, SOCK_RAW, htons(IPPROTO_RAW));
+   if (s == -1) {
+   DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket 
(%s)\n",
+strerror(errno)));
+   return NULL;
+   }
+
+
+   size = sizeof(struct ifreq);
+   ifc.ifc_buf = NULL;
+   ifc.ifc_len = size;
+
+   while(ifc.ifc_len > (size - sizeof(struct ifreq))) {
+   size *= 2;
+
+   free(ifc.ifc_buf);  
+   ifc.ifc_len = size;
+   ifc.ifc_buf = malloc(size);
+   memset(ifc.ifc_buf, 0, size);
+   if (ioctl(s, SIOCGIFCONF, (caddr_t)&ifc) < 0) {
+   DEBUG(DEBUG_CRIT,("Failed to read ifc buffer from 
socket\n"));
+   free(ifc.ifc_buf);  
+   close(s);
+   return NULL;
+   }
+   }
+
+   for (ptr =(char *)ifc.ifc_buf; ptr < ((char *)ifc.ifc_buf) + 
ifc.ifc_len; ) {
+   char *ifname;
+   struct ifreq *ifr;
+
+   ifr = (struct ifreq *)ptr;
+
+#ifdef HAVE_SOCKADDR_LEN
+   if (ifr->ifr_addr.sa_len > sizeof(struct sockaddr)) {
+   ptr += sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len;
+   } else {
+   ptr += sizeof(ifr->ifr_name) + sizeof(struct sockaddr);
+   }
+#else
+   ptr += sizeof(struct ifreq);
+#endif
+
+   if (ifr->ifr_addr.sa_family != addr->sa.sa_family) {
+   continue;
+   }
+
+   switch (addr->sa.sa_family) {
+   case AF_INET:
+
+
+   if (memcmp(&addr->ip.sin_addr, &((struct sockaddr_in 
*)&ifr->ifr_addr)->sin_addr, sizeof(addr->ip.sin_addr))) {
+   continue;
+   }
+   break;
+   case AF_INET6:
+   if (memcmp(&addr->ip6.sin6_addr, &((struct sockaddr_in6 
*)&ifr->ifr_addr)->sin6_addr, sizeof(addr->ip6.sin6_addr))) {
+   continue;
+   }
+   break;
+   }
+
+   ifname = strdup(ifr->ifr_name);
+   free(ifc.ifc_buf);  
+   close(s);
+   return ifname;
+   }
+
+
+   free(ifc.ifc_buf);  
+   close(s);
+
+   return NULL;
+}
diff --git a/include/ctdb_private.h b/in

[SCM] CTDB repository - branch 1.2.40 updated - ctdb-1.2.45-2-gec1bfce

2012-07-26 Thread Amitay Isaacs
The branch, 1.2.40 has been updated
   via  ec1bfcec167194344a5694427bede4597bcf2547 (commit)
   via  34e329c87d8104b3ce71d0c0f4004387ef058b41 (commit)
  from  95efb0cffb19a4311d706b2fd7031834a2711022 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=1.2.40


- Log -
commit ec1bfcec167194344a5694427bede4597bcf2547
Author: Martin Schwenke 
Date:   Tue Jul 24 11:26:32 2012 +1000

New version 1.2.46

Signed-off-by: Martin Schwenke 

commit 34e329c87d8104b3ce71d0c0f4004387ef058b41
Author: Martin Schwenke 
Date:   Fri Jul 20 16:43:39 2012 +1000

Eventscripts: Default route on NAT gateway should have a metric of 10

At the moment routes from 11.routing can fail to be added because they
conflict with the default route added by 11.natgw.

NAT gateway is meant to be a last resort, so routes from 11.routing
should override it.

Signed-off-by: Martin Schwenke 

---

Summary of changes:
 config/events.d/11.natgw   |2 +-
 doc/ctdbd.1|   39 +++---
 doc/ctdbd.1.html   |   92 +++-
 doc/ctdbd.1.xml|   12 --
 packaging/RPM/ctdb.spec.in |4 +-
 5 files changed, 84 insertions(+), 65 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/11.natgw b/config/events.d/11.natgw
index ba6d7a5..c7ff289 100755
--- a/config/events.d/11.natgw
+++ b/config/events.d/11.natgw
@@ -79,7 +79,7 @@ case "$1" in
iptables -I INPUT -p tcp --syn -d $CTDB_NATGW_PUBLIC_IP_HOST -j 
REJECT 2>/dev/null
 
ip addr add $CTDB_NATGW_PUBLIC_IP dev $CTDB_NATGW_PUBLIC_IFACE
-   ip route add 0.0.0.0/0 via $CTDB_NATGW_DEFAULT_GATEWAY 
>/dev/null 2>/dev/null
+   ip route add 0.0.0.0/0 metric 10 via 
$CTDB_NATGW_DEFAULT_GATEWAY >/dev/null 2>/dev/null
else
# This is not the NAT-GW
# Assign the public ip to the private interface and make
diff --git a/doc/ctdbd.1 b/doc/ctdbd.1
index 5800520..b7e7c04 100644
--- a/doc/ctdbd.1
+++ b/doc/ctdbd.1
@@ -1,13 +1,22 @@
 '\" t
 .\" Title: ctdbd
 .\"Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 
-.\"  Date: 09/08/2010
+.\" Generator: DocBook XSL Stylesheets v1.76.1 
+.\"  Date: 07/24/2012
 .\"Manual: CTDB - clustered TDB database
 .\"Source: ctdb
 .\"  Language: English
 .\"
-.TH "CTDBD" "1" "09/08/2010" "ctdb" "CTDB \- clustered TDB database"
+.TH "CTDBD" "1" "07/24/2012" "ctdb" "CTDB \- clustered TDB database"
+.\" -
+.\" * Define some portability stuff
+.\" -
+.\" ~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~
+.ie \n(.g .ds Aq \(aq
+.el   .ds Aq '
 .\" -
 .\" * set default formatting
 .\" -
@@ -118,7 +127,7 @@ This is a ctdbd debugging option\&. this option is only 
used when debugging ctdb
 .sp
 Normally ctdb will change its scheduler to run as a real\-time process\&. This 
is the default mode for a normal ctdbd operation to gurarantee that ctdbd 
always gets the cpu cycles that it needs\&.
 .sp
-This option is used to tell ctdbd to NOT run as a real\-time process and 
instead run ctdbd as a normal userspace process\&. This is useful for debugging 
and when you want to run ctdbd under valgrind or gdb\&. (You don\'t want to 
attach valgrind or gdb to a real\-time process\&.)
+This option is used to tell ctdbd to NOT run as a real\-time process and 
instead run ctdbd as a normal userspace process\&. This is useful for debugging 
and when you want to run ctdbd under valgrind or gdb\&. (You don\*(Aqt want to 
attach valgrind or gdb to a real\-time process\&.)
 .RE
 .PP
 \-\-notification\-script=
@@ -141,7 +150,7 @@ This is usually the file /etc/ctdb/public_addresses
 .RS 4
 This option tells ctdb which interface to attach public\-addresses to and also 
where to attach the single\-public\-ip when used\&.
 .sp
-This is only required when using public ip addresses and only when you don\'t 
specify the interface explicitly in /etc/ctdb/public_addresses or when you are 
using \-\-single\-public\-ip\&.
+This is only required when using public ip addresses and only when you 
don\*(Aqt specify the interface explicitly in /etc/ctdb/public_addresses or 
when you are using \-\-single\-public\-ip\&.
 .sp
 If you omit this argument when using public add