| 1 | /* |
| 2 | * HMP commands related to migration |
| 3 | * |
| 4 | * Copyright IBM, Corp. 2011 |
| 5 | * |
| 6 | * Authors: |
| 7 | * Anthony Liguori <aliguori@us.ibm.com> |
| 8 | * |
| 9 | * This work is licensed under the terms of the GNU GPL, version 2. See |
| 10 | * the COPYING file in the top-level directory. |
| 11 | * |
| 12 | * Contributions after 2012-01-13 are licensed under the terms of the |
| 13 | * GNU GPL, version 2 or (at your option) any later version. |
| 14 | */ |
| 15 | |
| 16 | #include "qemu/osdep.h" |
| 17 | #include "block/qapi.h" |
| 18 | #include "block/block-global-state.h" |
| 19 | #include "migration/snapshot.h" |
| 20 | #include "monitor/hmp.h" |
| 21 | #include "monitor/hmp-completion.h" |
| 22 | #include "monitor/monitor.h" |
| 23 | #include "monitor/monitor-internal.h" |
| 24 | #include "monitor/monitor-hmp-internal.h" |
| 25 | #include "qapi/error.h" |
| 26 | #include "qapi/qapi-commands-migration.h" |
| 27 | #include "qapi/qapi-visit-migration.h" |
| 28 | #include "qobject/qdict.h" |
| 29 | #include "qapi/string-input-visitor.h" |
| 30 | #include "qapi/string-output-visitor.h" |
| 31 | #include "qemu/cutils.h" |
| 32 | #include "qemu/error-report.h" |
| 33 | #include "qemu/sockets.h" |
| 34 | #include "system/runstate.h" |
| 35 | #include "ui/qemu-spice.h" |
| 36 | #include "system/system.h" |
| 37 | #include "options.h" |
| 38 | #include "migration.h" |
| 39 | |
| 40 | static void migration_global_dump(MonitorHMP *hmp) |
| 41 | { |
| 42 | MigrationState *ms = migrate_get_current(); |
| 43 | |
| 44 | monitor_hmp_printf(hmp, "Globals:\n"); |
| 45 | monitor_hmp_printf(hmp, " store-global-state: %s\n", |
| 46 | ms->store_global_state ? "on" : "off"); |
| 47 | monitor_hmp_printf(hmp, " only-migratable: %s\n", |
| 48 | only_migratable ? "on" : "off"); |
| 49 | monitor_hmp_printf(hmp, " send-configuration: %s\n", |
| 50 | ms->send_configuration ? "on" : "off"); |
| 51 | monitor_hmp_printf(hmp, " send-section-footer: %s\n", |
| 52 | ms->send_section_footer ? "on" : "off"); |
| 53 | monitor_hmp_printf(hmp, " send-switchover-start: %s\n", |
| 54 | ms->send_switchover_start ? "on" : "off"); |
| 55 | monitor_hmp_printf(hmp, " clear-bitmap-shift: %u\n", |
| 56 | ms->clear_bitmap_shift); |
| 57 | } |
| 58 | |
| 59 | static const gchar *format_time_str(uint64_t us) |
| 60 | { |
| 61 | const char *units[] = {"us", "ms", "sec"}; |
| 62 | int index = 0; |
| 63 | |
| 64 | while (us >= 1000 && index + 1 < ARRAY_SIZE(units)) { |
| 65 | us /= 1000; |
| 66 | index++; |
| 67 | } |
| 68 | |
| 69 | return g_strdup_printf("%"PRIu64" %s", us, units[index]); |
| 70 | } |
| 71 | |
| 72 | static void migration_dump_blocktime(MonitorHMP *hmp, MigrationInfo *info) |
| 73 | { |
| 74 | if (info->has_postcopy_blocktime) { |
| 75 | monitor_hmp_printf(hmp, "Postcopy Blocktime (ms): %" PRIu32 "\n", |
| 76 | info->postcopy_blocktime); |
| 77 | } |
| 78 | |
| 79 | if (info->has_postcopy_vcpu_blocktime) { |
| 80 | uint32List *item = info->postcopy_vcpu_blocktime; |
| 81 | const char *sep = ""; |
| 82 | int count = 0; |
| 83 | |
| 84 | monitor_hmp_printf(hmp, "Postcopy vCPU Blocktime (ms):\n ["); |
| 85 | |
| 86 | while (item) { |
| 87 | monitor_hmp_printf(hmp, "%s%"PRIu32, sep, item->value); |
| 88 | item = item->next; |
| 89 | /* Each line 10 vcpu results, newline if there's more */ |
| 90 | sep = ((++count % 10 == 0) && item) ? ",\n " : ", "; |
| 91 | } |
| 92 | monitor_hmp_printf(hmp, "]\n"); |
| 93 | } |
| 94 | |
| 95 | if (info->has_postcopy_latency) { |
| 96 | monitor_hmp_printf(hmp, "Postcopy Latency (ns): %" PRIu64 "\n", |
| 97 | info->postcopy_latency); |
| 98 | } |
| 99 | |
| 100 | if (info->has_postcopy_non_vcpu_latency) { |
| 101 | monitor_hmp_printf(hmp, "Postcopy non-vCPU Latency (ns): %" PRIu64 "\n", |
| 102 | info->postcopy_non_vcpu_latency); |
| 103 | } |
| 104 | |
| 105 | if (info->has_postcopy_vcpu_latency) { |
| 106 | uint64List *item = info->postcopy_vcpu_latency; |
| 107 | const char *sep = ""; |
| 108 | int count = 0; |
| 109 | |
| 110 | monitor_hmp_printf(hmp, "Postcopy vCPU Latencies (ns):\n ["); |
| 111 | |
| 112 | while (item) { |
| 113 | monitor_hmp_printf(hmp, "%s%"PRIu64, sep, item->value); |
| 114 | item = item->next; |
| 115 | /* Each line 10 vcpu results, newline if there's more */ |
| 116 | sep = ((++count % 10 == 0) && item) ? ",\n " : ", "; |
| 117 | } |
| 118 | monitor_hmp_printf(hmp, "]\n"); |
| 119 | } |
| 120 | |
| 121 | if (info->has_postcopy_latency_dist) { |
| 122 | uint64List *item = info->postcopy_latency_dist; |
| 123 | int count = 0; |
| 124 | |
| 125 | monitor_hmp_printf(hmp, "Postcopy Latency Distribution:\n"); |
| 126 | |
| 127 | while (item) { |
| 128 | g_autofree const gchar *from = format_time_str(1UL << count); |
| 129 | g_autofree const gchar *to = format_time_str(1UL << (count + 1)); |
| 130 | |
| 131 | monitor_hmp_printf(hmp, " [ %8s - %8s ]: %10"PRIu64"\n", |
| 132 | from, to, item->value); |
| 133 | item = item->next; |
| 134 | count++; |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | void hmp_info_migrate(MonitorHMP *hmp, const QDict *qdict) |
| 140 | { |
| 141 | bool show_all = qdict_get_try_bool(qdict, "all", false); |
| 142 | MigrationInfo *info; |
| 143 | |
| 144 | info = qmp_query_migrate(NULL); |
| 145 | |
| 146 | if (info->blocked_reasons) { |
| 147 | strList *reasons = info->blocked_reasons; |
| 148 | monitor_hmp_printf(hmp, "Outgoing migration blocked:\n"); |
| 149 | while (reasons) { |
| 150 | monitor_hmp_printf(hmp, " %s\n", reasons->value); |
| 151 | reasons = reasons->next; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | if (info->has_status) { |
| 156 | monitor_hmp_printf(hmp, "Status: \t\t%s", |
| 157 | MigrationStatus_str(info->status)); |
| 158 | if ((info->status == MIGRATION_STATUS_FAILED || |
| 159 | info->status == MIGRATION_STATUS_POSTCOPY_PAUSED) && |
| 160 | info->error_desc) { |
| 161 | monitor_hmp_printf(hmp, " (%s)\n", info->error_desc); |
| 162 | } else { |
| 163 | monitor_hmp_printf(hmp, "\n"); |
| 164 | } |
| 165 | |
| 166 | if (info->total_time) { |
| 167 | monitor_hmp_printf(hmp, "Time (ms): \t\ttotal=%" PRIu64, |
| 168 | info->total_time); |
| 169 | if (info->has_setup_time) { |
| 170 | monitor_hmp_printf(hmp, ", setup=%" PRIu64, |
| 171 | info->setup_time); |
| 172 | } |
| 173 | if (info->has_expected_downtime) { |
| 174 | monitor_hmp_printf(hmp, ", exp_down=%" PRIu64, |
| 175 | info->expected_downtime); |
| 176 | } |
| 177 | if (info->has_downtime) { |
| 178 | monitor_hmp_printf(hmp, ", down=%" PRIu64, |
| 179 | info->downtime); |
| 180 | } |
| 181 | monitor_hmp_printf(hmp, "\n"); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | if (info->has_remaining) { |
| 186 | g_autofree char *remaining = size_to_str(info->remaining); |
| 187 | monitor_hmp_printf(hmp, "Remaining: \t\t%s\n", remaining); |
| 188 | } |
| 189 | |
| 190 | if (info->has_socket_address) { |
| 191 | SocketAddressList *addr; |
| 192 | |
| 193 | monitor_hmp_printf(hmp, "Sockets: [\n"); |
| 194 | |
| 195 | for (addr = info->socket_address; addr; addr = addr->next) { |
| 196 | char *s = socket_uri(addr->value); |
| 197 | monitor_hmp_printf(hmp, "\t%s\n", s); |
| 198 | g_free(s); |
| 199 | } |
| 200 | monitor_hmp_printf(hmp, "]\n"); |
| 201 | } |
| 202 | |
| 203 | if (info->ram) { |
| 204 | g_autofree char *str_psize = size_to_str(info->ram->page_size); |
| 205 | g_autofree char *str_total = size_to_str(info->ram->total); |
| 206 | g_autofree char *str_transferred = size_to_str(info->ram->transferred); |
| 207 | g_autofree char *str_remaining = size_to_str(info->ram->remaining); |
| 208 | g_autofree char *str_precopy = size_to_str(info->ram->precopy_bytes); |
| 209 | g_autofree char *str_multifd = size_to_str(info->ram->multifd_bytes); |
| 210 | g_autofree char *str_postcopy = size_to_str(info->ram->postcopy_bytes); |
| 211 | |
| 212 | monitor_hmp_printf(hmp, "RAM info:\n"); |
| 213 | monitor_hmp_printf(hmp, " Throughput (Mbps): \t%0.2f\n", |
| 214 | info->ram->mbps); |
| 215 | monitor_hmp_printf(hmp, " Sizes: \t\tpagesize=%s, total=%s\n", |
| 216 | str_psize, str_total); |
| 217 | monitor_hmp_printf(hmp, " Transfers: \t\ttransferred=%s, remain=%s\n", |
| 218 | str_transferred, str_remaining); |
| 219 | monitor_hmp_printf(hmp, " Channels: \t\tprecopy=%s, " |
| 220 | "multifd=%s, postcopy=%s", |
| 221 | str_precopy, str_multifd, str_postcopy); |
| 222 | |
| 223 | if (info->vfio) { |
| 224 | g_autofree char *str_vfio = size_to_str(info->vfio->transferred); |
| 225 | |
| 226 | monitor_hmp_printf(hmp, ", vfio=%s", str_vfio); |
| 227 | } |
| 228 | monitor_hmp_printf(hmp, "\n"); |
| 229 | |
| 230 | monitor_hmp_printf(hmp, " Page Types: \tnormal=%" PRIu64 |
| 231 | ", zero=%" PRIu64 "\n", |
| 232 | info->ram->normal, info->ram->duplicate); |
| 233 | monitor_hmp_printf(hmp, " Page Rates (pps): \ttransfer=%" PRIu64, |
| 234 | info->ram->pages_per_second); |
| 235 | if (info->ram->dirty_pages_rate) { |
| 236 | monitor_hmp_printf(hmp, ", dirty=%" PRIu64, |
| 237 | info->ram->dirty_pages_rate); |
| 238 | } |
| 239 | monitor_hmp_printf(hmp, "\n"); |
| 240 | |
| 241 | monitor_hmp_printf(hmp, " Others: \t\tdirty_syncs=%" PRIu64, |
| 242 | info->ram->dirty_sync_count); |
| 243 | if (info->ram->postcopy_requests) { |
| 244 | monitor_hmp_printf(hmp, ", postcopy_req=%" PRIu64, |
| 245 | info->ram->postcopy_requests); |
| 246 | } |
| 247 | if (info->ram->downtime_bytes) { |
| 248 | monitor_hmp_printf(hmp, ", downtime_bytes=%" PRIu64, |
| 249 | info->ram->downtime_bytes); |
| 250 | } |
| 251 | if (info->ram->dirty_sync_missed_zero_copy) { |
| 252 | monitor_hmp_printf(hmp, ", zerocopy_fallbacks=%" PRIu64, |
| 253 | info->ram->dirty_sync_missed_zero_copy); |
| 254 | } |
| 255 | monitor_hmp_printf(hmp, "\n"); |
| 256 | } |
| 257 | |
| 258 | if (!show_all) { |
| 259 | goto out; |
| 260 | } |
| 261 | |
| 262 | migration_global_dump(hmp); |
| 263 | |
| 264 | if (info->xbzrle_cache) { |
| 265 | monitor_hmp_printf(hmp, "XBZRLE: size=%" PRIu64 |
| 266 | ", transferred=%" PRIu64 |
| 267 | ", pages=%" PRIu64 |
| 268 | ", miss=%" PRIu64 "\n" |
| 269 | " miss_rate=%0.2f" |
| 270 | ", encode_rate=%0.2f" |
| 271 | ", overflow=%" PRIu64 "\n", |
| 272 | info->xbzrle_cache->cache_size, |
| 273 | info->xbzrle_cache->bytes, |
| 274 | info->xbzrle_cache->pages, |
| 275 | info->xbzrle_cache->cache_miss, |
| 276 | info->xbzrle_cache->cache_miss_rate, |
| 277 | info->xbzrle_cache->encoding_rate, |
| 278 | info->xbzrle_cache->overflow); |
| 279 | } |
| 280 | |
| 281 | if (info->has_cpu_throttle_percentage) { |
| 282 | monitor_hmp_printf(hmp, "CPU Throttle (%%): %" PRIu64 "\n", |
| 283 | info->cpu_throttle_percentage); |
| 284 | } |
| 285 | |
| 286 | if (info->has_dirty_limit_throttle_time_per_round) { |
| 287 | monitor_hmp_printf(hmp, "Dirty-limit Throttle (us): %" PRIu64 "\n", |
| 288 | info->dirty_limit_throttle_time_per_round); |
| 289 | } |
| 290 | |
| 291 | if (info->has_dirty_limit_ring_full_time) { |
| 292 | monitor_hmp_printf(hmp, "Dirty-limit Ring Full (us): %" PRIu64 "\n", |
| 293 | info->dirty_limit_ring_full_time); |
| 294 | } |
| 295 | |
| 296 | migration_dump_blocktime(hmp, info); |
| 297 | out: |
| 298 | qapi_free_MigrationInfo(info); |
| 299 | } |
| 300 | |
| 301 | void hmp_info_migrate_capabilities(MonitorHMP *hmp, const QDict *qdict) |
| 302 | { |
| 303 | MigrationCapabilityStatusList *caps, *cap; |
| 304 | |
| 305 | caps = qmp_query_migrate_capabilities(NULL); |
| 306 | |
| 307 | if (caps) { |
| 308 | for (cap = caps; cap; cap = cap->next) { |
| 309 | monitor_hmp_printf(hmp, "%s: %s\n", |
| 310 | MigrationCapability_str(cap->value->capability), |
| 311 | cap->value->state ? "on" : "off"); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | qapi_free_MigrationCapabilityStatusList(caps); |
| 316 | } |
| 317 | |
| 318 | static void monitor_print_cpr_exec_command(MonitorHMP *hmp, strList *args) |
| 319 | { |
| 320 | monitor_hmp_printf(hmp, "%s:", |
| 321 | MigrationParameter_str(MIGRATION_PARAMETER_CPR_EXEC_COMMAND)); |
| 322 | |
| 323 | while (args) { |
| 324 | monitor_hmp_printf(hmp, " %s", args->value); |
| 325 | args = args->next; |
| 326 | } |
| 327 | monitor_hmp_printf(hmp, "\n"); |
| 328 | } |
| 329 | |
| 330 | void hmp_info_migrate_parameters(MonitorHMP *hmp, const QDict *qdict) |
| 331 | { |
| 332 | MigrationParameters *params; |
| 333 | MigrationState *s = migrate_get_current(); |
| 334 | |
| 335 | params = qmp_query_migrate_parameters(NULL); |
| 336 | |
| 337 | if (params) { |
| 338 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", |
| 339 | MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_INITIAL), |
| 340 | params->announce_initial); |
| 341 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", |
| 342 | MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_MAX), |
| 343 | params->announce_max); |
| 344 | monitor_hmp_printf(hmp, "%s: %" PRIu64 "\n", |
| 345 | MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_ROUNDS), |
| 346 | params->announce_rounds); |
| 347 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", |
| 348 | MigrationParameter_str(MIGRATION_PARAMETER_ANNOUNCE_STEP), |
| 349 | params->announce_step); |
| 350 | assert(params->has_throttle_trigger_threshold); |
| 351 | monitor_hmp_printf(hmp, "%s: %u\n", |
| 352 | MigrationParameter_str(MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD), |
| 353 | params->throttle_trigger_threshold); |
| 354 | assert(params->has_cpu_throttle_initial); |
| 355 | monitor_hmp_printf(hmp, "%s: %u\n", |
| 356 | MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL), |
| 357 | params->cpu_throttle_initial); |
| 358 | assert(params->has_cpu_throttle_increment); |
| 359 | monitor_hmp_printf(hmp, "%s: %u\n", |
| 360 | MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT), |
| 361 | params->cpu_throttle_increment); |
| 362 | assert(params->has_cpu_throttle_tailslow); |
| 363 | monitor_hmp_printf(hmp, "%s: %s\n", |
| 364 | MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_TAILSLOW), |
| 365 | params->cpu_throttle_tailslow ? "on" : "off"); |
| 366 | assert(params->has_max_cpu_throttle); |
| 367 | monitor_hmp_printf(hmp, "%s: %u\n", |
| 368 | MigrationParameter_str(MIGRATION_PARAMETER_MAX_CPU_THROTTLE), |
| 369 | params->max_cpu_throttle); |
| 370 | assert(params->tls_creds); |
| 371 | monitor_hmp_printf(hmp, "%s: '%s'\n", |
| 372 | MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS), |
| 373 | params->tls_creds->u.s); |
| 374 | assert(params->tls_hostname); |
| 375 | monitor_hmp_printf(hmp, "%s: '%s'\n", |
| 376 | MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME), |
| 377 | params->tls_hostname->u.s); |
| 378 | assert(params->tls_authz); |
| 379 | monitor_hmp_printf(hmp, "%s: '%s'\n", |
| 380 | MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ), |
| 381 | params->tls_authz->u.s); |
| 382 | assert(params->has_max_bandwidth); |
| 383 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", |
| 384 | MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH), |
| 385 | params->max_bandwidth); |
| 386 | assert(params->has_avail_switchover_bandwidth); |
| 387 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", |
| 388 | MigrationParameter_str(MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH), |
| 389 | params->avail_switchover_bandwidth); |
| 390 | assert(params->has_max_postcopy_bandwidth); |
| 391 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes/second\n", |
| 392 | MigrationParameter_str(MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWIDTH), |
| 393 | params->max_postcopy_bandwidth); |
| 394 | assert(params->has_downtime_limit); |
| 395 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", |
| 396 | MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT), |
| 397 | params->downtime_limit); |
| 398 | assert(params->has_x_checkpoint_delay); |
| 399 | monitor_hmp_printf(hmp, "%s: %u ms\n", |
| 400 | MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY), |
| 401 | params->x_checkpoint_delay); |
| 402 | monitor_hmp_printf(hmp, "%s: %u\n", |
| 403 | MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_CHANNELS), |
| 404 | params->multifd_channels); |
| 405 | monitor_hmp_printf(hmp, "%s: %s\n", |
| 406 | MigrationParameter_str(MIGRATION_PARAMETER_MULTIFD_COMPRESSION), |
| 407 | MultiFDCompression_str(params->multifd_compression)); |
| 408 | assert(params->has_zero_page_detection); |
| 409 | monitor_hmp_printf(hmp, "%s: %s\n", |
| 410 | MigrationParameter_str(MIGRATION_PARAMETER_ZERO_PAGE_DETECTION), |
| 411 | qapi_enum_lookup(&ZeroPageDetection_lookup, |
| 412 | params->zero_page_detection)); |
| 413 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes\n", |
| 414 | MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE), |
| 415 | params->xbzrle_cache_size); |
| 416 | |
| 417 | if (s->has_block_bitmap_mapping) { |
| 418 | const BitmapMigrationNodeAliasList *bmnal; |
| 419 | |
| 420 | monitor_hmp_printf(hmp, "%s:\n", |
| 421 | MigrationParameter_str( |
| 422 | MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING)); |
| 423 | |
| 424 | for (bmnal = params->block_bitmap_mapping; |
| 425 | bmnal; |
| 426 | bmnal = bmnal->next) |
| 427 | { |
| 428 | const BitmapMigrationNodeAlias *bmna = bmnal->value; |
| 429 | const BitmapMigrationBitmapAliasList *bmbal; |
| 430 | |
| 431 | monitor_hmp_printf(hmp, " '%s' -> '%s'\n", |
| 432 | bmna->node_name, bmna->alias); |
| 433 | |
| 434 | for (bmbal = bmna->bitmaps; bmbal; bmbal = bmbal->next) { |
| 435 | const BitmapMigrationBitmapAlias *bmba = bmbal->value; |
| 436 | |
| 437 | monitor_hmp_printf(hmp, " '%s' -> '%s'\n", |
| 438 | bmba->name, bmba->alias); |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " ms\n", |
| 444 | MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD), |
| 445 | params->x_vcpu_dirty_limit_period); |
| 446 | |
| 447 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " MB/s\n", |
| 448 | MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), |
| 449 | params->vcpu_dirty_limit); |
| 450 | |
| 451 | assert(params->has_mode); |
| 452 | monitor_hmp_printf(hmp, "%s: %s\n", |
| 453 | MigrationParameter_str(MIGRATION_PARAMETER_MODE), |
| 454 | qapi_enum_lookup(&MigMode_lookup, params->mode)); |
| 455 | |
| 456 | if (params->has_direct_io) { |
| 457 | monitor_hmp_printf(hmp, "%s: %s\n", |
| 458 | MigrationParameter_str( |
| 459 | MIGRATION_PARAMETER_DIRECT_IO), |
| 460 | params->direct_io ? "on" : "off"); |
| 461 | } |
| 462 | |
| 463 | if (params->has_x_rdma_chunk_size) { |
| 464 | monitor_hmp_printf(hmp, "%s: %" PRIu64 " bytes\n", |
| 465 | MigrationParameter_str( |
| 466 | MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), |
| 467 | params->x_rdma_chunk_size); |
| 468 | } |
| 469 | |
| 470 | assert(params->has_cpr_exec_command); |
| 471 | monitor_print_cpr_exec_command(hmp, params->cpr_exec_command); |
| 472 | } |
| 473 | |
| 474 | qapi_free_MigrationParameters(params); |
| 475 | } |
| 476 | |
| 477 | void hmp_loadvm(MonitorHMP *hmp, const QDict *qdict) |
| 478 | { |
| 479 | RunState saved_state = runstate_get(); |
| 480 | |
| 481 | const char *name = qdict_get_str(qdict, "name"); |
| 482 | Error *err = NULL; |
| 483 | |
| 484 | vm_stop(RUN_STATE_RESTORE_VM); |
| 485 | |
| 486 | if (load_snapshot(name, NULL, false, NULL, &err)) { |
| 487 | load_snapshot_resume(saved_state); |
| 488 | } |
| 489 | |
| 490 | hmp_handle_error(hmp, err); |
| 491 | } |
| 492 | |
| 493 | void hmp_savevm(MonitorHMP *hmp, const QDict *qdict) |
| 494 | { |
| 495 | Error *err = NULL; |
| 496 | |
| 497 | save_snapshot(qdict_get_try_str(qdict, "name"), |
| 498 | true, NULL, false, NULL, &err); |
| 499 | hmp_handle_error(hmp, err); |
| 500 | } |
| 501 | |
| 502 | void hmp_delvm(MonitorHMP *hmp, const QDict *qdict) |
| 503 | { |
| 504 | Error *err = NULL; |
| 505 | const char *name = qdict_get_str(qdict, "name"); |
| 506 | |
| 507 | delete_snapshot(name, false, NULL, &err); |
| 508 | hmp_handle_error(hmp, err); |
| 509 | } |
| 510 | |
| 511 | void hmp_migrate_cancel(MonitorHMP *hmp, const QDict *qdict) |
| 512 | { |
| 513 | qmp_migrate_cancel(NULL); |
| 514 | } |
| 515 | |
| 516 | void hmp_migrate_continue(MonitorHMP *hmp, const QDict *qdict) |
| 517 | { |
| 518 | Error *err = NULL; |
| 519 | const char *state = qdict_get_str(qdict, "state"); |
| 520 | int val = qapi_enum_parse(&MigrationStatus_lookup, state, -1, &err); |
| 521 | |
| 522 | if (val >= 0) { |
| 523 | qmp_migrate_continue(val, &err); |
| 524 | } |
| 525 | |
| 526 | hmp_handle_error(hmp, err); |
| 527 | } |
| 528 | |
| 529 | void hmp_migrate_incoming(MonitorHMP *hmp, const QDict *qdict) |
| 530 | { |
| 531 | Error *err = NULL; |
| 532 | const char *uri = qdict_get_str(qdict, "uri"); |
| 533 | MigrationChannelList *caps = NULL; |
| 534 | g_autoptr(MigrationChannel) channel = NULL; |
| 535 | |
| 536 | if (!migrate_uri_parse(uri, &channel, &err)) { |
| 537 | goto end; |
| 538 | } |
| 539 | QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); |
| 540 | |
| 541 | qmp_migrate_incoming(NULL, true, caps, true, false, &err); |
| 542 | qapi_free_MigrationChannelList(caps); |
| 543 | |
| 544 | end: |
| 545 | hmp_handle_error(hmp, err); |
| 546 | } |
| 547 | |
| 548 | void hmp_migrate_recover(MonitorHMP *hmp, const QDict *qdict) |
| 549 | { |
| 550 | Error *err = NULL; |
| 551 | const char *uri = qdict_get_str(qdict, "uri"); |
| 552 | |
| 553 | qmp_migrate_recover(uri, &err); |
| 554 | |
| 555 | hmp_handle_error(hmp, err); |
| 556 | } |
| 557 | |
| 558 | void hmp_migrate_pause(MonitorHMP *hmp, const QDict *qdict) |
| 559 | { |
| 560 | Error *err = NULL; |
| 561 | |
| 562 | qmp_migrate_pause(&err); |
| 563 | |
| 564 | hmp_handle_error(hmp, err); |
| 565 | } |
| 566 | |
| 567 | |
| 568 | void hmp_migrate_set_capability(MonitorHMP *hmp, const QDict *qdict) |
| 569 | { |
| 570 | const char *cap = qdict_get_str(qdict, "capability"); |
| 571 | bool state = qdict_get_bool(qdict, "state"); |
| 572 | Error *err = NULL; |
| 573 | MigrationCapabilityStatusList *caps = NULL; |
| 574 | MigrationCapabilityStatus *value; |
| 575 | int val; |
| 576 | |
| 577 | val = qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err); |
| 578 | if (val < 0) { |
| 579 | goto end; |
| 580 | } |
| 581 | |
| 582 | value = g_malloc0(sizeof(*value)); |
| 583 | value->capability = val; |
| 584 | value->state = state; |
| 585 | QAPI_LIST_PREPEND(caps, value); |
| 586 | qmp_migrate_set_capabilities(caps, &err); |
| 587 | qapi_free_MigrationCapabilityStatusList(caps); |
| 588 | |
| 589 | end: |
| 590 | hmp_handle_error(hmp, err); |
| 591 | } |
| 592 | |
| 593 | void hmp_migrate_set_parameter(MonitorHMP *hmp, const QDict *qdict) |
| 594 | { |
| 595 | const char *param = qdict_get_str(qdict, "parameter"); |
| 596 | const char *valuestr = qdict_get_str(qdict, "value"); |
| 597 | Visitor *v = string_input_visitor_new(valuestr); |
| 598 | MigrationParameters *p = g_new0(MigrationParameters, 1); |
| 599 | uint64_t valuebw = 0; |
| 600 | uint64_t cache_size; |
| 601 | Error *err = NULL; |
| 602 | int val, ret; |
| 603 | |
| 604 | val = qapi_enum_parse(&MigrationParameter_lookup, param, -1, &err); |
| 605 | if (val < 0) { |
| 606 | goto cleanup; |
| 607 | } |
| 608 | |
| 609 | switch (val) { |
| 610 | case MIGRATION_PARAMETER_THROTTLE_TRIGGER_THRESHOLD: |
| 611 | p->has_throttle_trigger_threshold = true; |
| 612 | visit_type_uint8(v, param, &p->throttle_trigger_threshold, &err); |
| 613 | break; |
| 614 | case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL: |
| 615 | p->has_cpu_throttle_initial = true; |
| 616 | visit_type_uint8(v, param, &p->cpu_throttle_initial, &err); |
| 617 | break; |
| 618 | case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT: |
| 619 | p->has_cpu_throttle_increment = true; |
| 620 | visit_type_uint8(v, param, &p->cpu_throttle_increment, &err); |
| 621 | break; |
| 622 | case MIGRATION_PARAMETER_CPU_THROTTLE_TAILSLOW: |
| 623 | p->has_cpu_throttle_tailslow = true; |
| 624 | visit_type_bool(v, param, &p->cpu_throttle_tailslow, &err); |
| 625 | break; |
| 626 | case MIGRATION_PARAMETER_MAX_CPU_THROTTLE: |
| 627 | p->has_max_cpu_throttle = true; |
| 628 | visit_type_uint8(v, param, &p->max_cpu_throttle, &err); |
| 629 | break; |
| 630 | case MIGRATION_PARAMETER_TLS_CREDS: |
| 631 | p->tls_creds = g_new0(StrOrNull, 1); |
| 632 | p->tls_creds->type = QTYPE_QSTRING; |
| 633 | visit_type_str(v, param, &p->tls_creds->u.s, &err); |
| 634 | break; |
| 635 | case MIGRATION_PARAMETER_TLS_HOSTNAME: |
| 636 | p->tls_hostname = g_new0(StrOrNull, 1); |
| 637 | p->tls_hostname->type = QTYPE_QSTRING; |
| 638 | visit_type_str(v, param, &p->tls_hostname->u.s, &err); |
| 639 | break; |
| 640 | case MIGRATION_PARAMETER_TLS_AUTHZ: |
| 641 | p->tls_authz = g_new0(StrOrNull, 1); |
| 642 | p->tls_authz->type = QTYPE_QSTRING; |
| 643 | visit_type_str(v, param, &p->tls_authz->u.s, &err); |
| 644 | break; |
| 645 | case MIGRATION_PARAMETER_MAX_BANDWIDTH: |
| 646 | p->has_max_bandwidth = true; |
| 647 | /* |
| 648 | * Can't use visit_type_size() here, because it |
| 649 | * defaults to Bytes rather than Mebibytes. |
| 650 | */ |
| 651 | ret = qemu_strtosz_MiB(valuestr, NULL, &valuebw); |
| 652 | if (ret < 0 || valuebw > INT64_MAX |
| 653 | || (size_t)valuebw != valuebw) { |
| 654 | error_setg(&err, "Invalid size %s", valuestr); |
| 655 | break; |
| 656 | } |
| 657 | p->max_bandwidth = valuebw; |
| 658 | break; |
| 659 | case MIGRATION_PARAMETER_AVAIL_SWITCHOVER_BANDWIDTH: |
| 660 | p->has_avail_switchover_bandwidth = true; |
| 661 | ret = qemu_strtosz_MiB(valuestr, NULL, &valuebw); |
| 662 | if (ret < 0 || valuebw > INT64_MAX |
| 663 | || (size_t)valuebw != valuebw) { |
| 664 | error_setg(&err, "Invalid size %s", valuestr); |
| 665 | break; |
| 666 | } |
| 667 | p->avail_switchover_bandwidth = valuebw; |
| 668 | break; |
| 669 | case MIGRATION_PARAMETER_DOWNTIME_LIMIT: |
| 670 | p->has_downtime_limit = true; |
| 671 | visit_type_size(v, param, &p->downtime_limit, &err); |
| 672 | break; |
| 673 | case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY: |
| 674 | p->has_x_checkpoint_delay = true; |
| 675 | visit_type_uint32(v, param, &p->x_checkpoint_delay, &err); |
| 676 | break; |
| 677 | case MIGRATION_PARAMETER_MULTIFD_CHANNELS: |
| 678 | p->has_multifd_channels = true; |
| 679 | visit_type_uint8(v, param, &p->multifd_channels, &err); |
| 680 | break; |
| 681 | case MIGRATION_PARAMETER_MULTIFD_COMPRESSION: |
| 682 | p->has_multifd_compression = true; |
| 683 | visit_type_MultiFDCompression(v, param, &p->multifd_compression, |
| 684 | &err); |
| 685 | break; |
| 686 | case MIGRATION_PARAMETER_MULTIFD_ZLIB_LEVEL: |
| 687 | p->has_multifd_zlib_level = true; |
| 688 | visit_type_uint8(v, param, &p->multifd_zlib_level, &err); |
| 689 | break; |
| 690 | case MIGRATION_PARAMETER_MULTIFD_QATZIP_LEVEL: |
| 691 | p->has_multifd_qatzip_level = true; |
| 692 | visit_type_uint8(v, param, &p->multifd_qatzip_level, &err); |
| 693 | break; |
| 694 | case MIGRATION_PARAMETER_MULTIFD_ZSTD_LEVEL: |
| 695 | p->has_multifd_zstd_level = true; |
| 696 | visit_type_uint8(v, param, &p->multifd_zstd_level, &err); |
| 697 | break; |
| 698 | case MIGRATION_PARAMETER_ZERO_PAGE_DETECTION: |
| 699 | p->has_zero_page_detection = true; |
| 700 | visit_type_ZeroPageDetection(v, param, &p->zero_page_detection, &err); |
| 701 | break; |
| 702 | case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE: |
| 703 | p->has_xbzrle_cache_size = true; |
| 704 | if (!visit_type_size(v, param, &cache_size, &err)) { |
| 705 | break; |
| 706 | } |
| 707 | if (cache_size > INT64_MAX || (size_t)cache_size != cache_size) { |
| 708 | error_setg(&err, "Invalid size %s", valuestr); |
| 709 | break; |
| 710 | } |
| 711 | p->xbzrle_cache_size = cache_size; |
| 712 | break; |
| 713 | case MIGRATION_PARAMETER_MAX_POSTCOPY_BANDWIDTH: |
| 714 | p->has_max_postcopy_bandwidth = true; |
| 715 | visit_type_size(v, param, &p->max_postcopy_bandwidth, &err); |
| 716 | break; |
| 717 | case MIGRATION_PARAMETER_ANNOUNCE_INITIAL: |
| 718 | p->has_announce_initial = true; |
| 719 | visit_type_size(v, param, &p->announce_initial, &err); |
| 720 | break; |
| 721 | case MIGRATION_PARAMETER_ANNOUNCE_MAX: |
| 722 | p->has_announce_max = true; |
| 723 | visit_type_size(v, param, &p->announce_max, &err); |
| 724 | break; |
| 725 | case MIGRATION_PARAMETER_ANNOUNCE_ROUNDS: |
| 726 | p->has_announce_rounds = true; |
| 727 | visit_type_size(v, param, &p->announce_rounds, &err); |
| 728 | break; |
| 729 | case MIGRATION_PARAMETER_ANNOUNCE_STEP: |
| 730 | p->has_announce_step = true; |
| 731 | visit_type_size(v, param, &p->announce_step, &err); |
| 732 | break; |
| 733 | case MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING: |
| 734 | error_setg(&err, "The block-bitmap-mapping parameter can only be set " |
| 735 | "through QMP"); |
| 736 | break; |
| 737 | case MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD: |
| 738 | p->has_x_vcpu_dirty_limit_period = true; |
| 739 | visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err); |
| 740 | break; |
| 741 | case MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT: |
| 742 | p->has_vcpu_dirty_limit = true; |
| 743 | visit_type_size(v, param, &p->vcpu_dirty_limit, &err); |
| 744 | break; |
| 745 | case MIGRATION_PARAMETER_MODE: |
| 746 | p->has_mode = true; |
| 747 | visit_type_MigMode(v, param, &p->mode, &err); |
| 748 | break; |
| 749 | case MIGRATION_PARAMETER_DIRECT_IO: |
| 750 | p->has_direct_io = true; |
| 751 | visit_type_bool(v, param, &p->direct_io, &err); |
| 752 | break; |
| 753 | case MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE: |
| 754 | p->has_x_rdma_chunk_size = true; |
| 755 | visit_type_size(v, param, &p->x_rdma_chunk_size, &err); |
| 756 | break; |
| 757 | case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: { |
| 758 | /* |
| 759 | * NOTE: g_autofree will only auto g_free() the strv array when |
| 760 | * needed, it will not free the strings within the array. It's |
| 761 | * intentional: when strv is set, the ownership of the strings will |
| 762 | * always be passed to p->cpr_exec_command via QAPI_LIST_APPEND(). |
| 763 | */ |
| 764 | g_autofree char **strv = NULL; |
| 765 | g_autoptr(GError) gerr = NULL; |
| 766 | strList **tail = &p->cpr_exec_command; |
| 767 | |
| 768 | if (!g_shell_parse_argv(valuestr, NULL, &strv, &gerr)) { |
| 769 | error_setg(&err, "%s", gerr->message); |
| 770 | break; |
| 771 | } |
| 772 | for (int i = 0; strv[i]; i++) { |
| 773 | QAPI_LIST_APPEND(tail, strv[i]); |
| 774 | } |
| 775 | p->has_cpr_exec_command = true; |
| 776 | break; |
| 777 | } |
| 778 | default: |
| 779 | g_assert_not_reached(); |
| 780 | } |
| 781 | |
| 782 | if (err) { |
| 783 | goto cleanup; |
| 784 | } |
| 785 | |
| 786 | qmp_migrate_set_parameters(p, &err); |
| 787 | |
| 788 | cleanup: |
| 789 | qapi_free_MigrationParameters(p); |
| 790 | visit_free(v); |
| 791 | hmp_handle_error(hmp, err); |
| 792 | } |
| 793 | |
| 794 | void hmp_migrate_start_postcopy(MonitorHMP *hmp, const QDict *qdict) |
| 795 | { |
| 796 | Error *err = NULL; |
| 797 | qmp_migrate_start_postcopy(&err); |
| 798 | hmp_handle_error(hmp, err); |
| 799 | } |
| 800 | |
| 801 | #ifdef CONFIG_REPLICATION |
| 802 | void hmp_x_colo_lost_heartbeat(MonitorHMP *hmp, const QDict *qdict) |
| 803 | { |
| 804 | Error *err = NULL; |
| 805 | |
| 806 | qmp_x_colo_lost_heartbeat(&err); |
| 807 | hmp_handle_error(hmp, err); |
| 808 | } |
| 809 | #endif |
| 810 | |
| 811 | typedef struct HMPMigrationStatus { |
| 812 | QEMUTimer *timer; |
| 813 | Monitor *mon; |
| 814 | } HMPMigrationStatus; |
| 815 | |
| 816 | static void hmp_migrate_status_cb(void *opaque) |
| 817 | { |
| 818 | HMPMigrationStatus *status = opaque; |
| 819 | MigrationInfo *info; |
| 820 | |
| 821 | info = qmp_query_migrate(NULL); |
| 822 | if (!info->has_status || info->status == MIGRATION_STATUS_ACTIVE || |
| 823 | info->status == MIGRATION_STATUS_SETUP) { |
| 824 | timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1000); |
| 825 | } else { |
| 826 | if (info->error_desc) { |
| 827 | error_report("%s", info->error_desc); |
| 828 | } |
| 829 | monitor_resume(status->mon); |
| 830 | timer_free(status->timer); |
| 831 | g_free(status); |
| 832 | } |
| 833 | |
| 834 | qapi_free_MigrationInfo(info); |
| 835 | } |
| 836 | |
| 837 | void hmp_migrate(MonitorHMP *hmp, const QDict *qdict) |
| 838 | { |
| 839 | Monitor *mon = MONITOR(hmp); |
| 840 | bool detach = qdict_get_try_bool(qdict, "detach", false); |
| 841 | bool resume = qdict_get_try_bool(qdict, "resume", false); |
| 842 | const char *uri = qdict_get_str(qdict, "uri"); |
| 843 | const char *uri_cpr = qdict_get_try_str(qdict, "uri-cpr"); |
| 844 | Error *err = NULL; |
| 845 | g_autoptr(MigrationChannelList) caps = NULL; |
| 846 | g_autoptr(MigrationChannel) channel = NULL; |
| 847 | g_autoptr(MigrationChannel) channel_cpr = NULL; |
| 848 | |
| 849 | if (!migrate_uri_parse(uri, &channel, &err)) { |
| 850 | hmp_handle_error(hmp, err); |
| 851 | return; |
| 852 | } |
| 853 | QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel)); |
| 854 | |
| 855 | if (uri_cpr) { |
| 856 | if (migrate_mode() != MIG_MODE_CPR_TRANSFER) { |
| 857 | error_setg(&err, "-c can only be used in cpr-transfer mode"); |
| 858 | hmp_handle_error(hmp, err); |
| 859 | return; |
| 860 | } |
| 861 | |
| 862 | if (!migrate_uri_parse(uri_cpr, &channel_cpr, &err)) { |
| 863 | hmp_handle_error(hmp, err); |
| 864 | return; |
| 865 | } |
| 866 | |
| 867 | channel_cpr->channel_type = MIGRATION_CHANNEL_TYPE_CPR; |
| 868 | QAPI_LIST_PREPEND(caps, g_steal_pointer(&channel_cpr)); |
| 869 | } |
| 870 | |
| 871 | qmp_migrate(NULL, true, caps, true, resume, &err); |
| 872 | if (hmp_handle_error(hmp, err)) { |
| 873 | return; |
| 874 | } |
| 875 | |
| 876 | if (!detach) { |
| 877 | HMPMigrationStatus *status; |
| 878 | |
| 879 | if (!hmp->use_readline) { |
| 880 | monitor_hmp_printf(hmp, "terminal does not allow synchronous " |
| 881 | "migration, continuing detached\n"); |
| 882 | return; |
| 883 | } |
| 884 | monitor_suspend(mon); |
| 885 | |
| 886 | status = g_malloc0(sizeof(*status)); |
| 887 | status->mon = mon; |
| 888 | status->timer = timer_new_ms(QEMU_CLOCK_REALTIME, hmp_migrate_status_cb, |
| 889 | status); |
| 890 | timer_mod(status->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | void migrate_set_capability_completion(ReadLineState *rs, int nb_args, |
| 895 | const char *str) |
| 896 | { |
| 897 | size_t len; |
| 898 | |
| 899 | len = strlen(str); |
| 900 | readline_set_completion_index(rs, len); |
| 901 | if (nb_args == 2) { |
| 902 | int i; |
| 903 | for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) { |
| 904 | readline_add_completion_of(rs, str, MigrationCapability_str(i)); |
| 905 | } |
| 906 | } else if (nb_args == 3) { |
| 907 | readline_add_completion_of(rs, str, "on"); |
| 908 | readline_add_completion_of(rs, str, "off"); |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | void migrate_set_parameter_completion(ReadLineState *rs, int nb_args, |
| 913 | const char *str) |
| 914 | { |
| 915 | size_t len; |
| 916 | |
| 917 | len = strlen(str); |
| 918 | readline_set_completion_index(rs, len); |
| 919 | if (nb_args == 2) { |
| 920 | int i; |
| 921 | for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) { |
| 922 | readline_add_completion_of(rs, str, MigrationParameter_str(i)); |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | |
| 927 | static void vm_completion(ReadLineState *rs, const char *str) |
| 928 | { |
| 929 | size_t len; |
| 930 | BlockDriverState *bs; |
| 931 | BdrvNextIterator it; |
| 932 | |
| 933 | GRAPH_RDLOCK_GUARD_MAINLOOP(); |
| 934 | |
| 935 | len = strlen(str); |
| 936 | readline_set_completion_index(rs, len); |
| 937 | |
| 938 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) { |
| 939 | SnapshotInfoList *snapshots, *snapshot; |
| 940 | bool ok = false; |
| 941 | |
| 942 | if (bdrv_can_snapshot(bs)) { |
| 943 | ok = bdrv_query_snapshot_info_list(bs, &snapshots, NULL) == 0; |
| 944 | } |
| 945 | if (!ok) { |
| 946 | continue; |
| 947 | } |
| 948 | |
| 949 | snapshot = snapshots; |
| 950 | while (snapshot) { |
| 951 | readline_add_completion_of(rs, str, snapshot->value->name); |
| 952 | readline_add_completion_of(rs, str, snapshot->value->id); |
| 953 | snapshot = snapshot->next; |
| 954 | } |
| 955 | qapi_free_SnapshotInfoList(snapshots); |
| 956 | } |
| 957 | |
| 958 | } |
| 959 | |
| 960 | void delvm_completion(ReadLineState *rs, int nb_args, const char *str) |
| 961 | { |
| 962 | if (nb_args == 2) { |
| 963 | vm_completion(rs, str); |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | void loadvm_completion(ReadLineState *rs, int nb_args, const char *str) |
| 968 | { |
| 969 | if (nb_args == 2) { |
| 970 | vm_completion(rs, str); |
| 971 | } |
| 972 | } |