aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2010-06-02 14:55:25 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-03 14:55:45 -0500
commit41ef56e61153d7bd27d34a634633bb51b1c5988d (patch)
treeeea50adb3c58ec6784b0c0ee1385324f0f6a6c1f /migration.c
parent4309a79bffce10d6d8de82c5ee403ffa4f45db64 (diff)
migration: respect exit status with exec:
This patch makes sure that if the exec: process exits with a non-zero return status, we treat the migration as failed. This fixes https://bugs.launchpad.net/qemu/+bug/391879 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/migration.c b/migration.c
index 706fe55767..fbf23399e5 100644
--- a/migration.c
+++ b/migration.c
@@ -252,13 +252,17 @@ void migrate_fd_error(FdMigrationState *s)
migrate_fd_cleanup(s);
}
-void migrate_fd_cleanup(FdMigrationState *s)
+int migrate_fd_cleanup(FdMigrationState *s)
{
+ int ret = 0;
+
qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
if (s->file) {
DPRINTF("closing file\n");
- qemu_fclose(s->file);
+ if (qemu_fclose(s->file) != 0) {
+ ret = -1;
+ }
s->file = NULL;
}
@@ -271,6 +275,8 @@ void migrate_fd_cleanup(FdMigrationState *s)
}
s->fd = -1;
+
+ return ret;
}
void migrate_fd_put_notify(void *opaque)
@@ -349,7 +355,12 @@ void migrate_fd_put_ready(void *opaque)
} else {
state = MIG_STATE_COMPLETED;
}
- migrate_fd_cleanup(s);
+ if (migrate_fd_cleanup(s) < 0) {
+ if (old_vm_running) {
+ vm_start();
+ }
+ state = MIG_STATE_ERROR;
+ }
s->state = state;
}
}