Add two new options
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 15 Jul 2008 01:03:35 +0000 (11:03 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 15 Jul 2008 01:03:35 +0000 (11:03 +1000)
CTDB_SAMBA_SKIP_CONF_CHECK and CTDB_SAMBA_CHECK_PORTS.
The first is used to tell ctdb to no longer monitoring if the smb.conf file is consistent or not.

The second specifies which ports to check that smb is listening on
instead of using testparm to figure this out.

Since the net, testparm and smbstatus may block indefinitely in some configurations
we must have a way to configure ctdb to NOT use any of these three commands
in the scripts. These commands should thus never be used in scripts.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
config/ctdb.sysconfig
config/events.d/50.samba
packaging/RPM/ctdb.spec

index 9084f8eb8d322a901ef5fed48397b94cd4a3c310..84a90d0609a5fdc84ee84d78e8834c1dfb916a7b 100644 (file)
 # since checking each one of them might take a long time.
 # CTDB_SAMBA_SKIP_SHARE_CHECK="yes"
 
+# should we skip checking smb.conf for consistency
+# CTDB_SAMBA_SKIP_CONF_CHECK="yes"
+
+# specify which ports we should check that there is a daemon listening to
+# by default we use testparm and look in smb.conf to figure out.
+# CTDB_SAMBA_CHECK_PORTS="445"
+
 # should ctdb manage starting/stopping Winbind service?
 # if left comented out then it will be autodetected based on smb.conf
 # CTDB_MANAGES_WINBIND=yes
index a8aad9152f6a8ca9e3a2c5e9f94cdefe874b44ea..9aa21e2ece030268f81fd8c0eb1223c65e2a1c39 100755 (executable)
@@ -108,9 +108,11 @@ case $cmd in
                touch $CTDB_BASE/state/samba/periodic_cleanup
        }
 
-       testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
-           echo "ERROR: testparm shows smb.conf is not clean"
-           exit 1
+       [ "$CTDB_SAMBA_SKIP_CONF_CHECK" != "yes" ] && {
+               testparm -s 2>&1 | egrep '^WARNING|^ERROR|^Unknown' && {
+                       echo "ERROR: testparm shows smb.conf is not clean"
+                       exit 1
+               }
        }
 
        [ "$CTDB_SAMBA_SKIP_SHARE_CHECK" != "yes" ] && {
@@ -118,7 +120,10 @@ case $cmd in
                ctdb_check_directories "Samba" $smb_dirs        
        }
 
-       smb_ports=`testparm -s --parameter-name="smb ports" 2> /dev/null`
+       smb_ports="$CTDB_SAMBA_CHECK_PORTS"
+       [ -z "$smb_ports" ] && {
+               smb_ports=`testparm -s --parameter-name="smb ports" 2> /dev/null`
+       }
        ctdb_check_tcp_ports "Samba" $smb_ports
 
        # check winbind is OK
index dfe8c39df8660e88ce78106b6d09c14ab1365a8b..7182f7de1287625d8e3605989455ca671eb85b62 100644 (file)
@@ -118,6 +118,13 @@ fi
 %{_includedir}/ctdb_private.h
 
 %changelog
+* Fri Jul 11 2008 : Version 1.0.48-pre
+ - Add two new options :
+   CTDB_SAMBA_SKIP_CONF_CHECK and CTDB_SAMBA_CHECK_PORTS that can be used
+   to override what checks to do when monitoring samba health.
+   We can no longer use the smbstatus, net or testparm commands to check
+   if samba or its config is healthy since these commands may block
+   indefinitely and thus can not be used in scripts.
 * Fri Jul 11 2008 : Version 1.0.47
  - Fix a double free bug where if a user striggered (ctdb eventscript)
    hung and while the timeout handler was being processed a new user