2 * QEMU migration capabilities
4 * Copyright (c) 2012-2023 Red Hat Inc
7 * Orit Wasserman <owasserm@redhat.com>
8 * Juan Quintela <quintela@redhat.com>
10 * This work is licensed under the terms of the GNU GPL, version 2 or later.
11 * See the COPYING file in the top-level directory.
14 #include "qemu/osdep.h"
15 #include "exec/target_page.h"
16 #include "qapi/clone-visitor.h"
17 #include "qapi/error.h"
18 #include "qapi/qapi-commands-migration.h"
19 #include "qapi/qapi-visit-migration.h"
20 #include "qapi/qmp/qerror.h"
21 #include "qapi/qmp/qnull.h"
22 #include "sysemu/runstate.h"
23 #include "migration/colo.h"
24 #include "migration/misc.h"
25 #include "migration.h"
26 #include "qemu-file.h"
30 /* Maximum migrate downtime set to 2000 seconds */
31 #define MAX_MIGRATE_DOWNTIME_SECONDS 2000
32 #define MAX_MIGRATE_DOWNTIME (MAX_MIGRATE_DOWNTIME_SECONDS * 1000)
34 #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttling */
36 /* Time in milliseconds we are allowed to stop the source,
37 * for sending the last part */
38 #define DEFAULT_MIGRATE_SET_DOWNTIME 300
40 /* Default compression thread count */
41 #define DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT 8
42 /* Default decompression thread count, usually decompression is at
43 * least 4 times as fast as compression.*/
44 #define DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT 2
45 /*0: means nocompress, 1: best speed, ... 9: best compress ratio */
46 #define DEFAULT_MIGRATE_COMPRESS_LEVEL 1
47 /* Define default autoconverge cpu throttle migration parameters */
48 #define DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD 50
49 #define DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL 20
50 #define DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT 10
51 #define DEFAULT_MIGRATE_MAX_CPU_THROTTLE 99
53 /* Migration XBZRLE default cache size */
54 #define DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE (64 * 1024 * 1024)
56 /* The delay time (in ms) between two COLO checkpoints */
57 #define DEFAULT_MIGRATE_X_CHECKPOINT_DELAY (200 * 100)
58 #define DEFAULT_MIGRATE_MULTIFD_CHANNELS 2
59 #define DEFAULT_MIGRATE_MULTIFD_COMPRESSION MULTIFD_COMPRESSION_NONE
60 /* 0: means nocompress, 1: best speed, ... 9: best compress ratio */
61 #define DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL 1
62 /* 0: means nocompress, 1: best speed, ... 20: best compress ratio */
63 #define DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL 1
65 /* Background transfer rate for postcopy, 0 means unlimited, note
66 * that page requests can still exceed this limit.
68 #define DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH 0
71 * Parameters for self_announce_delay giving a stream of RARP/ARP
72 * packets after migration.
74 #define DEFAULT_MIGRATE_ANNOUNCE_INITIAL 50
75 #define DEFAULT_MIGRATE_ANNOUNCE_MAX 550
76 #define DEFAULT_MIGRATE_ANNOUNCE_ROUNDS 5
77 #define DEFAULT_MIGRATE_ANNOUNCE_STEP 100
79 #define DEFINE_PROP_MIG_CAP(name, x) \
80 DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false)
82 Property migration_properties
[] = {
83 DEFINE_PROP_BOOL("store-global-state", MigrationState
,
84 store_global_state
, true),
85 DEFINE_PROP_BOOL("send-configuration", MigrationState
,
86 send_configuration
, true),
87 DEFINE_PROP_BOOL("send-section-footer", MigrationState
,
88 send_section_footer
, true),
89 DEFINE_PROP_BOOL("decompress-error-check", MigrationState
,
90 decompress_error_check
, true),
91 DEFINE_PROP_BOOL("multifd-flush-after-each-section", MigrationState
,
92 multifd_flush_after_each_section
, true),
93 DEFINE_PROP_UINT8("x-clear-bitmap-shift", MigrationState
,
94 clear_bitmap_shift
, CLEAR_BITMAP_SHIFT_DEFAULT
),
95 DEFINE_PROP_BOOL("x-preempt-pre-7-2", MigrationState
,
96 preempt_pre_7_2
, false),
98 /* Migration parameters */
99 DEFINE_PROP_UINT8("x-compress-level", MigrationState
,
100 parameters
.compress_level
,
101 DEFAULT_MIGRATE_COMPRESS_LEVEL
),
102 DEFINE_PROP_UINT8("x-compress-threads", MigrationState
,
103 parameters
.compress_threads
,
104 DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT
),
105 DEFINE_PROP_BOOL("x-compress-wait-thread", MigrationState
,
106 parameters
.compress_wait_thread
, true),
107 DEFINE_PROP_UINT8("x-decompress-threads", MigrationState
,
108 parameters
.decompress_threads
,
109 DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT
),
110 DEFINE_PROP_UINT8("x-throttle-trigger-threshold", MigrationState
,
111 parameters
.throttle_trigger_threshold
,
112 DEFAULT_MIGRATE_THROTTLE_TRIGGER_THRESHOLD
),
113 DEFINE_PROP_UINT8("x-cpu-throttle-initial", MigrationState
,
114 parameters
.cpu_throttle_initial
,
115 DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL
),
116 DEFINE_PROP_UINT8("x-cpu-throttle-increment", MigrationState
,
117 parameters
.cpu_throttle_increment
,
118 DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT
),
119 DEFINE_PROP_BOOL("x-cpu-throttle-tailslow", MigrationState
,
120 parameters
.cpu_throttle_tailslow
, false),
121 DEFINE_PROP_SIZE("x-max-bandwidth", MigrationState
,
122 parameters
.max_bandwidth
, MAX_THROTTLE
),
123 DEFINE_PROP_UINT64("x-downtime-limit", MigrationState
,
124 parameters
.downtime_limit
,
125 DEFAULT_MIGRATE_SET_DOWNTIME
),
126 DEFINE_PROP_UINT32("x-checkpoint-delay", MigrationState
,
127 parameters
.x_checkpoint_delay
,
128 DEFAULT_MIGRATE_X_CHECKPOINT_DELAY
),
129 DEFINE_PROP_UINT8("multifd-channels", MigrationState
,
130 parameters
.multifd_channels
,
131 DEFAULT_MIGRATE_MULTIFD_CHANNELS
),
132 DEFINE_PROP_MULTIFD_COMPRESSION("multifd-compression", MigrationState
,
133 parameters
.multifd_compression
,
134 DEFAULT_MIGRATE_MULTIFD_COMPRESSION
),
135 DEFINE_PROP_UINT8("multifd-zlib-level", MigrationState
,
136 parameters
.multifd_zlib_level
,
137 DEFAULT_MIGRATE_MULTIFD_ZLIB_LEVEL
),
138 DEFINE_PROP_UINT8("multifd-zstd-level", MigrationState
,
139 parameters
.multifd_zstd_level
,
140 DEFAULT_MIGRATE_MULTIFD_ZSTD_LEVEL
),
141 DEFINE_PROP_SIZE("xbzrle-cache-size", MigrationState
,
142 parameters
.xbzrle_cache_size
,
143 DEFAULT_MIGRATE_XBZRLE_CACHE_SIZE
),
144 DEFINE_PROP_SIZE("max-postcopy-bandwidth", MigrationState
,
145 parameters
.max_postcopy_bandwidth
,
146 DEFAULT_MIGRATE_MAX_POSTCOPY_BANDWIDTH
),
147 DEFINE_PROP_UINT8("max-cpu-throttle", MigrationState
,
148 parameters
.max_cpu_throttle
,
149 DEFAULT_MIGRATE_MAX_CPU_THROTTLE
),
150 DEFINE_PROP_SIZE("announce-initial", MigrationState
,
151 parameters
.announce_initial
,
152 DEFAULT_MIGRATE_ANNOUNCE_INITIAL
),
153 DEFINE_PROP_SIZE("announce-max", MigrationState
,
154 parameters
.announce_max
,
155 DEFAULT_MIGRATE_ANNOUNCE_MAX
),
156 DEFINE_PROP_SIZE("announce-rounds", MigrationState
,
157 parameters
.announce_rounds
,
158 DEFAULT_MIGRATE_ANNOUNCE_ROUNDS
),
159 DEFINE_PROP_SIZE("announce-step", MigrationState
,
160 parameters
.announce_step
,
161 DEFAULT_MIGRATE_ANNOUNCE_STEP
),
162 DEFINE_PROP_STRING("tls-creds", MigrationState
, parameters
.tls_creds
),
163 DEFINE_PROP_STRING("tls-hostname", MigrationState
, parameters
.tls_hostname
),
164 DEFINE_PROP_STRING("tls-authz", MigrationState
, parameters
.tls_authz
),
166 /* Migration capabilities */
167 DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE
),
168 DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_ALL
),
169 DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVERGE
),
170 DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS
),
171 DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS
),
172 DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS
),
173 DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RAM
),
174 DEFINE_PROP_MIG_CAP("x-postcopy-preempt",
175 MIGRATION_CAPABILITY_POSTCOPY_PREEMPT
),
176 DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO
),
177 DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM
),
178 DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK
),
179 DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH
),
180 DEFINE_PROP_MIG_CAP("x-multifd", MIGRATION_CAPABILITY_MULTIFD
),
181 DEFINE_PROP_MIG_CAP("x-background-snapshot",
182 MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT
),
184 DEFINE_PROP_MIG_CAP("x-zero-copy-send",
185 MIGRATION_CAPABILITY_ZERO_COPY_SEND
),
188 DEFINE_PROP_END_OF_LIST(),
191 bool migrate_auto_converge(void)
193 MigrationState
*s
= migrate_get_current();
195 return s
->capabilities
[MIGRATION_CAPABILITY_AUTO_CONVERGE
];
198 bool migrate_background_snapshot(void)
200 MigrationState
*s
= migrate_get_current();
202 return s
->capabilities
[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT
];
205 bool migrate_block(void)
207 MigrationState
*s
= migrate_get_current();
209 return s
->capabilities
[MIGRATION_CAPABILITY_BLOCK
];
212 bool migrate_colo(void)
214 MigrationState
*s
= migrate_get_current();
216 return s
->capabilities
[MIGRATION_CAPABILITY_X_COLO
];
219 bool migrate_compress(void)
221 MigrationState
*s
= migrate_get_current();
223 return s
->capabilities
[MIGRATION_CAPABILITY_COMPRESS
];
226 bool migrate_dirty_bitmaps(void)
228 MigrationState
*s
= migrate_get_current();
230 return s
->capabilities
[MIGRATION_CAPABILITY_DIRTY_BITMAPS
];
233 bool migrate_events(void)
235 MigrationState
*s
= migrate_get_current();
237 return s
->capabilities
[MIGRATION_CAPABILITY_EVENTS
];
240 bool migrate_ignore_shared(void)
242 MigrationState
*s
= migrate_get_current();
244 return s
->capabilities
[MIGRATION_CAPABILITY_X_IGNORE_SHARED
];
247 bool migrate_late_block_activate(void)
249 MigrationState
*s
= migrate_get_current();
251 return s
->capabilities
[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE
];
254 bool migrate_multifd(void)
256 MigrationState
*s
= migrate_get_current();
258 return s
->capabilities
[MIGRATION_CAPABILITY_MULTIFD
];
261 bool migrate_pause_before_switchover(void)
263 MigrationState
*s
= migrate_get_current();
265 return s
->capabilities
[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER
];
268 bool migrate_postcopy_blocktime(void)
270 MigrationState
*s
= migrate_get_current();
272 return s
->capabilities
[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME
];
275 bool migrate_postcopy_preempt(void)
277 MigrationState
*s
= migrate_get_current();
279 return s
->capabilities
[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT
];
282 bool migrate_postcopy_ram(void)
284 MigrationState
*s
= migrate_get_current();
286 return s
->capabilities
[MIGRATION_CAPABILITY_POSTCOPY_RAM
];
289 bool migrate_rdma_pin_all(void)
291 MigrationState
*s
= migrate_get_current();
293 return s
->capabilities
[MIGRATION_CAPABILITY_RDMA_PIN_ALL
];
296 bool migrate_release_ram(void)
298 MigrationState
*s
= migrate_get_current();
300 return s
->capabilities
[MIGRATION_CAPABILITY_RELEASE_RAM
];
303 bool migrate_return_path(void)
305 MigrationState
*s
= migrate_get_current();
307 return s
->capabilities
[MIGRATION_CAPABILITY_RETURN_PATH
];
310 bool migrate_validate_uuid(void)
312 MigrationState
*s
= migrate_get_current();
314 return s
->capabilities
[MIGRATION_CAPABILITY_VALIDATE_UUID
];
317 bool migrate_xbzrle(void)
319 MigrationState
*s
= migrate_get_current();
321 return s
->capabilities
[MIGRATION_CAPABILITY_XBZRLE
];
324 bool migrate_zero_blocks(void)
326 MigrationState
*s
= migrate_get_current();
328 return s
->capabilities
[MIGRATION_CAPABILITY_ZERO_BLOCKS
];
331 bool migrate_zero_copy_send(void)
333 MigrationState
*s
= migrate_get_current();
335 return s
->capabilities
[MIGRATION_CAPABILITY_ZERO_COPY_SEND
];
338 /* pseudo capabilities */
340 bool migrate_multifd_flush_after_each_section(void)
342 MigrationState
*s
= migrate_get_current();
345 * Until the patch that remove this comment, we always return that
346 * the property is enabled.
348 return true || s
->multifd_flush_after_each_section
;
351 bool migrate_postcopy(void)
353 return migrate_postcopy_ram() || migrate_dirty_bitmaps();
356 bool migrate_tls(void)
358 MigrationState
*s
= migrate_get_current();
360 return s
->parameters
.tls_creds
&& *s
->parameters
.tls_creds
;
363 typedef enum WriteTrackingSupport
{
364 WT_SUPPORT_UNKNOWN
= 0,
366 WT_SUPPORT_AVAILABLE
,
367 WT_SUPPORT_COMPATIBLE
368 } WriteTrackingSupport
;
371 WriteTrackingSupport
migrate_query_write_tracking(void)
373 /* Check if kernel supports required UFFD features */
374 if (!ram_write_tracking_available()) {
375 return WT_SUPPORT_ABSENT
;
378 * Check if current memory configuration is
379 * compatible with required UFFD features.
381 if (!ram_write_tracking_compatible()) {
382 return WT_SUPPORT_AVAILABLE
;
385 return WT_SUPPORT_COMPATIBLE
;
388 /* Migration capabilities set */
389 struct MigrateCapsSet
{
390 int size
; /* Capability set size */
391 MigrationCapability caps
[]; /* Variadic array of capabilities */
393 typedef struct MigrateCapsSet MigrateCapsSet
;
395 /* Define and initialize MigrateCapsSet */
396 #define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \
397 MigrateCapsSet _name = { \
398 .size = sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \
399 .caps = { __VA_ARGS__ } \
402 /* Background-snapshot compatibility check list */
404 INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot
,
405 MIGRATION_CAPABILITY_POSTCOPY_RAM
,
406 MIGRATION_CAPABILITY_DIRTY_BITMAPS
,
407 MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME
,
408 MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE
,
409 MIGRATION_CAPABILITY_RETURN_PATH
,
410 MIGRATION_CAPABILITY_MULTIFD
,
411 MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER
,
412 MIGRATION_CAPABILITY_AUTO_CONVERGE
,
413 MIGRATION_CAPABILITY_RELEASE_RAM
,
414 MIGRATION_CAPABILITY_RDMA_PIN_ALL
,
415 MIGRATION_CAPABILITY_COMPRESS
,
416 MIGRATION_CAPABILITY_XBZRLE
,
417 MIGRATION_CAPABILITY_X_COLO
,
418 MIGRATION_CAPABILITY_VALIDATE_UUID
,
419 MIGRATION_CAPABILITY_ZERO_COPY_SEND
);
422 * @migration_caps_check - check capability compatibility
424 * @old_caps: old capability list
425 * @new_caps: new capability list
426 * @errp: set *errp if the check failed, with reason
428 * Returns true if check passed, otherwise false.
430 bool migrate_caps_check(bool *old_caps
, bool *new_caps
, Error
**errp
)
432 MigrationIncomingState
*mis
= migration_incoming_get_current();
435 #ifndef CONFIG_LIVE_BLOCK_MIGRATION
436 if (new_caps
[MIGRATION_CAPABILITY_BLOCK
]) {
437 error_setg(errp
, "QEMU compiled without old-style (blk/-b, inc/-i) "
439 error_append_hint(errp
, "Use drive_mirror+NBD instead.\n");
444 #ifndef CONFIG_REPLICATION
445 if (new_caps
[MIGRATION_CAPABILITY_X_COLO
]) {
446 error_setg(errp
, "QEMU compiled without replication module"
447 " can't enable COLO");
448 error_append_hint(errp
, "Please enable replication before COLO.\n");
453 if (new_caps
[MIGRATION_CAPABILITY_POSTCOPY_RAM
]) {
454 /* This check is reasonably expensive, so only when it's being
455 * set the first time, also it's only the destination that needs
458 if (!old_caps
[MIGRATION_CAPABILITY_POSTCOPY_RAM
] &&
459 runstate_check(RUN_STATE_INMIGRATE
) &&
460 !postcopy_ram_supported_by_host(mis
, errp
)) {
461 error_prepend(errp
, "Postcopy is not supported: ");
465 if (new_caps
[MIGRATION_CAPABILITY_X_IGNORE_SHARED
]) {
466 error_setg(errp
, "Postcopy is not compatible with ignore-shared");
470 if (new_caps
[MIGRATION_CAPABILITY_MULTIFD
]) {
471 error_setg(errp
, "Postcopy is not yet compatible with multifd");
476 if (new_caps
[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT
]) {
477 WriteTrackingSupport wt_support
;
480 * Check if 'background-snapshot' capability is supported by
481 * host kernel and compatible with guest memory configuration.
483 wt_support
= migrate_query_write_tracking();
484 if (wt_support
< WT_SUPPORT_AVAILABLE
) {
485 error_setg(errp
, "Background-snapshot is not supported by host kernel");
488 if (wt_support
< WT_SUPPORT_COMPATIBLE
) {
489 error_setg(errp
, "Background-snapshot is not compatible "
490 "with guest memory configuration");
495 * Check if there are any migration capabilities
496 * incompatible with 'background-snapshot'.
498 for (idx
= 0; idx
< check_caps_background_snapshot
.size
; idx
++) {
499 int incomp_cap
= check_caps_background_snapshot
.caps
[idx
];
500 if (new_caps
[incomp_cap
]) {
502 "Background-snapshot is not compatible with %s",
503 MigrationCapability_str(incomp_cap
));
510 if (new_caps
[MIGRATION_CAPABILITY_ZERO_COPY_SEND
] &&
511 (!new_caps
[MIGRATION_CAPABILITY_MULTIFD
] ||
512 new_caps
[MIGRATION_CAPABILITY_COMPRESS
] ||
513 new_caps
[MIGRATION_CAPABILITY_XBZRLE
] ||
514 migrate_multifd_compression() ||
517 "Zero copy only available for non-compressed non-TLS multifd migration");
521 if (new_caps
[MIGRATION_CAPABILITY_ZERO_COPY_SEND
]) {
523 "Zero copy currently only available on Linux");
528 if (new_caps
[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT
]) {
529 if (!new_caps
[MIGRATION_CAPABILITY_POSTCOPY_RAM
]) {
530 error_setg(errp
, "Postcopy preempt requires postcopy-ram");
535 * Preempt mode requires urgent pages to be sent in separate
536 * channel, OTOH compression logic will disorder all pages into
537 * different compression channels, which is not compatible with the
538 * preempt assumptions on channel assignments.
540 if (new_caps
[MIGRATION_CAPABILITY_COMPRESS
]) {
541 error_setg(errp
, "Postcopy preempt not compatible with compress");
546 if (new_caps
[MIGRATION_CAPABILITY_MULTIFD
]) {
547 if (new_caps
[MIGRATION_CAPABILITY_COMPRESS
]) {
548 error_setg(errp
, "Multifd is not compatible with compress");
556 bool migrate_cap_set(int cap
, bool value
, Error
**errp
)
558 MigrationState
*s
= migrate_get_current();
559 bool new_caps
[MIGRATION_CAPABILITY__MAX
];
561 if (migration_is_running(s
->state
)) {
562 error_setg(errp
, QERR_MIGRATION_ACTIVE
);
566 memcpy(new_caps
, s
->capabilities
, sizeof(new_caps
));
567 new_caps
[cap
] = value
;
569 if (!migrate_caps_check(s
->capabilities
, new_caps
, errp
)) {
572 s
->capabilities
[cap
] = value
;
576 MigrationCapabilityStatusList
*qmp_query_migrate_capabilities(Error
**errp
)
578 MigrationCapabilityStatusList
*head
= NULL
, **tail
= &head
;
579 MigrationCapabilityStatus
*caps
;
580 MigrationState
*s
= migrate_get_current();
583 for (i
= 0; i
< MIGRATION_CAPABILITY__MAX
; i
++) {
584 #ifndef CONFIG_LIVE_BLOCK_MIGRATION
585 if (i
== MIGRATION_CAPABILITY_BLOCK
) {
589 caps
= g_malloc0(sizeof(*caps
));
590 caps
->capability
= i
;
591 caps
->state
= s
->capabilities
[i
];
592 QAPI_LIST_APPEND(tail
, caps
);
598 void qmp_migrate_set_capabilities(MigrationCapabilityStatusList
*params
,
601 MigrationState
*s
= migrate_get_current();
602 MigrationCapabilityStatusList
*cap
;
603 bool new_caps
[MIGRATION_CAPABILITY__MAX
];
605 if (migration_is_running(s
->state
)) {
606 error_setg(errp
, QERR_MIGRATION_ACTIVE
);
610 memcpy(new_caps
, s
->capabilities
, sizeof(new_caps
));
611 for (cap
= params
; cap
; cap
= cap
->next
) {
612 new_caps
[cap
->value
->capability
] = cap
->value
->state
;
615 if (!migrate_caps_check(s
->capabilities
, new_caps
, errp
)) {
619 for (cap
= params
; cap
; cap
= cap
->next
) {
620 s
->capabilities
[cap
->value
->capability
] = cap
->value
->state
;
626 const BitmapMigrationNodeAliasList
*migrate_block_bitmap_mapping(void)
628 MigrationState
*s
= migrate_get_current();
630 return s
->parameters
.block_bitmap_mapping
;
633 bool migrate_block_incremental(void)
635 MigrationState
*s
= migrate_get_current();
637 return s
->parameters
.block_incremental
;
640 uint32_t migrate_checkpoint_delay(void)
642 MigrationState
*s
= migrate_get_current();
644 return s
->parameters
.x_checkpoint_delay
;
647 int migrate_compress_level(void)
649 MigrationState
*s
= migrate_get_current();
651 return s
->parameters
.compress_level
;
654 int migrate_compress_threads(void)
656 MigrationState
*s
= migrate_get_current();
658 return s
->parameters
.compress_threads
;
661 int migrate_compress_wait_thread(void)
663 MigrationState
*s
= migrate_get_current();
665 return s
->parameters
.compress_wait_thread
;
668 uint8_t migrate_cpu_throttle_increment(void)
670 MigrationState
*s
= migrate_get_current();
672 return s
->parameters
.cpu_throttle_increment
;
675 uint8_t migrate_cpu_throttle_initial(void)
677 MigrationState
*s
= migrate_get_current();
679 return s
->parameters
.cpu_throttle_initial
;
682 bool migrate_cpu_throttle_tailslow(void)
684 MigrationState
*s
= migrate_get_current();
686 return s
->parameters
.cpu_throttle_tailslow
;
689 int migrate_decompress_threads(void)
691 MigrationState
*s
= migrate_get_current();
693 return s
->parameters
.decompress_threads
;
696 uint64_t migrate_downtime_limit(void)
698 MigrationState
*s
= migrate_get_current();
700 return s
->parameters
.downtime_limit
;
703 uint8_t migrate_max_cpu_throttle(void)
705 MigrationState
*s
= migrate_get_current();
707 return s
->parameters
.max_cpu_throttle
;
710 uint64_t migrate_max_bandwidth(void)
712 MigrationState
*s
= migrate_get_current();
714 return s
->parameters
.max_bandwidth
;
717 int64_t migrate_max_postcopy_bandwidth(void)
719 MigrationState
*s
= migrate_get_current();
721 return s
->parameters
.max_postcopy_bandwidth
;
724 int migrate_multifd_channels(void)
726 MigrationState
*s
= migrate_get_current();
728 return s
->parameters
.multifd_channels
;
731 MultiFDCompression
migrate_multifd_compression(void)
733 MigrationState
*s
= migrate_get_current();
735 assert(s
->parameters
.multifd_compression
< MULTIFD_COMPRESSION__MAX
);
736 return s
->parameters
.multifd_compression
;
739 int migrate_multifd_zlib_level(void)
741 MigrationState
*s
= migrate_get_current();
743 return s
->parameters
.multifd_zlib_level
;
746 int migrate_multifd_zstd_level(void)
748 MigrationState
*s
= migrate_get_current();
750 return s
->parameters
.multifd_zstd_level
;
753 uint8_t migrate_throttle_trigger_threshold(void)
755 MigrationState
*s
= migrate_get_current();
757 return s
->parameters
.throttle_trigger_threshold
;
760 const char *migrate_tls_authz(void)
762 MigrationState
*s
= migrate_get_current();
764 return s
->parameters
.tls_authz
;
767 const char *migrate_tls_creds(void)
769 MigrationState
*s
= migrate_get_current();
771 return s
->parameters
.tls_creds
;
774 const char *migrate_tls_hostname(void)
776 MigrationState
*s
= migrate_get_current();
778 return s
->parameters
.tls_hostname
;
781 uint64_t migrate_xbzrle_cache_size(void)
783 MigrationState
*s
= migrate_get_current();
785 return s
->parameters
.xbzrle_cache_size
;
788 /* parameter setters */
790 void migrate_set_block_incremental(bool value
)
792 MigrationState
*s
= migrate_get_current();
794 s
->parameters
.block_incremental
= value
;
797 /* parameters helpers */
799 void block_cleanup_parameters(void)
801 MigrationState
*s
= migrate_get_current();
803 if (s
->must_remove_block_options
) {
804 /* setting to false can never fail */
805 migrate_cap_set(MIGRATION_CAPABILITY_BLOCK
, false, &error_abort
);
806 migrate_set_block_incremental(false);
807 s
->must_remove_block_options
= false;
811 AnnounceParameters
*migrate_announce_params(void)
813 static AnnounceParameters ap
;
815 MigrationState
*s
= migrate_get_current();
817 ap
.initial
= s
->parameters
.announce_initial
;
818 ap
.max
= s
->parameters
.announce_max
;
819 ap
.rounds
= s
->parameters
.announce_rounds
;
820 ap
.step
= s
->parameters
.announce_step
;
825 MigrationParameters
*qmp_query_migrate_parameters(Error
**errp
)
827 MigrationParameters
*params
;
828 MigrationState
*s
= migrate_get_current();
830 /* TODO use QAPI_CLONE() instead of duplicating it inline */
831 params
= g_malloc0(sizeof(*params
));
832 params
->has_compress_level
= true;
833 params
->compress_level
= s
->parameters
.compress_level
;
834 params
->has_compress_threads
= true;
835 params
->compress_threads
= s
->parameters
.compress_threads
;
836 params
->has_compress_wait_thread
= true;
837 params
->compress_wait_thread
= s
->parameters
.compress_wait_thread
;
838 params
->has_decompress_threads
= true;
839 params
->decompress_threads
= s
->parameters
.decompress_threads
;
840 params
->has_throttle_trigger_threshold
= true;
841 params
->throttle_trigger_threshold
= s
->parameters
.throttle_trigger_threshold
;
842 params
->has_cpu_throttle_initial
= true;
843 params
->cpu_throttle_initial
= s
->parameters
.cpu_throttle_initial
;
844 params
->has_cpu_throttle_increment
= true;
845 params
->cpu_throttle_increment
= s
->parameters
.cpu_throttle_increment
;
846 params
->has_cpu_throttle_tailslow
= true;
847 params
->cpu_throttle_tailslow
= s
->parameters
.cpu_throttle_tailslow
;
848 params
->tls_creds
= g_strdup(s
->parameters
.tls_creds
);
849 params
->tls_hostname
= g_strdup(s
->parameters
.tls_hostname
);
850 params
->tls_authz
= g_strdup(s
->parameters
.tls_authz
?
851 s
->parameters
.tls_authz
: "");
852 params
->has_max_bandwidth
= true;
853 params
->max_bandwidth
= s
->parameters
.max_bandwidth
;
854 params
->has_downtime_limit
= true;
855 params
->downtime_limit
= s
->parameters
.downtime_limit
;
856 params
->has_x_checkpoint_delay
= true;
857 params
->x_checkpoint_delay
= s
->parameters
.x_checkpoint_delay
;
858 params
->has_block_incremental
= true;
859 params
->block_incremental
= s
->parameters
.block_incremental
;
860 params
->has_multifd_channels
= true;
861 params
->multifd_channels
= s
->parameters
.multifd_channels
;
862 params
->has_multifd_compression
= true;
863 params
->multifd_compression
= s
->parameters
.multifd_compression
;
864 params
->has_multifd_zlib_level
= true;
865 params
->multifd_zlib_level
= s
->parameters
.multifd_zlib_level
;
866 params
->has_multifd_zstd_level
= true;
867 params
->multifd_zstd_level
= s
->parameters
.multifd_zstd_level
;
868 params
->has_xbzrle_cache_size
= true;
869 params
->xbzrle_cache_size
= s
->parameters
.xbzrle_cache_size
;
870 params
->has_max_postcopy_bandwidth
= true;
871 params
->max_postcopy_bandwidth
= s
->parameters
.max_postcopy_bandwidth
;
872 params
->has_max_cpu_throttle
= true;
873 params
->max_cpu_throttle
= s
->parameters
.max_cpu_throttle
;
874 params
->has_announce_initial
= true;
875 params
->announce_initial
= s
->parameters
.announce_initial
;
876 params
->has_announce_max
= true;
877 params
->announce_max
= s
->parameters
.announce_max
;
878 params
->has_announce_rounds
= true;
879 params
->announce_rounds
= s
->parameters
.announce_rounds
;
880 params
->has_announce_step
= true;
881 params
->announce_step
= s
->parameters
.announce_step
;
883 if (s
->parameters
.has_block_bitmap_mapping
) {
884 params
->has_block_bitmap_mapping
= true;
885 params
->block_bitmap_mapping
=
886 QAPI_CLONE(BitmapMigrationNodeAliasList
,
887 s
->parameters
.block_bitmap_mapping
);
893 void migrate_params_init(MigrationParameters
*params
)
895 params
->tls_hostname
= g_strdup("");
896 params
->tls_creds
= g_strdup("");
898 /* Set has_* up only for parameter checks */
899 params
->has_compress_level
= true;
900 params
->has_compress_threads
= true;
901 params
->has_compress_wait_thread
= true;
902 params
->has_decompress_threads
= true;
903 params
->has_throttle_trigger_threshold
= true;
904 params
->has_cpu_throttle_initial
= true;
905 params
->has_cpu_throttle_increment
= true;
906 params
->has_cpu_throttle_tailslow
= true;
907 params
->has_max_bandwidth
= true;
908 params
->has_downtime_limit
= true;
909 params
->has_x_checkpoint_delay
= true;
910 params
->has_block_incremental
= true;
911 params
->has_multifd_channels
= true;
912 params
->has_multifd_compression
= true;
913 params
->has_multifd_zlib_level
= true;
914 params
->has_multifd_zstd_level
= true;
915 params
->has_xbzrle_cache_size
= true;
916 params
->has_max_postcopy_bandwidth
= true;
917 params
->has_max_cpu_throttle
= true;
918 params
->has_announce_initial
= true;
919 params
->has_announce_max
= true;
920 params
->has_announce_rounds
= true;
921 params
->has_announce_step
= true;
925 * Check whether the parameters are valid. Error will be put into errp
926 * (if provided). Return true if valid, otherwise false.
928 bool migrate_params_check(MigrationParameters
*params
, Error
**errp
)
930 if (params
->has_compress_level
&&
931 (params
->compress_level
> 9)) {
932 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
, "compress_level",
933 "a value between 0 and 9");
937 if (params
->has_compress_threads
&& (params
->compress_threads
< 1)) {
938 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
940 "a value between 1 and 255");
944 if (params
->has_decompress_threads
&& (params
->decompress_threads
< 1)) {
945 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
946 "decompress_threads",
947 "a value between 1 and 255");
951 if (params
->has_throttle_trigger_threshold
&&
952 (params
->throttle_trigger_threshold
< 1 ||
953 params
->throttle_trigger_threshold
> 100)) {
954 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
955 "throttle_trigger_threshold",
956 "an integer in the range of 1 to 100");
960 if (params
->has_cpu_throttle_initial
&&
961 (params
->cpu_throttle_initial
< 1 ||
962 params
->cpu_throttle_initial
> 99)) {
963 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
964 "cpu_throttle_initial",
965 "an integer in the range of 1 to 99");
969 if (params
->has_cpu_throttle_increment
&&
970 (params
->cpu_throttle_increment
< 1 ||
971 params
->cpu_throttle_increment
> 99)) {
972 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
973 "cpu_throttle_increment",
974 "an integer in the range of 1 to 99");
978 if (params
->has_max_bandwidth
&& (params
->max_bandwidth
> SIZE_MAX
)) {
979 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
981 "an integer in the range of 0 to "stringify(SIZE_MAX
)
986 if (params
->has_downtime_limit
&&
987 (params
->downtime_limit
> MAX_MIGRATE_DOWNTIME
)) {
988 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
990 "an integer in the range of 0 to "
991 stringify(MAX_MIGRATE_DOWNTIME
)" ms");
995 /* x_checkpoint_delay is now always positive */
997 if (params
->has_multifd_channels
&& (params
->multifd_channels
< 1)) {
998 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1000 "a value between 1 and 255");
1004 if (params
->has_multifd_zlib_level
&&
1005 (params
->multifd_zlib_level
> 9)) {
1006 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
, "multifd_zlib_level",
1007 "a value between 0 and 9");
1011 if (params
->has_multifd_zstd_level
&&
1012 (params
->multifd_zstd_level
> 20)) {
1013 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
, "multifd_zstd_level",
1014 "a value between 0 and 20");
1018 if (params
->has_xbzrle_cache_size
&&
1019 (params
->xbzrle_cache_size
< qemu_target_page_size() ||
1020 !is_power_of_2(params
->xbzrle_cache_size
))) {
1021 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1022 "xbzrle_cache_size",
1023 "a power of two no less than the target page size");
1027 if (params
->has_max_cpu_throttle
&&
1028 (params
->max_cpu_throttle
< params
->cpu_throttle_initial
||
1029 params
->max_cpu_throttle
> 99)) {
1030 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1032 "an integer in the range of cpu_throttle_initial to 99");
1036 if (params
->has_announce_initial
&&
1037 params
->announce_initial
> 100000) {
1038 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1040 "a value between 0 and 100000");
1043 if (params
->has_announce_max
&&
1044 params
->announce_max
> 100000) {
1045 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1047 "a value between 0 and 100000");
1050 if (params
->has_announce_rounds
&&
1051 params
->announce_rounds
> 1000) {
1052 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1054 "a value between 0 and 1000");
1057 if (params
->has_announce_step
&&
1058 (params
->announce_step
< 1 ||
1059 params
->announce_step
> 10000)) {
1060 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1062 "a value between 0 and 10000");
1066 if (params
->has_block_bitmap_mapping
&&
1067 !check_dirty_bitmap_mig_alias_map(params
->block_bitmap_mapping
, errp
)) {
1068 error_prepend(errp
, "Invalid mapping given for block-bitmap-mapping: ");
1073 if (migrate_zero_copy_send() &&
1074 ((params
->has_multifd_compression
&& params
->multifd_compression
) ||
1075 (params
->tls_creds
&& *params
->tls_creds
))) {
1077 "Zero copy only available for non-compressed non-TLS multifd migration");
1085 static void migrate_params_test_apply(MigrateSetParameters
*params
,
1086 MigrationParameters
*dest
)
1088 *dest
= migrate_get_current()->parameters
;
1090 /* TODO use QAPI_CLONE() instead of duplicating it inline */
1092 if (params
->has_compress_level
) {
1093 dest
->compress_level
= params
->compress_level
;
1096 if (params
->has_compress_threads
) {
1097 dest
->compress_threads
= params
->compress_threads
;
1100 if (params
->has_compress_wait_thread
) {
1101 dest
->compress_wait_thread
= params
->compress_wait_thread
;
1104 if (params
->has_decompress_threads
) {
1105 dest
->decompress_threads
= params
->decompress_threads
;
1108 if (params
->has_throttle_trigger_threshold
) {
1109 dest
->throttle_trigger_threshold
= params
->throttle_trigger_threshold
;
1112 if (params
->has_cpu_throttle_initial
) {
1113 dest
->cpu_throttle_initial
= params
->cpu_throttle_initial
;
1116 if (params
->has_cpu_throttle_increment
) {
1117 dest
->cpu_throttle_increment
= params
->cpu_throttle_increment
;
1120 if (params
->has_cpu_throttle_tailslow
) {
1121 dest
->cpu_throttle_tailslow
= params
->cpu_throttle_tailslow
;
1124 if (params
->tls_creds
) {
1125 assert(params
->tls_creds
->type
== QTYPE_QSTRING
);
1126 dest
->tls_creds
= params
->tls_creds
->u
.s
;
1129 if (params
->tls_hostname
) {
1130 assert(params
->tls_hostname
->type
== QTYPE_QSTRING
);
1131 dest
->tls_hostname
= params
->tls_hostname
->u
.s
;
1134 if (params
->has_max_bandwidth
) {
1135 dest
->max_bandwidth
= params
->max_bandwidth
;
1138 if (params
->has_downtime_limit
) {
1139 dest
->downtime_limit
= params
->downtime_limit
;
1142 if (params
->has_x_checkpoint_delay
) {
1143 dest
->x_checkpoint_delay
= params
->x_checkpoint_delay
;
1146 if (params
->has_block_incremental
) {
1147 dest
->block_incremental
= params
->block_incremental
;
1149 if (params
->has_multifd_channels
) {
1150 dest
->multifd_channels
= params
->multifd_channels
;
1152 if (params
->has_multifd_compression
) {
1153 dest
->multifd_compression
= params
->multifd_compression
;
1155 if (params
->has_xbzrle_cache_size
) {
1156 dest
->xbzrle_cache_size
= params
->xbzrle_cache_size
;
1158 if (params
->has_max_postcopy_bandwidth
) {
1159 dest
->max_postcopy_bandwidth
= params
->max_postcopy_bandwidth
;
1161 if (params
->has_max_cpu_throttle
) {
1162 dest
->max_cpu_throttle
= params
->max_cpu_throttle
;
1164 if (params
->has_announce_initial
) {
1165 dest
->announce_initial
= params
->announce_initial
;
1167 if (params
->has_announce_max
) {
1168 dest
->announce_max
= params
->announce_max
;
1170 if (params
->has_announce_rounds
) {
1171 dest
->announce_rounds
= params
->announce_rounds
;
1173 if (params
->has_announce_step
) {
1174 dest
->announce_step
= params
->announce_step
;
1177 if (params
->has_block_bitmap_mapping
) {
1178 dest
->has_block_bitmap_mapping
= true;
1179 dest
->block_bitmap_mapping
= params
->block_bitmap_mapping
;
1183 static void migrate_params_apply(MigrateSetParameters
*params
, Error
**errp
)
1185 MigrationState
*s
= migrate_get_current();
1187 /* TODO use QAPI_CLONE() instead of duplicating it inline */
1189 if (params
->has_compress_level
) {
1190 s
->parameters
.compress_level
= params
->compress_level
;
1193 if (params
->has_compress_threads
) {
1194 s
->parameters
.compress_threads
= params
->compress_threads
;
1197 if (params
->has_compress_wait_thread
) {
1198 s
->parameters
.compress_wait_thread
= params
->compress_wait_thread
;
1201 if (params
->has_decompress_threads
) {
1202 s
->parameters
.decompress_threads
= params
->decompress_threads
;
1205 if (params
->has_throttle_trigger_threshold
) {
1206 s
->parameters
.throttle_trigger_threshold
= params
->throttle_trigger_threshold
;
1209 if (params
->has_cpu_throttle_initial
) {
1210 s
->parameters
.cpu_throttle_initial
= params
->cpu_throttle_initial
;
1213 if (params
->has_cpu_throttle_increment
) {
1214 s
->parameters
.cpu_throttle_increment
= params
->cpu_throttle_increment
;
1217 if (params
->has_cpu_throttle_tailslow
) {
1218 s
->parameters
.cpu_throttle_tailslow
= params
->cpu_throttle_tailslow
;
1221 if (params
->tls_creds
) {
1222 g_free(s
->parameters
.tls_creds
);
1223 assert(params
->tls_creds
->type
== QTYPE_QSTRING
);
1224 s
->parameters
.tls_creds
= g_strdup(params
->tls_creds
->u
.s
);
1227 if (params
->tls_hostname
) {
1228 g_free(s
->parameters
.tls_hostname
);
1229 assert(params
->tls_hostname
->type
== QTYPE_QSTRING
);
1230 s
->parameters
.tls_hostname
= g_strdup(params
->tls_hostname
->u
.s
);
1233 if (params
->tls_authz
) {
1234 g_free(s
->parameters
.tls_authz
);
1235 assert(params
->tls_authz
->type
== QTYPE_QSTRING
);
1236 s
->parameters
.tls_authz
= g_strdup(params
->tls_authz
->u
.s
);
1239 if (params
->has_max_bandwidth
) {
1240 s
->parameters
.max_bandwidth
= params
->max_bandwidth
;
1241 if (s
->to_dst_file
&& !migration_in_postcopy()) {
1242 qemu_file_set_rate_limit(s
->to_dst_file
,
1243 s
->parameters
.max_bandwidth
/ XFER_LIMIT_RATIO
);
1247 if (params
->has_downtime_limit
) {
1248 s
->parameters
.downtime_limit
= params
->downtime_limit
;
1251 if (params
->has_x_checkpoint_delay
) {
1252 s
->parameters
.x_checkpoint_delay
= params
->x_checkpoint_delay
;
1253 if (migration_in_colo_state()) {
1254 colo_checkpoint_notify(s
);
1258 if (params
->has_block_incremental
) {
1259 s
->parameters
.block_incremental
= params
->block_incremental
;
1261 if (params
->has_multifd_channels
) {
1262 s
->parameters
.multifd_channels
= params
->multifd_channels
;
1264 if (params
->has_multifd_compression
) {
1265 s
->parameters
.multifd_compression
= params
->multifd_compression
;
1267 if (params
->has_xbzrle_cache_size
) {
1268 s
->parameters
.xbzrle_cache_size
= params
->xbzrle_cache_size
;
1269 xbzrle_cache_resize(params
->xbzrle_cache_size
, errp
);
1271 if (params
->has_max_postcopy_bandwidth
) {
1272 s
->parameters
.max_postcopy_bandwidth
= params
->max_postcopy_bandwidth
;
1273 if (s
->to_dst_file
&& migration_in_postcopy()) {
1274 qemu_file_set_rate_limit(s
->to_dst_file
,
1275 s
->parameters
.max_postcopy_bandwidth
/ XFER_LIMIT_RATIO
);
1278 if (params
->has_max_cpu_throttle
) {
1279 s
->parameters
.max_cpu_throttle
= params
->max_cpu_throttle
;
1281 if (params
->has_announce_initial
) {
1282 s
->parameters
.announce_initial
= params
->announce_initial
;
1284 if (params
->has_announce_max
) {
1285 s
->parameters
.announce_max
= params
->announce_max
;
1287 if (params
->has_announce_rounds
) {
1288 s
->parameters
.announce_rounds
= params
->announce_rounds
;
1290 if (params
->has_announce_step
) {
1291 s
->parameters
.announce_step
= params
->announce_step
;
1294 if (params
->has_block_bitmap_mapping
) {
1295 qapi_free_BitmapMigrationNodeAliasList(
1296 s
->parameters
.block_bitmap_mapping
);
1298 s
->parameters
.has_block_bitmap_mapping
= true;
1299 s
->parameters
.block_bitmap_mapping
=
1300 QAPI_CLONE(BitmapMigrationNodeAliasList
,
1301 params
->block_bitmap_mapping
);
1305 void qmp_migrate_set_parameters(MigrateSetParameters
*params
, Error
**errp
)
1307 MigrationParameters tmp
;
1309 /* TODO Rewrite "" to null instead */
1310 if (params
->tls_creds
1311 && params
->tls_creds
->type
== QTYPE_QNULL
) {
1312 qobject_unref(params
->tls_creds
->u
.n
);
1313 params
->tls_creds
->type
= QTYPE_QSTRING
;
1314 params
->tls_creds
->u
.s
= strdup("");
1316 /* TODO Rewrite "" to null instead */
1317 if (params
->tls_hostname
1318 && params
->tls_hostname
->type
== QTYPE_QNULL
) {
1319 qobject_unref(params
->tls_hostname
->u
.n
);
1320 params
->tls_hostname
->type
= QTYPE_QSTRING
;
1321 params
->tls_hostname
->u
.s
= strdup("");
1324 migrate_params_test_apply(params
, &tmp
);
1326 if (!migrate_params_check(&tmp
, errp
)) {
1327 /* Invalid parameter */
1331 migrate_params_apply(params
, errp
);