1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-10-16 23:33:52 +03:00

virsh: Pass vshControl to all vshCommandOpt*() calls

This will allow us to use vshError() to report errors from inside
vshCommandOpt*(), instead of replicating the same logic and error
messages all over the place.

We also have more context inside the vshCommandOpt*() functions,
for example the actual value used on the command line, which means
we can produce more detailed error messages.

vshCommandOptBool() is the exception here, because it's explicitly
designed not to report any error.
This commit is contained in:
Andrea Bolognani
2015-06-02 11:17:28 +02:00
committed by John Ferlan
parent 5eaca29fbb
commit be6ff4da95
10 changed files with 175 additions and 153 deletions

View File

@@ -843,7 +843,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
/* use "no-stp" because we want "stp" to default true */
stp = !vshCommandOptBool(cmd, "no-stp");
if (vshCommandOptUInt(cmd, "delay", &delay) < 0) {
if (vshCommandOptUInt(ctl, cmd, "delay", &delay) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"delay");