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