tests: Run filter-redirector and -mirror test only on POSIX systems
[qemu.git] / migration / channel.c
blob3b7252f5a2ef644e99c99999aea73bafb736f518
1 /*
2 * QEMU live migration channel operations
4 * Copyright Red Hat, Inc. 2016
6 * Authors:
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"
14 #include "channel.h"
15 #include "tls.h"
16 #include "migration.h"
17 #include "qemu-file-channel.h"
18 #include "trace.h"
19 #include "qapi/error.h"
20 #include "io/channel-tls.h"
22 void migration_channel_process_incoming(QIOChannel *ioc)
24 MigrationState *s = migrate_get_current();
26 trace_migration_set_incoming_channel(
27 ioc, object_get_typename(OBJECT(ioc)));
29 if (s->parameters.tls_creds &&
30 *s->parameters.tls_creds &&
31 !object_dynamic_cast(OBJECT(ioc),
32 TYPE_QIO_CHANNEL_TLS)) {
33 Error *local_err = NULL;
34 migration_tls_channel_process_incoming(s, ioc, &local_err);
35 if (local_err) {
36 error_report_err(local_err);
38 } else {
39 QEMUFile *f = qemu_fopen_channel_input(ioc);
40 migration_fd_process_incoming(f);
45 void migration_channel_connect(MigrationState *s,
46 QIOChannel *ioc,
47 const char *hostname)
49 trace_migration_set_outgoing_channel(
50 ioc, object_get_typename(OBJECT(ioc)), hostname);
52 if (s->parameters.tls_creds &&
53 *s->parameters.tls_creds &&
54 !object_dynamic_cast(OBJECT(ioc),
55 TYPE_QIO_CHANNEL_TLS)) {
56 Error *local_err = NULL;
57 migration_tls_channel_connect(s, ioc, hostname, &local_err);
58 if (local_err) {
59 migrate_fd_error(s, local_err);
60 error_free(local_err);
62 } else {
63 QEMUFile *f = qemu_fopen_channel_output(ioc);
65 s->to_dst_file = f;
67 migrate_fd_connect(s);