]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-replay: Add rbd-replay-many
authorAdam Crume <adamcrume@gmail.com>
Thu, 4 Sep 2014 23:48:35 +0000 (16:48 -0700)
committerAdam Crume <adamcrume@gmail.com>
Thu, 11 Sep 2014 23:48:03 +0000 (16:48 -0700)
Signed-off-by: Adam Crume <adamcrume@gmail.com>
ceph.spec.in
doc/man/8/rbd-replay-many.rst [new file with mode: 0644]
man/Makefile.am
man/rbd-replay-many.8 [new file with mode: 0644]
src/Makefile.am
src/rbd-replay-many [new file with mode: 0755]

index 9a11305d801df070c0cc10d7fc3a7f5872dbe473..411cccc9321230713fd3589ff27da2356549e75c 100644 (file)
@@ -742,7 +742,9 @@ ln -sf %{_libdir}/librbd.so.1 /usr/lib64/qemu/librbd.so.1
 %{_bindir}/ceph-osdomap-tool
 %{_bindir}/ceph-kvstore-tool
 %{_mandir}/man8/rbd-replay.8*
+%{_mandir}/man8/rbd-replay-many.8*
 %{_bindir}/rbd-replay
+%{_bindir}/rbd-replay-many
 %if (0%{?fedora} >= 20 || 0%{?rhel} == 6)
 %{_mandir}/man8/rbd-replay-prep.8*
 %{_bindir}/rbd-replay-prep
diff --git a/doc/man/8/rbd-replay-many.rst b/doc/man/8/rbd-replay-many.rst
new file mode 100644 (file)
index 0000000..f397d45
--- /dev/null
@@ -0,0 +1,71 @@
+==================================================================================
+ rbd-replay-many -- replay a rados block device (RBD) workload on several clients
+==================================================================================
+
+.. program:: rbd-replay-many
+
+Synopsis
+========
+
+| **rbd-replay-many** [ *options* ] --original-image *name* *host1* [ *host2* [ ... ] ] -- *rbd_replay_args*
+
+
+Description
+===========
+
+**rbd-replay-many** is a utility for replaying a rados block device (RBD) workload on several clients.
+Although all clients use the same workload, they replay against separate images.
+This matches normal use of librbd, where each original client is a VM with its own image.
+
+Configuration and replay files are not automatically copied to clients.
+Replay images must already exist.
+
+
+Options
+=======
+
+.. option:: --original-image name
+
+   Specifies the name (and snap) of the originally traced image.
+   Necessary for correct name mapping.
+
+.. option:: --image-prefix prefix
+
+   Prefix of image names to replay against.
+   Specifying --image-prefix=foo results in clients replaying against foo-0, foo-1, etc.
+   Defaults to the original image name.
+
+.. option:: --exec program
+
+   Path to the rbd-replay executable.
+
+.. option:: --delay seconds
+
+   Delay between starting each client.  Defaults to 0.
+
+
+Examples
+========
+
+Typical usage::
+
+       rbd-replay-many host-0 host-1 --original-image=image -- -c ceph.conf replay.bin
+
+This results in the following commands being executed::
+
+       ssh host-0 'rbd-replay' --map-image 'image=image-0' -c ceph.conf replay.bin
+       ssh host-1 'rbd-replay' --map-image 'image=image-1' -c ceph.conf replay.bin
+
+
+Availability
+============
+
+**rbd-replay-many** is part of the Ceph distributed storage system. Please refer to
+the Ceph documentation at http://ceph.com/docs for more information.
+
+
+See also
+========
+
+:doc:`rbd-replay <rbd-replay>`\(8),
+:doc:`rbd <rbd>`\(8)
index 4dc71cc208d20f166029c81e02f2c37c4d53a627..50cd987bc681069c528adb9bec4828e1d5b85dd1 100644 (file)
@@ -28,4 +28,5 @@ dist_man_MANS = \
        ceph-post-file.8 \
        rbd-fuse.8 \
        rbd-replay.8 \
+       rbd-replay-many.8 \
        rbd-replay-prep.8
