@@ -17,6 +17,9 @@ void cpr_save_fd(const char *name, int id, int fd);
void cpr_delete_fd(const char *name, int id);
int cpr_find_fd(const char *name, int id);
+void cpr_set_cpr_channel(MigrationChannel *channel);
+MigrationChannel *cpr_get_cpr_channel(void);
+
int cpr_state_save(MigrationChannel *channel, Error **errp);
int cpr_state_load(Error **errp);
void cpr_state_close(void);
@@ -116,6 +116,21 @@ QIOChannel *cpr_state_ioc(void)
return qemu_file_get_ioc(cpr_state_file);
}
+static MigrationChannel *cpr_channel;
+
+void cpr_set_cpr_channel(MigrationChannel *channel)
+{
+ if (cpr_channel) {
+ qapi_free_MigrationChannel(cpr_channel);
+ }
+ cpr_channel = channel;
+}
+
+MigrationChannel *cpr_get_cpr_channel(void)
+{
+ return cpr_channel;
+}
+
int cpr_state_save(MigrationChannel *channel, Error **errp)
{
int ret;
@@ -1578,11 +1578,12 @@
# The migration channel-type request options.
#
# @main: Main outbound migration channel.
+# @cpr: cpr state channel.
#
# Since: 8.1
##
{ 'enum': 'MigrationChannelType',
- 'data': [ 'main' ] }
+ 'data': [ 'main', 'cpr' ] }
##
# @MigrationChannel:
@@ -77,6 +77,7 @@
#include "hw/block/block.h"
#include "hw/i386/x86.h"
#include "hw/i386/pc.h"
+#include "migration/cpr.h"
#include "migration/misc.h"
#include "migration/snapshot.h"
#include "sysemu/tpm.h"
@@ -1834,6 +1835,11 @@ static void incoming_option_parse(const char *str)
qobject_unref(obj);
visit_type_MigrationChannel(v, "channel", &channel, &error_fatal);
visit_free(v);
+
+ if (channel->channel_type == MIGRATION_CHANNEL_TYPE_CPR) {
+ cpr_set_cpr_channel(channel);
+ return;
+ }
} else if (!strcmp(str, "defer")) {
channel = NULL;
} else {
Add the 'cpr' channel type, and stash the incoming cpr channel for use in a subsequent patch. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> --- include/migration/cpr.h | 3 +++ migration/cpr.c | 15 +++++++++++++++ qapi/migration.json | 3 ++- system/vl.c | 6 ++++++ 4 files changed, 26 insertions(+), 1 deletion(-)