[libvirt] [PATCH 1/6] vsh: Tweak error message for scaled integers

Peter Krempa pkrempa at redhat.com
Fri Mar 18 08:57:00 UTC 2016


It was too similar to the non-scaled alternative.

before:
error: Numeric value 'abc' for <size> option is malformed or out of range
after:
error: Scaled numeric value 'abc' for <size> option is malformed or out of range
---
 tests/virsh-optparse | 6 +++---
 tools/vsh.c          | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/virsh-optparse b/tests/virsh-optparse
index e032094..0fc261d 100755
--- a/tests/virsh-optparse
+++ b/tests/virsh-optparse
@@ -205,7 +205,7 @@ compare exp-err err || fail=1

 # Non-numeric value
 cat <<\EOF > exp-err || framework_failure
-error: Numeric value 'abc' for <size> option is malformed or out of range
+error: Scaled numeric value 'abc' for <size> option is malformed or out of range
 EOF
 virsh -q -c $test_url setmaxmem test abc >out 2>err && fail=1
 test -s out && fail=1
@@ -213,7 +213,7 @@ compare exp-err err || fail=1

 # Numeric value with invalid suffix
 cat <<\EOF > exp-err || framework_failure
-error: Numeric value '42WB' for <size> option is malformed or out of range
+error: Scaled numeric value '42WB' for <size> option is malformed or out of range
 EOF
 virsh -q -c $test_url setmaxmem test 42WB >out 2>err && fail=1
 test -s out && fail=1
@@ -232,7 +232,7 @@ test -s err && fail=1

 # Negative numeric value
 cat <<\EOF > exp-err || framework_failure
-error: Numeric value '-1' for <size> option is malformed or out of range
+error: Scaled numeric value '-1' for <size> option is malformed or out of range
 EOF
 virsh -q -c $test_url setmaxmem test -1 >out 2>err && fail=1
 test -s out && fail=1
diff --git a/tools/vsh.c b/tools/vsh.c
index 4ce1727..047a0cc 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -1147,8 +1147,8 @@ vshCommandOptScaledInt(vshControl *ctl, const vshCmd *cmd,
         virScaleInteger(value, end, scale, max) < 0)
     {
         vshError(ctl,
-                 _("Numeric value '%s' for <%s> option is malformed or out of range"),
-                 arg->data, name);
+                 _("Scaled numeric value '%s' for <%s> option is malformed or "
+                   "out of range"), arg->data, name);
         ret = -1;
     } else {
         ret = 1;
-- 
2.7.3




More information about the libvir-list mailing list