]>
Commit | Line | Data |
---|---|---|
dd4339c5 JQ |
1 | /* |
2 | * QEMU live migration channel operations | |
3 | * | |
4 | * Copyright Red Hat, Inc. 2016 | |
5 | * | |
6 | * Authors: | |
7 | * Daniel P. Berrange <[email protected]> | |
8 | * | |
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. | |
11 | */ | |
12 | ||
13 | #include "qemu/osdep.h" | |
14 | #include "channel.h" | |
41d64227 | 15 | #include "tls.h" |
6666c96a | 16 | #include "migration.h" |
40014d81 | 17 | #include "qemu-file-channel.h" |
dd4339c5 JQ |
18 | #include "trace.h" |
19 | #include "qapi/error.h" | |
20 | #include "io/channel-tls.h" | |
21 | ||
54314711 | 22 | void migration_channel_process_incoming(QIOChannel *ioc) |
dd4339c5 | 23 | { |
54314711 JQ |
24 | MigrationState *s = migrate_get_current(); |
25 | ||
dd4339c5 JQ |
26 | trace_migration_set_incoming_channel( |
27 | ioc, object_get_typename(OBJECT(ioc))); | |
28 | ||
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); | |
37 | } | |
38 | } else { | |
4f0fae7f | 39 | migration_ioc_process_incoming(ioc); |
dd4339c5 JQ |
40 | } |
41 | } | |
42 | ||
43 | ||
44 | void migration_channel_connect(MigrationState *s, | |
45 | QIOChannel *ioc, | |
46 | const char *hostname) | |
47 | { | |
48 | trace_migration_set_outgoing_channel( | |
49 | ioc, object_get_typename(OBJECT(ioc)), hostname); | |
50 | ||
51 | if (s->parameters.tls_creds && | |
52 | *s->parameters.tls_creds && | |
53 | !object_dynamic_cast(OBJECT(ioc), | |
54 | TYPE_QIO_CHANNEL_TLS)) { | |
55 | Error *local_err = NULL; | |
56 | migration_tls_channel_connect(s, ioc, hostname, &local_err); | |
57 | if (local_err) { | |
58 | migrate_fd_error(s, local_err); | |
59 | error_free(local_err); | |
60 | } | |
61 | } else { | |
62 | QEMUFile *f = qemu_fopen_channel_output(ioc); | |
63 | ||
64 | s->to_dst_file = f; | |
65 | ||
66 | migrate_fd_connect(s); | |
67 | } | |
68 | } |