summaryrefslogtreecommitdiff
path: root/migration-exec.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-02-22 17:36:41 +0100
committerJuan Quintela <quintela@redhat.com>2013-03-11 13:32:02 +0100
commitf8bbc1286337a8506162b5785babe6f2a7de2476 (patch)
tree15b6553d15211d4bc73afcfa1a18a3e4b875cc21 /migration-exec.c
parent3f2d38faab97f4d676c41868a8243997b2aab7cb (diff)
migration: use QEMUFile for migration channel lifetime
As a start, use QEMUFile to store the destination and close it. qemu_get_fd gets a file descriptor that will be used by the write callbacks. Reviewed-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration-exec.c')
-rw-r--r--migration-exec.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/migration-exec.c b/migration-exec.c
index a2b5f8d729..8c3f72050a 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -43,33 +43,16 @@ static int file_write(MigrationState *s, const void * buf, size_t size)
return write(s->fd, buf, size);
}
-static int exec_close(MigrationState *s)
-{
- int ret = 0;
- DPRINTF("exec_close\n");
- ret = qemu_fclose(s->opaque);
- s->opaque = NULL;
- s->fd = -1;
- return ret;
-}
-
void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)
{
- QEMUFile *f;
- f = qemu_popen_cmd(command, "w");
- if (f == NULL) {
+ s->migration_file = qemu_popen_cmd(command, "w");
+ if (s->migration_file == NULL) {
error_setg_errno(errp, errno, "failed to popen the migration target");
return;
}
- s->opaque = f;
- s->fd = qemu_get_fd(f);
- assert(s->fd != -1);
-
- s->close = exec_close;
s->get_error = file_errno;
s->write = file_write;
-
migrate_fd_connect(s);
}