diff --git a/man/rbd-replay-many.8 b/man/rbd-replay-many.8
new file mode 100644 (file)
index 0000000..e07d79a
--- /dev/null
@@ -0,0 +1,134 @@
+.\" Man page generated from reStructuredText.
+.
+.TH "RBD-REPLAY-MANY" "8" "September 04, 2014" "dev" "Ceph"
+.SH NAME
+rbd-replay-many \- replay a rados block device (RBD) workload on several clients
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.
+.nr rst2man-indent-level 0
+.
+.de1 rstReportMargin
+\\$1 \\n[an-margin]
+level \\n[rst2man-indent-level]
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
+-
+\\n[rst2man-indent0]
+\\n[rst2man-indent1]
+\\n[rst2man-indent2]
+..
+.de1 INDENT
+.\" .rstReportMargin pre:
+. RS \\$1
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
+. nr rst2man-indent-level +1
+.\" .rstReportMargin post:
+..
+.de UNINDENT
+. RE
+.\" indent \\n[an-margin]
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.nr rst2man-indent-level -1
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
+..
+.SH SYNOPSIS
+.nf
+\fBrbd\-replay\-many\fP [ \fIoptions\fP ] \-\-original\-image \fIname\fP \fIhost1\fP [ \fIhost2\fP [ ... ] ] \-\- \fIrbd_replay_args\fP
+.fi
+.sp
+.SH DESCRIPTION
+.sp
+\fBrbd\-replay\-many\fP is a utility for replaying a rados block device (RBD) workload on several clients.
+Although all clients use the same workload, they replay against separate images.
+This matches normal use of librbd, where each original client is a VM with its own image.
+.sp
+Configuration and replay files are not automatically copied to clients.
+Replay images must already exist.
+.SH OPTIONS
+.INDENT 0.0
+.TP
+.B \-\-original\-image name
+Specifies the name (and snap) of the originally traced image.
+Necessary for correct name mapping.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-image\-prefix prefix
+Prefix of image names to replay against.
+Specifying \-\-image\-prefix=foo results in clients replaying against foo\-0, foo\-1, etc.
+Defaults to the original image name.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-exec program
+Path to the rbd\-replay executable.
+.UNINDENT
+.INDENT 0.0
+.TP
+.B \-\-delay seconds
+Delay between starting each client.  Defaults to 0.
+.UNINDENT
+.SH EXAMPLES
+.sp
+Typical usage:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+rbd\-replay\-many host\-0 host\-1 \-\-original\-image=image \-\- \-c ceph.conf replay.bin
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.sp
+This results in the following commands being executed:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+ssh host\-0 \(aqrbd\-replay\(aq \-\-map\-image \(aqimage=image\-0\(aq \-c ceph.conf replay.bin
+ssh host\-1 \(aqrbd\-replay\(aq \-\-map\-image \(aqimage=image\-1\(aq \-c ceph.conf replay.bin
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
+.SH AVAILABILITY
+.sp
+\fBrbd\-replay\-many\fP is part of the Ceph distributed storage system. Please refer to
+the Ceph documentation at \fI\%http://ceph.com/docs\fP for more information.
+.SH SEE ALSO
+.sp
+\fBrbd\-replay\fP(8),
+\fBrbd\fP(8)
+.SH COPYRIGHT
+2010-2014, Inktank Storage, Inc. and contributors. Licensed under Creative Commons BY-SA
+.\" Generated by docutils manpage writer.
+.
index b954f3f8d0516d01fc349567609169b2f348cb1a..270829c09c8bf130f51f71a341186649037420c4 100644 (file)
@@ -191,6 +191,7 @@ EXTRA_DIST += \
        ceph-rest-api \
        ceph-crush-location \
        mount.fuse.ceph \
+       rbd-replay-many \
        rbdmap \
        yasm-wrapper
 
@@ -623,7 +624,8 @@ bin_SCRIPTS += \
        ceph-debugpack \
        ceph-rbdnamer \
        ceph-post-file \
-       ceph-crush-location
+       ceph-crush-location \
+       rbd-replay-many
 
 BUILT_SOURCES += init-ceph
 
diff --git a/src/rbd-replay-many b/src/rbd-replay-many
new file mode 100755 (executable)
index 0000000..e89e9ab
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/bash
+
+original_image=
+hosts=
+image_prefix=
+prog=rbd-replay
+delay=0
+
+while test -n "$1"; do
+  case "$1" in
+    --original-image)
+        original_image="$2"
+        shift
+        ;;
+    --original-image=*)
+        original_image="${1#--original-image=}"
+        ;;
+    --image-prefix)
+        image_prefix="$2"
+        shift
+        ;;
+    --image-prefix=*)
+        image_prefix="${1#--image-prefix=}"
+        ;;
+    --exec)
+        prog="$2"
+        shift
+        ;;
+    --exec=*)
+        prog="${1#--exec=}"
+        ;;
+    --delay)
+        delay="$2"
+        shift
+        ;;
+    --delay=*)
+        delay="${1#--delay=}"
+        ;;
+    --help|-h)
+        echo "Usage: $0 [options] --original-image=<name> <host1> [<host2> [...]] -- <rbd-replay-args>"
+        echo "Options:"
+        echo "  --original-image=name  Name (and snap) of the image that was originally traced"
+        echo "  --image-prefix=prefix  Prefix of the image names to replay against"
+        echo "  --exec=program         Path to the rbd-replay executable"
+        echo "  --delay=seconds        Wait <seconds> between starting each replay"
+        exit 0
+        ;;
+    --)
+        # remaining args are passed directly to rbd-replay
+        shift
+        break
+        ;;
+    -*)
+        echo "Unrecognized argument: $1" >&2
+        echo "(If you want to pass an argument directly to rbd-replay, use it after '--'.)" >&2
+        exit 1
+        ;;
+    *)
+        hosts="$hosts $1"
+        ;;
+  esac
+  shift
+done
+
+if test -z "$original_image"; then
+   echo "Specify the original image name with --original-image." >&2
+   exit 1
+fi
+
+if test -z "$hosts"; then
+   echo "No hosts specified." >&2
+   exit 1
+fi
+
+if test -z "$image_prefix"; then
+   image_prefix="$original_image"
+fi
+
+index=0
+for host in $hosts; do
+    echo ssh $host "'$prog'" --map-image "'${original_image}=${image_prefix}-${index}'" "$@"
+    ssh $host "'$prog'" --map-image "'${original_image}=${image_prefix}-${index}'" "$@" &
+    index=$((index + 1))
+    if [ $delay -gt 0 ]; then
+       sleep $delay
+    fi
+done
+wait