2 * QEMU live migration channel operations
4 * Copyright Red Hat, Inc. 2016
7 * Daniel P. Berrange <berrange@redhat.com>
9 * Contributions after 2012-01-13 are licensed under the terms of the
10 * GNU GPL, version 2 or (at your option) any later version.
13 #include "qemu/osdep.h"
16 #include "migration.h"
17 #include "qemu-file-channel.h"
19 #include "qapi/error.h"
20 #include "io/channel-tls.h"
23 * @migration_channel_process_incoming - Create new incoming migration channel
25 * Notice that TLS is special. For it we listen in a listener socket,
26 * and then create a new client socket from the TLS library.
28 * @ioc: Channel to which we are connecting
30 void migration_channel_process_incoming(QIOChannel
*ioc
)
32 MigrationState
*s
= migrate_get_current();
34 trace_migration_set_incoming_channel(
35 ioc
, object_get_typename(OBJECT(ioc
)));
37 if (s
->parameters
.tls_creds
&&
38 *s
->parameters
.tls_creds
&&
39 !object_dynamic_cast(OBJECT(ioc
),
40 TYPE_QIO_CHANNEL_TLS
)) {
41 Error
*local_err
= NULL
;
42 migration_tls_channel_process_incoming(s
, ioc
, &local_err
);
44 error_report_err(local_err
);
47 migration_ioc_process_incoming(ioc
);
53 * @migration_channel_connect - Create new outgoing migration channel
55 * @s: Current migration state
56 * @ioc: Channel to which we are connecting
57 * @hostname: Where we want to connect
59 void migration_channel_connect(MigrationState
*s
,
63 trace_migration_set_outgoing_channel(
64 ioc
, object_get_typename(OBJECT(ioc
)), hostname
);
66 if (s
->parameters
.tls_creds
&&
67 *s
->parameters
.tls_creds
&&
68 !object_dynamic_cast(OBJECT(ioc
),
69 TYPE_QIO_CHANNEL_TLS
)) {
70 Error
*local_err
= NULL
;
71 migration_tls_channel_connect(s
, ioc
, hostname
, &local_err
);
73 migrate_fd_error(s
, local_err
);
74 error_free(local_err
);
77 QEMUFile
*f
= qemu_fopen_channel_output(ioc
);
81 migrate_fd_connect(s
);