mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
virsh: Improve error message on integer value parsing failure.
Replace more than 30 ad-hoc error messages with a single, generic one that contains the name of the option being processed and some hints to help the user understand what could have gone wrong. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1207043
This commit is contained in:
parent
8ed0bcfd81
commit
449316701b
@ -34,7 +34,7 @@ fail=0
|
|||||||
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
|
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
|
||||||
test $? = 1 || fail=1
|
test $? = 1 || fail=1
|
||||||
cat <<\EOF > exp || fail=1
|
cat <<\EOF > exp || fail=1
|
||||||
error: vcpupin: Invalid vCPU number.
|
error: Numeric value for <vcpu> option is malformed or out of range
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
compare exp out || fail=1
|
compare exp out || fail=1
|
||||||
@ -52,7 +52,7 @@ compare exp out || fail=1
|
|||||||
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1
|
$abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1
|
||||||
test $? = 1 || fail=1
|
test $? = 1 || fail=1
|
||||||
cat <<\EOF > exp || fail=1
|
cat <<\EOF > exp || fail=1
|
||||||
error: vcpupin: Invalid vCPU number.
|
error: Numeric value for <vcpu> option is malformed or out of range
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
compare exp out || fail=1
|
compare exp out || fail=1
|
||||||
|
@ -341,8 +341,9 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
|
|||||||
* This is not really an unsigned long, but it
|
* This is not really an unsigned long, but it
|
||||||
*/
|
*/
|
||||||
if ((rv = vshCommandOptInt(cmd, "period", &period)) < 0) {
|
if ((rv = vshCommandOptInt(cmd, "period", &period)) < 0) {
|
||||||
vshError(ctl, "%s",
|
vshError(ctl,
|
||||||
_("Unable to parse integer parameter."));
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"period");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (rv > 0) {
|
if (rv > 0) {
|
||||||
@ -1439,8 +1440,9 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
if (rv < 0) {
|
if (rv < 0) {
|
||||||
/* invalid integer format */
|
/* invalid integer format */
|
||||||
vshError(ctl, "%s",
|
vshError(ctl,
|
||||||
_("Unable to parse integer parameter to --time."));
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"time");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rv > 0) {
|
} else if (rv > 0) {
|
||||||
/* valid integer to set */
|
/* valid integer to set */
|
||||||
|
@ -1552,7 +1552,9 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((rv = vshCommandOptInt(cmd, "weight", &weight)) < 0) {
|
if ((rv = vshCommandOptInt(cmd, "weight", &weight)) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse integer parameter"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"weight");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rv > 0) {
|
} else if (rv > 0) {
|
||||||
if (weight <= 0) {
|
if (weight <= 0) {
|
||||||
@ -1691,7 +1693,9 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (vshCommandOptULWrap(cmd, "bandwidth", &bandwidth) < 0) {
|
if (vshCommandOptULWrap(cmd, "bandwidth", &bandwidth) < 0) {
|
||||||
vshError(ctl, "%s", _("bandwidth must be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"bandwidth");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2213,15 +2217,21 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
|
|||||||
* than trying to guess which value will work well across both
|
* than trying to guess which value will work well across both
|
||||||
* APIs with their different sizes and scales. */
|
* APIs with their different sizes and scales. */
|
||||||
if (vshCommandOptULWrap(cmd, "bandwidth", &bandwidth) < 0) {
|
if (vshCommandOptULWrap(cmd, "bandwidth", &bandwidth) < 0) {
|
||||||
vshError(ctl, "%s", _("bandwidth must be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"bandwidth");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (vshCommandOptUInt(cmd, "granularity", &granularity) < 0) {
|
if (vshCommandOptUInt(cmd, "granularity", &granularity) < 0) {
|
||||||
vshError(ctl, "%s", _("granularity must be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"granularity");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (vshCommandOptULongLong(cmd, "buf-size", &buf_size) < 0) {
|
if (vshCommandOptULongLong(cmd, "buf-size", &buf_size) < 0) {
|
||||||
vshError(ctl, "%s", _("buf-size must be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"buf-size");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2791,7 +2801,9 @@ cmdBlockResize(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptScaledInt(cmd, "size", &size, 1024, ULLONG_MAX) < 0) {
|
if (vshCommandOptScaledInt(cmd, "size", &size, 1024, ULLONG_MAX) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse integer"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"size");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3395,7 +3407,9 @@ cmdDomPMSuspend(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptULongLong(cmd, "duration", &duration) < 0) {
|
if (vshCommandOptULongLong(cmd, "duration", &duration) < 0) {
|
||||||
vshError(ctl, _("Invalid duration argument"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"duration");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5317,7 +5331,9 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptUInt(cmd, "screen", &screen) < 0) {
|
if (vshCommandOptUInt(cmd, "screen", &screen) < 0) {
|
||||||
vshError(ctl, "%s", _("invalid screen ID"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"screen");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6414,7 +6430,9 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_EXCLUSIVE_OPTIONS_VAR(live, config);
|
VSH_EXCLUSIVE_OPTIONS_VAR(live, config);
|
||||||
|
|
||||||
if ((got_vcpu = vshCommandOptUInt(cmd, "vcpu", &vcpu)) < 0) {
|
if ((got_vcpu = vshCommandOptUInt(cmd, "vcpu", &vcpu)) < 0) {
|
||||||
vshError(ctl, "%s", _("vcpupin: Invalid vCPU number."));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"vcpu");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6681,7 +6699,9 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "count", &count) < 0 || count <= 0) {
|
if (vshCommandOptInt(cmd, "count", &count) < 0 || count <= 0) {
|
||||||
vshError(ctl, "%s", _("Invalid number of virtual CPUs"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"count");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6859,7 +6879,9 @@ cmdIOThreadPin(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptUInt(cmd, "iothread", &iothread_id) < 0) {
|
if (vshCommandOptUInt(cmd, "iothread", &iothread_id) < 0) {
|
||||||
vshError(ctl, "%s", _("iothreadpin: Invalid IOThread number."));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"iothread");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6948,7 +6970,9 @@ cmdIOThreadAdd(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "id", &iothread_id) < 0) {
|
if (vshCommandOptInt(cmd, "id", &iothread_id) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse integer parameter"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"id");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (iothread_id <= 0) {
|
if (iothread_id <= 0) {
|
||||||
@ -7028,7 +7052,9 @@ cmdIOThreadDel(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "id", &iothread_id) < 0) {
|
if (vshCommandOptInt(cmd, "id", &iothread_id) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse integer parameter"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"id");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (iothread_id <= 0) {
|
if (iothread_id <= 0) {
|
||||||
@ -7315,7 +7341,9 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
show_total = vshCommandOptBool(cmd, "total");
|
show_total = vshCommandOptBool(cmd, "total");
|
||||||
|
|
||||||
if ((rv = vshCommandOptInt(cmd, "start", &cpu)) < 0) {
|
if ((rv = vshCommandOptInt(cmd, "start", &cpu)) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse integer parameter for start"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"start");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rv > 0) {
|
} else if (rv > 0) {
|
||||||
if (cpu < 0) {
|
if (cpu < 0) {
|
||||||
@ -7326,8 +7354,9 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = vshCommandOptInt(cmd, "count", &show_count)) < 0) {
|
if ((rv = vshCommandOptInt(cmd, "count", &show_count)) < 0) {
|
||||||
vshError(ctl, "%s",
|
vshError(ctl,
|
||||||
_("Unable to parse integer parameter for CPUs to show"));
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"count");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rv > 0) {
|
} else if (rv > 0) {
|
||||||
if (show_count < 0) {
|
if (show_count < 0) {
|
||||||
@ -8115,7 +8144,9 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd)
|
|||||||
codeset_option = "linux";
|
codeset_option = "linux";
|
||||||
|
|
||||||
if (vshCommandOptUInt(cmd, "holdtime", &holdtime) < 0) {
|
if (vshCommandOptUInt(cmd, "holdtime", &holdtime) < 0) {
|
||||||
vshError(ctl, _("invalid value of --holdtime"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"holdtime");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8342,7 +8373,9 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
|
|||||||
else
|
else
|
||||||
max = ULONG_MAX;
|
max = ULONG_MAX;
|
||||||
if (vshCommandOptScaledInt(cmd, "size", &bytes, 1024, max) < 0) {
|
if (vshCommandOptScaledInt(cmd, "size", &bytes, 1024, max) < 0) {
|
||||||
vshError(ctl, "%s", _("memory size has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"size");
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -8437,7 +8470,9 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
|
|||||||
else
|
else
|
||||||
max = ULONG_MAX;
|
max = ULONG_MAX;
|
||||||
if (vshCommandOptScaledInt(cmd, "size", &bytes, 1024, max) < 0) {
|
if (vshCommandOptScaledInt(cmd, "size", &bytes, 1024, max) < 0) {
|
||||||
vshError(ctl, "%s", _("memory size has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"size");
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -9071,7 +9106,9 @@ cmdQemuAttach(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int pid_value; /* API uses unsigned int, not pid_t */
|
unsigned int pid_value; /* API uses unsigned int, not pid_t */
|
||||||
|
|
||||||
if (vshCommandOptUInt(cmd, "pid", &pid_value) <= 0) {
|
if (vshCommandOptUInt(cmd, "pid", &pid_value) <= 0) {
|
||||||
vshError(ctl, "%s", _("missing pid value"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"pid");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9166,7 +9203,9 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
judge = vshCommandOptInt(cmd, "timeout", &timeout);
|
judge = vshCommandOptInt(cmd, "timeout", &timeout);
|
||||||
if (judge < 0) {
|
if (judge < 0) {
|
||||||
vshError(ctl, "%s", _("timeout number has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"timeout");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (judge > 0) {
|
} else if (judge > 0) {
|
||||||
judge = 1;
|
judge = 1;
|
||||||
@ -10048,8 +10087,13 @@ cmdMigrateSetMaxDowntime(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptLongLong(cmd, "downtime", &downtime) < 0 ||
|
if (vshCommandOptLongLong(cmd, "downtime", &downtime) < 0) {
|
||||||
downtime < 1) {
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"downtime");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (downtime < 1) {
|
||||||
vshError(ctl, "%s", _("migrate: Invalid downtime"));
|
vshError(ctl, "%s", _("migrate: Invalid downtime"));
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -10107,7 +10151,9 @@ cmdMigrateCompCache(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
rc = vshCommandOptULongLong(cmd, "size", &size);
|
rc = vshCommandOptULongLong(cmd, "size", &size);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse size parameter"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"size");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rc != 0) {
|
} else if (rc != 0) {
|
||||||
if (virDomainMigrateSetCompressionCache(dom, size, 0) < 0)
|
if (virDomainMigrateSetCompressionCache(dom, size, 0) < 0)
|
||||||
@ -10165,7 +10211,9 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptULWrap(cmd, "bandwidth", &bandwidth) < 0) {
|
if (vshCommandOptULWrap(cmd, "bandwidth", &bandwidth) < 0) {
|
||||||
vshError(ctl, "%s", _("migrate: Invalid bandwidth"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"bandwidth");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12503,7 +12551,9 @@ cmdDomFSTrim(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (vshCommandOptULongLong(cmd, "minimum", &minimum) < 0) {
|
if (vshCommandOptULongLong(cmd, "minimum", &minimum) < 0) {
|
||||||
vshError(ctl, _("Unable to parse integer parameter minimum"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"minimum");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,9 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
|
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
|
||||||
|
|
||||||
if (cellno && vshCommandOptInt(cmd, "cellno", &cell) < 0) {
|
if (cellno && vshCommandOptInt(cmd, "cellno", &cell) < 0) {
|
||||||
vshError(ctl, "%s", _("cell number has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"cellno");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +312,9 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
|
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
|
||||||
|
|
||||||
if (vshCommandOptScaledInt(cmd, "pagesize", &bytes, 1024, UINT_MAX) < 0) {
|
if (vshCommandOptScaledInt(cmd, "pagesize", &bytes, 1024, UINT_MAX) < 0) {
|
||||||
vshError(ctl, "%s", _("page size has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"pagesize");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
kibibytes = VIR_DIV_UP(bytes, 1024);
|
kibibytes = VIR_DIV_UP(bytes, 1024);
|
||||||
@ -388,7 +392,9 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "cellno", &cell) < 0) {
|
if (vshCommandOptInt(cmd, "cellno", &cell) < 0) {
|
||||||
vshError(ctl, "%s", _("Invalid cellno argument"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"cellno");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,12 +491,16 @@ cmdAllocpages(vshControl *ctl, const vshCmd *cmd)
|
|||||||
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
|
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
|
||||||
|
|
||||||
if (cellno && vshCommandOptInt(cmd, "cellno", &startCell) < 0) {
|
if (cellno && vshCommandOptInt(cmd, "cellno", &startCell) < 0) {
|
||||||
vshError(ctl, "%s", _("cell number has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"cellno");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptScaledInt(cmd, "pagesize", &tmp, 1024, UINT_MAX) < 0) {
|
if (vshCommandOptScaledInt(cmd, "pagesize", &tmp, 1024, UINT_MAX) < 0) {
|
||||||
vshError(ctl, "%s", _("pagesize has to be a number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"cellno");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pageSizes[0] = VIR_DIV_UP(tmp, 1024);
|
pageSizes[0] = VIR_DIV_UP(tmp, 1024);
|
||||||
@ -755,7 +765,9 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool present[VSH_CPU_LAST] = { false };
|
bool present[VSH_CPU_LAST] = { false };
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "cpu", &cpuNum) < 0) {
|
if (vshCommandOptInt(cmd, "cpu", &cpuNum) < 0) {
|
||||||
vshError(ctl, "%s", _("Invalid value of cpuNum"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"cpu");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,7 +876,9 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "cell", &cellNum) < 0) {
|
if (vshCommandOptInt(cmd, "cell", &cellNum) < 0) {
|
||||||
vshError(ctl, "%s", _("Invalid value of cellNum"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"cell");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,7 +952,9 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) {
|
if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) {
|
||||||
vshError(ctl, _("Invalid duration argument"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"duration");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,7 +1261,9 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if ((rc = vshCommandOptUInt(cmd, "shm-pages-to-scan", &value)) < 0) {
|
if ((rc = vshCommandOptUInt(cmd, "shm-pages-to-scan", &value)) < 0) {
|
||||||
vshError(ctl, "%s", _("invalid shm-pages-to-scan number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"shm-pages-to-scan");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rc > 0) {
|
} else if (rc > 0) {
|
||||||
if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
|
if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
|
||||||
@ -1255,7 +1273,9 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = vshCommandOptUInt(cmd, "shm-sleep-millisecs", &value)) < 0) {
|
if ((rc = vshCommandOptUInt(cmd, "shm-sleep-millisecs", &value)) < 0) {
|
||||||
vshError(ctl, "%s", _("invalid shm-sleep-millisecs number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"shm-sleep-millisecs");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rc > 0) {
|
} else if (rc > 0) {
|
||||||
if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
|
if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
|
||||||
@ -1265,7 +1285,9 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = vshCommandOptUInt(cmd, "shm-merge-across-nodes", &value)) < 0) {
|
if ((rc = vshCommandOptUInt(cmd, "shm-merge-across-nodes", &value)) < 0) {
|
||||||
vshError(ctl, "%s", _("invalid shm-merge-across-nodes number"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"shm-merge-across-nodes");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (rc > 0) {
|
} else if (rc > 0) {
|
||||||
if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
|
if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams,
|
||||||
|
@ -844,7 +844,9 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
|
|||||||
stp = !vshCommandOptBool(cmd, "no-stp");
|
stp = !vshCommandOptBool(cmd, "no-stp");
|
||||||
|
|
||||||
if (vshCommandOptUInt(cmd, "delay", &delay) < 0) {
|
if (vshCommandOptUInt(cmd, "delay", &delay) < 0) {
|
||||||
vshError(ctl, "%s", _("Unable to parse delay parameter"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"delay");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,7 +937,9 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptInt(cmd, "parent-index", &parentIndex) < 0) {
|
if (vshCommandOptInt(cmd, "parent-index", &parentIndex) < 0) {
|
||||||
vshError(ctl, "%s", _("malformed parent-index argument"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"parent-index");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,12 +694,16 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned long long offset = 0, length = 0;
|
unsigned long long offset = 0, length = 0;
|
||||||
|
|
||||||
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
|
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
|
||||||
vshError(ctl, _("Unable to parse offset value"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"offset");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
|
if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
|
||||||
vshError(ctl, _("Unable to parse length value"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"length");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -803,12 +807,16 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd)
|
|||||||
bool created = false;
|
bool created = false;
|
||||||
|
|
||||||
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
|
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
|
||||||
vshError(ctl, _("Unable to parse offset value"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"offset");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
|
if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
|
||||||
vshError(ctl, _("Unable to parse length value"));
|
vshError(ctl,
|
||||||
|
_("Numeric value for <%s> option is malformed or out of range"),
|
||||||
|
"length");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user