[libvirt] [PATCH] virsh: Fix *-event error string

When using virsh net-event non-existing-net the error message says that 'either --list or event type is required' This is misleading as 'virsh net-event $valid-event-type' is not going to work either. What is expected is 'virsh net-event --event $valid-event-type' This commit fixes the string in pool-event, nodedev-event, event, and net-event. --- tools/virsh-domain.c | 2 +- tools/virsh-network.c | 2 +- tools/virsh-nodedev.c | 2 +- tools/virsh-pool.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a614512..702a8bd8 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12694,7 +12694,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd) } } else if (!all) { vshError(ctl, "%s", - _("one of --list, --all, or event type is required")); + _("one of --list, --all, or --event type is required")); return false; } diff --git a/tools/virsh-network.c b/tools/virsh-network.c index eec7faf..c6bd132 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1238,7 +1238,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) return false; if (!eventName) { - vshError(ctl, "%s", _("either --list or event type is required")); + vshError(ctl, "%s", _("either --list or --event type is required")); return false; } if ((event = virshNetworkEventIdTypeFromString(eventName)) < 0) { diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 805c0ff..0e695b9 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -903,7 +903,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) return false; if (!eventName) { - vshError(ctl, "%s", _("either --list or event type is required")); + vshError(ctl, "%s", _("either --list or --event type is required")); return false; } diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index d25851e..70b2bdd 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -2057,7 +2057,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) return false; if (!eventName) { - vshError(ctl, "%s", _("either --list or event type is required")); + vshError(ctl, "%s", _("either --list or --event type is required")); return false; } -- 2.7.4

On 06/09/16 13:17, Christophe Fergeau wrote:
When using virsh net-event non-existing-net the error message says that 'either --list or event type is required' This is misleading as 'virsh net-event $valid-event-type' is not going to work either. What is expected is 'virsh net-event --event $valid-event-type'
This commit fixes the string in pool-event, nodedev-event, event, and net-event. --- tools/virsh-domain.c | 2 +- tools/virsh-network.c | 2 +- tools/virsh-nodedev.c | 2 +- tools/virsh-pool.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index a614512..702a8bd8 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -12694,7 +12694,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd) } } else if (!all) { vshError(ctl, "%s", - _("one of --list, --all, or event type is required")); + _("one of --list, --all, or --event type is required")); return false; }
diff --git a/tools/virsh-network.c b/tools/virsh-network.c index eec7faf..c6bd132 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1238,7 +1238,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) return false; if (!eventName) { - vshError(ctl, "%s", _("either --list or event type is required")); + vshError(ctl, "%s", _("either --list or --event type is required")); return false; } if ((event = virshNetworkEventIdTypeFromString(eventName)) < 0) { diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 805c0ff..0e695b9 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -903,7 +903,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) return false; if (!eventName) { - vshError(ctl, "%s", _("either --list or event type is required")); + vshError(ctl, "%s", _("either --list or --event type is required")); return false; }
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index d25851e..70b2bdd 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -2057,7 +2057,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "event", &eventName) < 0) return false; if (!eventName) { - vshError(ctl, "%s", _("either --list or event type is required")); + vshError(ctl, "%s", _("either --list or --event type is required")); return false; }
ACK, although, I have a really small nitpick the decision on fixing of which I leave to you. After the fix, "--list or --event type...", at least to me, sounds like "--event" was the mentioned type itself which is of course wrong. Maybe it could be better (just an idea) to use angle brackets like this '<type>' to make the message more clear, but as I said, your call. Regards, Erik

On Tue, Sep 06, 2016 at 03:07:37PM +0200, Erik Skultety wrote:
ACK, although, I have a really small nitpick the decision on fixing of which I leave to you. After the fix, "--list or --event type...", at least to me, sounds like "--event" was the mentioned type itself which is of course wrong. Maybe it could be better (just an idea) to use angle brackets like this '<type>' to make the message more clear, but as I said, your call.
I considered doing it, but did not for no particular reason. I'll change it before pushing. Thanks, Christophe
participants (2)
-
Christophe Fergeau
-
Erik Skultety