ctdb-tools: Simplify "ctdb getmonmode" output format
authorMartin Schwenke <martin@meltin.net>
Fri, 22 Jul 2016 05:40:00 +0000 (15:40 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 25 Jul 2016 19:29:46 +0000 (21:29 +0200)
No preamble, just print keyword ENABLED or DISABLED.  Fix the
documentation to reflect this and remove the text that is simply
wrong.

Also remove output from "ctdb enablemonitor" and "ctdb disablemonitor"
on success.  This is just noise.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/doc/ctdb.1.xml
ctdb/tools/ctdb.c

index 8296cefbf093896153d38669eb32ac217cc1657d..8a5278eb93817ec64b9bdc52a380dc0fb48bfc3e 100644 (file)
@@ -1601,17 +1601,12 @@ HEALTH: NO-HEALTHY-NODES - ERROR - Backup of corrupted TDB in '/usr/local/var/li
     <refsect2>
       <title>getmonmode</title>
       <para>
-       This command returns the monutoring mode of a node. The monitoring mode is either ACTIVE or DISABLED. Normally a node will continuously monitor that all other nodes that are expected are in fact connected and that they respond to commands.
-      </para>
-      <para>
-       ACTIVE - This is the normal mode. The node is actively monitoring all other nodes, both that the transport is connected and also that the node responds to commands. If a node becomes unavailable, it will be marked as DISCONNECTED and a recovery is initiated to restore the cluster.
-      </para>
-      <para>
-       DISABLED - This node is not monitoring that other nodes are available. In this mode a node failure will not be detected and no recovery will be performed. This mode is useful when for debugging purposes one wants to attach GDB to a ctdb process but wants to prevent the rest of the cluster from marking this node as DISCONNECTED and do a recovery.
+       This command prints the monitoring mode of a node.  This
+       indicates when CTDB is monitoring services on the node. The
+       monitoring mode is either ENABLED or DISABLED.
       </para>
     </refsect2>
 
-
     <refsect2>
       <title>attach <parameter>DBNAME</parameter> [persistent]</title>
       <para>
index c03e61c9562a3d9bfb106e73638ba18165cbcee6..8ec2e4f84f4cd6c8f5be81a5c6852d52af68874d 100644 (file)
@@ -2949,15 +2949,13 @@ static int control_getmonmode(struct ctdb_context *ctdb, int argc, const char **
 
        ret = ctdb_ctrl_getmonmode(ctdb, TIMELIMIT(), options.pnn, &monmode);
        if (ret != 0) {
-               DEBUG(DEBUG_ERR, ("Unable to get monmode from node %u\n", options.pnn));
+               DEBUG(DEBUG_ERR, ("Unable to get monmode from node %u\n",
+                                 options.pnn));
                return ret;
        }
-       if (!options.machinereadable){
-               printf("Monitoring mode:%s (%d)\n",monmode==CTDB_MONITORING_ACTIVE?"ACTIVE":"DISABLED",monmode);
-       } else {
-               printm(":mode:\n");
-               printm(":%d:\n",monmode);
-       }
+       printf("%s\n",
+              monmode==CTDB_MONITORING_ACTIVE ? "ENABLED" : "DISABLED");
+
        return 0;
 }
 
@@ -3025,7 +3023,6 @@ static int control_disable_monmode(struct ctdb_context *ctdb, int argc, const ch
                DEBUG(DEBUG_ERR, ("Unable to disable monmode on node %u\n", options.pnn));
                return ret;
        }
-       printf("Monitoring mode:%s\n","DISABLED");
 
        return 0;
 }
@@ -3043,7 +3040,6 @@ static int control_enable_monmode(struct ctdb_context *ctdb, int argc, const cha
                DEBUG(DEBUG_ERR, ("Unable to enable monmode on node %u\n", options.pnn));
                return ret;
        }
-       printf("Monitoring mode:%s\n","ACTIVE");
 
        return 0;
 }