@@ -18,6 +18,7 @@
#include "exec/ramblock.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
+#include "channel.h"
#include "file.h"
#include "migration.h"
#include "migration-stats.h"
@@ -1014,15 +1015,20 @@ struct MFDSendChannelConnectData {
unsigned int ref;
MultiFDSendParams *p;
QIOChannelTLS *tioc;
+ MigChannelHeader header;
};
-static MFDSendChannelConnectData *mfd_send_channel_connect_data_new(MultiFDSendParams *p)
+static MFDSendChannelConnectData *mfd_send_channel_connect_data_new(MultiFDSendParams *p,
+ MigChannelHeader *header)
{
MFDSendChannelConnectData *data;
data = g_malloc0(sizeof(*data));
data->ref = 1;
data->p = p;
+ if (header) {
+ memcpy(&data->header, header, sizeof(*header));
+ }
return data;
}
@@ -1110,6 +1116,10 @@ bool multifd_channel_connect(MFDSendChannelConnectData *data, QIOChannel *ioc,
{
MultiFDSendParams *p = data->p;
+ if (migration_channel_header_send(ioc, &data->header, errp)) {
+ return false;
+ }
+
qio_channel_set_delay(ioc, false);
migration_ioc_register_yank(ioc);
@@ -1182,7 +1192,7 @@ static bool multifd_new_send_channel_create(MultiFDSendParams *p, Error **errp)
{
g_autoptr(MFDSendChannelConnectData) data = NULL;
- data = mfd_send_channel_connect_data_new(p);
+ data = mfd_send_channel_connect_data_new(p, NULL);
if (!multifd_use_packets()) {
return file_send_channel_create(data, errp);
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qemu/madvise.h"
#include "exec/target_page.h"
+#include "channel.h"
#include "migration.h"
#include "qemu-file.h"
#include "savevm.h"
@@ -1620,15 +1621,20 @@ void postcopy_preempt_new_channel(MigrationIncomingState *mis, QEMUFile *file)
typedef struct {
unsigned int ref;
MigrationState *s;
+ MigChannelHeader header;
} PostcopyPChannelConnectData;
-static PostcopyPChannelConnectData *pcopy_preempt_connect_data_new(MigrationState *s)
+static PostcopyPChannelConnectData *pcopy_preempt_connect_data_new(MigrationState *s,
+ MigChannelHeader *header)
{
PostcopyPChannelConnectData *data;
data = g_malloc0(sizeof(*data));
data->ref = 1;
data->s = s;
+ if (header) {
+ memcpy(&data->header, header, sizeof(*header));
+ }
return data;
}
@@ -1673,6 +1679,10 @@ postcopy_preempt_send_channel_done(PostcopyPChannelConnectData *data,
{
MigrationState *s = data->s;
+ if (!local_err) {
+ migration_channel_header_send(ioc, &data->header, &local_err);
+ }
+
if (local_err) {
migrate_set_error(s, local_err);
error_free(local_err);
@@ -1766,7 +1776,7 @@ void postcopy_preempt_setup(MigrationState *s)
{
PostcopyPChannelConnectData *data;
- data = pcopy_preempt_connect_data_new(s);
+ data = pcopy_preempt_connect_data_new(s, NULL);
/* Kick an async task to connect */
socket_send_channel_create(postcopy_preempt_send_channel_new,
data, pcopy_preempt_connect_data_unref);