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