diff mbox series

[v4,4/9] hmp: disable monitor in preconfig state

Message ID 1520860275-101576-5-git-send-email-imammedo@redhat.com
State New
Headers show
Series enable numa configuration before machine_init() from QMP | expand

Commit Message

Igor Mammedov March 12, 2018, 1:11 p.m. UTC
Ban it for now, if someone would need it to work early,
one would have to implement checks if HMP command is valid
at preconfig state.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
v4:
  * v3 was only printing error but not preventing command execution,
    Fix it by returning after printing error message.
    ("Dr. David Alan Gilbert" <dgilbert@redhat.com>)
---
 monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Eduardo Habkost March 23, 2018, 9:27 p.m. UTC | #1
On Mon, Mar 12, 2018 at 02:11:10PM +0100, Igor Mammedov wrote:
> Ban it for now, if someone would need it to work early,
> one would have to implement checks if HMP command is valid
> at preconfig state.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v4:
>   * v3 was only printing error but not preventing command execution,
>     Fix it by returning after printing error message.
>     ("Dr. David Alan Gilbert" <dgilbert@redhat.com>)
> ---
>  monitor.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/monitor.c b/monitor.c
> index a4417f2..ea0ca57 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3104,6 +3104,11 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
>  
>      trace_handle_hmp_command(mon, cmdline);
>  
> +    if (runstate_check(RUN_STATE_PRECONFIG)) {
> +        monitor_printf(mon, "HMP not available in preconfig state\n");
> +        return;

Not even the "cont" command?  It would be useful for testing
-preconfig.
Igor Mammedov March 28, 2018, 11:16 a.m. UTC | #2
On Fri, 23 Mar 2018 18:27:32 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Mon, Mar 12, 2018 at 02:11:10PM +0100, Igor Mammedov wrote:
> > Ban it for now, if someone would need it to work early,
> > one would have to implement checks if HMP command is valid
> > at preconfig state.
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > v4:
> >   * v3 was only printing error but not preventing command execution,
> >     Fix it by returning after printing error message.
> >     ("Dr. David Alan Gilbert" <dgilbert@redhat.com>)
> > ---
> >  monitor.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/monitor.c b/monitor.c
> > index a4417f2..ea0ca57 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -3104,6 +3104,11 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
> >  
> >      trace_handle_hmp_command(mon, cmdline);
> >  
> > +    if (runstate_check(RUN_STATE_PRECONFIG)) {
> > +        monitor_printf(mon, "HMP not available in preconfig state\n");
> > +        return;  
> 
> Not even the "cont" command?  It would be useful for testing
> -preconfig.
As someone already said on the list it's very easy to test with
QMP nowdays, just use qmp-shell for that.
So if someone isn't willing to learn to use QMP, one can write
HMP part with proper white-listing.

I can extend error message like this:

"HMP not available in preconfig state, use QMP instead\n"
Eduardo Habkost March 28, 2018, 6:55 p.m. UTC | #3
On Wed, Mar 28, 2018 at 01:16:53PM +0200, Igor Mammedov wrote:
> On Fri, 23 Mar 2018 18:27:32 -0300
> Eduardo Habkost <ehabkost@redhat.com> wrote:
> 
> > On Mon, Mar 12, 2018 at 02:11:10PM +0100, Igor Mammedov wrote:
> > > Ban it for now, if someone would need it to work early,
> > > one would have to implement checks if HMP command is valid
> > > at preconfig state.
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---
> > > v4:
> > >   * v3 was only printing error but not preventing command execution,
> > >     Fix it by returning after printing error message.
> > >     ("Dr. David Alan Gilbert" <dgilbert@redhat.com>)
> > > ---
> > >  monitor.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/monitor.c b/monitor.c
> > > index a4417f2..ea0ca57 100644
> > > --- a/monitor.c
> > > +++ b/monitor.c
> > > @@ -3104,6 +3104,11 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
> > >  
> > >      trace_handle_hmp_command(mon, cmdline);
> > >  
> > > +    if (runstate_check(RUN_STATE_PRECONFIG)) {
> > > +        monitor_printf(mon, "HMP not available in preconfig state\n");
> > > +        return;  
> > 
> > Not even the "cont" command?  It would be useful for testing
> > -preconfig.
> As someone already said on the list it's very easy to test with
> QMP nowdays, just use qmp-shell for that.
> So if someone isn't willing to learn to use QMP, one can write
> HMP part with proper white-listing.
> 
> I can extend error message like this:
> 
> "HMP not available in preconfig state, use QMP instead\n"

Sounds good enough to me.
diff mbox series

Patch

diff --git a/monitor.c b/monitor.c
index a4417f2..ea0ca57 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3104,6 +3104,11 @@  static void handle_hmp_command(Monitor *mon, const char *cmdline)
 
     trace_handle_hmp_command(mon, cmdline);
 
+    if (runstate_check(RUN_STATE_PRECONFIG)) {
+        monitor_printf(mon, "HMP not available in preconfig state\n");
+        return;
+    }
+
     cmd = monitor_parse_command(mon, cmdline, &cmdline, mon->cmd_table);
     if (!cmd) {
         return;