Patchwork [05/22] savevm: load_vmstate(): Return 'ret' on error

login
register
mail settings
Submitter Luiz Capitulino
Date April 20, 2010, 9:09 p.m.
Message ID <1271797792-24571-6-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/50578/
State New
Headers show

Comments

Luiz Capitulino - April 20, 2010, 9:09 p.m.
When looping to restore the snapshot on all drives, load_vmstate()
will return 0 if bdrv_snapshot_goto() returns an error.

This seems a trick to avoid the call to vm_start() in do_loadvm(),
however it brings two problems:

1. The call to load_vmstate() from main() will succeed

2. In QMP, it's just not allowed to fail and return 0

This commit fixes that.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 savevm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/savevm.c b/savevm.c
index cc6cbb2..5024829 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1793,7 +1793,7 @@  int load_vmstate(const char *name)
                 }
                 /* fatal on snapshot block device */
                 if (bs == bs1)
-                    return 0;
+                    return ret;
             }
         }
     }