[SCM] CTDB repository - branch master updated - ctdb-1.0.82-6-g92b5580

Ronnie Sahlberg sahlberg at samba.org
Mon May 18 22:56:26 GMT 2009


The branch, master has been updated
       via  92b5580c38c23b99c1692708540983b0c0fcd6cf (commit)
       via  025a836ab3be3c078fccd8c10b10dfffbfdd94d0 (commit)
      from  177295ba400fcaf47f026653f27a42a8ff798d36 (commit)

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


- Log -----------------------------------------------------------------
commit 92b5580c38c23b99c1692708540983b0c0fcd6cf
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue May 19 08:55:42 2009 +1000

    Change the loglevel of "registered tcp client for ..." to INFO
    instead of ERR

commit 025a836ab3be3c078fccd8c10b10dfffbfdd94d0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue May 19 08:47:19 2009 +1000

    From : Flavio Carmo Junior <carmo.flavio at gmail.com>
    
    Add a helper function that checks whether a unix domain socket exists
    and there is a daemon LISTENING to it  similar to the existing function
    to check for a daemon LISTENING to a tcp/ip socket.

-----------------------------------------------------------------------

Summary of changes:
 config/functions       |   36 ++++++++++++++++++++++++++++++++++++
 server/ctdb_takeover.c |    4 ++--
 2 files changed, 38 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/functions b/config/functions
index 8b29fe4..a6b4688 100644
--- a/config/functions
+++ b/config/functions
@@ -248,6 +248,42 @@ ctdb_check_tcp_ports() {
 }
 
 ######################################################
+# check a unix socket
+# usage: ctdb_check_unix_socket SERVICE_NAME <socket_path>
+######################################################
+ctdb_check_unix_socket() {
+  service_name="$1"
+  socket_path="$2"
+  [ -z "$socket_path" ] && return;
+
+  # check availability of netstat first
+  NETSTAT=""
+  if [ -x $(type -p netstat) ]; then
+        NETSTAT=$(type -p netstat)
+  elif [ -x /usr/bin/netstat ]; then
+      NETSTAT=/usr/bin/netstat
+  elif [ -x /bin/netstat ]; then
+      NETSTAT=/bin/netstat
+  fi
+
+  all_ok=1
+  if [ "x$NETSTAT" != "x" ]; then
+    if $NETSTAT -l -a -n | grep -qE "^unix.*LISTEN.*${socket_path}$"; then
+      all_ok=1
+    else
+      all_ok=0
+    fi
+    else
+    [ -S ${socket_path} ] && all_ok=1 || all_ok=0
+  fi
+
+  [ $all_ok -eq 1 ] || {
+    echo "ERROR: $service_name socket $socket_path not found"
+    exit 1
+  }
+}
+
+######################################################
 # check a command returns zero status
 # usage: ctdb_check_command SERVICE_NAME <command>
 ######################################################
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 4b32c6e..29c0ee6 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -1118,13 +1118,13 @@ int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
 
 	switch (addr.sa.sa_family) {
 	case AF_INET:
-		DEBUG(DEBUG_ERR,("registered tcp client for %u->%s:%u (client_id %u pid %u)\n",
+		DEBUG(DEBUG_INFO,("registered tcp client for %u->%s:%u (client_id %u pid %u)\n",
 			(unsigned)ntohs(tcp_sock->dest.ip.sin_port), 
 			ctdb_addr_to_str(&tcp_sock->src),
 			(unsigned)ntohs(tcp_sock->src.ip.sin_port), client_id, client->pid));
 		break;
 	case AF_INET6:
-		DEBUG(DEBUG_ERR,("registered tcp client for %u->%s:%u (client_id %u pid %u)\n",
+		DEBUG(DEBUG_INFO,("registered tcp client for %u->%s:%u (client_id %u pid %u)\n",
 			(unsigned)ntohs(tcp_sock->dest.ip6.sin6_port), 
 			ctdb_addr_to_str(&tcp_sock->src),
 			(unsigned)ntohs(tcp_sock->src.ip6.sin6_port), client_id, client->pid));


-- 
CTDB repository


More information about the samba-cvs mailing list