[SCM] CTDB repository - branch master updated - ctdb-1.13-239-gfa0f3cb

Amitay Isaacs amitay at samba.org
Sun Jul 29 23:43:35 MDT 2012


The branch, master has been updated
       via  fa0f3cba5adaa38bed37dd8b121ad53e962a010d (commit)
       via  aed9b98ddbbf3e81de4f7257a10676565f7d7507 (commit)
      from  96fdda124f5511fb76190e7c7a7f0b98e6b01a31 (commit)

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


- Log -----------------------------------------------------------------
commit fa0f3cba5adaa38bed37dd8b121ad53e962a010d
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 17 16:52:04 2012 +1000

    doc: Document the new onnode -P option
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit aed9b98ddbbf3e81de4f7257a10676565f7d7507
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 17 16:45:55 2012 +1000

    tools/onnode: Add -P option to push files to given nodes
    
    A list of files is given rather than a command.  These files are
    pushed to the specified nodes.
    
    Quoting is fragile/broken so filenames with spaces won't work - you
    win some, you lose some.  :-)
    
    All of the other onnode options should work together with this option.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 doc/onnode.1      |   26 ++++++++++++++++++++------
 doc/onnode.1.html |   20 ++++++++++++--------
 doc/onnode.1.xml  |   10 ++++++++++
 tools/onnode      |   49 ++++++++++++++++++++++++++++++++++++-------------
 4 files changed, 78 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/onnode.1 b/doc/onnode.1
index 055a82e..28ad0d0 100644
--- a/doc/onnode.1
+++ b/doc/onnode.1
@@ -1,13 +1,22 @@
 '\" t
 .\"     Title: onnode
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: 02/05/2010
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\"      Date: 07/17/2012
 .\"    Manual:  
 .\"    Source:  
 .\"  Language: English
 .\"
-.TH "ONNODE" "1" "02/05/2010" "" ""
+.TH "ONNODE" "1" "07/17/2012" "" ""
+.\" -----------------------------------------------------------------
+.\" * 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
 .\" -----------------------------------------------------------------
@@ -92,7 +101,7 @@ Do not print node addresses\&. Normally, onnode prints informational node addres
 .PP
 \-n
 .RS 4
-Allow nodes to be specified by name rather than node numbers\&. These nodes don\'t need to be listed in the nodes file\&. You can avoid the nodes file entirely by combining this with
+Allow nodes to be specified by name rather than node numbers\&. These nodes don\*(Aqt need to be listed in the nodes file\&. You can avoid the nodes file entirely by combining this with
 \-f /dev/null\&.
 .RE
 .PP
@@ -108,6 +117,11 @@ in the FILES section for more details\&.
 Print a node addresses even if only one node is specified\&. Normally, onnode prints informational node addresses when more than one node is specified\&.
 .RE
 .PP
+\-P
+.RS 4
+Push files to nodes\&. Names of files to push are specified rather than the usual command\&. Quoting is fragile/broken \- filenames with whitespace in them are not supported\&.
+.RE
+.PP
 \-h, \-\-help
 .RS 4
 Show a short usage guide\&.
@@ -127,7 +141,7 @@ The following command would show the process ID of ctdb on all nodes
 .RE
 .\}
 .PP
