xref: /openbmc/qemu/qapi/migration.json (revision 66c83cdd91c07575ebf30bb45da8cc5df8041c29)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# = Migration
7##
8
9{ 'include': 'common.json' }
10{ 'include': 'sockets.json' }
11
12##
13# @MigrationStats:
14#
15# Detailed migration status.
16#
17# @transferred: amount of bytes already transferred to the target VM
18#
19# @remaining: amount of bytes remaining to be transferred to the
20#     target VM
21#
22# @total: total amount of bytes involved in the migration process
23#
24# @duplicate: number of duplicate (zero) pages (since 1.2)
25#
26# @normal: number of normal pages (since 1.2)
27#
28# @normal-bytes: number of normal bytes sent (since 1.2)
29#
30# @dirty-pages-rate: number of pages dirtied by second by the guest
31#     (since 1.3)
32#
33# @mbps: throughput in megabits/sec.  (since 1.6)
34#
35# @dirty-sync-count: number of times that dirty ram was synchronized
36#     (since 2.1)
37#
38# @postcopy-requests: The number of page requests received from the
39#     destination (since 2.7)
40#
41# @page-size: The number of bytes per page for the various page-based
42#     statistics (since 2.10)
43#
44# @multifd-bytes: The number of bytes sent through multifd (since 3.0)
45#
46# @pages-per-second: the number of memory pages transferred per second
47#     (Since 4.0)
48#
49# @precopy-bytes: The number of bytes sent in the pre-copy phase
50#     (since 7.0).
51#
52# @downtime-bytes: The number of bytes sent while the guest is paused
53#     (since 7.0).
54#
55# @postcopy-bytes: The number of bytes sent during the post-copy phase
56#     (since 7.0).
57#
58# @dirty-sync-missed-zero-copy: Number of times dirty RAM
59#     synchronization could not avoid copying dirty pages.  This is
60#     between 0 and @dirty-sync-count * @multifd-channels.
61#     (since 7.1)
62#
63# Since: 0.14
64##
65{ 'struct': 'MigrationStats',
66  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
67           'duplicate': 'int',
68           'normal': 'int',
69           'normal-bytes': 'int', 'dirty-pages-rate': 'int',
70           'mbps': 'number', 'dirty-sync-count': 'int',
71           'postcopy-requests': 'int', 'page-size': 'int',
72           'multifd-bytes': 'uint64', 'pages-per-second': 'uint64',
73           'precopy-bytes': 'uint64', 'downtime-bytes': 'uint64',
74           'postcopy-bytes': 'uint64',
75           'dirty-sync-missed-zero-copy': 'uint64' } }
76
77##
78# @XBZRLECacheStats:
79#
80# Detailed XBZRLE migration cache statistics
81#
82# @cache-size: XBZRLE cache size
83#
84# @bytes: amount of bytes already transferred to the target VM
85#
86# @pages: amount of pages transferred to the target VM
87#
88# @cache-miss: number of cache miss
89#
90# @cache-miss-rate: rate of cache miss (since 2.1)
91#
92# @encoding-rate: rate of encoded bytes (since 5.1)
93#
94# @overflow: number of overflows
95#
96# Since: 1.2
97##
98{ 'struct': 'XBZRLECacheStats',
99  'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
100           'cache-miss': 'int', 'cache-miss-rate': 'number',
101           'encoding-rate': 'number', 'overflow': 'int' } }
102
103##
104# @CompressionStats:
105#
106# Detailed migration compression statistics
107#
108# @pages: amount of pages compressed and transferred to the target VM
109#
110# @busy: count of times that no free thread was available to compress
111#     data
112#
113# @busy-rate: rate of thread busy
114#
115# @compressed-size: amount of bytes after compression
116#
117# @compression-rate: rate of compressed size
118#
119# Since: 3.1
120##
121{ 'struct': 'CompressionStats',
122  'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
123           'compressed-size': 'int', 'compression-rate': 'number' } }
124
125##
126# @MigrationStatus:
127#
128# An enumeration of migration status.
129#
130# @none: no migration has ever happened.
131#
132# @setup: migration process has been initiated.
133#
134# @cancelling: in the process of cancelling migration.
135#
136# @cancelled: cancelling migration is finished.
137#
138# @active: in the process of doing migration.
139#
140# @postcopy-active: like active, but now in postcopy mode.
141#     (since 2.5)
142#
143# @postcopy-paused: during postcopy but paused.  (since 3.0)
144#
145# @postcopy-recover-setup: setup phase for a postcopy recovery
146#     process, preparing for a recovery phase to start.  (since 9.1)
147#
148# @postcopy-recover: trying to recover from a paused postcopy.
149#     (since 3.0)
150#
151# @completed: migration is finished.
152#
153# @failed: some error occurred during migration process.
154#
155# @colo: VM is in the process of fault tolerance, VM can not get into
156#     this state unless colo capability is enabled for migration.
157#     (since 2.8)
158#
159# @pre-switchover: Paused before device serialisation.  (since 2.11)
160#
161# @device: During device serialisation (also known as switchover phase).
162#     Before 9.2, this is only used when (1) in precopy, and (2) when
163#     pre-switchover capability is enabled.  After 10.0, this state will
164#     always be present for every migration procedure as the switchover
165#     phase.  (since 2.11)
166#
167# @wait-unplug: wait for device unplug request by guest OS to be
168#     completed.  (since 4.2)
169#
170# Since: 2.3
171##
172{ 'enum': 'MigrationStatus',
173  'data': [ 'none', 'setup', 'cancelling', 'cancelled',
174            'active', 'postcopy-active', 'postcopy-paused',
175            'postcopy-recover-setup',
176            'postcopy-recover', 'completed', 'failed', 'colo',
177            'pre-switchover', 'device', 'wait-unplug' ] }
178##
179# @VfioStats:
180#
181# Detailed VFIO devices migration statistics
182#
183# @transferred: amount of bytes transferred to the target VM by VFIO
184#     devices
185#
186# Since: 5.2
187##
188{ 'struct': 'VfioStats',
189  'data': {'transferred': 'int' } }
190
191##
192# @MigrationInfo:
193#
194# Information about current migration process.
195#
196# @status: @MigrationStatus describing the current migration status.
197#     If this field is not returned, no migration process has been
198#     initiated
199#
200# @ram: @MigrationStats containing detailed migration status, only
201#     returned if status is 'active' or 'completed'(since 1.2)
202#
203# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
204#     migration statistics, only returned if XBZRLE feature is on and
205#     status is 'active' or 'completed' (since 1.2)
206#
207# @total-time: total amount of milliseconds since migration started.
208#     If migration has ended, it returns the total migration time.
209#     (since 1.2)
210#
211# @downtime: only present when migration finishes correctly total
212#     downtime in milliseconds for the guest.  (since 1.3)
213#
214# @expected-downtime: only present while migration is active expected
215#     downtime in milliseconds for the guest in last walk of the dirty
216#     bitmap.  (since 1.3)
217#
218# @setup-time: amount of setup time in milliseconds *before* the
219#     iterations begin but *after* the QMP command is issued.  This is
220#     designed to provide an accounting of any activities (such as
221#     RDMA pinning) which may be expensive, but do not actually occur
222#     during the iterative migration rounds themselves.  (since 1.6)
223#
224# @cpu-throttle-percentage: percentage of time guest cpus are being
225#     throttled during auto-converge.  This is only present when
226#     auto-converge has started throttling guest cpus.  (Since 2.7)
227#
228# @error-desc: the human readable error description string.  Clients
229#     should not attempt to parse the error strings.  (Since 2.7)
230#
231# @postcopy-blocktime: total time when all vCPU were blocked during
232#     postcopy live migration.  This is only present when the
233#     postcopy-blocktime migration capability is enabled.  (Since 3.0)
234#
235# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.
236#     This is only present when the postcopy-blocktime migration
237#     capability is enabled.  (Since 3.0)
238#
239# @postcopy-latency: average remote page fault latency (in ns).  Note that
240#     this doesn't include all faults, but only the ones that require a
241#     remote page request.  So it should be always bigger than the real
242#     average page fault latency. This is only present when the
243#     postcopy-blocktime migration capability is enabled.  (Since 10.1)
244#
245# @postcopy-latency-dist: remote page fault latency distributions.  Each
246#     element of the array is the number of faults that fall into the
247#     bucket period.  For the N-th bucket (N>=0), the latency window is
248#     [2^Nus, 2^(N+1)us).  For example, the 8th element stores how many
249#     remote faults got resolved within [256us, 512us) window. This is only
250#     present when the postcopy-blocktime migration capability is enabled.
251#     (Since 10.1)
252#
253# @postcopy-vcpu-latency: average remote page fault latency per vCPU (in
254#     ns).  It has the same definition of @postcopy-latency, but instead
255#     this is the per-vCPU statistics.  This is only present when the
256#     postcopy-blocktime migration capability is enabled.  (Since 10.1)
257#
258# @postcopy-non-vcpu-latency: average remote page fault latency for all
259#     faults happend in non-vCPU threads (in ns).  It has the same
260#     definition of @postcopy-latency but this only provides statistics to
261#     non-vCPU faults.  This is only present when the postcopy-blocktime
262#     migration capability is enabled.  (Since 10.1)
263#
264# @socket-address: Only used for tcp, to know what the real port is
265#     (Since 4.0)
266#
267# @vfio: @VfioStats containing detailed VFIO devices migration
268#     statistics, only returned if VFIO device is present, migration
269#     is supported by all VFIO devices and status is 'active' or
270#     'completed' (since 5.2)
271#
272# @blocked-reasons: A list of reasons an outgoing migration is
273#     blocked.  Present and non-empty when migration is blocked.
274#     (since 6.0)
275#
276# @dirty-limit-throttle-time-per-round: Maximum throttle time (in
277#     microseconds) of virtual CPUs each dirty ring full round, which
278#     shows how MigrationCapability dirty-limit affects the guest
279#     during live migration.  (Since 8.1)
280#
281# @dirty-limit-ring-full-time: Estimated average dirty ring full time
282#     (in microseconds) for each dirty ring full round.  The value
283#     equals the dirty ring memory size divided by the average dirty
284#     page rate of the virtual CPU, which can be used to observe the
285#     average memory load of the virtual CPU indirectly.  Note that
286#     zero means guest doesn't dirty memory.  (Since 8.1)
287#
288# Features:
289#
290# @unstable: Members @postcopy-latency, @postcopy-vcpu-latency,
291#     @postcopy-latency-dist, @postcopy-non-vcpu-latency are experimental.
292#
293# Since: 0.14
294##
295{ 'struct': 'MigrationInfo',
296  'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
297           '*vfio': 'VfioStats',
298           '*xbzrle-cache': 'XBZRLECacheStats',
299           '*total-time': 'int',
300           '*expected-downtime': 'int',
301           '*downtime': 'int',
302           '*setup-time': 'int',
303           '*cpu-throttle-percentage': 'int',
304           '*error-desc': 'str',
305           '*blocked-reasons': ['str'],
306           '*postcopy-blocktime': 'uint32',
307           '*postcopy-vcpu-blocktime': ['uint32'],
308           '*postcopy-latency': {
309               'type': 'uint64', 'features': [ 'unstable' ] },
310           '*postcopy-latency-dist': {
311               'type': ['uint64'], 'features': [ 'unstable' ] },
312           '*postcopy-vcpu-latency': {
313               'type': ['uint64'], 'features': [ 'unstable' ] },
314           '*postcopy-non-vcpu-latency': {
315               'type': 'uint64', 'features': [ 'unstable' ] },
316           '*socket-address': ['SocketAddress'],
317           '*dirty-limit-throttle-time-per-round': 'uint64',
318           '*dirty-limit-ring-full-time': 'uint64'} }
319
320##
321# @query-migrate:
322#
323# Return information about current migration process.  If migration
324# is active there will be another json-object with RAM migration
325# status.
326#
327# Returns: @MigrationInfo
328#
329# Since: 0.14
330#
331# .. qmp-example::
332#    :title: Before the first migration
333#
334#     -> { "execute": "query-migrate" }
335#     <- { "return": {} }
336#
337# .. qmp-example::
338#    :title: Migration is done and has succeeded
339#
340#     -> { "execute": "query-migrate" }
341#     <- { "return": {
342#             "status": "completed",
343#             "total-time":12345,
344#             "setup-time":12345,
345#             "downtime":12345,
346#             "ram":{
347#               "transferred":123,
348#               "remaining":123,
349#               "total":246,
350#               "duplicate":123,
351#               "normal":123,
352#               "normal-bytes":123456,
353#               "dirty-sync-count":15
354#             }
355#          }
356#        }
357#
358# .. qmp-example::
359#    :title: Migration is done and has failed
360#
361#     -> { "execute": "query-migrate" }
362#     <- { "return": { "status": "failed" } }
363#
364# .. qmp-example::
365#    :title: Migration is being performed
366#
367#     -> { "execute": "query-migrate" }
368#     <- {
369#           "return":{
370#              "status":"active",
371#              "total-time":12345,
372#              "setup-time":12345,
373#              "expected-downtime":12345,
374#              "ram":{
375#                 "transferred":123,
376#                 "remaining":123,
377#                 "total":246,
378#                 "duplicate":123,
379#                 "normal":123,
380#                 "normal-bytes":123456,
381#                 "dirty-sync-count":15
382#              }
383#           }
384#        }
385#
386# .. qmp-example::
387#    :title: Migration is being performed and XBZRLE is active
388#
389#     -> { "execute": "query-migrate" }
390#     <- {
391#           "return":{
392#              "status":"active",
393#              "total-time":12345,
394#              "setup-time":12345,
395#              "expected-downtime":12345,
396#              "ram":{
397#                 "total":1057024,
398#                 "remaining":1053304,
399#                 "transferred":3720,
400#                 "duplicate":10,
401#                 "normal":3333,
402#                 "normal-bytes":3412992,
403#                 "dirty-sync-count":15
404#              },
405#              "xbzrle-cache":{
406#                 "cache-size":67108864,
407#                 "bytes":20971520,
408#                 "pages":2444343,
409#                 "cache-miss":2244,
410#                 "cache-miss-rate":0.123,
411#                 "encoding-rate":80.1,
412#                 "overflow":34434
413#              }
414#           }
415#        }
416##
417{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
418
419##
420# @MigrationCapability:
421#
422# Migration capabilities enumeration
423#
424# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length
425#     Encoding).  This feature allows us to minimize migration traffic
426#     for certain work loads, by sending compressed difference of the
427#     pages
428#
429# @rdma-pin-all: Controls whether or not the entire VM memory
430#     footprint is mlock()'d on demand or all at once.  Refer to
431#     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
432#
433# @zero-blocks: During storage migration encode blocks of zeroes
434#     efficiently.  This essentially saves 1MB of zeroes per block on
435#     the wire.  Enabling requires source and target VM to support
436#     this feature.  To enable it is sufficient to enable the
437#     capability on the source VM.  The feature is disabled by
438#     default.  (since 1.6)
439#
440# @events: generate events for each migration state change (since 2.4)
441#
442# @auto-converge: If enabled, QEMU will automatically throttle down
443#     the guest to speed up convergence of RAM migration.  (since 1.6)
444#
445# @postcopy-ram: Start executing on the migration target before all of
446#     RAM has been migrated, pulling the remaining pages along as
447#     needed.  The capacity must have the same setting on both source
448#     and target or migration will not even start.  **Note:** if the
449#     migration fails during postcopy the VM will fail.  (since 2.6)
450#
451# @x-colo: If enabled, migration will never end, and the state of the
452#     VM on the primary side will be migrated continuously to the VM
453#     on secondary side, this process is called COarse-Grain LOck
454#     Stepping (COLO) for Non-stop Service.  (since 2.8)
455#
456# @release-ram: if enabled, QEMU will free the migrated ram pages on
457#     the source during postcopy-ram migration.  (since 2.9)
458#
459# @return-path: If enabled, migration will use the return path even
460#     for precopy.  (since 2.10)
461#
462# @pause-before-switchover: Pause outgoing migration before
463#     serialising device state and before disabling block IO
464#     (since 2.11)
465#
466# @multifd: Use more than one fd for migration (since 4.0)
467#
468# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
469#     (since 2.12)
470#
471# @postcopy-blocktime: Calculate downtime for postcopy live migration
472#     (since 3.0)
473#
474# @late-block-activate: If enabled, the destination will not activate
475#     block devices (and thus take locks) immediately at the end of
476#     migration.  (since 3.0)
477#
478# @x-ignore-shared: If enabled, QEMU will not migrate shared memory
479#     that is accessible on the destination machine.  (since 4.0)
480#
481# @validate-uuid: Send the UUID of the source to allow the destination
482#     to ensure it is the same.  (since 4.2)
483#
484# @background-snapshot: If enabled, the migration stream will be a
485#     snapshot of the VM exactly at the point when the migration
486#     procedure starts.  The VM RAM is saved with running VM.
487#     (since 6.0)
488#
489# @zero-copy-send: Controls behavior on sending memory pages on
490#     migration.  When true, enables a zero-copy mechanism for sending
491#     memory pages, if host supports it.  Requires that QEMU be
492#     permitted to use locked memory for guest RAM pages.  (since 7.1)
493#
494# @postcopy-preempt: If enabled, the migration process will allow
495#     postcopy requests to preempt precopy stream, so postcopy
496#     requests will be handled faster.  This is a performance feature
497#     and should not affect the correctness of postcopy migration.
498#     (since 7.1)
499#
500# @switchover-ack: If enabled, migration will not stop the source VM
501#     and complete the migration until an ACK is received from the
502#     destination that it's OK to do so.  Exactly when this ACK is
503#     sent depends on the migrated devices that use this feature.  For
504#     example, a device can use it to make sure some of its data is
505#     sent and loaded in the destination before doing switchover.
506#     This can reduce downtime if devices that support this capability
507#     are present.  'return-path' capability must be enabled to use
508#     it.  (since 8.1)
509#
510# @dirty-limit: If enabled, migration will throttle vCPUs as needed to
511#     keep their dirty page rate within @vcpu-dirty-limit.  This can
512#     improve responsiveness of large guests during live migration,
513#     and can result in more stable read performance.  Requires KVM
514#     with accelerator property "dirty-ring-size" set.  (Since 8.1)
515#
516# @mapped-ram: Migrate using fixed offsets in the migration file for
517#     each RAM page.  Requires a migration URI that supports seeking,
518#     such as a file.  (since 9.0)
519#
520# Features:
521#
522# @unstable: Members @x-colo and @x-ignore-shared are experimental.
523# @deprecated: Member @zero-blocks is deprecated as being part of
524#     block migration which was already removed.
525#
526# Since: 1.2
527##
528{ 'enum': 'MigrationCapability',
529  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
530           { 'name': 'zero-blocks', 'features': [ 'deprecated' ] },
531           'events', 'postcopy-ram',
532           { 'name': 'x-colo', 'features': [ 'unstable' ] },
533           'release-ram',
534           'return-path', 'pause-before-switchover', 'multifd',
535           'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
536           { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] },
537           'validate-uuid', 'background-snapshot',
538           'zero-copy-send', 'postcopy-preempt', 'switchover-ack',
539           'dirty-limit', 'mapped-ram'] }
540
541##
542# @MigrationCapabilityStatus:
543#
544# Migration capability information
545#
546# @capability: capability enum
547#
548# @state: capability state bool
549#
550# Since: 1.2
551##
552{ 'struct': 'MigrationCapabilityStatus',
553  'data': { 'capability': 'MigrationCapability', 'state': 'bool' } }
554
555##
556# @migrate-set-capabilities:
557#
558# Enable/Disable the following migration capabilities (like xbzrle)
559#
560# @capabilities: json array of capability modifications to make
561#
562# Since: 1.2
563#
564# .. qmp-example::
565#
566#     -> { "execute": "migrate-set-capabilities" , "arguments":
567#          { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
568#     <- { "return": {} }
569##
570{ 'command': 'migrate-set-capabilities',
571  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
572
573##
574# @query-migrate-capabilities:
575#
576# Return information about the current migration capabilities status
577#
578# Returns: @MigrationCapabilityStatus
579#
580# Since: 1.2
581#
582# .. qmp-example::
583#
584#     -> { "execute": "query-migrate-capabilities" }
585#     <- { "return": [
586#           {"state": false, "capability": "xbzrle"},
587#           {"state": false, "capability": "rdma-pin-all"},
588#           {"state": false, "capability": "auto-converge"},
589#           {"state": false, "capability": "zero-blocks"},
590#           {"state": true, "capability": "events"},
591#           {"state": false, "capability": "postcopy-ram"},
592#           {"state": false, "capability": "x-colo"}
593#        ]}
594##
595{ 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}
596
597##
598# @MultiFDCompression:
599#
600# An enumeration of multifd compression methods.
601#
602# @none: no compression.
603#
604# @zlib: use zlib compression method.
605#
606# @zstd: use zstd compression method.
607#
608# @qatzip: use qatzip compression method.  (Since 9.2)
609#
610# @qpl: use qpl compression method.  Query Processing Library(qpl) is
611#     based on the deflate compression algorithm and use the Intel
612#     In-Memory Analytics Accelerator(IAA) accelerated compression and
613#     decompression.  (Since 9.1)
614#
615# @uadk: use UADK library compression method.  (Since 9.1)
616#
617# Since: 5.0
618##
619{ 'enum': 'MultiFDCompression',
620  'prefix': 'MULTIFD_COMPRESSION',
621  'data': [ 'none', 'zlib',
622            { 'name': 'zstd', 'if': 'CONFIG_ZSTD' },
623            { 'name': 'qatzip', 'if': 'CONFIG_QATZIP'},
624            { 'name': 'qpl', 'if': 'CONFIG_QPL' },
625            { 'name': 'uadk', 'if': 'CONFIG_UADK' } ] }
626
627##
628# @MigMode:
629#
630# @normal: the original form of migration.  (since 8.2)
631#
632# @cpr-reboot: The migrate command stops the VM and saves state to the
633#     URI.  After quitting QEMU, the user resumes by running QEMU
634#     -incoming.
635#
636#     This mode allows the user to quit QEMU, optionally update and
637#     reboot the OS, and restart QEMU.  If the user reboots, the URI
638#     must persist across the reboot, such as by using a file.
639#
640#     Unlike normal mode, the use of certain local storage options
641#     does not block the migration, but the user must not modify the
642#     contents of guest block devices between the quit and restart.
643#
644#     This mode supports VFIO devices provided the user first puts the
645#     guest in the suspended runstate, such as by issuing
646#     guest-suspend-ram to the QEMU guest agent.
647#
648#     Best performance is achieved when the memory backend is shared
649#     and the @x-ignore-shared migration capability is set, but this
650#     is not required.  Further, if the user reboots before restarting
651#     such a configuration, the shared memory must persist across the
652#     reboot, such as by backing it with a dax device.
653#
654#     @cpr-reboot may not be used with postcopy, background-snapshot,
655#     or COLO.
656#
657#     (since 8.2)
658#
659# @cpr-transfer: This mode allows the user to transfer a guest to a
660#     new QEMU instance on the same host with minimal guest pause
661#     time by preserving guest RAM in place.
662#
663#     Devices and their pinned pages are also preserved for VFIO and
664#     IOMMUFD. (since 10.1)
665#
666#     The user starts new QEMU on the same host as old QEMU, with
667#     command-line arguments to create the same machine, plus the
668#     -incoming option for the main migration channel, like normal
669#     live migration.  In addition, the user adds a second -incoming
670#     option with channel type "cpr".  This CPR channel must support
671#     file descriptor transfer with SCM_RIGHTS, i.e. it must be a
672#     UNIX domain socket.
673#
674#     To initiate CPR, the user issues a migrate command to old QEMU,
675#     adding a second migration channel of type "cpr" in the channels
676#     argument.  Old QEMU stops the VM, saves state to the migration
677#     channels, and enters the postmigrate state.  Execution resumes
678#     in new QEMU.
679#
680#     New QEMU reads the CPR channel before opening a monitor, hence
681#     the CPR channel cannot be specified in the list of channels for
682#     a migrate-incoming command.  It may only be specified on the
683#     command line.
684#
685#     The main channel address cannot be a file type, and for an
686#     inet socket, the port cannot be 0 (meaning dynamically choose
687#     a port).
688#
689#     Memory-backend objects must have the share=on attribute, but
690#     memory-backend-epc is not supported.  The VM must be started
691#     with the '-machine aux-ram-share=on' option.
692#
693#     When using -incoming defer, you must issue the migrate command
694#     to old QEMU before issuing any monitor commands to new QEMU.
695#     However, new QEMU does not open and read the migration stream
696#     until you issue the migrate incoming command.
697#
698#     (since 10.0)
699##
700{ 'enum': 'MigMode',
701  'data': [ 'normal', 'cpr-reboot', 'cpr-transfer' ] }
702
703##
704# @ZeroPageDetection:
705#
706# @none: Do not perform zero page checking.
707#
708# @legacy: Perform zero page checking in main migration thread.
709#
710# @multifd: Perform zero page checking in multifd sender thread if
711#     multifd migration is enabled, else in the main migration thread
712#     as for @legacy.
713#
714# Since: 9.0
715##
716{ 'enum': 'ZeroPageDetection',
717  'data': [ 'none', 'legacy', 'multifd' ] }
718
719##
720# @BitmapMigrationBitmapAliasTransform:
721#
722# @persistent: If present, the bitmap will be made persistent or
723#     transient depending on this parameter.
724#
725# Since: 6.0
726##
727{ 'struct': 'BitmapMigrationBitmapAliasTransform',
728  'data': {
729      '*persistent': 'bool'
730  } }
731
732##
733# @BitmapMigrationBitmapAlias:
734#
735# @name: The name of the bitmap.
736#
737# @alias: An alias name for migration (for example the bitmap name on
738#     the opposite site).
739#
740# @transform: Allows the modification of the migrated bitmap.
741#     (since 6.0)
742#
743# Since: 5.2
744##
745{ 'struct': 'BitmapMigrationBitmapAlias',
746  'data': {
747      'name': 'str',
748      'alias': 'str',
749      '*transform': 'BitmapMigrationBitmapAliasTransform'
750  } }
751
752##
753# @BitmapMigrationNodeAlias:
754#
755# Maps a block node name and the bitmaps it has to aliases for dirty
756# bitmap migration.
757#
758# @node-name: A block node name.
759#
760# @alias: An alias block node name for migration (for example the node
761#     name on the opposite site).
762#
763# @bitmaps: Mappings for the bitmaps on this node.
764#
765# Since: 5.2
766##
767{ 'struct': 'BitmapMigrationNodeAlias',
768  'data': {
769      'node-name': 'str',
770      'alias': 'str',
771      'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
772  } }
773
774##
775# @MigrationParameter:
776#
777# Migration parameters enumeration
778#
779# @announce-initial: Initial delay (in milliseconds) before sending
780#     the first announce (Since 4.0)
781#
782# @announce-max: Maximum delay (in milliseconds) between packets in
783#     the announcement (Since 4.0)
784#
785# @announce-rounds: Number of self-announce packets sent after
786#     migration (Since 4.0)
787#
788# @announce-step: Increase in delay (in milliseconds) between
789#     subsequent packets in the announcement (Since 4.0)
790#
791# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
792#     bytes_xfer_period to trigger throttling.  It is expressed as
793#     percentage.  The default value is 50.  (Since 5.0)
794#
795# @cpu-throttle-initial: Initial percentage of time guest cpus are
796#     throttled when migration auto-converge is activated.  The
797#     default value is 20.  (Since 2.7)
798#
799# @cpu-throttle-increment: throttle percentage increase each time
800#     auto-converge detects that migration is not making progress.
801#     The default value is 10.  (Since 2.7)
802#
803# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage.
804#     At the tail stage of throttling, the Guest is very sensitive to
805#     CPU percentage while the @cpu-throttle -increment is excessive
806#     usually at tail stage.  If this parameter is true, we will
807#     compute the ideal CPU percentage used by the Guest, which may
808#     exactly make the dirty rate match the dirty rate threshold.
809#     Then we will choose a smaller throttle increment between the one
810#     specified by @cpu-throttle-increment and the one generated by
811#     ideal CPU percentage.  Therefore, it is compatible to
812#     traditional throttling, meanwhile the throttle increment won't
813#     be excessive at tail stage.  The default value is false.
814#     (Since 5.1)
815#
816# @tls-creds: ID of the 'tls-creds' object that provides credentials
817#     for establishing a TLS connection over the migration data
818#     channel.  On the outgoing side of the migration, the credentials
819#     must be for a 'client' endpoint, while for the incoming side the
820#     credentials must be for a 'server' endpoint.  Setting this to a
821#     non-empty string enables TLS for all migrations.  An empty
822#     string means that QEMU will use plain text mode for migration,
823#     rather than TLS.  (Since 2.7)
824#
825# @tls-hostname: migration target's hostname for validating the
826#     server's x509 certificate identity.  If empty, QEMU will use the
827#     hostname from the migration URI, if any.  A non-empty value is
828#     required when using x509 based TLS credentials and the migration
829#     URI does not include a hostname, such as fd: or exec: based
830#     migration.  (Since 2.7)
831#
832#     Note: empty value works only since 2.9.
833#
834# @tls-authz: ID of the 'authz' object subclass that provides access
835#     control checking of the TLS x509 certificate distinguished name.
836#     This object is only resolved at time of use, so can be deleted
837#     and recreated on the fly while the migration server is active.
838#     If missing, it will default to denying access (Since 4.0)
839#
840# @max-bandwidth: maximum speed for migration, in bytes per second.
841#     (Since 2.8)
842#
843# @avail-switchover-bandwidth: to set the available bandwidth that
844#     migration can use during switchover phase.  **Note:** this does
845#     not limit the bandwidth during switchover, but only for
846#     calculations when making decisions to switchover.  By default,
847#     this value is zero, which means QEMU will estimate the bandwidth
848#     automatically.  This can be set when the estimated value is not
849#     accurate, while the user is able to guarantee such bandwidth is
850#     available when switching over.  When specified correctly, this
851#     can make the switchover decision much more accurate.
852#     (Since 8.2)
853#
854# @downtime-limit: set maximum tolerated downtime for migration.
855#     maximum downtime in milliseconds (Since 2.8)
856#
857# @x-checkpoint-delay: The delay time (in ms) between two COLO
858#     checkpoints in periodic mode.  (Since 2.8)
859#
860# @multifd-channels: Number of channels used to migrate data in
861#     parallel.  This is the same number that the number of sockets
862#     used for migration.  The default value is 2 (since 4.0)
863#
864# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
865#     needs to be a multiple of the target page size and a power of 2
866#     (Since 2.11)
867#
868# @max-postcopy-bandwidth: Background transfer bandwidth during
869#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
870#     (Since 3.0)
871#
872# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
873#     (Since 3.1)
874#
875# @multifd-compression: Which compression method to use.  Defaults to
876#     none.  (Since 5.0)
877#
878# @multifd-zlib-level: Set the compression level to be used in live
879#     migration, the compression level is an integer between 0 and 9,
880#     where 0 means no compression, 1 means the best compression
881#     speed, and 9 means best compression ratio which will consume
882#     more CPU.  Defaults to 1.  (Since 5.0)
883#
884# @multifd-qatzip-level: Set the compression level to be used in live
885#     migration.  The level is an integer between 1 and 9, where 1 means
886#     the best compression speed, and 9 means the best compression
887#     ratio which will consume more CPU.  Defaults to 1.  (Since 9.2)
888#
889# @multifd-zstd-level: Set the compression level to be used in live
890#     migration, the compression level is an integer between 0 and 20,
891#     where 0 means no compression, 1 means the best compression
892#     speed, and 20 means best compression ratio which will consume
893#     more CPU.  Defaults to 1.  (Since 5.0)
894#
895# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
896#     aliases for the purpose of dirty bitmap migration.  Such aliases
897#     may for example be the corresponding names on the opposite site.
898#     The mapping must be one-to-one, but not necessarily complete: On
899#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
900#     will be ignored.  On the destination, encountering an unmapped
901#     alias in the incoming migration stream will result in a report,
902#     and all further bitmap migration data will then be discarded.
903#     Note that the destination does not know about bitmaps it does
904#     not receive, so there is no limitation or requirement regarding
905#     the number of bitmaps received, or how they are named, or on
906#     which nodes they are placed.  By default (when this parameter
907#     has never been set), bitmap names are mapped to themselves.
908#     Nodes are mapped to their block device name if there is one, and
909#     to their node name otherwise.  (Since 5.2)
910#
911# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
912#     limit during live migration.  Should be in the range 1 to
913#     1000ms.  Defaults to 1000ms.  (Since 8.1)
914#
915# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
916#     Defaults to 1.  (Since 8.1)
917#
918# @mode: Migration mode.  See description in @MigMode.  Default is
919#     'normal'.  (Since 8.2)
920#
921# @zero-page-detection: Whether and how to detect zero pages.
922#     See description in @ZeroPageDetection.  Default is 'multifd'.
923#     (since 9.0)
924#
925# @direct-io: Open migration files with O_DIRECT when possible.  This
926#     only has effect if the @mapped-ram capability is enabled.
927#     (Since 9.1)
928#
929# Features:
930#
931# @unstable: Members @x-checkpoint-delay and
932#     @x-vcpu-dirty-limit-period are experimental.
933#
934# Since: 2.4
935##
936{ 'enum': 'MigrationParameter',
937  'data': ['announce-initial', 'announce-max',
938           'announce-rounds', 'announce-step',
939           'throttle-trigger-threshold',
940           'cpu-throttle-initial', 'cpu-throttle-increment',
941           'cpu-throttle-tailslow',
942           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
943           'avail-switchover-bandwidth', 'downtime-limit',
944           { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
945           'multifd-channels',
946           'xbzrle-cache-size', 'max-postcopy-bandwidth',
947           'max-cpu-throttle', 'multifd-compression',
948           'multifd-zlib-level', 'multifd-zstd-level',
949           'multifd-qatzip-level',
950           'block-bitmap-mapping',
951           { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
952           'vcpu-dirty-limit',
953           'mode',
954           'zero-page-detection',
955           'direct-io'] }
956
957##
958# @MigrateSetParameters:
959#
960# @announce-initial: Initial delay (in milliseconds) before sending
961#     the first announce (Since 4.0)
962#
963# @announce-max: Maximum delay (in milliseconds) between packets in
964#     the announcement (Since 4.0)
965#
966# @announce-rounds: Number of self-announce packets sent after
967#     migration (Since 4.0)
968#
969# @announce-step: Increase in delay (in milliseconds) between
970#     subsequent packets in the announcement (Since 4.0)
971#
972# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
973#     bytes_xfer_period to trigger throttling.  It is expressed as
974#     percentage.  The default value is 50.  (Since 5.0)
975#
976# @cpu-throttle-initial: Initial percentage of time guest cpus are
977#     throttled when migration auto-converge is activated.  The
978#     default value is 20.  (Since 2.7)
979#
980# @cpu-throttle-increment: throttle percentage increase each time
981#     auto-converge detects that migration is not making progress.
982#     The default value is 10.  (Since 2.7)
983#
984# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage.
985#     At the tail stage of throttling, the Guest is very sensitive to
986#     CPU percentage while the @cpu-throttle -increment is excessive
987#     usually at tail stage.  If this parameter is true, we will
988#     compute the ideal CPU percentage used by the Guest, which may
989#     exactly make the dirty rate match the dirty rate threshold.
990#     Then we will choose a smaller throttle increment between the one
991#     specified by @cpu-throttle-increment and the one generated by
992#     ideal CPU percentage.  Therefore, it is compatible to
993#     traditional throttling, meanwhile the throttle increment won't
994#     be excessive at tail stage.  The default value is false.
995#     (Since 5.1)
996#
997# @tls-creds: ID of the 'tls-creds' object that provides credentials
998#     for establishing a TLS connection over the migration data
999#     channel.  On the outgoing side of the migration, the credentials
1000#     must be for a 'client' endpoint, while for the incoming side the
1001#     credentials must be for a 'server' endpoint.  Setting this to a
1002#     non-empty string enables TLS for all migrations.  An empty
1003#     string means that QEMU will use plain text mode for migration,
1004#     rather than TLS.  This is the default.  (Since 2.7)
1005#
1006# @tls-hostname: migration target's hostname for validating the
1007#     server's x509 certificate identity.  If empty, QEMU will use the
1008#     hostname from the migration URI, if any.  A non-empty value is
1009#     required when using x509 based TLS credentials and the migration
1010#     URI does not include a hostname, such as fd: or exec: based
1011#     migration.  (Since 2.7)
1012#
1013#     Note: empty value works only since 2.9.
1014#
1015# @tls-authz: ID of the 'authz' object subclass that provides access
1016#     control checking of the TLS x509 certificate distinguished name.
1017#     This object is only resolved at time of use, so can be deleted
1018#     and recreated on the fly while the migration server is active.
1019#     If missing, it will default to denying access (Since 4.0)
1020#
1021# @max-bandwidth: maximum speed for migration, in bytes per second.
1022#     (Since 2.8)
1023#
1024# @avail-switchover-bandwidth: to set the available bandwidth that
1025#     migration can use during switchover phase.  **Note:** this does
1026#     not limit the bandwidth during switchover, but only for
1027#     calculations when making decisions to switchover.  By default,
1028#     this value is zero, which means QEMU will estimate the bandwidth
1029#     automatically.  This can be set when the estimated value is not
1030#     accurate, while the user is able to guarantee such bandwidth is
1031#     available when switching over.  When specified correctly, this
1032#     can make the switchover decision much more accurate.
1033#     (Since 8.2)
1034#
1035# @downtime-limit: set maximum tolerated downtime for migration.
1036#     maximum downtime in milliseconds (Since 2.8)
1037#
1038# @x-checkpoint-delay: The delay time (in ms) between two COLO
1039#     checkpoints in periodic mode.  (Since 2.8)
1040#
1041# @multifd-channels: Number of channels used to migrate data in
1042#     parallel.  This is the same number that the number of sockets
1043#     used for migration.  The default value is 2 (since 4.0)
1044#
1045# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1046#     needs to be a multiple of the target page size and a power of 2
1047#     (Since 2.11)
1048#
1049# @max-postcopy-bandwidth: Background transfer bandwidth during
1050#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1051#     (Since 3.0)
1052#
1053# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1054#     (Since 3.1)
1055#
1056# @multifd-compression: Which compression method to use.  Defaults to
1057#     none.  (Since 5.0)
1058#
1059# @multifd-zlib-level: Set the compression level to be used in live
1060#     migration, the compression level is an integer between 0 and 9,
1061#     where 0 means no compression, 1 means the best compression
1062#     speed, and 9 means best compression ratio which will consume
1063#     more CPU.  Defaults to 1.  (Since 5.0)
1064#
1065# @multifd-qatzip-level: Set the compression level to be used in live
1066#     migration.  The level is an integer between 1 and 9, where 1 means
1067#     the best compression speed, and 9 means the best compression
1068#     ratio which will consume more CPU.  Defaults to 1.  (Since 9.2)
1069#
1070# @multifd-zstd-level: Set the compression level to be used in live
1071#     migration, the compression level is an integer between 0 and 20,
1072#     where 0 means no compression, 1 means the best compression
1073#     speed, and 20 means best compression ratio which will consume
1074#     more CPU.  Defaults to 1.  (Since 5.0)
1075#
1076# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1077#     aliases for the purpose of dirty bitmap migration.  Such aliases
1078#     may for example be the corresponding names on the opposite site.
1079#     The mapping must be one-to-one, but not necessarily complete: On
1080#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1081#     will be ignored.  On the destination, encountering an unmapped
1082#     alias in the incoming migration stream will result in a report,
1083#     and all further bitmap migration data will then be discarded.
1084#     Note that the destination does not know about bitmaps it does
1085#     not receive, so there is no limitation or requirement regarding
1086#     the number of bitmaps received, or how they are named, or on
1087#     which nodes they are placed.  By default (when this parameter
1088#     has never been set), bitmap names are mapped to themselves.
1089#     Nodes are mapped to their block device name if there is one, and
1090#     to their node name otherwise.  (Since 5.2)
1091#
1092# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1093#     limit during live migration.  Should be in the range 1 to
1094#     1000ms.  Defaults to 1000ms.  (Since 8.1)
1095#
1096# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1097#     Defaults to 1.  (Since 8.1)
1098#
1099# @mode: Migration mode.  See description in @MigMode.  Default is
1100#     'normal'.  (Since 8.2)
1101#
1102# @zero-page-detection: Whether and how to detect zero pages.
1103#     See description in @ZeroPageDetection.  Default is 'multifd'.
1104#     (since 9.0)
1105#
1106# @direct-io: Open migration files with O_DIRECT when possible.  This
1107#     only has effect if the @mapped-ram capability is enabled.
1108#     (Since 9.1)
1109#
1110# Features:
1111#
1112# @unstable: Members @x-checkpoint-delay and
1113#     @x-vcpu-dirty-limit-period are experimental.
1114#
1115# TODO: either fuse back into MigrationParameters, or make
1116#     MigrationParameters members mandatory
1117#
1118# Since: 2.4
1119##
1120{ 'struct': 'MigrateSetParameters',
1121  'data': { '*announce-initial': 'size',
1122            '*announce-max': 'size',
1123            '*announce-rounds': 'size',
1124            '*announce-step': 'size',
1125            '*throttle-trigger-threshold': 'uint8',
1126            '*cpu-throttle-initial': 'uint8',
1127            '*cpu-throttle-increment': 'uint8',
1128            '*cpu-throttle-tailslow': 'bool',
1129            '*tls-creds': 'StrOrNull',
1130            '*tls-hostname': 'StrOrNull',
1131            '*tls-authz': 'StrOrNull',
1132            '*max-bandwidth': 'size',
1133            '*avail-switchover-bandwidth': 'size',
1134            '*downtime-limit': 'uint64',
1135            '*x-checkpoint-delay': { 'type': 'uint32',
1136                                     'features': [ 'unstable' ] },
1137            '*multifd-channels': 'uint8',
1138            '*xbzrle-cache-size': 'size',
1139            '*max-postcopy-bandwidth': 'size',
1140            '*max-cpu-throttle': 'uint8',
1141            '*multifd-compression': 'MultiFDCompression',
1142            '*multifd-zlib-level': 'uint8',
1143            '*multifd-qatzip-level': 'uint8',
1144            '*multifd-zstd-level': 'uint8',
1145            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1146            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1147                                            'features': [ 'unstable' ] },
1148            '*vcpu-dirty-limit': 'uint64',
1149            '*mode': 'MigMode',
1150            '*zero-page-detection': 'ZeroPageDetection',
1151            '*direct-io': 'bool' } }
1152
1153##
1154# @migrate-set-parameters:
1155#
1156# Set various migration parameters.
1157#
1158# Since: 2.4
1159#
1160# .. qmp-example::
1161#
1162#     -> { "execute": "migrate-set-parameters" ,
1163#          "arguments": { "multifd-channels": 5 } }
1164#     <- { "return": {} }
1165##
1166{ 'command': 'migrate-set-parameters', 'boxed': true,
1167  'data': 'MigrateSetParameters' }
1168
1169##
1170# @MigrationParameters:
1171#
1172# The optional members aren't actually optional.
1173#
1174# @announce-initial: Initial delay (in milliseconds) before sending
1175#     the first announce (Since 4.0)
1176#
1177# @announce-max: Maximum delay (in milliseconds) between packets in
1178#     the announcement (Since 4.0)
1179#
1180# @announce-rounds: Number of self-announce packets sent after
1181#     migration (Since 4.0)
1182#
1183# @announce-step: Increase in delay (in milliseconds) between
1184#     subsequent packets in the announcement (Since 4.0)
1185#
1186# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
1187#     bytes_xfer_period to trigger throttling.  It is expressed as
1188#     percentage.  The default value is 50.  (Since 5.0)
1189#
1190# @cpu-throttle-initial: Initial percentage of time guest cpus are
1191#     throttled when migration auto-converge is activated.
1192#     (Since 2.7)
1193#
1194# @cpu-throttle-increment: throttle percentage increase each time
1195#     auto-converge detects that migration is not making progress.
1196#     (Since 2.7)
1197#
1198# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage.
1199#     At the tail stage of throttling, the Guest is very sensitive to
1200#     CPU percentage while the @cpu-throttle -increment is excessive
1201#     usually at tail stage.  If this parameter is true, we will
1202#     compute the ideal CPU percentage used by the Guest, which may
1203#     exactly make the dirty rate match the dirty rate threshold.
1204#     Then we will choose a smaller throttle increment between the one
1205#     specified by @cpu-throttle-increment and the one generated by
1206#     ideal CPU percentage.  Therefore, it is compatible to
1207#     traditional throttling, meanwhile the throttle increment won't
1208#     be excessive at tail stage.  The default value is false.
1209#     (Since 5.1)
1210#
1211# @tls-creds: ID of the 'tls-creds' object that provides credentials
1212#     for establishing a TLS connection over the migration data
1213#     channel.  On the outgoing side of the migration, the credentials
1214#     must be for a 'client' endpoint, while for the incoming side the
1215#     credentials must be for a 'server' endpoint.  An empty string
1216#     means that QEMU will use plain text mode for migration, rather
1217#     than TLS.  (Since 2.7)
1218#
1219#     Note: 2.8 omits empty @tls-creds instead.
1220#
1221# @tls-hostname: migration target's hostname for validating the
1222#     server's x509 certificate identity.  If empty, QEMU will use the
1223#     hostname from the migration URI, if any.  (Since 2.7)
1224#
1225#     Note: 2.8 omits empty @tls-hostname instead.
1226#
1227# @tls-authz: ID of the 'authz' object subclass that provides access
1228#     control checking of the TLS x509 certificate distinguished name.
1229#     (Since 4.0)
1230#
1231# @max-bandwidth: maximum speed for migration, in bytes per second.
1232#     (Since 2.8)
1233#
1234# @avail-switchover-bandwidth: to set the available bandwidth that
1235#     migration can use during switchover phase.  **Note:** this does
1236#     not limit the bandwidth during switchover, but only for
1237#     calculations when making decisions to switchover.  By default,
1238#     this value is zero, which means QEMU will estimate the bandwidth
1239#     automatically.  This can be set when the estimated value is not
1240#     accurate, while the user is able to guarantee such bandwidth is
1241#     available when switching over.  When specified correctly, this
1242#     can make the switchover decision much more accurate.
1243#     (Since 8.2)
1244#
1245# @downtime-limit: set maximum tolerated downtime for migration.
1246#     maximum downtime in milliseconds (Since 2.8)
1247#
1248# @x-checkpoint-delay: the delay time between two COLO checkpoints.
1249#     (Since 2.8)
1250#
1251# @multifd-channels: Number of channels used to migrate data in
1252#     parallel.  This is the same number that the number of sockets
1253#     used for migration.  The default value is 2 (since 4.0)
1254#
1255# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1256#     needs to be a multiple of the target page size and a power of 2
1257#     (Since 2.11)
1258#
1259# @max-postcopy-bandwidth: Background transfer bandwidth during
1260#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1261#     (Since 3.0)
1262#
1263# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1264#     (Since 3.1)
1265#
1266# @multifd-compression: Which compression method to use.  Defaults to
1267#     none.  (Since 5.0)
1268#
1269# @multifd-zlib-level: Set the compression level to be used in live
1270#     migration, the compression level is an integer between 0 and 9,
1271#     where 0 means no compression, 1 means the best compression
1272#     speed, and 9 means best compression ratio which will consume
1273#     more CPU.  Defaults to 1.  (Since 5.0)
1274#
1275# @multifd-qatzip-level: Set the compression level to be used in live
1276#     migration.  The level is an integer between 1 and 9, where 1 means
1277#     the best compression speed, and 9 means the best compression
1278#     ratio which will consume more CPU.  Defaults to 1.  (Since 9.2)
1279#
1280# @multifd-zstd-level: Set the compression level to be used in live
1281#     migration, the compression level is an integer between 0 and 20,
1282#     where 0 means no compression, 1 means the best compression
1283#     speed, and 20 means best compression ratio which will consume
1284#     more CPU.  Defaults to 1.  (Since 5.0)
1285#
1286# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1287#     aliases for the purpose of dirty bitmap migration.  Such aliases
1288#     may for example be the corresponding names on the opposite site.
1289#     The mapping must be one-to-one, but not necessarily complete: On
1290#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1291#     will be ignored.  On the destination, encountering an unmapped
1292#     alias in the incoming migration stream will result in a report,
1293#     and all further bitmap migration data will then be discarded.
1294#     Note that the destination does not know about bitmaps it does
1295#     not receive, so there is no limitation or requirement regarding
1296#     the number of bitmaps received, or how they are named, or on
1297#     which nodes they are placed.  By default (when this parameter
1298#     has never been set), bitmap names are mapped to themselves.
1299#     Nodes are mapped to their block device name if there is one, and
1300#     to their node name otherwise.  (Since 5.2)
1301#
1302# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1303#     limit during live migration.  Should be in the range 1 to
1304#     1000ms.  Defaults to 1000ms.  (Since 8.1)
1305#
1306# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1307#     Defaults to 1.  (Since 8.1)
1308#
1309# @mode: Migration mode.  See description in @MigMode.  Default is
1310#     'normal'.  (Since 8.2)
1311#
1312# @zero-page-detection: Whether and how to detect zero pages.
1313#     See description in @ZeroPageDetection.  Default is 'multifd'.
1314#     (since 9.0)
1315#
1316# @direct-io: Open migration files with O_DIRECT when possible.  This
1317#     only has effect if the @mapped-ram capability is enabled.
1318#     (Since 9.1)
1319#
1320# Features:
1321#
1322# @unstable: Members @x-checkpoint-delay and
1323#     @x-vcpu-dirty-limit-period are experimental.
1324#
1325# Since: 2.4
1326##
1327{ 'struct': 'MigrationParameters',
1328  'data': { '*announce-initial': 'size',
1329            '*announce-max': 'size',
1330            '*announce-rounds': 'size',
1331            '*announce-step': 'size',
1332            '*throttle-trigger-threshold': 'uint8',
1333            '*cpu-throttle-initial': 'uint8',
1334            '*cpu-throttle-increment': 'uint8',
1335            '*cpu-throttle-tailslow': 'bool',
1336            '*tls-creds': 'str',
1337            '*tls-hostname': 'str',
1338            '*tls-authz': 'str',
1339            '*max-bandwidth': 'size',
1340            '*avail-switchover-bandwidth': 'size',
1341            '*downtime-limit': 'uint64',
1342            '*x-checkpoint-delay': { 'type': 'uint32',
1343                                     'features': [ 'unstable' ] },
1344            '*multifd-channels': 'uint8',
1345            '*xbzrle-cache-size': 'size',
1346            '*max-postcopy-bandwidth': 'size',
1347            '*max-cpu-throttle': 'uint8',
1348            '*multifd-compression': 'MultiFDCompression',
1349            '*multifd-zlib-level': 'uint8',
1350            '*multifd-qatzip-level': 'uint8',
1351            '*multifd-zstd-level': 'uint8',
1352            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1353            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1354                                            'features': [ 'unstable' ] },
1355            '*vcpu-dirty-limit': 'uint64',
1356            '*mode': 'MigMode',
1357            '*zero-page-detection': 'ZeroPageDetection',
1358            '*direct-io': 'bool' } }
1359
1360##
1361# @query-migrate-parameters:
1362#
1363# Return information about the current migration parameters
1364#
1365# Returns: @MigrationParameters
1366#
1367# Since: 2.4
1368#
1369# .. qmp-example::
1370#
1371#     -> { "execute": "query-migrate-parameters" }
1372#     <- { "return": {
1373#              "multifd-channels": 2,
1374#              "cpu-throttle-increment": 10,
1375#              "cpu-throttle-initial": 20,
1376#              "max-bandwidth": 33554432,
1377#              "downtime-limit": 300
1378#           }
1379#        }
1380##
1381{ 'command': 'query-migrate-parameters',
1382  'returns': 'MigrationParameters' }
1383
1384##
1385# @migrate-start-postcopy:
1386#
1387# Followup to a migration command to switch the migration to postcopy
1388# mode.  The postcopy-ram capability must be set on both source and
1389# destination before the original migration command.
1390#
1391# Since: 2.5
1392#
1393# .. qmp-example::
1394#
1395#     -> { "execute": "migrate-start-postcopy" }
1396#     <- { "return": {} }
1397##
1398{ 'command': 'migrate-start-postcopy' }
1399
1400##
1401# @MIGRATION:
1402#
1403# Emitted when a migration event happens
1404#
1405# @status: @MigrationStatus describing the current migration status.
1406#
1407# Since: 2.4
1408#
1409# .. qmp-example::
1410#
1411#     <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1412#         "event": "MIGRATION",
1413#         "data": {"status": "completed"} }
1414##
1415{ 'event': 'MIGRATION',
1416  'data': {'status': 'MigrationStatus'}}
1417
1418##
1419# @MIGRATION_PASS:
1420#
1421# Emitted from the source side of a migration at the start of each
1422# pass (when it syncs the dirty bitmap)
1423#
1424# @pass: An incrementing count (starting at 1 on the first pass)
1425#
1426# Since: 2.6
1427#
1428# .. qmp-example::
1429#
1430#     <- { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1431#           "event": "MIGRATION_PASS", "data": {"pass": 2} }
1432##
1433{ 'event': 'MIGRATION_PASS',
1434  'data': { 'pass': 'int' } }
1435
1436##
1437# @COLOMessage:
1438#
1439# The message transmission between Primary side and Secondary side.
1440#
1441# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1442#
1443# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for
1444#     checkpointing
1445#
1446# @checkpoint-reply: SVM gets PVM's checkpoint request
1447#
1448# @vmstate-send: VM's state will be sent by PVM.
1449#
1450# @vmstate-size: The total size of VMstate.
1451#
1452# @vmstate-received: VM's state has been received by SVM.
1453#
1454# @vmstate-loaded: VM's state has been loaded by SVM.
1455#
1456# Since: 2.8
1457##
1458{ 'enum': 'COLOMessage',
1459  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1460            'vmstate-send', 'vmstate-size', 'vmstate-received',
1461            'vmstate-loaded' ] }
1462
1463##
1464# @COLOMode:
1465#
1466# The COLO current mode.
1467#
1468# @none: COLO is disabled.
1469#
1470# @primary: COLO node in primary side.
1471#
1472# @secondary: COLO node in slave side.
1473#
1474# Since: 2.8
1475##
1476{ 'enum': 'COLOMode',
1477  'data': [ 'none', 'primary', 'secondary'] }
1478
1479##
1480# @FailoverStatus:
1481#
1482# An enumeration of COLO failover status
1483#
1484# @none: no failover has ever happened
1485#
1486# @require: got failover requirement but not handled
1487#
1488# @active: in the process of doing failover
1489#
1490# @completed: finish the process of failover
1491#
1492# @relaunch: restart the failover process, from 'none' -> 'completed'
1493#     (Since 2.9)
1494#
1495# Since: 2.8
1496##
1497{ 'enum': 'FailoverStatus',
1498  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1499
1500##
1501# @COLO_EXIT:
1502#
1503# Emitted when VM finishes COLO mode due to some errors happening or
1504# at the request of users.
1505#
1506# @mode: report COLO mode when COLO exited.
1507#
1508# @reason: describes the reason for the COLO exit.
1509#
1510# Since: 3.1
1511#
1512# .. qmp-example::
1513#
1514#     <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1515#          "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1516##
1517{ 'event': 'COLO_EXIT',
1518  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1519
1520##
1521# @COLOExitReason:
1522#
1523# The reason for a COLO exit.
1524#
1525# @none: failover has never happened.  This state does not occur in
1526#     the COLO_EXIT event, and is only visible in the result of
1527#     query-colo-status.
1528#
1529# @request: COLO exit is due to an external request.
1530#
1531# @error: COLO exit is due to an internal error.
1532#
1533# @processing: COLO is currently handling a failover (since 4.0).
1534#
1535# Since: 3.1
1536##
1537{ 'enum': 'COLOExitReason',
1538  'data': [ 'none', 'request', 'error' , 'processing' ] }
1539
1540##
1541# @x-colo-lost-heartbeat:
1542#
1543# Tell QEMU that heartbeat is lost, request it to do takeover
1544# procedures.  If this command is sent to the PVM, the Primary side
1545# will exit COLO mode.  If sent to the Secondary, the Secondary side
1546# will run failover work, then takes over server operation to become
1547# the service VM.
1548#
1549# Features:
1550#
1551# @unstable: This command is experimental.
1552#
1553# Since: 2.8
1554#
1555# .. qmp-example::
1556#
1557#     -> { "execute": "x-colo-lost-heartbeat" }
1558#     <- { "return": {} }
1559##
1560{ 'command': 'x-colo-lost-heartbeat',
1561  'features': [ 'unstable' ],
1562  'if': 'CONFIG_REPLICATION' }
1563
1564##
1565# @migrate_cancel:
1566#
1567# Cancel the currently executing migration process.  Allows a new
1568# migration to be started right after.  When postcopy-ram is in use,
1569# cancelling is not allowed after the postcopy phase has started.
1570#
1571# .. note:: This command succeeds even if there is no migration
1572#    process running.
1573#
1574# Since: 0.14
1575#
1576# .. qmp-example::
1577#
1578#     -> { "execute": "migrate_cancel" }
1579#     <- { "return": {} }
1580##
1581{ 'command': 'migrate_cancel' }
1582
1583##
1584# @migrate-continue:
1585#
1586# Continue migration when it's in a paused state.
1587#
1588# @state: The state the migration is currently expected to be in
1589#
1590# Since: 2.11
1591#
1592# .. qmp-example::
1593#
1594#     -> { "execute": "migrate-continue" , "arguments":
1595#          { "state": "pre-switchover" } }
1596#     <- { "return": {} }
1597##
1598{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1599
1600##
1601# @MigrationAddressType:
1602#
1603# The migration stream transport mechanisms.
1604#
1605# @socket: Migrate via socket.
1606#
1607# @exec: Direct the migration stream to another process.
1608#
1609# @rdma: Migrate via RDMA.
1610#
1611# @file: Direct the migration stream to a file.
1612#
1613# Since: 8.2
1614##
1615{ 'enum': 'MigrationAddressType',
1616  'data': [ 'socket', 'exec', 'rdma', 'file' ] }
1617
1618##
1619# @FileMigrationArgs:
1620#
1621# @filename: The file to receive the migration stream
1622#
1623# @offset: The file offset where the migration stream will start
1624#
1625# Since: 8.2
1626##
1627{ 'struct': 'FileMigrationArgs',
1628  'data': { 'filename': 'str',
1629            'offset': 'uint64' } }
1630
1631##
1632# @MigrationExecCommand:
1633#
1634# @args: command (list head) and arguments to execute.
1635#
1636# Since: 8.2
1637##
1638{ 'struct': 'MigrationExecCommand',
1639  'data': {'args': [ 'str' ] } }
1640
1641##
1642# @MigrationAddress:
1643#
1644# Migration endpoint configuration.
1645#
1646# @transport: The migration stream transport mechanism
1647#
1648# Since: 8.2
1649##
1650{ 'union': 'MigrationAddress',
1651  'base': { 'transport' : 'MigrationAddressType'},
1652  'discriminator': 'transport',
1653  'data': {
1654    'socket': 'SocketAddress',
1655    'exec': 'MigrationExecCommand',
1656    'rdma': 'InetSocketAddress',
1657    'file': 'FileMigrationArgs' } }
1658
1659##
1660# @MigrationChannelType:
1661#
1662# The migration channel-type request options.
1663#
1664# @main: Main outbound migration channel.
1665# @cpr: Checkpoint and restart state channel.
1666#
1667# Since: 8.1
1668##
1669{ 'enum': 'MigrationChannelType',
1670  'data': [ 'main', 'cpr' ] }
1671
1672##
1673# @MigrationChannel:
1674#
1675# Migration stream channel parameters.
1676#
1677# @channel-type: Channel type for transferring packet information.
1678#
1679# @addr: Migration endpoint configuration on destination interface.
1680#
1681# Since: 8.1
1682##
1683{ 'struct': 'MigrationChannel',
1684  'data': {
1685      'channel-type': 'MigrationChannelType',
1686      'addr': 'MigrationAddress' } }
1687
1688##
1689# @migrate:
1690#
1691# Migrates the current running guest to another Virtual Machine.
1692#
1693# @uri: the Uniform Resource Identifier of the destination VM
1694#
1695# @channels: list of migration stream channels with each stream in the
1696#     list connected to a destination interface endpoint.
1697#
1698# @detach: this argument exists only for compatibility reasons and is
1699#     ignored by QEMU
1700#
1701# @resume: resume one paused migration, default "off".  (since 3.0)
1702#
1703# Features:
1704#
1705# @deprecated: Argument @detach is deprecated.
1706#
1707# Since: 0.14
1708#
1709# .. admonition:: Notes
1710#
1711#     1. The 'query-migrate' command should be used to check
1712#        migration's progress and final result (this information is
1713#        provided by the 'status' member).
1714#
1715#     2. The uri argument should have the Uniform Resource Identifier
1716#        of default destination VM.  This connection will be bound to
1717#        default network.
1718#
1719#     3. For now, number of migration streams is restricted to one,
1720#        i.e. number of items in 'channels' list is just 1.
1721#
1722#     4. The 'uri' and 'channels' arguments are mutually exclusive;
1723#        exactly one of the two should be present.
1724#
1725# .. qmp-example::
1726#
1727#     -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1728#     <- { "return": {} }
1729#
1730#     -> { "execute": "migrate",
1731#          "arguments": {
1732#              "channels": [ { "channel-type": "main",
1733#                              "addr": { "transport": "socket",
1734#                                        "type": "inet",
1735#                                        "host": "10.12.34.9",
1736#                                        "port": "1050" } } ] } }
1737#     <- { "return": {} }
1738#
1739#     -> { "execute": "migrate",
1740#          "arguments": {
1741#              "channels": [ { "channel-type": "main",
1742#                              "addr": { "transport": "exec",
1743#                                        "args": [ "/bin/nc", "-p", "6000",
1744#                                                  "/some/sock" ] } } ] } }
1745#     <- { "return": {} }
1746#
1747#     -> { "execute": "migrate",
1748#          "arguments": {
1749#              "channels": [ { "channel-type": "main",
1750#                              "addr": { "transport": "rdma",
1751#                                        "host": "10.12.34.9",
1752#                                        "port": "1050" } } ] } }
1753#     <- { "return": {} }
1754#
1755#     -> { "execute": "migrate",
1756#          "arguments": {
1757#              "channels": [ { "channel-type": "main",
1758#                              "addr": { "transport": "file",
1759#                                        "filename": "/tmp/migfile",
1760#                                        "offset": "0x1000" } } ] } }
1761#     <- { "return": {} }
1762##
1763{ 'command': 'migrate',
1764  'data': {'*uri': 'str',
1765           '*channels': [ 'MigrationChannel' ],
1766           '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] },
1767           '*resume': 'bool' } }
1768
1769##
1770# @migrate-incoming:
1771#
1772# Start an incoming migration.  QEMU must have been started with
1773# -incoming defer.
1774#
1775# @uri: The Uniform Resource Identifier identifying the source or
1776#     address to listen on
1777#
1778# @channels: list of migration stream channels with each stream in the
1779#     list connected to a destination interface endpoint.
1780#
1781# @exit-on-error: Exit on incoming migration failure.  Default true.
1782#     When set to false, the failure triggers a MIGRATION event, and
1783#     error details could be retrieved with query-migrate.
1784#     (since 9.1)
1785#
1786# Since: 2.3
1787#
1788# .. admonition:: Notes
1789#
1790#     1. It's a bad idea to use a string for the uri, but it needs to
1791#        stay compatible with -incoming and the format of the uri is
1792#        already exposed above libvirt.
1793#
1794#     2. QEMU must be started with -incoming defer to allow
1795#        migrate-incoming to be used.
1796#
1797#     3. The uri format is the same as for -incoming
1798#
1799#     4. For now, number of migration streams is restricted to one,
1800#        i.e. number of items in 'channels' list is just 1.
1801#
1802#     5. The 'uri' and 'channels' arguments are mutually exclusive;
1803#        exactly one of the two should be present.
1804#
1805# .. qmp-example::
1806#
1807#     -> { "execute": "migrate-incoming",
1808#          "arguments": { "uri": "tcp:0:4446" } }
1809#     <- { "return": {} }
1810#
1811#     -> { "execute": "migrate-incoming",
1812#          "arguments": {
1813#              "channels": [ { "channel-type": "main",
1814#                              "addr": { "transport": "socket",
1815#                                        "type": "inet",
1816#                                        "host": "10.12.34.9",
1817#                                        "port": "1050" } } ] } }
1818#     <- { "return": {} }
1819#
1820#     -> { "execute": "migrate-incoming",
1821#          "arguments": {
1822#              "channels": [ { "channel-type": "main",
1823#                              "addr": { "transport": "exec",
1824#                                        "args": [ "/bin/nc", "-p", "6000",
1825#                                                  "/some/sock" ] } } ] } }
1826#     <- { "return": {} }
1827#
1828#     -> { "execute": "migrate-incoming",
1829#          "arguments": {
1830#              "channels": [ { "channel-type": "main",
1831#                              "addr": { "transport": "rdma",
1832#                                        "host": "10.12.34.9",
1833#                                        "port": "1050" } } ] } }
1834#     <- { "return": {} }
1835##
1836{ 'command': 'migrate-incoming',
1837             'data': {'*uri': 'str',
1838                      '*channels': [ 'MigrationChannel' ],
1839                      '*exit-on-error': 'bool' } }
1840
1841##
1842# @xen-save-devices-state:
1843#
1844# Save the state of all devices to file.  The RAM and the block
1845# devices of the VM are not saved by this command.
1846#
1847# @filename: the file to save the state of the devices to as binary
1848#     data.  See xen-save-devices-state.txt for a description of the
1849#     binary format.
1850#
1851# @live: Optional argument to ask QEMU to treat this command as part
1852#     of a live migration.  Default to true.  (since 2.11)
1853#
1854# Since: 1.1
1855#
1856# .. qmp-example::
1857#
1858#     -> { "execute": "xen-save-devices-state",
1859#          "arguments": { "filename": "/tmp/save" } }
1860#     <- { "return": {} }
1861##
1862{ 'command': 'xen-save-devices-state',
1863  'data': {'filename': 'str', '*live':'bool' } }
1864
1865##
1866# @xen-set-global-dirty-log:
1867#
1868# Enable or disable the global dirty log mode.
1869#
1870# @enable: true to enable, false to disable.
1871#
1872# Since: 1.3
1873#
1874# .. qmp-example::
1875#
1876#     -> { "execute": "xen-set-global-dirty-log",
1877#          "arguments": { "enable": true } }
1878#     <- { "return": {} }
1879##
1880{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1881
1882##
1883# @xen-load-devices-state:
1884#
1885# Load the state of all devices from file.  The RAM and the block
1886# devices of the VM are not loaded by this command.
1887#
1888# @filename: the file to load the state of the devices from as binary
1889#     data.  See xen-save-devices-state.txt for a description of the
1890#     binary format.
1891#
1892# Since: 2.7
1893#
1894# .. qmp-example::
1895#
1896#     -> { "execute": "xen-load-devices-state",
1897#          "arguments": { "filename": "/tmp/resume" } }
1898#     <- { "return": {} }
1899##
1900{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1901
1902##
1903# @xen-set-replication:
1904#
1905# Enable or disable replication.
1906#
1907# @enable: true to enable, false to disable.
1908#
1909# @primary: true for primary or false for secondary.
1910#
1911# @failover: true to do failover, false to stop.  Cannot be specified
1912#     if 'enable' is true.  Default value is false.
1913#
1914# .. qmp-example::
1915#
1916#     -> { "execute": "xen-set-replication",
1917#          "arguments": {"enable": true, "primary": false} }
1918#     <- { "return": {} }
1919#
1920# Since: 2.9
1921##
1922{ 'command': 'xen-set-replication',
1923  'data': { 'enable': 'bool', 'primary': 'bool', '*failover': 'bool' },
1924  'if': 'CONFIG_REPLICATION' }
1925
1926##
1927# @ReplicationStatus:
1928#
1929# The result format for 'query-xen-replication-status'.
1930#
1931# @error: true if an error happened, false if replication is normal.
1932#
1933# @desc: the human readable error description string, when @error is
1934#     'true'.
1935#
1936# Since: 2.9
1937##
1938{ 'struct': 'ReplicationStatus',
1939  'data': { 'error': 'bool', '*desc': 'str' },
1940  'if': 'CONFIG_REPLICATION' }
1941
1942##
1943# @query-xen-replication-status:
1944#
1945# Query replication status while the vm is running.
1946#
1947# Returns: A @ReplicationStatus object showing the status.
1948#
1949# .. qmp-example::
1950#
1951#     -> { "execute": "query-xen-replication-status" }
1952#     <- { "return": { "error": false } }
1953#
1954# Since: 2.9
1955##
1956{ 'command': 'query-xen-replication-status',
1957  'returns': 'ReplicationStatus',
1958  'if': 'CONFIG_REPLICATION' }
1959
1960##
1961# @xen-colo-do-checkpoint:
1962#
1963# Xen uses this command to notify replication to trigger a checkpoint.
1964#
1965# .. qmp-example::
1966#
1967#     -> { "execute": "xen-colo-do-checkpoint" }
1968#     <- { "return": {} }
1969#
1970# Since: 2.9
1971##
1972{ 'command': 'xen-colo-do-checkpoint',
1973  'if': 'CONFIG_REPLICATION' }
1974
1975##
1976# @COLOStatus:
1977#
1978# The result format for 'query-colo-status'.
1979#
1980# @mode: COLO running mode.  If COLO is running, this field will
1981#     return 'primary' or 'secondary'.
1982#
1983# @last-mode: COLO last running mode.  If COLO is running, this field
1984#     will return same like mode field, after failover we can use this
1985#     field to get last colo mode.  (since 4.0)
1986#
1987# @reason: describes the reason for the COLO exit.
1988#
1989# Since: 3.1
1990##
1991{ 'struct': 'COLOStatus',
1992  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1993            'reason': 'COLOExitReason' },
1994  'if': 'CONFIG_REPLICATION' }
1995
1996##
1997# @query-colo-status:
1998#
1999# Query COLO status while the vm is running.
2000#
2001# Returns: A @COLOStatus object showing the status.
2002#
2003# .. qmp-example::
2004#
2005#     -> { "execute": "query-colo-status" }
2006#     <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
2007#
2008# Since: 3.1
2009##
2010{ 'command': 'query-colo-status',
2011  'returns': 'COLOStatus',
2012  'if': 'CONFIG_REPLICATION' }
2013
2014##
2015# @migrate-recover:
2016#
2017# Provide a recovery migration stream URI.
2018#
2019# @uri: the URI to be used for the recovery of migration stream.
2020#
2021# .. qmp-example::
2022#
2023#     -> { "execute": "migrate-recover",
2024#          "arguments": { "uri": "tcp:192.168.1.200:12345" } }
2025#     <- { "return": {} }
2026#
2027# Since: 3.0
2028##
2029{ 'command': 'migrate-recover',
2030  'data': { 'uri': 'str' },
2031  'allow-oob': true }
2032
2033##
2034# @migrate-pause:
2035#
2036# Pause a migration.  Currently it only supports postcopy.
2037#
2038# .. qmp-example::
2039#
2040#     -> { "execute": "migrate-pause" }
2041#     <- { "return": {} }
2042#
2043# Since: 3.0
2044##
2045{ 'command': 'migrate-pause', 'allow-oob': true }
2046
2047##
2048# @UNPLUG_PRIMARY:
2049#
2050# Emitted from source side of a migration when migration state is
2051# WAIT_UNPLUG.  Device was unplugged by guest operating system.
2052# Device resources in QEMU are kept on standby to be able to re-plug
2053# it in case of migration failure.
2054#
2055# @device-id: QEMU device id of the unplugged device
2056#
2057# Since: 4.2
2058#
2059# .. qmp-example::
2060#
2061#     <- { "event": "UNPLUG_PRIMARY",
2062#          "data": { "device-id": "hostdev0" },
2063#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
2064##
2065{ 'event': 'UNPLUG_PRIMARY',
2066  'data': { 'device-id': 'str' } }
2067
2068##
2069# @DirtyRateVcpu:
2070#
2071# Dirty rate of vcpu.
2072#
2073# @id: vcpu index.
2074#
2075# @dirty-rate: dirty rate.
2076#
2077# Since: 6.2
2078##
2079{ 'struct': 'DirtyRateVcpu',
2080  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
2081
2082##
2083# @DirtyRateStatus:
2084#
2085# Dirty page rate measurement status.
2086#
2087# @unstarted: measuring thread has not been started yet
2088#
2089# @measuring: measuring thread is running
2090#
2091# @measured: dirty page rate is measured and the results are available
2092#
2093# Since: 5.2
2094##
2095{ 'enum': 'DirtyRateStatus',
2096  'data': [ 'unstarted', 'measuring', 'measured'] }
2097
2098##
2099# @DirtyRateMeasureMode:
2100#
2101# Method used to measure dirty page rate.  Differences between
2102# available methods are explained in @calc-dirty-rate.
2103#
2104# @page-sampling: use page sampling
2105#
2106# @dirty-ring: use dirty ring
2107#
2108# @dirty-bitmap: use dirty bitmap
2109#
2110# Since: 6.2
2111##
2112{ 'enum': 'DirtyRateMeasureMode',
2113  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
2114
2115##
2116# @TimeUnit:
2117#
2118# Specifies unit in which time-related value is specified.
2119#
2120# @second: value is in seconds
2121#
2122# @millisecond: value is in milliseconds
2123#
2124# Since: 8.2
2125##
2126{ 'enum': 'TimeUnit',
2127  'data': ['second', 'millisecond'] }
2128
2129##
2130# @DirtyRateInfo:
2131#
2132# Information about measured dirty page rate.
2133#
2134# @dirty-rate: an estimate of the dirty page rate of the VM in units
2135#     of MiB/s.  Value is present only when @status is 'measured'.
2136#
2137# @status: current status of dirty page rate measurements
2138#
2139# @start-time: start time in units of second for calculation
2140#
2141# @calc-time: time period for which dirty page rate was measured,
2142#     expressed and rounded down to @calc-time-unit.
2143#
2144# @calc-time-unit: time unit of @calc-time  (Since 8.2)
2145#
2146# @sample-pages: number of sampled pages per GiB of guest memory.
2147#     Valid only in page-sampling mode (Since 6.1)
2148#
2149# @mode: mode that was used to measure dirty page rate (Since 6.2)
2150#
2151# @vcpu-dirty-rate: dirty rate for each vCPU if dirty-ring mode was
2152#     specified (Since 6.2)
2153#
2154# Since: 5.2
2155##
2156{ 'struct': 'DirtyRateInfo',
2157  'data': {'*dirty-rate': 'int64',
2158           'status': 'DirtyRateStatus',
2159           'start-time': 'int64',
2160           'calc-time': 'int64',
2161           'calc-time-unit': 'TimeUnit',
2162           'sample-pages': 'uint64',
2163           'mode': 'DirtyRateMeasureMode',
2164           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
2165
2166##
2167# @calc-dirty-rate:
2168#
2169# Start measuring dirty page rate of the VM.  Results can be retrieved
2170# with @query-dirty-rate after measurements are completed.
2171#
2172# Dirty page rate is the number of pages changed in a given time
2173# period expressed in MiB/s.  The following methods of calculation are
2174# available:
2175#
2176# 1. In page sampling mode, a random subset of pages are selected and
2177#    hashed twice: once at the beginning of measurement time period,
2178#    and once again at the end.  If two hashes for some page are
2179#    different, the page is counted as changed.  Since this method
2180#    relies on sampling and hashing, calculated dirty page rate is
2181#    only an estimate of its true value.  Increasing @sample-pages
2182#    improves estimation quality at the cost of higher computational
2183#    overhead.
2184#
2185# 2. Dirty bitmap mode captures writes to memory (for example by
2186#    temporarily revoking write access to all pages) and counting page
2187#    faults.  Information about modified pages is collected into a
2188#    bitmap, where each bit corresponds to one guest page.  This mode
2189#    requires that KVM accelerator property "dirty-ring-size" is *not*
2190#    set.
2191#
2192# 3. Dirty ring mode is similar to dirty bitmap mode, but the
2193#    information about modified pages is collected into ring buffer.
2194#    This mode tracks page modification per each vCPU separately.  It
2195#    requires that KVM accelerator property "dirty-ring-size" is set.
2196#
2197# @calc-time: time period for which dirty page rate is calculated.  By
2198#     default it is specified in seconds, but the unit can be set
2199#     explicitly with @calc-time-unit.  Note that larger @calc-time
2200#     values will typically result in smaller dirty page rates because
2201#     page dirtying is a one-time event.  Once some page is counted as
2202#     dirty during @calc-time period, further writes to this page will
2203#     not increase dirty page rate anymore.
2204#
2205# @calc-time-unit: time unit in which @calc-time is specified.  By
2206#     default it is seconds.  (Since 8.2)
2207#
2208# @sample-pages: number of sampled pages per each GiB of guest memory.
2209#     Default value is 512.  For 4KiB guest pages this corresponds to
2210#     sampling ratio of 0.2%.  This argument is used only in page
2211#     sampling mode.  (Since 6.1)
2212#
2213# @mode: mechanism for tracking dirty pages.  Default value is
2214#     'page-sampling'.  Others are 'dirty-bitmap' and 'dirty-ring'.
2215#     (Since 6.1)
2216#
2217# Since: 5.2
2218#
2219# .. qmp-example::
2220#
2221#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
2222#                                                     "sample-pages": 512} }
2223#     <- { "return": {} }
2224#
2225# .. qmp-example::
2226#    :annotated:
2227#
2228#    Measure dirty rate using dirty bitmap for 500 milliseconds::
2229#
2230#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 500,
2231#         "calc-time-unit": "millisecond", "mode": "dirty-bitmap"} }
2232#
2233#     <- { "return": {} }
2234##
2235{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
2236                                         '*calc-time-unit': 'TimeUnit',
2237                                         '*sample-pages': 'int',
2238                                         '*mode': 'DirtyRateMeasureMode'} }
2239
2240##
2241# @query-dirty-rate:
2242#
2243# Query results of the most recent invocation of @calc-dirty-rate.
2244#
2245# @calc-time-unit: time unit in which to report calculation time.
2246#     By default it is reported in seconds.  (Since 8.2)
2247#
2248# Since: 5.2
2249#
2250# .. qmp-example::
2251#    :title: Measurement is in progress
2252#
2253#     <- {"status": "measuring", "sample-pages": 512,
2254#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2255#         "calc-time-unit": "second"}
2256#
2257# .. qmp-example::
2258#    :title: Measurement has been completed
2259#
2260#     <- {"status": "measured", "sample-pages": 512, "dirty-rate": 108,
2261#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2262#         "calc-time-unit": "second"}
2263##
2264{ 'command': 'query-dirty-rate', 'data': {'*calc-time-unit': 'TimeUnit' },
2265                                 'returns': 'DirtyRateInfo' }
2266
2267##
2268# @DirtyLimitInfo:
2269#
2270# Dirty page rate limit information of a virtual CPU.
2271#
2272# @cpu-index: index of a virtual CPU.
2273#
2274# @limit-rate: upper limit of dirty page rate (MB/s) for a virtual
2275#     CPU, 0 means unlimited.
2276#
2277# @current-rate: current dirty page rate (MB/s) for a virtual CPU.
2278#
2279# Since: 7.1
2280##
2281{ 'struct': 'DirtyLimitInfo',
2282  'data': { 'cpu-index': 'int',
2283            'limit-rate': 'uint64',
2284            'current-rate': 'uint64' } }
2285
2286##
2287# @set-vcpu-dirty-limit:
2288#
2289# Set the upper limit of dirty page rate for virtual CPUs.
2290#
2291# Requires KVM with accelerator property "dirty-ring-size" set.  A
2292# virtual CPU's dirty page rate is a measure of its memory load.  To
2293# observe dirty page rates, use @calc-dirty-rate.
2294#
2295# @cpu-index: index of a virtual CPU, default is all.
2296#
2297# @dirty-rate: upper limit of dirty page rate (MB/s) for virtual CPUs.
2298#
2299# Since: 7.1
2300#
2301# .. qmp-example::
2302#
2303#     -> {"execute": "set-vcpu-dirty-limit"}
2304#         "arguments": { "dirty-rate": 200,
2305#                        "cpu-index": 1 } }
2306#     <- { "return": {} }
2307##
2308{ 'command': 'set-vcpu-dirty-limit',
2309  'data': { '*cpu-index': 'int',
2310            'dirty-rate': 'uint64' } }
2311
2312##
2313# @cancel-vcpu-dirty-limit:
2314#
2315# Cancel the upper limit of dirty page rate for virtual CPUs.
2316#
2317# Cancel the dirty page limit for the vCPU which has been set with
2318# set-vcpu-dirty-limit command.  Note that this command requires
2319# support from dirty ring, same as the "set-vcpu-dirty-limit".
2320#
2321# @cpu-index: index of a virtual CPU, default is all.
2322#
2323# Since: 7.1
2324#
2325# .. qmp-example::
2326#
2327#     -> {"execute": "cancel-vcpu-dirty-limit"},
2328#         "arguments": { "cpu-index": 1 } }
2329#     <- { "return": {} }
2330##
2331{ 'command': 'cancel-vcpu-dirty-limit',
2332  'data': { '*cpu-index': 'int'} }
2333
2334##
2335# @query-vcpu-dirty-limit:
2336#
2337# Return information about virtual CPU dirty page rate limits, if
2338# any.
2339#
2340# Since: 7.1
2341#
2342# .. qmp-example::
2343#
2344#     -> {"execute": "query-vcpu-dirty-limit"}
2345#     <- {"return": [
2346#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 0},
2347#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 1}]}
2348##
2349{ 'command': 'query-vcpu-dirty-limit',
2350  'returns': [ 'DirtyLimitInfo' ] }
2351
2352##
2353# @MigrationThreadInfo:
2354#
2355# Information about migrationthreads
2356#
2357# @name: the name of migration thread
2358#
2359# @thread-id: ID of the underlying host thread
2360#
2361# Since: 7.2
2362##
2363{ 'struct': 'MigrationThreadInfo',
2364  'data': {'name': 'str',
2365           'thread-id': 'int'} }
2366
2367##
2368# @query-migrationthreads:
2369#
2370# Return information of migration threads
2371#
2372# Features:
2373#
2374# @deprecated: This command is deprecated with no replacement yet.
2375#
2376# Returns: @MigrationThreadInfo
2377#
2378# Since: 7.2
2379##
2380{ 'command': 'query-migrationthreads',
2381  'returns': ['MigrationThreadInfo'],
2382  'features': ['deprecated'] }
2383
2384##
2385# @snapshot-save:
2386#
2387# Save a VM snapshot
2388#
2389# @job-id: identifier for the newly created job
2390#
2391# @tag: name of the snapshot to create
2392#
2393# @vmstate: block device node name to save vmstate to
2394#
2395# @devices: list of block device node names to save a snapshot to
2396#
2397# Applications should not assume that the snapshot save is complete
2398# when this command returns.  The job commands / events must be used
2399# to determine completion and to fetch details of any errors that
2400# arise.
2401#
2402# Note that execution of the guest CPUs may be stopped during the time
2403# it takes to save the snapshot.  A future version of QEMU may ensure
2404# CPUs are executing continuously.
2405#
2406# It is strongly recommended that @devices contain all writable block
2407# device nodes if a consistent snapshot is required.
2408#
2409# If @tag already exists, an error will be reported
2410#
2411# .. qmp-example::
2412#
2413#     -> { "execute": "snapshot-save",
2414#          "arguments": {
2415#             "job-id": "snapsave0",
2416#             "tag": "my-snap",
2417#             "vmstate": "disk0",
2418#             "devices": ["disk0", "disk1"]
2419#          }
2420#        }
2421#     <- { "return": { } }
2422#     <- {"event": "JOB_STATUS_CHANGE",
2423#         "timestamp": {"seconds": 1432121972, "microseconds": 744001},
2424#         "data": {"status": "created", "id": "snapsave0"}}
2425#     <- {"event": "JOB_STATUS_CHANGE",
2426#         "timestamp": {"seconds": 1432122172, "microseconds": 744001},
2427#         "data": {"status": "running", "id": "snapsave0"}}
2428#     <- {"event": "STOP",
2429#         "timestamp": {"seconds": 1432122372, "microseconds": 744001} }
2430#     <- {"event": "RESUME",
2431#         "timestamp": {"seconds": 1432122572, "microseconds": 744001} }
2432#     <- {"event": "JOB_STATUS_CHANGE",
2433#         "timestamp": {"seconds": 1432122772, "microseconds": 744001},
2434#         "data": {"status": "waiting", "id": "snapsave0"}}
2435#     <- {"event": "JOB_STATUS_CHANGE",
2436#         "timestamp": {"seconds": 1432122972, "microseconds": 744001},
2437#         "data": {"status": "pending", "id": "snapsave0"}}
2438#     <- {"event": "JOB_STATUS_CHANGE",
2439#         "timestamp": {"seconds": 1432123172, "microseconds": 744001},
2440#         "data": {"status": "concluded", "id": "snapsave0"}}
2441#     -> {"execute": "query-jobs"}
2442#     <- {"return": [{"current-progress": 1,
2443#                     "status": "concluded",
2444#                     "total-progress": 1,
2445#                     "type": "snapshot-save",
2446#                     "id": "snapsave0"}]}
2447#
2448# Since: 6.0
2449##
2450{ 'command': 'snapshot-save',
2451  'data': { 'job-id': 'str',
2452            'tag': 'str',
2453            'vmstate': 'str',
2454            'devices': ['str'] } }
2455
2456##
2457# @snapshot-load:
2458#
2459# Load a VM snapshot
2460#
2461# @job-id: identifier for the newly created job
2462#
2463# @tag: name of the snapshot to load.
2464#
2465# @vmstate: block device node name to load vmstate from
2466#
2467# @devices: list of block device node names to load a snapshot from
2468#
2469# Applications should not assume that the snapshot load is complete
2470# when this command returns.  The job commands / events must be used
2471# to determine completion and to fetch details of any errors that
2472# arise.
2473#
2474# Note that execution of the guest CPUs will be stopped during the
2475# time it takes to load the snapshot.
2476#
2477# It is strongly recommended that @devices contain all writable block
2478# device nodes that can have changed since the original @snapshot-save
2479# command execution.
2480#
2481# .. qmp-example::
2482#
2483#     -> { "execute": "snapshot-load",
2484#          "arguments": {
2485#             "job-id": "snapload0",
2486#             "tag": "my-snap",
2487#             "vmstate": "disk0",
2488#             "devices": ["disk0", "disk1"]
2489#          }
2490#        }
2491#     <- { "return": { } }
2492#     <- {"event": "JOB_STATUS_CHANGE",
2493#         "timestamp": {"seconds": 1472124172, "microseconds": 744001},
2494#         "data": {"status": "created", "id": "snapload0"}}
2495#     <- {"event": "JOB_STATUS_CHANGE",
2496#         "timestamp": {"seconds": 1472125172, "microseconds": 744001},
2497#         "data": {"status": "running", "id": "snapload0"}}
2498#     <- {"event": "STOP",
2499#         "timestamp": {"seconds": 1472125472, "microseconds": 744001} }
2500#     <- {"event": "RESUME",
2501#         "timestamp": {"seconds": 1472125872, "microseconds": 744001} }
2502#     <- {"event": "JOB_STATUS_CHANGE",
2503#         "timestamp": {"seconds": 1472126172, "microseconds": 744001},
2504#         "data": {"status": "waiting", "id": "snapload0"}}
2505#     <- {"event": "JOB_STATUS_CHANGE",
2506#         "timestamp": {"seconds": 1472127172, "microseconds": 744001},
2507#         "data": {"status": "pending", "id": "snapload0"}}
2508#     <- {"event": "JOB_STATUS_CHANGE",
2509#         "timestamp": {"seconds": 1472128172, "microseconds": 744001},
2510#         "data": {"status": "concluded", "id": "snapload0"}}
2511#     -> {"execute": "query-jobs"}
2512#     <- {"return": [{"current-progress": 1,
2513#                     "status": "concluded",
2514#                     "total-progress": 1,
2515#                     "type": "snapshot-load",
2516#                     "id": "snapload0"}]}
2517#
2518# Since: 6.0
2519##
2520{ 'command': 'snapshot-load',
2521  'data': { 'job-id': 'str',
2522            'tag': 'str',
2523            'vmstate': 'str',
2524            'devices': ['str'] } }
2525
2526##
2527# @snapshot-delete:
2528#
2529# Delete a VM snapshot
2530#
2531# @job-id: identifier for the newly created job
2532#
2533# @tag: name of the snapshot to delete.
2534#
2535# @devices: list of block device node names to delete a snapshot from
2536#
2537# Applications should not assume that the snapshot delete is complete
2538# when this command returns.  The job commands / events must be used
2539# to determine completion and to fetch details of any errors that
2540# arise.
2541#
2542# .. qmp-example::
2543#
2544#     -> { "execute": "snapshot-delete",
2545#          "arguments": {
2546#             "job-id": "snapdelete0",
2547#             "tag": "my-snap",
2548#             "devices": ["disk0", "disk1"]
2549#          }
2550#        }
2551#     <- { "return": { } }
2552#     <- {"event": "JOB_STATUS_CHANGE",
2553#         "timestamp": {"seconds": 1442124172, "microseconds": 744001},
2554#         "data": {"status": "created", "id": "snapdelete0"}}
2555#     <- {"event": "JOB_STATUS_CHANGE",
2556#         "timestamp": {"seconds": 1442125172, "microseconds": 744001},
2557#         "data": {"status": "running", "id": "snapdelete0"}}
2558#     <- {"event": "JOB_STATUS_CHANGE",
2559#         "timestamp": {"seconds": 1442126172, "microseconds": 744001},
2560#         "data": {"status": "waiting", "id": "snapdelete0"}}
2561#     <- {"event": "JOB_STATUS_CHANGE",
2562#         "timestamp": {"seconds": 1442127172, "microseconds": 744001},
2563#         "data": {"status": "pending", "id": "snapdelete0"}}
2564#     <- {"event": "JOB_STATUS_CHANGE",
2565#         "timestamp": {"seconds": 1442128172, "microseconds": 744001},
2566#         "data": {"status": "concluded", "id": "snapdelete0"}}
2567#     -> {"execute": "query-jobs"}
2568#     <- {"return": [{"current-progress": 1,
2569#                     "status": "concluded",
2570#                     "total-progress": 1,
2571#                     "type": "snapshot-delete",
2572#                     "id": "snapdelete0"}]}
2573#
2574# Since: 6.0
2575##
2576{ 'command': 'snapshot-delete',
2577  'data': { 'job-id': 'str',
2578            'tag': 'str',
2579            'devices': ['str'] } }
2580