From: Adam Crume Date: Thu, 4 Sep 2014 23:48:35 +0000 (-0700) Subject: rbd-replay: Add rbd-replay-many X-Git-Tag: v0.88~176^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=675a6a6704b589832c291c36b3c0676e4dfc9152;p=ceph.git rbd-replay: Add rbd-replay-many Signed-off-by: Adam Crume --- diff --git a/ceph.spec.in b/ceph.spec.in index 9a11305d801d..411cccc93212 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -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 index 000000000000..f397d45acdd3 --- /dev/null +++ b/doc/man/8/rbd-replay-many.rst @@ -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 `\(8), +:doc:`rbd `\(8) diff --git a/man/Makefile.am b/man/Makefile.am index 4dc71cc208d2..50cd987bc681 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -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 index 000000000000..e07d79a04811 --- /dev/null +++ b/man/rbd-replay-many.8 @@ -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. +. diff --git a/src/Makefile.am b/src/Makefile.am index b954f3f8d051..270829c09c8b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 index 000000000000..e89e9ab90a7c --- /dev/null +++ b/src/rbd-replay-many @@ -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= [ [...]] -- " + 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 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