-The following command would show the last 5 lines of log on each node, preceded by the node\'s hostname
+The following command would show the last 5 lines of log on each node, preceded by the node\*(Aqs hostname
 .sp
 .if n \{\
 .RS 4
@@ -177,7 +191,7 @@ in the FILES section for more details\&.
 .PP
 /etc/ctdb/nodes
 .RS 4
-Default file containing a list of each node\'s IP address or hostname\&.
+Default file containing a list of each node\*(Aqs IP address or hostname\&.
 .sp
 Actually, the default is
 $\fBCTDB_BASE\fR/nodes, where
diff --git a/doc/onnode.1.html b/doc/onnode.1.html
index f99bdb9..399941a 100644
--- a/doc/onnode.1.html
+++ b/doc/onnode.1.html
@@ -1,4 +1,4 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>onnode</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="onnode"><a name="onnode.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>onnode — run commands on ctdb nodes</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">onnode [OPTION] ... NODES COMMAND ...</code> </p></div></div><div class="refsect1" title="DESCRIPTION"><a name="id2602518"></a><h2>DESCRIPTION</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>onnode</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="onnode"><a name="onnode.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>onnode — run commands on ctdb nodes</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">onnode [OPTION] ... NODES COMMAND ...</code> </p></div></div><div class="refsect1" title="DESCRIPTION"><a name="idp234704"></a><h2>DESCRIPTION</h2><p>
       onnode is a utility to run commands on a specific node of a CTDB
       cluster, or on all nodes.
     </p><p>
@@ -13,7 +13,7 @@
     </p><p>
       The COMMAND can be any shell command. The onnode utility uses
       ssh or rsh to connect to the remote nodes and run the command.
-    </p></div><div class="refsect1" title="DESCRIPTIVE NODE SPECIFICATIONS"><a name="id2602547"></a><h2>DESCRIPTIVE NODE SPECIFICATIONS</h2><p>
+    </p></div><div class="refsect1" title="DESCRIPTIVE NODE SPECIFICATIONS"><a name="idp236384"></a><h2>DESCRIPTIVE NODE SPECIFICATIONS</h2><p>
       The following descriptive node specification can be used in
       place of numeric node numbers:
     </p><div class="variablelist"><dl><dt><span class="term">all</span></dt><dd><p>
@@ -32,7 +32,7 @@
             The current NAT gateway.
 	  </p></dd><dt><span class="term">rm | recmaster</span></dt><dd><p>
             The current recovery master.
-	  </p></dd></dl></div></div><div class="refsect1" title="OPTIONS"><a name="id2600718"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-c</span></dt><dd><p>
+	  </p></dd></dl></div></div><div class="refsect1" title="OPTIONS"><a name="idp253704"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-c</span></dt><dd><p>
             Execute COMMAND in the current working directory on the
             specified nodes.
 	  </p></dd><dt><span class="term">-o <prefix></span></dt><dd><p>
@@ -60,9 +60,13 @@
             Print a node addresses even if only one node is specified.
             Normally, onnode prints informational node addresses when
             more than one node is specified.
+	  </p></dd><dt><span class="term">-P</span></dt><dd><p>
+            Push files to nodes.  Names of files to push are specified
+            rather than the usual command.  Quoting is fragile/broken
+            - filenames with whitespace in them are not supported.
 	  </p></dd><dt><span class="term">-h, --help</span></dt><dd><p>
             Show a short usage guide.
-	  </p></dd></dl></div></div><div class="refsect1" title="EXAMPLES"><a name="id2600855"></a><h2>EXAMPLES</h2><p>
+	  </p></dd></dl></div></div><div class="refsect1" title="EXAMPLES"><a name="idp262848"></a><h2>EXAMPLES</h2><p>
       The following command would show the process ID of ctdb on all nodes
     </p><pre class="screen">
       onnode all pidof ctdbd
@@ -80,12 +84,12 @@
       directory, in parallel, on nodes 0, 2, 3 and 4.
     </p><pre class="screen">
       onnode -c -p 0,2-4 ./foo
-    </pre></div><div class="refsect1" title="ENVIRONMENT"><a name="id2600905"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl><dt><span class="term"><code class="envar">CTDB_NODES_FILE</code></span></dt><dd><p>
+    </pre></div><div class="refsect1" title="ENVIRONMENT"><a name="idp265888"></a><h2>ENVIRONMENT</h2><div class="variablelist"><dl><dt><span class="term"><code class="envar">CTDB_NODES_FILE</code></span></dt><dd><p>
 	    Name of alternative nodes file to use instead of the
             default.  See the discussion of
             <code class="filename">/etc/ctdb/nodes</code> in the FILES section
             for more details.
-	  </p></dd></dl></div></div><div class="refsect1" title="FILES"><a name="id2652169"></a><h2>FILES</h2><div class="variablelist"><dl><dt><span class="term"><code class="filename">/etc/ctdb/nodes</code></span></dt><dd><p>
+	  </p></dd></dl></div></div><div class="refsect1" title="FILES"><a name="idp124208"></a><h2>FILES</h2><div class="variablelist"><dl><dt><span class="term"><code class="filename">/etc/ctdb/nodes</code></span></dt><dd><p>
             Default file containing a list of each node's IP address
             or hostname.
 	  </p><p>
@@ -103,9 +107,9 @@
             something other than "ssh".  In this case the -t option is
             ignored.  For example, the administrator may choose to use
             use rsh instead of ssh.
-	  </p></dd></dl></div></div><div class="refsect1" title="SEE ALSO"><a name="id2652258"></a><h2>SEE ALSO</h2><p>
+	  </p></dd></dl></div></div><div class="refsect1" title="SEE ALSO"><a name="idp129264"></a><h2>SEE ALSO</h2><p>
       ctdbd(1), ctdb(1), <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
-    </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="id2652271"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+    </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="idp130040"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
 Copyright (C) Andrew Tridgell 2007<br>
 Copyright (C) Ronnie sahlberg 2007<br>
 Copyright (C) Martin Schwenke 2008<br>
diff --git a/doc/onnode.1.xml b/doc/onnode.1.xml
index 073f067..1b97c2f 100644
--- a/doc/onnode.1.xml
+++ b/doc/onnode.1.xml
@@ -177,6 +177,16 @@
         </listitem>
       </varlistentry>
 
+      <varlistentry><term>-P</term>
+        <listitem>
+          <para>
+            Push files to nodes.  Names of files to push are specified
+            rather than the usual command.  Quoting is fragile/broken
+            - filenames with whitespace in them are not supported.
+	  </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry><term>-h, --help</term>
         <listitem>
           <para>
diff --git a/tools/onnode b/tools/onnode
index 4bd8243..11ad708 100755
--- a/tools/onnode
+++ b/tools/onnode
@@ -37,6 +37,7 @@ Usage: onnode [OPTION] ... <NODES> <COMMAND> ...
     -n          Allow nodes to be specified by name.
     -f          Specify nodes file, overrides CTDB_NODES_FILE.
     -v          Print node address even for a single node.
+    -P          Push given files to nodes instead of running commands.
   <NODES>       "all", "any", "ok" (or "healthy"), "con" (or "connected"),
                 "rm" (or "recmaster"), "lvs" (or "lvsmaster"),
                 "natgw" (or "natgwlist"); or
@@ -62,6 +63,7 @@ verbose=false
 quiet=false
 prefix=""
 names_ok=false
+push=false
 
 ctdb_base="${CTDB_BASE:-/etc/ctdb}"
 
@@ -72,7 +74,7 @@ parse_options ()
     # options ot onnode.
     local temp
     # Not on the previous line - local returns 0!
-    temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqv" -l help -- "$@")
+    temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "cf:hno:pqvP" -l help -- "$@")
 
     [ $? != 0 ] && usage
 
@@ -87,6 +89,7 @@ parse_options ()
 	    -p) parallel=true ; shift ;;
 	    -q) quiet=true ; shift ;;
 	    -v) verbose=true ; shift ;;
