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
, false),
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();
344 return s
->multifd_flush_after_each_section
;
347 bool migrate_postcopy(void)
349 return migrate_postcopy_ram() || migrate_dirty_bitmaps();
352 bool migrate_tls(void)
354 MigrationState
*s
= migrate_get_current();
356 return s
->parameters
.tls_creds
&& *s
->parameters
.tls_creds
;
359 typedef enum WriteTrackingSupport
{
360 WT_SUPPORT_UNKNOWN
= 0,
362 WT_SUPPORT_AVAILABLE
,
363 WT_SUPPORT_COMPATIBLE
364 } WriteTrackingSupport
;
367 WriteTrackingSupport
migrate_query_write_tracking(void)
369 /* Check if kernel supports required UFFD features */
370 if (!ram_write_tracking_available()) {
371 return WT_SUPPORT_ABSENT
;
374 * Check if current memory configuration is
375 * compatible with required UFFD features.
377 if (!ram_write_tracking_compatible()) {
378 return WT_SUPPORT_AVAILABLE
;
381 return WT_SUPPORT_COMPATIBLE
;
384 /* Migration capabilities set */
385 struct MigrateCapsSet
{
386 int size
; /* Capability set size */
387 MigrationCapability caps
[]; /* Variadic array of capabilities */
389 typedef struct MigrateCapsSet MigrateCapsSet
;
391 /* Define and initialize MigrateCapsSet */
392 #define INITIALIZE_MIGRATE_CAPS_SET(_name, ...) \
393 MigrateCapsSet _name = { \
394 .size = sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \
395 .caps = { __VA_ARGS__ } \
398 /* Background-snapshot compatibility check list */
400 INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snapshot
,
401 MIGRATION_CAPABILITY_POSTCOPY_RAM
,
402 MIGRATION_CAPABILITY_DIRTY_BITMAPS
,
403 MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME
,
404 MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE
,
405 MIGRATION_CAPABILITY_RETURN_PATH
,
406 MIGRATION_CAPABILITY_MULTIFD
,
407 MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER
,
408 MIGRATION_CAPABILITY_AUTO_CONVERGE
,
409 MIGRATION_CAPABILITY_RELEASE_RAM
,
410 MIGRATION_CAPABILITY_RDMA_PIN_ALL
,
411 MIGRATION_CAPABILITY_COMPRESS
,
412 MIGRATION_CAPABILITY_XBZRLE
,
413 MIGRATION_CAPABILITY_X_COLO
,
414 MIGRATION_CAPABILITY_VALIDATE_UUID
,
415 MIGRATION_CAPABILITY_ZERO_COPY_SEND
);
418 * @migration_caps_check - check capability compatibility
420 * @old_caps: old capability list
421 * @new_caps: new capability list
422 * @errp: set *errp if the check failed, with reason
424 * Returns true if check passed, otherwise false.
426 bool migrate_caps_check(bool *old_caps
, bool *new_caps
, Error
**errp
)
428 MigrationIncomingState
*mis
= migration_incoming_get_current();
431 #ifndef CONFIG_LIVE_BLOCK_MIGRATION
432 if (new_caps
[MIGRATION_CAPABILITY_BLOCK
]) {
433 error_setg(errp
, "QEMU compiled without old-style (blk/-b, inc/-i) "
435 error_append_hint(errp
, "Use drive_mirror+NBD instead.\n");
440 #ifndef CONFIG_REPLICATION
441 if (new_caps
[MIGRATION_CAPABILITY_X_COLO
]) {
442 error_setg(errp
, "QEMU compiled without replication module"
443 " can't enable COLO");
444 error_append_hint(errp
, "Please enable replication before COLO.\n");
449 if (new_caps
[MIGRATION_CAPABILITY_POSTCOPY_RAM
]) {
450 /* This check is reasonably expensive, so only when it's being
451 * set the first time, also it's only the destination that needs
454 if (!old_caps
[MIGRATION_CAPABILITY_POSTCOPY_RAM
] &&
455 runstate_check(RUN_STATE_INMIGRATE
) &&
456 !postcopy_ram_supported_by_host(mis
, errp
)) {
457 error_prepend(errp
, "Postcopy is not supported: ");
461 if (new_caps
[MIGRATION_CAPABILITY_X_IGNORE_SHARED
]) {
462 error_setg(errp
, "Postcopy is not compatible with ignore-shared");
466 if (new_caps
[MIGRATION_CAPABILITY_MULTIFD
]) {
467 error_setg(errp
, "Postcopy is not yet compatible with multifd");
472 if (new_caps
[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT
]) {
473 WriteTrackingSupport wt_support
;
476 * Check if 'background-snapshot' capability is supported by
477 * host kernel and compatible with guest memory configuration.
479 wt_support
= migrate_query_write_tracking();
480 if (wt_support
< WT_SUPPORT_AVAILABLE
) {
481 error_setg(errp
, "Background-snapshot is not supported by host kernel");
484 if (wt_support
< WT_SUPPORT_COMPATIBLE
) {
485 error_setg(errp
, "Background-snapshot is not compatible "
486 "with guest memory configuration");
491 * Check if there are any migration capabilities
492 * incompatible with 'background-snapshot'.
494 for (idx
= 0; idx
< check_caps_background_snapshot
.size
; idx
++) {
495 int incomp_cap
= check_caps_background_snapshot
.caps
[idx
];
496 if (new_caps
[incomp_cap
]) {
498 "Background-snapshot is not compatible with %s",
499 MigrationCapability_str(incomp_cap
));
506 if (new_caps
[MIGRATION_CAPABILITY_ZERO_COPY_SEND
] &&
507 (!new_caps
[MIGRATION_CAPABILITY_MULTIFD
] ||
508 new_caps
[MIGRATION_CAPABILITY_COMPRESS
] ||
509 new_caps
[MIGRATION_CAPABILITY_XBZRLE
] ||
510 migrate_multifd_compression() ||
513 "Zero copy only available for non-compressed non-TLS multifd migration");
517 if (new_caps
[MIGRATION_CAPABILITY_ZERO_COPY_SEND
]) {
519 "Zero copy currently only available on Linux");
524 if (new_caps
[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT
]) {
525 if (!new_caps
[MIGRATION_CAPABILITY_POSTCOPY_RAM
]) {
526 error_setg(errp
, "Postcopy preempt requires postcopy-ram");
531 * Preempt mode requires urgent pages to be sent in separate
532 * channel, OTOH compression logic will disorder all pages into
533 * different compression channels, which is not compatible with the
534 * preempt assumptions on channel assignments.
536 if (new_caps
[MIGRATION_CAPABILITY_COMPRESS
]) {
537 error_setg(errp
, "Postcopy preempt not compatible with compress");
542 if (new_caps
[MIGRATION_CAPABILITY_MULTIFD
]) {
543 if (new_caps
[MIGRATION_CAPABILITY_COMPRESS
]) {
544 error_setg(errp
, "Multifd is not compatible with compress");
552 bool migrate_cap_set(int cap
, bool value
, Error
**errp
)
554 MigrationState
*s
= migrate_get_current();
555 bool new_caps
[MIGRATION_CAPABILITY__MAX
];
557 if (migration_is_running(s
->state
)) {
558 error_setg(errp
, QERR_MIGRATION_ACTIVE
);
562 memcpy(new_caps
, s
->capabilities
, sizeof(new_caps
));
563 new_caps
[cap
] = value
;
565 if (!migrate_caps_check(s
->capabilities
, new_caps
, errp
)) {
568 s
->capabilities
[cap
] = value
;
572 MigrationCapabilityStatusList
*qmp_query_migrate_capabilities(Error
**errp
)
574 MigrationCapabilityStatusList
*head
= NULL
, **tail
= &head
;
575 MigrationCapabilityStatus
*caps
;
576 MigrationState
*s
= migrate_get_current();
579 for (i
= 0; i
< MIGRATION_CAPABILITY__MAX
; i
++) {
580 #ifndef CONFIG_LIVE_BLOCK_MIGRATION
581 if (i
== MIGRATION_CAPABILITY_BLOCK
) {
585 caps
= g_malloc0(sizeof(*caps
));
586 caps
->capability
= i
;
587 caps
->state
= s
->capabilities
[i
];
588 QAPI_LIST_APPEND(tail
, caps
);
594 void qmp_migrate_set_capabilities(MigrationCapabilityStatusList
*params
,
597 MigrationState
*s
= migrate_get_current();
598 MigrationCapabilityStatusList
*cap
;
599 bool new_caps
[MIGRATION_CAPABILITY__MAX
];
601 if (migration_is_running(s
->state
) || migration_in_colo_state()) {
602 error_setg(errp
, QERR_MIGRATION_ACTIVE
);
606 memcpy(new_caps
, s
->capabilities
, sizeof(new_caps
));
607 for (cap
= params
; cap
; cap
= cap
->next
) {
608 new_caps
[cap
->value
->capability
] = cap
->value
->state
;
611 if (!migrate_caps_check(s
->capabilities
, new_caps
, errp
)) {
615 for (cap
= params
; cap
; cap
= cap
->next
) {
616 s
->capabilities
[cap
->value
->capability
] = cap
->value
->state
;
622 const BitmapMigrationNodeAliasList
*migrate_block_bitmap_mapping(void)
624 MigrationState
*s
= migrate_get_current();
626 return s
->parameters
.block_bitmap_mapping
;
629 bool migrate_has_block_bitmap_mapping(void)
631 MigrationState
*s
= migrate_get_current();
633 return s
->parameters
.has_block_bitmap_mapping
;
636 bool migrate_block_incremental(void)
638 MigrationState
*s
= migrate_get_current();
640 return s
->parameters
.block_incremental
;
643 uint32_t migrate_checkpoint_delay(void)
645 MigrationState
*s
= migrate_get_current();
647 return s
->parameters
.x_checkpoint_delay
;
650 int migrate_compress_level(void)
652 MigrationState
*s
= migrate_get_current();
654 return s
->parameters
.compress_level
;
657 int migrate_compress_threads(void)
659 MigrationState
*s
= migrate_get_current();
661 return s
->parameters
.compress_threads
;
664 int migrate_compress_wait_thread(void)
666 MigrationState
*s
= migrate_get_current();
668 return s
->parameters
.compress_wait_thread
;
671 uint8_t migrate_cpu_throttle_increment(void)
673 MigrationState
*s
= migrate_get_current();
675 return s
->parameters
.cpu_throttle_increment
;
678 uint8_t migrate_cpu_throttle_initial(void)
680 MigrationState
*s
= migrate_get_current();
682 return s
->parameters
.cpu_throttle_initial
;
685 bool migrate_cpu_throttle_tailslow(void)
687 MigrationState
*s
= migrate_get_current();
689 return s
->parameters
.cpu_throttle_tailslow
;
692 int migrate_decompress_threads(void)
694 MigrationState
*s
= migrate_get_current();
696 return s
->parameters
.decompress_threads
;
699 uint64_t migrate_downtime_limit(void)
701 MigrationState
*s
= migrate_get_current();
703 return s
->parameters
.downtime_limit
;
706 uint8_t migrate_max_cpu_throttle(void)
708 MigrationState
*s
= migrate_get_current();
710 return s
->parameters
.max_cpu_throttle
;
713 uint64_t migrate_max_bandwidth(void)
715 MigrationState
*s
= migrate_get_current();
717 return s
->parameters
.max_bandwidth
;
720 uint64_t migrate_max_postcopy_bandwidth(void)
722 MigrationState
*s
= migrate_get_current();
724 return s
->parameters
.max_postcopy_bandwidth
;
727 int migrate_multifd_channels(void)
729 MigrationState
*s
= migrate_get_current();
731 return s
->parameters
.multifd_channels
;
734 MultiFDCompression
migrate_multifd_compression(void)
736 MigrationState
*s
= migrate_get_current();
738 assert(s
->parameters
.multifd_compression
< MULTIFD_COMPRESSION__MAX
);
739 return s
->parameters
.multifd_compression
;
742 int migrate_multifd_zlib_level(void)
744 MigrationState
*s
= migrate_get_current();
746 return s
->parameters
.multifd_zlib_level
;
749 int migrate_multifd_zstd_level(void)
751 MigrationState
*s
= migrate_get_current();
753 return s
->parameters
.multifd_zstd_level
;
756 uint8_t migrate_throttle_trigger_threshold(void)
758 MigrationState
*s
= migrate_get_current();
760 return s
->parameters
.throttle_trigger_threshold
;
763 const char *migrate_tls_authz(void)
765 MigrationState
*s
= migrate_get_current();
767 return s
->parameters
.tls_authz
;
770 const char *migrate_tls_creds(void)
772 MigrationState
*s
= migrate_get_current();
774 return s
->parameters
.tls_creds
;
777 const char *migrate_tls_hostname(void)
779 MigrationState
*s
= migrate_get_current();
781 return s
->parameters
.tls_hostname
;
784 uint64_t migrate_xbzrle_cache_size(void)
786 MigrationState
*s
= migrate_get_current();
788 return s
->parameters
.xbzrle_cache_size
;
791 /* parameter setters */
793 void migrate_set_block_incremental(bool value
)
795 MigrationState
*s
= migrate_get_current();
797 s
->parameters
.block_incremental
= value
;
800 /* parameters helpers */
802 void block_cleanup_parameters(void)
804 MigrationState
*s
= migrate_get_current();
806 if (s
->must_remove_block_options
) {
807 /* setting to false can never fail */
808 migrate_cap_set(MIGRATION_CAPABILITY_BLOCK
, false, &error_abort
);
809 migrate_set_block_incremental(false);
810 s
->must_remove_block_options
= false;
814 AnnounceParameters
*migrate_announce_params(void)
816 static AnnounceParameters ap
;
818 MigrationState
*s
= migrate_get_current();
820 ap
.initial
= s
->parameters
.announce_initial
;
821 ap
.max
= s
->parameters
.announce_max
;
822 ap
.rounds
= s
->parameters
.announce_rounds
;
823 ap
.step
= s
->parameters
.announce_step
;
828 MigrationParameters
*qmp_query_migrate_parameters(Error
**errp
)
830 MigrationParameters
*params
;
831 MigrationState
*s
= migrate_get_current();
833 /* TODO use QAPI_CLONE() instead of duplicating it inline */
834 params
= g_malloc0(sizeof(*params
));
835 params
->has_compress_level
= true;
836 params
->compress_level
= s
->parameters
.compress_level
;
837 params
->has_compress_threads
= true;
838 params
->compress_threads
= s
->parameters
.compress_threads
;
839 params
->has_compress_wait_thread
= true;
840 params
->compress_wait_thread
= s
->parameters
.compress_wait_thread
;
841 params
->has_decompress_threads
= true;
842 params
->decompress_threads
= s
->parameters
.decompress_threads
;
843 params
->has_throttle_trigger_threshold
= true;
844 params
->throttle_trigger_threshold
= s
->parameters
.throttle_trigger_threshold
;
845 params
->has_cpu_throttle_initial
= true;
846 params
->cpu_throttle_initial
= s
->parameters
.cpu_throttle_initial
;
847 params
->has_cpu_throttle_increment
= true;
848 params
->cpu_throttle_increment
= s
->parameters
.cpu_throttle_increment
;
849 params
->has_cpu_throttle_tailslow
= true;
850 params
->cpu_throttle_tailslow
= s
->parameters
.cpu_throttle_tailslow
;
851 params
->tls_creds
= g_strdup(s
->parameters
.tls_creds
);
852 params
->tls_hostname
= g_strdup(s
->parameters
.tls_hostname
);
853 params
->tls_authz
= g_strdup(s
->parameters
.tls_authz
?
854 s
->parameters
.tls_authz
: "");
855 params
->has_max_bandwidth
= true;
856 params
->max_bandwidth
= s
->parameters
.max_bandwidth
;
857 params
->has_downtime_limit
= true;
858 params
->downtime_limit
= s
->parameters
.downtime_limit
;
859 params
->has_x_checkpoint_delay
= true;
860 params
->x_checkpoint_delay
= s
->parameters
.x_checkpoint_delay
;
861 params
->has_block_incremental
= true;
862 params
->block_incremental
= s
->parameters
.block_incremental
;
863 params
->has_multifd_channels
= true;
864 params
->multifd_channels
= s
->parameters
.multifd_channels
;
865 params
->has_multifd_compression
= true;
866 params
->multifd_compression
= s
->parameters
.multifd_compression
;
867 params
->has_multifd_zlib_level
= true;
868 params
->multifd_zlib_level
= s
->parameters
.multifd_zlib_level
;
869 params
->has_multifd_zstd_level
= true;
870 params
->multifd_zstd_level
= s
->parameters
.multifd_zstd_level
;
871 params
->has_xbzrle_cache_size
= true;
872 params
->xbzrle_cache_size
= s
->parameters
.xbzrle_cache_size
;
873 params
->has_max_postcopy_bandwidth
= true;
874 params
->max_postcopy_bandwidth
= s
->parameters
.max_postcopy_bandwidth
;
875 params
->has_max_cpu_throttle
= true;
876 params
->max_cpu_throttle
= s
->parameters
.max_cpu_throttle
;
877 params
->has_announce_initial
= true;
878 params
->announce_initial
= s
->parameters
.announce_initial
;
879 params
->has_announce_max
= true;
880 params
->announce_max
= s
->parameters
.announce_max
;
881 params
->has_announce_rounds
= true;
882 params
->announce_rounds
= s
->parameters
.announce_rounds
;
883 params
->has_announce_step
= true;
884 params
->announce_step
= s
->parameters
.announce_step
;
886 if (s
->parameters
.has_block_bitmap_mapping
) {
887 params
->has_block_bitmap_mapping
= true;
888 params
->block_bitmap_mapping
=
889 QAPI_CLONE(BitmapMigrationNodeAliasList
,
890 s
->parameters
.block_bitmap_mapping
);
896 void migrate_params_init(MigrationParameters
*params
)
898 params
->tls_hostname
= g_strdup("");
899 params
->tls_creds
= g_strdup("");
901 /* Set has_* up only for parameter checks */
902 params
->has_compress_level
= true;
903 params
->has_compress_threads
= true;
904 params
->has_compress_wait_thread
= true;
905 params
->has_decompress_threads
= true;
906 params
->has_throttle_trigger_threshold
= true;
907 params
->has_cpu_throttle_initial
= true;
908 params
->has_cpu_throttle_increment
= true;
909 params
->has_cpu_throttle_tailslow
= true;
910 params
->has_max_bandwidth
= true;
911 params
->has_downtime_limit
= true;
912 params
->has_x_checkpoint_delay
= true;
913 params
->has_block_incremental
= true;
914 params
->has_multifd_channels
= true;
915 params
->has_multifd_compression
= true;
916 params
->has_multifd_zlib_level
= true;
917 params
->has_multifd_zstd_level
= true;
918 params
->has_xbzrle_cache_size
= true;
919 params
->has_max_postcopy_bandwidth
= true;
920 params
->has_max_cpu_throttle
= true;
921 params
->has_announce_initial
= true;
922 params
->has_announce_max
= true;
923 params
->has_announce_rounds
= true;
924 params
->has_announce_step
= true;
928 * Check whether the parameters are valid. Error will be put into errp
929 * (if provided). Return true if valid, otherwise false.
931 bool migrate_params_check(MigrationParameters
*params
, Error
**errp
)
933 if (params
->has_compress_level
&&
934 (params
->compress_level
> 9)) {
935 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
, "compress_level",
936 "a value between 0 and 9");
940 if (params
->has_compress_threads
&& (params
->compress_threads
< 1)) {
941 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
943 "a value between 1 and 255");
947 if (params
->has_decompress_threads
&& (params
->decompress_threads
< 1)) {
948 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
949 "decompress_threads",
950 "a value between 1 and 255");
954 if (params
->has_throttle_trigger_threshold
&&
955 (params
->throttle_trigger_threshold
< 1 ||
956 params
->throttle_trigger_threshold
> 100)) {
957 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
958 "throttle_trigger_threshold",
959 "an integer in the range of 1 to 100");
963 if (params
->has_cpu_throttle_initial
&&
964 (params
->cpu_throttle_initial
< 1 ||
965 params
->cpu_throttle_initial
> 99)) {
966 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
967 "cpu_throttle_initial",
968 "an integer in the range of 1 to 99");
972 if (params
->has_cpu_throttle_increment
&&
973 (params
->cpu_throttle_increment
< 1 ||
974 params
->cpu_throttle_increment
> 99)) {
975 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
976 "cpu_throttle_increment",
977 "an integer in the range of 1 to 99");
981 if (params
->has_max_bandwidth
&& (params
->max_bandwidth
> SIZE_MAX
)) {
982 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
984 "an integer in the range of 0 to "stringify(SIZE_MAX
)
989 if (params
->has_downtime_limit
&&
990 (params
->downtime_limit
> MAX_MIGRATE_DOWNTIME
)) {
991 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
993 "an integer in the range of 0 to "
994 stringify(MAX_MIGRATE_DOWNTIME
)" ms");
998 /* x_checkpoint_delay is now always positive */
1000 if (params
->has_multifd_channels
&& (params
->multifd_channels
< 1)) {
1001 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1003 "a value between 1 and 255");
1007 if (params
->has_multifd_zlib_level
&&
1008 (params
->multifd_zlib_level
> 9)) {
1009 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
, "multifd_zlib_level",
1010 "a value between 0 and 9");
1014 if (params
->has_multifd_zstd_level
&&
1015 (params
->multifd_zstd_level
> 20)) {
1016 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
, "multifd_zstd_level",
1017 "a value between 0 and 20");
1021 if (params
->has_xbzrle_cache_size
&&
1022 (params
->xbzrle_cache_size
< qemu_target_page_size() ||
1023 !is_power_of_2(params
->xbzrle_cache_size
))) {
1024 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1025 "xbzrle_cache_size",
1026 "a power of two no less than the target page size");
1030 if (params
->has_max_cpu_throttle
&&
1031 (params
->max_cpu_throttle
< params
->cpu_throttle_initial
||
1032 params
->max_cpu_throttle
> 99)) {
1033 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1035 "an integer in the range of cpu_throttle_initial to 99");
1039 if (params
->has_announce_initial
&&
1040 params
->announce_initial
> 100000) {
1041 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1043 "a value between 0 and 100000");
1046 if (params
->has_announce_max
&&
1047 params
->announce_max
> 100000) {
1048 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1050 "a value between 0 and 100000");
1053 if (params
->has_announce_rounds
&&
1054 params
->announce_rounds
> 1000) {
1055 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1057 "a value between 0 and 1000");
1060 if (params
->has_announce_step
&&
1061 (params
->announce_step
< 1 ||
1062 params
->announce_step
> 10000)) {
1063 error_setg(errp
, QERR_INVALID_PARAMETER_VALUE
,
1065 "a value between 0 and 10000");
1069 if (params
->has_block_bitmap_mapping
&&
1070 !check_dirty_bitmap_mig_alias_map(params
->block_bitmap_mapping
, errp
)) {
1071 error_prepend(errp
, "Invalid mapping given for block-bitmap-mapping: ");
1076 if (migrate_zero_copy_send() &&
1077 ((params
->has_multifd_compression
&& params
->multifd_compression
) ||
1078 (params
->tls_creds
&& *params
->tls_creds
))) {
1080 "Zero copy only available for non-compressed non-TLS multifd migration");
1088 static void migrate_params_test_apply(MigrateSetParameters
*params
,
1089 MigrationParameters
*dest
)
1091 *dest
= migrate_get_current()->parameters
;
1093 /* TODO use QAPI_CLONE() instead of duplicating it inline */
1095 if (params
->has_compress_level
) {
1096 dest
->compress_level
= params
->compress_level
;
1099 if (params
->has_compress_threads
) {
1100 dest
->compress_threads
= params
->compress_threads
;
1103 if (params
->has_compress_wait_thread
) {
1104 dest
->compress_wait_thread
= params
->compress_wait_thread
;
1107 if (params
->has_decompress_threads
) {
1108 dest
->decompress_threads
= params
->decompress_threads
;
1111 if (params
->has_throttle_trigger_threshold
) {
1112 dest
->throttle_trigger_threshold
= params
->throttle_trigger_threshold
;
1115 if (params
->has_cpu_throttle_initial
) {
1116 dest
->cpu_throttle_initial
= params
->cpu_throttle_initial
;
1119 if (params
->has_cpu_throttle_increment
) {
1120 dest
->cpu_throttle_increment
= params
->cpu_throttle_increment
;
1123 if (params
->has_cpu_throttle_tailslow
) {
1124 dest
->cpu_throttle_tailslow
= params
->cpu_throttle_tailslow
;
1127 if (params
->tls_creds
) {
1128 assert(params
->tls_creds
->type
== QTYPE_QSTRING
);
1129 dest
->tls_creds
= params
->tls_creds
->u
.s
;
1132 if (params
->tls_hostname
) {
1133 assert(params
->tls_hostname
->type
== QTYPE_QSTRING
);
1134 dest
->tls_hostname
= params
->tls_hostname
->u
.s
;
1137 if (params
->has_max_bandwidth
) {
1138 dest
->max_bandwidth
= params
->max_bandwidth
;
1141 if (params
->has_downtime_limit
) {
1142 dest
->downtime_limit
= params
->downtime_limit
;
1145 if (params
->has_x_checkpoint_delay
) {
1146 dest
->x_checkpoint_delay
= params
->x_checkpoint_delay
;
1149 if (params
->has_block_incremental
) {
1150 dest
->block_incremental
= params
->block_incremental
;
1152 if (params
->has_multifd_channels
) {
1153 dest
->multifd_channels
= params
->multifd_channels
;
1155 if (params
->has_multifd_compression
) {
1156 dest
->multifd_compression
= params
->multifd_compression
;
1158 if (params
->has_xbzrle_cache_size
) {
1159 dest
->xbzrle_cache_size
= params
->xbzrle_cache_size
;
1161 if (params
->has_max_postcopy_bandwidth
) {
1162 dest
->max_postcopy_bandwidth
= params
->max_postcopy_bandwidth
;
1164 if (params
->has_max_cpu_throttle
) {
1165 dest
->max_cpu_throttle
= params
->max_cpu_throttle
;
1167 if (params
->has_announce_initial
) {
1168 dest
->announce_initial
= params
->announce_initial
;
1170 if (params
->has_announce_max
) {
1171 dest
->announce_max
= params
->announce_max
;
1173 if (params
->has_announce_rounds
) {
1174 dest
->announce_rounds
= params
->announce_rounds
;
1176 if (params
->has_announce_step
) {
1177 dest
->announce_step
= params
->announce_step
;
1180 if (params
->has_block_bitmap_mapping
) {
1181 dest
->has_block_bitmap_mapping
= true;
1182 dest
->block_bitmap_mapping
= params
->block_bitmap_mapping
;
1186 static void migrate_params_apply(MigrateSetParameters
*params
, Error
**errp
)
1188 MigrationState
*s
= migrate_get_current();
1190 /* TODO use QAPI_CLONE() instead of duplicating it inline */
1192 if (params
->has_compress_level
) {
1193 s
->parameters
.compress_level
= params
->compress_level
;
1196 if (params
->has_compress_threads
) {
1197 s
->parameters
.compress_threads
= params
->compress_threads
;
1200 if (params
->has_compress_wait_thread
) {
1201 s
->parameters
.compress_wait_thread
= params
->compress_wait_thread
;
1204 if (params
->has_decompress_threads
) {
1205 s
->parameters
.decompress_threads
= params
->decompress_threads
;
1208 if (params
->has_throttle_trigger_threshold
) {
1209 s
->parameters
.throttle_trigger_threshold
= params
->throttle_trigger_threshold
;
1212 if (params
->has_cpu_throttle_initial
) {
1213 s
->parameters
.cpu_throttle_initial
= params
->cpu_throttle_initial
;
1216 if (params
->has_cpu_throttle_increment
) {
1217 s
->parameters
.cpu_throttle_increment
= params
->cpu_throttle_increment
;
1220 if (params
->has_cpu_throttle_tailslow
) {
1221 s
->parameters
.cpu_throttle_tailslow
= params
->cpu_throttle_tailslow
;
1224 if (params
->tls_creds
) {
1225 g_free(s
->parameters
.tls_creds
);
1226 assert(params
->tls_creds
->type
== QTYPE_QSTRING
);
1227 s
->parameters
.tls_creds
= g_strdup(params
->tls_creds
->u
.s
);
1230 if (params
->tls_hostname
) {
1231 g_free(s
->parameters
.tls_hostname
);
1232 assert(params
->tls_hostname
->type
== QTYPE_QSTRING
);
1233 s
->parameters
.tls_hostname
= g_strdup(params
->tls_hostname
->u
.s
);
1236 if (params
->tls_authz
) {
1237 g_free(s
->parameters
.tls_authz
);
1238 assert(params
->tls_authz
->type
== QTYPE_QSTRING
);
1239 s
->parameters
.tls_authz
= g_strdup(params
->tls_authz
->u
.s
);
1242 if (params
->has_max_bandwidth
) {
1243 s
->parameters
.max_bandwidth
= params
->max_bandwidth
;
1244 if (s
->to_dst_file
&& !migration_in_postcopy()) {
1245 qemu_file_set_rate_limit(s
->to_dst_file
,
1246 s
->parameters
.max_bandwidth
);
1250 if (params
->has_downtime_limit
) {
1251 s
->parameters
.downtime_limit
= params
->downtime_limit
;
1254 if (params
->has_x_checkpoint_delay
) {
1255 s
->parameters
.x_checkpoint_delay
= params
->x_checkpoint_delay
;
1256 colo_checkpoint_delay_set();
1259 if (params
->has_block_incremental
) {
1260 s
->parameters
.block_incremental
= params
->block_incremental
;
1262 if (params
->has_multifd_channels
) {
1263 s
->parameters
.multifd_channels
= params
->multifd_channels
;
1265 if (params
->has_multifd_compression
) {
1266 s
->parameters
.multifd_compression
= params
->multifd_compression
;
1268 if (params
->has_xbzrle_cache_size
) {
1269 s
->parameters
.xbzrle_cache_size
= params
->xbzrle_cache_size
;
1270 xbzrle_cache_resize(params
->xbzrle_cache_size
, errp
);
1272 if (params
->has_max_postcopy_bandwidth
) {
1273 s
->parameters
.max_postcopy_bandwidth
= params
->max_postcopy_bandwidth
;
1274 if (s
->to_dst_file
&& migration_in_postcopy()) {
1275 qemu_file_set_rate_limit(s
->to_dst_file
,
1276 s
->parameters
.max_postcopy_bandwidth
);
1279 if (params
->has_max_cpu_throttle
) {
1280 s
->parameters
.max_cpu_throttle
= params
->max_cpu_throttle
;
1282 if (params
->has_announce_initial
) {
1283 s
->parameters
.announce_initial
= params
->announce_initial
;
1285 if (params
->has_announce_max
) {
1286 s
->parameters
.announce_max
= params
->announce_max
;
1288 if (params
->has_announce_rounds
) {
1289 s
->parameters
.announce_rounds
= params
->announce_rounds
;
1291 if (params
->has_announce_step
) {
1292 s
->parameters
.announce_step
= params
->announce_step
;
1295 if (params
->has_block_bitmap_mapping
) {
1296 qapi_free_BitmapMigrationNodeAliasList(
1297 s
->parameters
.block_bitmap_mapping
);
1299 s
->parameters
.has_block_bitmap_mapping
= true;
1300 s
->parameters
.block_bitmap_mapping
=
1301 QAPI_CLONE(BitmapMigrationNodeAliasList
,
1302 params
->block_bitmap_mapping
);
1306 void qmp_migrate_set_parameters(MigrateSetParameters
*params
, Error
**errp
)
1308 MigrationParameters tmp
;
1310 /* TODO Rewrite "" to null instead */
1311 if (params
->tls_creds
1312 && params
->tls_creds
->type
== QTYPE_QNULL
) {
1313 qobject_unref(params
->tls_creds
->u
.n
);
1314 params
->tls_creds
->type
= QTYPE_QSTRING
;
1315 params
->tls_creds
->u
.s
= strdup("");
1317 /* TODO Rewrite "" to null instead */
1318 if (params
->tls_hostname
1319 && params
->tls_hostname
->type
== QTYPE_QNULL
) {
1320 qobject_unref(params
->tls_hostname
->u
.n
);
1321 params
->tls_hostname
->type
= QTYPE_QSTRING
;
1322 params
->tls_hostname
->u
.s
= strdup("");
1325 migrate_params_test_apply(params
, &tmp
);
1327 if (!migrate_params_check(&tmp
, errp
)) {
1328 /* Invalid parameter */
1332 migrate_params_apply(params
, errp
);