[sheepdog] [PATCH] vditest: fix vdisize handling

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Feb 7 13:14:50 CET 2013


This fixes a bug introduced by commit 0b37b3.  'qemu-io -c length'
returns size with "iB" (e.g. KiB, MiB, GiB).  This handles it
correctly.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 script/vditest |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/script/vditest b/script/vditest
index f1d950d..5ce048b 100755
--- a/script/vditest
+++ b/script/vditest
@@ -59,9 +59,9 @@ sub to_bytes {
     my ($size) = @_;
 
     given ($size) {
-	when (/k$/i) { $size *= 1024; }
-	when (/m$/i) { $size *= 1024 ** 2; }
-	when (/g$/i) { $size *= 1024 ** 3; }
+	when (/k(i?b)?$/i) { $size *= 1024; }
+	when (/m(i?b)?$/i) { $size *= 1024 ** 2; }
+	when (/g(i?b)?$/i) { $size *= 1024 ** 3; }
     }
 
     $_[0] = $size;
-- 
1.7.2.5




More information about the sheepdog mailing list