qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 04/22] savevm: do_loadvm(): Always resume the VM


From: Luiz Capitulino
Subject: [Qemu-devel] Re: [PATCH 04/22] savevm: do_loadvm(): Always resume the VM
Date: Tue, 20 Apr 2010 18:59:59 -0300

On Tue, 20 Apr 2010 23:28:23 +0200
Juan Quintela <address@hidden> wrote:

> Luiz Capitulino <address@hidden> wrote:
> > do_loadvm(), which implements the 'loadvm' Monitor command, pauses
> > the emulation to load the saved VM, however it will only resume
> > it if the loading succeeds.
> >
> > In other words, if the user issues 'loadvm' and it fails, the
> > end result will be an error message and a paused VM.
> >
> > This seems an undesirable side effect to me because, most of the
> > time, if a Monitor command fails the best thing we can do is to
> > leave the VM as it were before the command was executed.
> >
> > FIXME: This will try to run a potentially corrupted image, the
> >        solution is to split load_vmstate() in two and only keep
> >        the VM paused if qemu_loadvm_state() fails.
> 
> Any of the other errors in loadvm also requires you to not load the
> state.

 Really? Everything that happens before qemu_fopen_bdrv() seems to be
only looking for the snapshot..

>
> > Signed-off-by: Luiz Capitulino <address@hidden>
> 
> Nack.
> 
> This can cause disk corruption.  You tried to load a vm image, failed
> the load somehow (notice the somehow) and you try to run it anyways.
> That is a recipe for disaster.  If load_vmstate() fails -> you don't run.

 My understanding is that the loading only happens in qemu_loadvm_state(),
is this wrong?

 If it isn't, my plan is to split load_vmstate() in two functions:

- load_vmstate_prepare(): everything before qemu_fopen_bdrv()
- load_vmstate_finish(): qemu_loadvm_state() block

 then, do_loadvm() would do:

err = load_vmstate_prepare();
if (err && vm_running) {
   vm_start();
   return -1;
}

err = load_vmstate_finish();
if (err) {
  return -1;
}

vm_start();
return 0;

 And load_vmstate() would just call prepare() and finish(), maintaining
its current behavior.

 It's important to understand why this is needed: currently you have a
'return 0' in line savevm.c:1872. It's an error path, but I'm almost sure
that this trick is needed because if you return -1 there and loadvm fails
for stupid reasons (like a not found snapshot) you get a paused VM.




reply via email to

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