+	    -P) push=true ; shift ;;
 	    --) shift ; break ;;
 	    -h|--help|*) usage ;; # Shouldn't happen, so this is reasonable.
 	esac
@@ -305,6 +308,21 @@ get_nodes ()
     done
 }
 
+push()
+{
+    local host="$1"
+    local files="$2"
+
+    local f
+    for f in $files ; do
+        $verbose && echo "Pushing $f"
+        case "$f" in
+	    /*) rsync "$f" "${host}:${f}" ;;
+	    *)  rsync "${PWD}/${f}" "${host}:${PWD}/${f}" ;;
+	esac
+    done
+}
+
 fakessh ()
 {
     CTDB_SOCKET="$1" sh -c "$2" 3>/dev/null
@@ -334,20 +352,25 @@ stderr_filter ()
 
 parse_options "$@"
 
-$current && command="cd $PWD && $command"
-
 ssh_opts=
-if [ -n "$CTDB_NODES_SOCKETS" ] ; then
-    SSH=fakessh
+if $push ; then
+    SSH=push
     EXTRA_SSH_OPTS=""
-else 
-    # Could "2>/dev/null || true" but want to see errors from typos in file.
-    [ -r "${ctdb_base}/onnode.conf" ] && . "${ctdb_base}/onnode.conf"
-    [ -n "$SSH" ] || SSH=ssh
-    if [ "$SSH" = "ssh" ] ; then
-	ssh_opts="-n"
-    else
-	: # rsh? All bets are off!
+else
+    $current && command="cd $PWD && $command"
+
+    if [ -n "$CTDB_NODES_SOCKETS" ] ; then
+	SSH=fakessh
+	EXTRA_SSH_OPTS=""
+    else 
+	# Could "2>/dev/null || true" but want to see errors from typos in file.
+	[ -r "${ctdb_base}/onnode.conf" ] && . "${ctdb_base}/onnode.conf"
+	[ -n "$SSH" ] || SSH=ssh
+	if [ "$SSH" = "ssh" ] ; then
+	    ssh_opts="-n"
+	else
+	    : # rsh? All bets are off!
+	fi
     fi
 fi
 


-- 
CTDB repository


More information about the samba-cvs mailing list