qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hmp: Fix loadvm to resume the VM on success instead of failu


From: Kevin Wolf
Subject: Re: [PATCH] hmp: Fix loadvm to resume the VM on success instead of failure
Date: Tue, 11 May 2021 18:58:01 +0200

Am 11.05.2021 um 18:49 hat Daniel P. Berrangé geschrieben:
> On Tue, May 11, 2021 at 06:31:51PM +0200, Kevin Wolf wrote:
> > Commit f61fe11aa6f broke hmp_loadvm() by adding an incorrect negation
> > when converting from 0/-errno return values to a bool value. The result
> > is that loadvm resumes the VM now if it failed and keeps it stopped if
> > it failed. Fix it to restore the old behaviour and do it the other way
> > around.
> > 
> > Fixes: f61fe11aa6f7f8f0ffe4ddaa56a8108f3ab57854
> > Cc: qemu-stable@nongnu.org
> > Reported-by: Yanhui Ma <yama@redhat.com>
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  monitor/hmp-cmds.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> > index 0ad5b77477..cc15d9b6ee 100644
> > --- a/monitor/hmp-cmds.c
> > +++ b/monitor/hmp-cmds.c
> > @@ -1133,7 +1133,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)
> >  
> >      vm_stop(RUN_STATE_RESTORE_VM);
> >  
> > -    if (!load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) 
> > {
> > +    if (load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) {
> >          vm_start();
> >      }
> >      hmp_handle_error(mon, err);
> 
> Paolo had sent a different fix here:
> 
>   https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg01093.html

Hm... I missed that patch, but doesn't it just generalise the buggy HMP
code instead of fixing it? That is, we still resume the VM on failure
rather than on success?

> As with my feedback there, I think we should be adding test coverage
> when fixing this. How about this:
> [...]

Yes, this looks good.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]