2 * QEMU live migration via generic fd
4 * Copyright Red Hat, Inc. 2009-2016
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
13 * Contributions after 2012-01-13 are licensed under the terms of the
14 * GNU GPL, version 2 or (at your option) any later version.
17 #include "qemu/osdep.h"
20 #include "monitor/monitor.h"
21 #include "io/channel-util.h"
25 void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
28 int fd = monitor_get_fd(cur_mon, fdname, errp);
33 trace_migration_fd_outgoing(fd);
34 ioc = qio_channel_new_fd(fd, errp);
40 qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-outgoing");
41 migration_channel_connect(s, ioc, NULL, NULL);
42 object_unref(OBJECT(ioc));
45 static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
46 GIOCondition condition,
49 migration_channel_process_incoming(ioc);
50 object_unref(OBJECT(ioc));
51 return G_SOURCE_REMOVE;
54 void fd_start_incoming_migration(const char *infd, Error **errp)
59 fd = strtol(infd, NULL, 0);
60 trace_migration_fd_incoming(fd);
62 ioc = qio_channel_new_fd(fd, errp);
68 qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-incoming");
69 qio_channel_add_watch(ioc,
71 fd_accept_incoming_migration,