[sheepdog] [PATCH 09/10] vditest: add option to use a local file for testing
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Mon Oct 22 04:54:12 CEST 2012
This is useful to compare performances between sheepdog vdi and local
file.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
script/vditest | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/script/vditest b/script/vditest
index 81c56ff..001166f 100755
--- a/script/vditest
+++ b/script/vditest
@@ -28,6 +28,7 @@ my $offset = 0;
my $seek_pattern = "linear";
my $seed = time();
my ($sblk, $eblk) = (0, 0);
+my $file = 0;
my $flush_interval = -1;
my $verbose = 0;
my ($read_test, $write_test) = (0,0);
@@ -116,7 +117,11 @@ sub vdi_open {
return if $no_act;
- $cmd = "qemu-io -t $cache sheepdog:$vdiname";
+ if ($file) {
+ $cmd = "qemu-io -t $cache $vdiname";
+ } else {
+ $cmd = "qemu-io -t $cache sheepdog:$vdiname";
+ }
open2 *QEMU_OUT, *QEMU, $cmd or die "cannot run qemu-io\n" if !$no_act;
<QEMU_OUT>;
}
@@ -177,7 +182,7 @@ sub vdi_flush {
sub parse_opts {
my %opts = ();
- getopts("?aB:c:D:f:h:no:p:rs:S:T:vw", \%opts) or help(1);
+ getopts("?aB:c:D:f:Fh:no:p:rs:S:T:vw", \%opts) or help(1);
foreach my $key (keys %opts) {
my $val = $opts{$key};
@@ -212,6 +217,9 @@ sub parse_opts {
case 'f' {
$flush_interval = $val;
}
+ case 'F' {
+ $file = 1;
+ }
case 'h' {
error("\"$val\" is not valid\n") if ($val <= 0);
$hbeat = $val;
@@ -283,7 +291,11 @@ sub parse {
}
error("too many arguments\n") if @ARGV > 0;
- $vdisize = `qemu-io -c length sheepdog:$vdiname`;
+ if ($file) {
+ $vdisize = `qemu-io -c length $vdiname`;
+ } else {
+ $vdisize = `qemu-io -c length sheepdog:$vdiname`;
+ }
to_bytes($vdisize);
error("cannot get vdi size\n") if $vdisize == 0;
@@ -406,6 +418,7 @@ Usage: $program [OPTION] vdiname
-D r%:w% duty cycle used while reading and/or writing.
-f flush_interval specify that a flush should occur at flush_interval
number of IO operations.
+ -F vdiname is not a sheepdog vdi but a local file
-h hbeat displays performance statistic every <hbeat> seconds.
-n print events that would occur but do not access disk.
-o offset set the start offset.
--
1.7.2.5
More information about the sheepdog
mailing list