Patchwork [26/28] migration: qemu_savevm_iterate has three return values

login
register
mail settings
Submitter Juan Quintela
Date Feb. 23, 2011, 9:47 p.m.
Message ID <6c4ad6e1bb087e22aa0f72acfc9989a2c4e37a10.1298492768.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/84276/
State New
Headers show

Comments

Juan Quintela - Feb. 23, 2011, 9:47 p.m.
We were retrying when there was one error, entering a loop.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch

diff --git a/migration.c b/migration.c
index a02100b..6082c32 100644
--- a/migration.c
+++ b/migration.c
@@ -269,6 +269,7 @@  static ssize_t migrate_fd_put_buffer(void *opaque, const void *data,
 static void migrate_fd_put_ready(void *opaque)
 {
     MigrationState *s = opaque;
+    int ret;

     if (s->state != MIG_STATE_ACTIVE) {
         DPRINTF("put_ready returning because of non-active state\n");
@@ -276,7 +277,10 @@  static void migrate_fd_put_ready(void *opaque)
     }

     DPRINTF("iterate\n");
-    if (qemu_savevm_state_iterate(s->mon, s->file) == 1) {
+    ret = qemu_savevm_state_iterate(s->mon, s->file);
+    if (ret == -1) {
+        migrate_fd_error(s);
+    } else if (ret == 1) {
         int old_vm_running = vm_running;

         DPRINTF("done iterating\n");