qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] error: report hints on stderr when no monitor
@ 2017-01-05 13:59 Marc-André Lureau
  2017-01-05 14:07 ` Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marc-André Lureau @ 2017-01-05 13:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: eblake, armbru, Marc-André Lureau

Report the error hint when running from the command line and reaching an
error, ex:

$ qemu-system-x86_64 -m 1Z
qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 monitor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/monitor.c b/monitor.c
index a82f547488..e5cc11b5a5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
 {
     if (cur_mon && !monitor_cur_is_qmp()) {
         monitor_vprintf(cur_mon, fmt, ap);
+    } else if (!cur_mon) {
+        vfprintf(stderr, fmt, ap);
     }
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] error: report hints on stderr when no monitor
  2017-01-05 13:59 [Qemu-devel] [PATCH] error: report hints on stderr when no monitor Marc-André Lureau
@ 2017-01-05 14:07 ` Paolo Bonzini
  2017-01-05 15:39 ` Eric Blake
  2017-01-09 12:18 ` Markus Armbruster
  2 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2017-01-05 14:07 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: armbru



On 05/01/2017 14:59, Marc-André Lureau wrote:
> Report the error hint when running from the command line and reaching an
> error, ex:
> 
> $ qemu-system-x86_64 -m 1Z
> qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
> You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  monitor.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/monitor.c b/monitor.c
> index a82f547488..e5cc11b5a5 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
>  {
>      if (cur_mon && !monitor_cur_is_qmp()) {
>          monitor_vprintf(cur_mon, fmt, ap);
> +    } else if (!cur_mon) {
> +        vfprintf(stderr, fmt, ap);
>      }
>  }
>  
> 

Good idea!

Paolo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] error: report hints on stderr when no monitor
  2017-01-05 13:59 [Qemu-devel] [PATCH] error: report hints on stderr when no monitor Marc-André Lureau
  2017-01-05 14:07 ` Paolo Bonzini
@ 2017-01-05 15:39 ` Eric Blake
  2017-01-09 12:18 ` Markus Armbruster
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Blake @ 2017-01-05 15:39 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: armbru

[-- Attachment #1: Type: text/plain, Size: 1272 bytes --]

On 01/05/2017 07:59 AM, Marc-André Lureau wrote:
> Report the error hint when running from the command line and reaching an
> error, ex:
> 
> $ qemu-system-x86_64 -m 1Z
> qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
> You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.

[unrelated, but this reminds me: qemu-io allows '1m' and '1M' as
synonyms, but our command line parser is picky and requires the spelling
'1M'.  I wouldn't mind if we unified those two parsers, and make size
parsing case-insensitive everywhere]

> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  monitor.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/monitor.c b/monitor.c
> index a82f547488..e5cc11b5a5 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
>  {
>      if (cur_mon && !monitor_cur_is_qmp()) {
>          monitor_vprintf(cur_mon, fmt, ap);
> +    } else if (!cur_mon) {
> +        vfprintf(stderr, fmt, ap);
>      }
>  }
>  
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] error: report hints on stderr when no monitor
  2017-01-05 13:59 [Qemu-devel] [PATCH] error: report hints on stderr when no monitor Marc-André Lureau
  2017-01-05 14:07 ` Paolo Bonzini
  2017-01-05 15:39 ` Eric Blake
@ 2017-01-09 12:18 ` Markus Armbruster
  2017-01-09 12:32   ` Marc-André Lureau
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2017-01-09 12:18 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Report the error hint when running from the command line and reaching an

Not just any hint, only the ones printed with error_printf_unless_qmp().

> error, ex:
>
> $ qemu-system-x86_64 -m 1Z
> qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
> You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.

The last line is due to this patch.

Suggest to rephrase the commit message:

    error: Report certain hints on stderr when no monitor

    Hints printed with error_printf_unless_qmp() are suppressed outside
    monitor context.  Reproducer:

        $ qemu-system-x86_64 -m 1Z
        qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size

    Print to stderr instead.  The reproducer now additionally prints:

        You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.

>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  monitor.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/monitor.c b/monitor.c
> index a82f547488..e5cc11b5a5 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
>  {
>      if (cur_mon && !monitor_cur_is_qmp()) {
>          monitor_vprintf(cur_mon, fmt, ap);
> +    } else if (!cur_mon) {
> +        vfprintf(stderr, fmt, ap);
>      }
>  }

Preferably with an improved commit message:
Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] error: report hints on stderr when no monitor
  2017-01-09 12:18 ` Markus Armbruster
@ 2017-01-09 12:32   ` Marc-André Lureau
  2017-01-09 13:14     ` Markus Armbruster
  0 siblings, 1 reply; 6+ messages in thread
From: Marc-André Lureau @ 2017-01-09 12:32 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

Hi

On Mon, Jan 9, 2017 at 1:23 PM Markus Armbruster <armbru@redhat.com> wrote:

> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
> > Report the error hint when running from the command line and reaching an
>
> Not just any hint, only the ones printed with error_printf_unless_qmp().
>
> > error, ex:
> >
> > $ qemu-system-x86_64 -m 1Z
> > qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
> > You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes
> and terabytes.
>
> The last line is due to this patch.
>
> Suggest to rephrase the commit message:
>
>     error: Report certain hints on stderr when no monitor
>
>     Hints printed with error_printf_unless_qmp() are suppressed outside
>     monitor context.  Reproducer:
>
>         $ qemu-system-x86_64 -m 1Z
>         qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
>
>     Print to stderr instead.  The reproducer now additionally prints:
>
>         You may use k, M, G or T suffixes for kilobytes, megabytes,
> gigabytes and terabytes.
>
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  monitor.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/monitor.c b/monitor.c
> > index a82f547488..e5cc11b5a5 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt,
> va_list ap)
> >  {
> >      if (cur_mon && !monitor_cur_is_qmp()) {
> >          monitor_vprintf(cur_mon, fmt, ap);
> > +    } else if (!cur_mon) {
> > +        vfprintf(stderr, fmt, ap);
> >      }
> >  }
>
> Preferably with an improved commit message:
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>

Markus, as maintainer of monitor.c, could you take the patch with the
commit message modified?

thanks
-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] error: report hints on stderr when no monitor
  2017-01-09 12:32   ` Marc-André Lureau
@ 2017-01-09 13:14     ` Markus Armbruster
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2017-01-09 13:14 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel

Marc-André Lureau <marcandre.lureau@gmail.com> writes:

> Hi
>
> On Mon, Jan 9, 2017 at 1:23 PM Markus Armbruster <armbru@redhat.com> wrote:
>
>> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>>
>> > Report the error hint when running from the command line and reaching an
>>
>> Not just any hint, only the ones printed with error_printf_unless_qmp().
>>
>> > error, ex:
>> >
>> > $ qemu-system-x86_64 -m 1Z
>> > qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
>> > You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes
>> and terabytes.
>>
>> The last line is due to this patch.
>>
>> Suggest to rephrase the commit message:
>>
>>     error: Report certain hints on stderr when no monitor
>>
>>     Hints printed with error_printf_unless_qmp() are suppressed outside
>>     monitor context.  Reproducer:
>>
>>         $ qemu-system-x86_64 -m 1Z
>>         qemu-system-x86_64: -m 1Z: Parameter 'size' expects a size
>>
>>     Print to stderr instead.  The reproducer now additionally prints:
>>
>>         You may use k, M, G or T suffixes for kilobytes, megabytes,
>> gigabytes and terabytes.
>>
>> >
>> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> > ---
>> >  monitor.c | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/monitor.c b/monitor.c
>> > index a82f547488..e5cc11b5a5 100644
>> > --- a/monitor.c
>> > +++ b/monitor.c
>> > @@ -3973,6 +3973,8 @@ void error_vprintf_unless_qmp(const char *fmt,
>> va_list ap)
>> >  {
>> >      if (cur_mon && !monitor_cur_is_qmp()) {
>> >          monitor_vprintf(cur_mon, fmt, ap);
>> > +    } else if (!cur_mon) {
>> > +        vfprintf(stderr, fmt, ap);
>> >      }
>> >  }
>>
>> Preferably with an improved commit message:
>> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>>
>
> Markus, as maintainer of monitor.c, could you take the patch with the
> commit message modified?

Yes.  It's in my error-next branch now.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-09 13:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-05 13:59 [Qemu-devel] [PATCH] error: report hints on stderr when no monitor Marc-André Lureau
2017-01-05 14:07 ` Paolo Bonzini
2017-01-05 15:39 ` Eric Blake
2017-01-09 12:18 ` Markus Armbruster
2017-01-09 12:32   ` Marc-André Lureau
2017-01-09 13:14     ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).