xref: /qemu/qapi/migration.json (revision 5fdbb1df)
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# Since: 9.0
681##
682{ 'enum': 'ZeroPageDetection',
683  'data': [ 'none', 'legacy' ] }
684
685##
686# @BitmapMigrationBitmapAliasTransform:
687#
688# @persistent: If present, the bitmap will be made persistent or
689#     transient depending on this parameter.
690#
691# Since: 6.0
692##
693{ 'struct': 'BitmapMigrationBitmapAliasTransform',
694  'data': {
695      '*persistent': 'bool'
696  } }
697
698##
699# @BitmapMigrationBitmapAlias:
700#
701# @name: The name of the bitmap.
702#
703# @alias: An alias name for migration (for example the bitmap name on
704#     the opposite site).
705#
706# @transform: Allows the modification of the migrated bitmap.  (since
707#     6.0)
708#
709# Since: 5.2
710##
711{ 'struct': 'BitmapMigrationBitmapAlias',
712  'data': {
713      'name': 'str',
714      'alias': 'str',
715      '*transform': 'BitmapMigrationBitmapAliasTransform'
716  } }
717
718##
719# @BitmapMigrationNodeAlias:
720#
721# Maps a block node name and the bitmaps it has to aliases for dirty
722# bitmap migration.
723#
724# @node-name: A block node name.
725#
726# @alias: An alias block node name for migration (for example the node
727#     name on the opposite site).
728#
729# @bitmaps: Mappings for the bitmaps on this node.
730#
731# Since: 5.2
732##
733{ 'struct': 'BitmapMigrationNodeAlias',
734  'data': {
735      'node-name': 'str',
736      'alias': 'str',
737      'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
738  } }
739
740##
741# @MigrationParameter:
742#
743# Migration parameters enumeration
744#
745# @announce-initial: Initial delay (in milliseconds) before sending
746#     the first announce (Since 4.0)
747#
748# @announce-max: Maximum delay (in milliseconds) between packets in
749#     the announcement (Since 4.0)
750#
751# @announce-rounds: Number of self-announce packets sent after
752#     migration (Since 4.0)
753#
754# @announce-step: Increase in delay (in milliseconds) between
755#     subsequent packets in the announcement (Since 4.0)
756#
757# @compress-level: Set the compression level to be used in live
758#     migration, the compression level is an integer between 0 and 9,
759#     where 0 means no compression, 1 means the best compression
760#     speed, and 9 means best compression ratio which will consume
761#     more CPU.
762#
763# @compress-threads: Set compression thread count to be used in live
764#     migration, the compression thread count is an integer between 1
765#     and 255.
766#
767# @compress-wait-thread: Controls behavior when all compression
768#     threads are currently busy.  If true (default), wait for a free
769#     compression thread to become available; otherwise, send the page
770#     uncompressed.  (Since 3.1)
771#
772# @decompress-threads: Set decompression thread count to be used in
773#     live migration, the decompression thread count is an integer
774#     between 1 and 255. Usually, decompression is at least 4 times as
775#     fast as compression, so set the decompress-threads to the number
776#     about 1/4 of compress-threads is adequate.
777#
778# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
779#     bytes_xfer_period to trigger throttling.  It is expressed as
780#     percentage.  The default value is 50. (Since 5.0)
781#
782# @cpu-throttle-initial: Initial percentage of time guest cpus are
783#     throttled when migration auto-converge is activated.  The
784#     default value is 20. (Since 2.7)
785#
786# @cpu-throttle-increment: throttle percentage increase each time
787#     auto-converge detects that migration is not making progress.
788#     The default value is 10. (Since 2.7)
789#
790# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At
791#     the tail stage of throttling, the Guest is very sensitive to CPU
792#     percentage while the @cpu-throttle -increment is excessive
793#     usually at tail stage.  If this parameter is true, we will
794#     compute the ideal CPU percentage used by the Guest, which may
795#     exactly make the dirty rate match the dirty rate threshold.
796#     Then we will choose a smaller throttle increment between the one
797#     specified by @cpu-throttle-increment and the one generated by
798#     ideal CPU percentage.  Therefore, it is compatible to
799#     traditional throttling, meanwhile the throttle increment won't
800#     be excessive at tail stage.  The default value is false.  (Since
801#     5.1)
802#
803# @tls-creds: ID of the 'tls-creds' object that provides credentials
804#     for establishing a TLS connection over the migration data
805#     channel.  On the outgoing side of the migration, the credentials
806#     must be for a 'client' endpoint, while for the incoming side the
807#     credentials must be for a 'server' endpoint.  Setting this will
808#     enable TLS for all migrations.  The default is unset, resulting
809#     in unsecured migration at the QEMU level.  (Since 2.7)
810#
811# @tls-hostname: hostname of the target host for the migration.  This
812#     is required when using x509 based TLS credentials and the
813#     migration URI does not already include a hostname.  For example
814#     if using fd: or exec: based migration, the hostname must be
815#     provided so that the server's x509 certificate identity can be
816#     validated.  (Since 2.7)
817#
818# @tls-authz: ID of the 'authz' object subclass that provides access
819#     control checking of the TLS x509 certificate distinguished name.
820#     This object is only resolved at time of use, so can be deleted
821#     and recreated on the fly while the migration server is active.
822#     If missing, it will default to denying access (Since 4.0)
823#
824# @max-bandwidth: to set maximum speed for migration.  maximum speed
825#     in bytes per second.  (Since 2.8)
826#
827# @avail-switchover-bandwidth: to set the available bandwidth that
828#     migration can use during switchover phase.  NOTE!  This does not
829#     limit the bandwidth during switchover, but only for calculations when
830#     making decisions to switchover.  By default, this value is zero,
831#     which means QEMU will estimate the bandwidth automatically.  This can
832#     be set when the estimated value is not accurate, while the user is
833#     able to guarantee such bandwidth is available when switching over.
834#     When specified correctly, this can make the switchover decision much
835#     more accurate.  (Since 8.2)
836#
837# @downtime-limit: set maximum tolerated downtime for migration.
838#     maximum downtime in milliseconds (Since 2.8)
839#
840# @x-checkpoint-delay: The delay time (in ms) between two COLO
841#     checkpoints in periodic mode.  (Since 2.8)
842#
843# @block-incremental: Affects how much storage is migrated when the
844#     block migration capability is enabled.  When false, the entire
845#     storage backing chain is migrated into a flattened image at the
846#     destination; when true, only the active qcow2 layer is migrated
847#     and the destination must already have access to the same backing
848#     chain as was used on the source.  (since 2.10)
849#
850# @multifd-channels: Number of channels used to migrate data in
851#     parallel.  This is the same number that the number of sockets
852#     used for migration.  The default value is 2 (since 4.0)
853#
854# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
855#     needs to be a multiple of the target page size and a power of 2
856#     (Since 2.11)
857#
858# @max-postcopy-bandwidth: Background transfer bandwidth during
859#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
860#     (Since 3.0)
861#
862# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
863#     (Since 3.1)
864#
865# @multifd-compression: Which compression method to use.  Defaults to
866#     none.  (Since 5.0)
867#
868# @multifd-zlib-level: Set the compression level to be used in live
869#     migration, the compression level is an integer between 0 and 9,
870#     where 0 means no compression, 1 means the best compression
871#     speed, and 9 means best compression ratio which will consume
872#     more CPU. Defaults to 1. (Since 5.0)
873#
874# @multifd-zstd-level: Set the compression level to be used in live
875#     migration, the compression level is an integer between 0 and 20,
876#     where 0 means no compression, 1 means the best compression
877#     speed, and 20 means best compression ratio which will consume
878#     more CPU. Defaults to 1. (Since 5.0)
879#
880# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
881#     aliases for the purpose of dirty bitmap migration.  Such aliases
882#     may for example be the corresponding names on the opposite site.
883#     The mapping must be one-to-one, but not necessarily complete: On
884#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
885#     will be ignored.  On the destination, encountering an unmapped
886#     alias in the incoming migration stream will result in a report,
887#     and all further bitmap migration data will then be discarded.
888#     Note that the destination does not know about bitmaps it does
889#     not receive, so there is no limitation or requirement regarding
890#     the number of bitmaps received, or how they are named, or on
891#     which nodes they are placed.  By default (when this parameter
892#     has never been set), bitmap names are mapped to themselves.
893#     Nodes are mapped to their block device name if there is one, and
894#     to their node name otherwise.  (Since 5.2)
895#
896# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
897#     limit during live migration.  Should be in the range 1 to 1000ms.
898#     Defaults to 1000ms.  (Since 8.1)
899#
900# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
901#     Defaults to 1.  (Since 8.1)
902#
903# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
904#        (Since 8.2)
905#
906# @zero-page-detection: Whether and how to detect zero pages.
907#     See description in @ZeroPageDetection.  Default is 'legacy'.
908#     (since 9.0)
909#
910# Features:
911#
912# @deprecated: Member @block-incremental is deprecated.  Use
913#     blockdev-mirror with NBD instead.  Members @compress-level,
914#     @compress-threads, @decompress-threads and @compress-wait-thread
915#     are deprecated because @compression is deprecated.
916#
917# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period
918#     are experimental.
919#
920# Since: 2.4
921##
922{ 'enum': 'MigrationParameter',
923  'data': ['announce-initial', 'announce-max',
924           'announce-rounds', 'announce-step',
925           { 'name': 'compress-level', 'features': [ 'deprecated' ] },
926           { 'name': 'compress-threads', 'features': [ 'deprecated' ] },
927           { 'name': 'decompress-threads', 'features': [ 'deprecated' ] },
928           { 'name': 'compress-wait-thread', 'features': [ 'deprecated' ] },
929           'throttle-trigger-threshold',
930           'cpu-throttle-initial', 'cpu-throttle-increment',
931           'cpu-throttle-tailslow',
932           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
933           'avail-switchover-bandwidth', 'downtime-limit',
934           { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
935           { 'name': 'block-incremental', 'features': [ 'deprecated' ] },
936           'multifd-channels',
937           'xbzrle-cache-size', 'max-postcopy-bandwidth',
938           'max-cpu-throttle', 'multifd-compression',
939           'multifd-zlib-level', 'multifd-zstd-level',
940           'block-bitmap-mapping',
941           { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
942           'vcpu-dirty-limit',
943           'mode',
944           'zero-page-detection'] }
945
946##
947# @MigrateSetParameters:
948#
949# @announce-initial: Initial delay (in milliseconds) before sending
950#     the first announce (Since 4.0)
951#
952# @announce-max: Maximum delay (in milliseconds) between packets in
953#     the announcement (Since 4.0)
954#
955# @announce-rounds: Number of self-announce packets sent after
956#     migration (Since 4.0)
957#
958# @announce-step: Increase in delay (in milliseconds) between
959#     subsequent packets in the announcement (Since 4.0)
960#
961# @compress-level: compression level
962#
963# @compress-threads: compression thread count
964#
965# @compress-wait-thread: Controls behavior when all compression
966#     threads are currently busy.  If true (default), wait for a free
967#     compression thread to become available; otherwise, send the page
968#     uncompressed.  (Since 3.1)
969#
970# @decompress-threads: decompression thread count
971#
972# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
973#     bytes_xfer_period to trigger throttling.  It is expressed as
974#     percentage.  The default value is 50. (Since 5.0)
975#
976# @cpu-throttle-initial: Initial percentage of time guest cpus are
977#     throttled when migration auto-converge is activated.  The
978#     default value is 20. (Since 2.7)
979#
980# @cpu-throttle-increment: throttle percentage increase each time
981#     auto-converge detects that migration is not making progress.
982#     The default value is 10. (Since 2.7)
983#
984# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At
985#     the tail stage of throttling, the Guest is very sensitive to CPU
986#     percentage while the @cpu-throttle -increment is excessive
987#     usually at tail stage.  If this parameter is true, we will
988#     compute the ideal CPU percentage used by the Guest, which may
989#     exactly make the dirty rate match the dirty rate threshold.
990#     Then we will choose a smaller throttle increment between the one
991#     specified by @cpu-throttle-increment and the one generated by
992#     ideal CPU percentage.  Therefore, it is compatible to
993#     traditional throttling, meanwhile the throttle increment won't
994#     be excessive at tail stage.  The default value is false.  (Since
995#     5.1)
996#
997# @tls-creds: ID of the 'tls-creds' object that provides credentials
998#     for establishing a TLS connection over the migration data
999#     channel.  On the outgoing side of the migration, the credentials
1000#     must be for a 'client' endpoint, while for the incoming side the
1001#     credentials must be for a 'server' endpoint.  Setting this to a
1002#     non-empty string enables TLS for all migrations.  An empty
1003#     string means that QEMU will use plain text mode for migration,
1004#     rather than TLS (Since 2.9) Previously (since 2.7), this was
1005#     reported by omitting tls-creds instead.
1006#
1007# @tls-hostname: hostname of the target host for the migration.  This
1008#     is required when using x509 based TLS credentials and the
1009#     migration URI does not already include a hostname.  For example
1010#     if using fd: or exec: based migration, the hostname must be
1011#     provided so that the server's x509 certificate identity can be
1012#     validated.  (Since 2.7) An empty string means that QEMU will use
1013#     the hostname associated with the migration URI, if any.  (Since
1014#     2.9) Previously (since 2.7), this was reported by omitting
1015#     tls-hostname instead.
1016#
1017# @tls-authz: ID of the 'authz' object subclass that provides access
1018#     control checking of the TLS x509 certificate distinguished name.
1019#     (Since 4.0)
1020#
1021# @max-bandwidth: to set maximum speed for migration.  maximum speed
1022#     in bytes per second.  (Since 2.8)
1023#
1024# @avail-switchover-bandwidth: to set the available bandwidth that
1025#     migration can use during switchover phase.  NOTE!  This does not
1026#     limit the bandwidth during switchover, but only for calculations when
1027#     making decisions to switchover.  By default, this value is zero,
1028#     which means QEMU will estimate the bandwidth automatically.  This can
1029#     be set when the estimated value is not accurate, while the user is
1030#     able to guarantee such bandwidth is available when switching over.
1031#     When specified correctly, this can make the switchover decision much
1032#     more accurate.  (Since 8.2)
1033#
1034# @downtime-limit: set maximum tolerated downtime for migration.
1035#     maximum downtime in milliseconds (Since 2.8)
1036#
1037# @x-checkpoint-delay: the delay time between two COLO checkpoints.
1038#     (Since 2.8)
1039#
1040# @block-incremental: Affects how much storage is migrated when the
1041#     block migration capability is enabled.  When false, the entire
1042#     storage backing chain is migrated into a flattened image at the
1043#     destination; when true, only the active qcow2 layer is migrated
1044#     and the destination must already have access to the same backing
1045#     chain as was used on the source.  (since 2.10)
1046#
1047# @multifd-channels: Number of channels used to migrate data in
1048#     parallel.  This is the same number that the number of sockets
1049#     used for migration.  The default value is 2 (since 4.0)
1050#
1051# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1052#     needs to be a multiple of the target page size and a power of 2
1053#     (Since 2.11)
1054#
1055# @max-postcopy-bandwidth: Background transfer bandwidth during
1056#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1057#     (Since 3.0)
1058#
1059# @max-cpu-throttle: maximum cpu throttle percentage.  The default
1060#     value is 99. (Since 3.1)
1061#
1062# @multifd-compression: Which compression method to use.  Defaults to
1063#     none.  (Since 5.0)
1064#
1065# @multifd-zlib-level: Set the compression level to be used in live
1066#     migration, the compression level is an integer between 0 and 9,
1067#     where 0 means no compression, 1 means the best compression
1068#     speed, and 9 means best compression ratio which will consume
1069#     more CPU. Defaults to 1. (Since 5.0)
1070#
1071# @multifd-zstd-level: Set the compression level to be used in live
1072#     migration, the compression level is an integer between 0 and 20,
1073#     where 0 means no compression, 1 means the best compression
1074#     speed, and 20 means best compression ratio which will consume
1075#     more CPU. Defaults to 1. (Since 5.0)
1076#
1077# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1078#     aliases for the purpose of dirty bitmap migration.  Such aliases
1079#     may for example be the corresponding names on the opposite site.
1080#     The mapping must be one-to-one, but not necessarily complete: On
1081#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1082#     will be ignored.  On the destination, encountering an unmapped
1083#     alias in the incoming migration stream will result in a report,
1084#     and all further bitmap migration data will then be discarded.
1085#     Note that the destination does not know about bitmaps it does
1086#     not receive, so there is no limitation or requirement regarding
1087#     the number of bitmaps received, or how they are named, or on
1088#     which nodes they are placed.  By default (when this parameter
1089#     has never been set), bitmap names are mapped to themselves.
1090#     Nodes are mapped to their block device name if there is one, and
1091#     to their node name otherwise.  (Since 5.2)
1092#
1093# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1094#     limit during live migration.  Should be in the range 1 to 1000ms.
1095#     Defaults to 1000ms.  (Since 8.1)
1096#
1097# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1098#     Defaults to 1.  (Since 8.1)
1099#
1100# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
1101#        (Since 8.2)
1102#
1103# @zero-page-detection: Whether and how to detect zero pages.
1104#     See description in @ZeroPageDetection.  Default is 'legacy'.
1105#     (since 9.0)
1106#
1107# Features:
1108#
1109# @deprecated: Member @block-incremental is deprecated.  Use
1110#     blockdev-mirror with NBD instead.  Members @compress-level,
1111#     @compress-threads, @decompress-threads and @compress-wait-thread
1112#     are deprecated because @compression is deprecated.
1113#
1114# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period
1115#     are experimental.
1116#
1117# TODO: either fuse back into MigrationParameters, or make
1118#     MigrationParameters members mandatory
1119#
1120# Since: 2.4
1121##
1122{ 'struct': 'MigrateSetParameters',
1123  'data': { '*announce-initial': 'size',
1124            '*announce-max': 'size',
1125            '*announce-rounds': 'size',
1126            '*announce-step': 'size',
1127            '*compress-level': { 'type': 'uint8',
1128                                 'features': [ 'deprecated' ] },
1129            '*compress-threads':  { 'type': 'uint8',
1130                                    'features': [ 'deprecated' ] },
1131            '*compress-wait-thread':  { 'type': 'bool',
1132                                        'features': [ 'deprecated' ] },
1133            '*decompress-threads':  { 'type': 'uint8',
1134                                      'features': [ 'deprecated' ] },
1135            '*throttle-trigger-threshold': 'uint8',
1136            '*cpu-throttle-initial': 'uint8',
1137            '*cpu-throttle-increment': 'uint8',
1138            '*cpu-throttle-tailslow': 'bool',
1139            '*tls-creds': 'StrOrNull',
1140            '*tls-hostname': 'StrOrNull',
1141            '*tls-authz': 'StrOrNull',
1142            '*max-bandwidth': 'size',
1143            '*avail-switchover-bandwidth': 'size',
1144            '*downtime-limit': 'uint64',
1145            '*x-checkpoint-delay': { 'type': 'uint32',
1146                                     'features': [ 'unstable' ] },
1147            '*block-incremental': { 'type': 'bool',
1148                                    'features': [ 'deprecated' ] },
1149            '*multifd-channels': 'uint8',
1150            '*xbzrle-cache-size': 'size',
1151            '*max-postcopy-bandwidth': 'size',
1152            '*max-cpu-throttle': 'uint8',
1153            '*multifd-compression': 'MultiFDCompression',
1154            '*multifd-zlib-level': 'uint8',
1155            '*multifd-zstd-level': 'uint8',
1156            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1157            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1158                                            'features': [ 'unstable' ] },
1159            '*vcpu-dirty-limit': 'uint64',
1160            '*mode': 'MigMode',
1161            '*zero-page-detection': 'ZeroPageDetection'} }
1162
1163##
1164# @migrate-set-parameters:
1165#
1166# Set various migration parameters.
1167#
1168# Since: 2.4
1169#
1170# Example:
1171#
1172#     -> { "execute": "migrate-set-parameters" ,
1173#          "arguments": { "multifd-channels": 5 } }
1174#     <- { "return": {} }
1175##
1176{ 'command': 'migrate-set-parameters', 'boxed': true,
1177  'data': 'MigrateSetParameters' }
1178
1179##
1180# @MigrationParameters:
1181#
1182# The optional members aren't actually optional.
1183#
1184# @announce-initial: Initial delay (in milliseconds) before sending
1185#     the first announce (Since 4.0)
1186#
1187# @announce-max: Maximum delay (in milliseconds) between packets in
1188#     the announcement (Since 4.0)
1189#
1190# @announce-rounds: Number of self-announce packets sent after
1191#     migration (Since 4.0)
1192#
1193# @announce-step: Increase in delay (in milliseconds) between
1194#     subsequent packets in the announcement (Since 4.0)
1195#
1196# @compress-level: compression level
1197#
1198# @compress-threads: compression thread count
1199#
1200# @compress-wait-thread: Controls behavior when all compression
1201#     threads are currently busy.  If true (default), wait for a free
1202#     compression thread to become available; otherwise, send the page
1203#     uncompressed.  (Since 3.1)
1204#
1205# @decompress-threads: decompression thread count
1206#
1207# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
1208#     bytes_xfer_period to trigger throttling.  It is expressed as
1209#     percentage.  The default value is 50. (Since 5.0)
1210#
1211# @cpu-throttle-initial: Initial percentage of time guest cpus are
1212#     throttled when migration auto-converge is activated.  (Since
1213#     2.7)
1214#
1215# @cpu-throttle-increment: throttle percentage increase each time
1216#     auto-converge detects that migration is not making progress.
1217#     (Since 2.7)
1218#
1219# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At
1220#     the tail stage of throttling, the Guest is very sensitive to CPU
1221#     percentage while the @cpu-throttle -increment is excessive
1222#     usually at tail stage.  If this parameter is true, we will
1223#     compute the ideal CPU percentage used by the Guest, which may
1224#     exactly make the dirty rate match the dirty rate threshold.
1225#     Then we will choose a smaller throttle increment between the one
1226#     specified by @cpu-throttle-increment and the one generated by
1227#     ideal CPU percentage.  Therefore, it is compatible to
1228#     traditional throttling, meanwhile the throttle increment won't
1229#     be excessive at tail stage.  The default value is false.  (Since
1230#     5.1)
1231#
1232# @tls-creds: ID of the 'tls-creds' object that provides credentials
1233#     for establishing a TLS connection over the migration data
1234#     channel.  On the outgoing side of the migration, the credentials
1235#     must be for a 'client' endpoint, while for the incoming side the
1236#     credentials must be for a 'server' endpoint.  An empty string
1237#     means that QEMU will use plain text mode for migration, rather
1238#     than TLS (Since 2.7) Note: 2.8 reports this by omitting
1239#     tls-creds instead.
1240#
1241# @tls-hostname: hostname of the target host for the migration.  This
1242#     is required when using x509 based TLS credentials and the
1243#     migration URI does not already include a hostname.  For example
1244#     if using fd: or exec: based migration, the hostname must be
1245#     provided so that the server's x509 certificate identity can be
1246#     validated.  (Since 2.7) An empty string means that QEMU will use
1247#     the hostname associated with the migration URI, if any.  (Since
1248#     2.9) Note: 2.8 reports this by omitting tls-hostname instead.
1249#
1250# @tls-authz: ID of the 'authz' object subclass that provides access
1251#     control checking of the TLS x509 certificate distinguished name.
1252#     (Since 4.0)
1253#
1254# @max-bandwidth: to set maximum speed for migration.  maximum speed
1255#     in bytes per second.  (Since 2.8)
1256#
1257# @avail-switchover-bandwidth: to set the available bandwidth that
1258#     migration can use during switchover phase.  NOTE!  This does not
1259#     limit the bandwidth during switchover, but only for calculations when
1260#     making decisions to switchover.  By default, this value is zero,
1261#     which means QEMU will estimate the bandwidth automatically.  This can
1262#     be set when the estimated value is not accurate, while the user is
1263#     able to guarantee such bandwidth is available when switching over.
1264#     When specified correctly, this can make the switchover decision much
1265#     more accurate.  (Since 8.2)
1266#
1267# @downtime-limit: set maximum tolerated downtime for migration.
1268#     maximum downtime in milliseconds (Since 2.8)
1269#
1270# @x-checkpoint-delay: the delay time between two COLO checkpoints.
1271#     (Since 2.8)
1272#
1273# @block-incremental: Affects how much storage is migrated when the
1274#     block migration capability is enabled.  When false, the entire
1275#     storage backing chain is migrated into a flattened image at the
1276#     destination; when true, only the active qcow2 layer is migrated
1277#     and the destination must already have access to the same backing
1278#     chain as was used on the source.  (since 2.10)
1279#
1280# @multifd-channels: Number of channels used to migrate data in
1281#     parallel.  This is the same number that the number of sockets
1282#     used for migration.  The default value is 2 (since 4.0)
1283#
1284# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1285#     needs to be a multiple of the target page size and a power of 2
1286#     (Since 2.11)
1287#
1288# @max-postcopy-bandwidth: Background transfer bandwidth during
1289#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1290#     (Since 3.0)
1291#
1292# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1293#     (Since 3.1)
1294#
1295# @multifd-compression: Which compression method to use.  Defaults to
1296#     none.  (Since 5.0)
1297#
1298# @multifd-zlib-level: Set the compression level to be used in live
1299#     migration, the compression level is an integer between 0 and 9,
1300#     where 0 means no compression, 1 means the best compression
1301#     speed, and 9 means best compression ratio which will consume
1302#     more CPU. Defaults to 1. (Since 5.0)
1303#
1304# @multifd-zstd-level: Set the compression level to be used in live
1305#     migration, the compression level is an integer between 0 and 20,
1306#     where 0 means no compression, 1 means the best compression
1307#     speed, and 20 means best compression ratio which will consume
1308#     more CPU. Defaults to 1. (Since 5.0)
1309#
1310# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1311#     aliases for the purpose of dirty bitmap migration.  Such aliases
1312#     may for example be the corresponding names on the opposite site.
1313#     The mapping must be one-to-one, but not necessarily complete: On
1314#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1315#     will be ignored.  On the destination, encountering an unmapped
1316#     alias in the incoming migration stream will result in a report,
1317#     and all further bitmap migration data will then be discarded.
1318#     Note that the destination does not know about bitmaps it does
1319#     not receive, so there is no limitation or requirement regarding
1320#     the number of bitmaps received, or how they are named, or on
1321#     which nodes they are placed.  By default (when this parameter
1322#     has never been set), bitmap names are mapped to themselves.
1323#     Nodes are mapped to their block device name if there is one, and
1324#     to their node name otherwise.  (Since 5.2)
1325#
1326# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1327#     limit during live migration.  Should be in the range 1 to 1000ms.
1328#     Defaults to 1000ms.  (Since 8.1)
1329#
1330# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1331#     Defaults to 1.  (Since 8.1)
1332#
1333# @mode: Migration mode. See description in @MigMode. Default is 'normal'.
1334#        (Since 8.2)
1335#
1336# @zero-page-detection: Whether and how to detect zero pages.
1337#     See description in @ZeroPageDetection.  Default is 'legacy'.
1338#     (since 9.0)
1339#
1340# Features:
1341#
1342# @deprecated: Member @block-incremental is deprecated.  Use
1343#     blockdev-mirror with NBD instead.  Members @compress-level,
1344#     @compress-threads, @decompress-threads and @compress-wait-thread
1345#     are deprecated because @compression is deprecated.
1346#
1347# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period
1348#     are experimental.
1349#
1350# Since: 2.4
1351##
1352{ 'struct': 'MigrationParameters',
1353  'data': { '*announce-initial': 'size',
1354            '*announce-max': 'size',
1355            '*announce-rounds': 'size',
1356            '*announce-step': 'size',
1357            '*compress-level': { 'type': 'uint8',
1358                                 'features': [ 'deprecated' ] },
1359            '*compress-threads': { 'type': 'uint8',
1360                                   'features': [ 'deprecated' ] },
1361            '*compress-wait-thread': { 'type': 'bool',
1362                                       'features': [ 'deprecated' ] },
1363            '*decompress-threads': { 'type': 'uint8',
1364                                     'features': [ 'deprecated' ] },
1365            '*throttle-trigger-threshold': 'uint8',
1366            '*cpu-throttle-initial': 'uint8',
1367            '*cpu-throttle-increment': 'uint8',
1368            '*cpu-throttle-tailslow': 'bool',
1369            '*tls-creds': 'str',
1370            '*tls-hostname': 'str',
1371            '*tls-authz': 'str',
1372            '*max-bandwidth': 'size',
1373            '*avail-switchover-bandwidth': 'size',
1374            '*downtime-limit': 'uint64',
1375            '*x-checkpoint-delay': { 'type': 'uint32',
1376                                     'features': [ 'unstable' ] },
1377            '*block-incremental': { 'type': 'bool',
1378                                    'features': [ 'deprecated' ] },
1379            '*multifd-channels': 'uint8',
1380            '*xbzrle-cache-size': 'size',
1381            '*max-postcopy-bandwidth': 'size',
1382            '*max-cpu-throttle': 'uint8',
1383            '*multifd-compression': 'MultiFDCompression',
1384            '*multifd-zlib-level': 'uint8',
1385            '*multifd-zstd-level': 'uint8',
1386            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1387            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1388                                            'features': [ 'unstable' ] },
1389            '*vcpu-dirty-limit': 'uint64',
1390            '*mode': 'MigMode',
1391            '*zero-page-detection': 'ZeroPageDetection'} }
1392
1393##
1394# @query-migrate-parameters:
1395#
1396# Returns information about the current migration parameters
1397#
1398# Returns: @MigrationParameters
1399#
1400# Since: 2.4
1401#
1402# Example:
1403#
1404#     -> { "execute": "query-migrate-parameters" }
1405#     <- { "return": {
1406#              "multifd-channels": 2,
1407#              "cpu-throttle-increment": 10,
1408#              "cpu-throttle-initial": 20,
1409#              "max-bandwidth": 33554432,
1410#              "downtime-limit": 300
1411#           }
1412#        }
1413##
1414{ 'command': 'query-migrate-parameters',
1415  'returns': 'MigrationParameters' }
1416
1417##
1418# @migrate-start-postcopy:
1419#
1420# Followup to a migration command to switch the migration to postcopy
1421# mode.  The postcopy-ram capability must be set on both source and
1422# destination before the original migration command.
1423#
1424# Since: 2.5
1425#
1426# Example:
1427#
1428#     -> { "execute": "migrate-start-postcopy" }
1429#     <- { "return": {} }
1430##
1431{ 'command': 'migrate-start-postcopy' }
1432
1433##
1434# @MIGRATION:
1435#
1436# Emitted when a migration event happens
1437#
1438# @status: @MigrationStatus describing the current migration status.
1439#
1440# Since: 2.4
1441#
1442# Example:
1443#
1444#     <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1445#         "event": "MIGRATION",
1446#         "data": {"status": "completed"} }
1447##
1448{ 'event': 'MIGRATION',
1449  'data': {'status': 'MigrationStatus'}}
1450
1451##
1452# @MIGRATION_PASS:
1453#
1454# Emitted from the source side of a migration at the start of each
1455# pass (when it syncs the dirty bitmap)
1456#
1457# @pass: An incrementing count (starting at 1 on the first pass)
1458#
1459# Since: 2.6
1460#
1461# Example:
1462#
1463#     <- { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1464#           "event": "MIGRATION_PASS", "data": {"pass": 2} }
1465##
1466{ 'event': 'MIGRATION_PASS',
1467  'data': { 'pass': 'int' } }
1468
1469##
1470# @COLOMessage:
1471#
1472# The message transmission between Primary side and Secondary side.
1473#
1474# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1475#
1476# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for
1477#     checkpointing
1478#
1479# @checkpoint-reply: SVM gets PVM's checkpoint request
1480#
1481# @vmstate-send: VM's state will be sent by PVM.
1482#
1483# @vmstate-size: The total size of VMstate.
1484#
1485# @vmstate-received: VM's state has been received by SVM.
1486#
1487# @vmstate-loaded: VM's state has been loaded by SVM.
1488#
1489# Since: 2.8
1490##
1491{ 'enum': 'COLOMessage',
1492  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1493            'vmstate-send', 'vmstate-size', 'vmstate-received',
1494            'vmstate-loaded' ] }
1495
1496##
1497# @COLOMode:
1498#
1499# The COLO current mode.
1500#
1501# @none: COLO is disabled.
1502#
1503# @primary: COLO node in primary side.
1504#
1505# @secondary: COLO node in slave side.
1506#
1507# Since: 2.8
1508##
1509{ 'enum': 'COLOMode',
1510  'data': [ 'none', 'primary', 'secondary'] }
1511
1512##
1513# @FailoverStatus:
1514#
1515# An enumeration of COLO failover status
1516#
1517# @none: no failover has ever happened
1518#
1519# @require: got failover requirement but not handled
1520#
1521# @active: in the process of doing failover
1522#
1523# @completed: finish the process of failover
1524#
1525# @relaunch: restart the failover process, from 'none' -> 'completed'
1526#     (Since 2.9)
1527#
1528# Since: 2.8
1529##
1530{ 'enum': 'FailoverStatus',
1531  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1532
1533##
1534# @COLO_EXIT:
1535#
1536# Emitted when VM finishes COLO mode due to some errors happening or
1537# at the request of users.
1538#
1539# @mode: report COLO mode when COLO exited.
1540#
1541# @reason: describes the reason for the COLO exit.
1542#
1543# Since: 3.1
1544#
1545# Example:
1546#
1547#     <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1548#          "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1549##
1550{ 'event': 'COLO_EXIT',
1551  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1552
1553##
1554# @COLOExitReason:
1555#
1556# The reason for a COLO exit.
1557#
1558# @none: failover has never happened.  This state does not occur in
1559#     the COLO_EXIT event, and is only visible in the result of
1560#     query-colo-status.
1561#
1562# @request: COLO exit is due to an external request.
1563#
1564# @error: COLO exit is due to an internal error.
1565#
1566# @processing: COLO is currently handling a failover (since 4.0).
1567#
1568# Since: 3.1
1569##
1570{ 'enum': 'COLOExitReason',
1571  'data': [ 'none', 'request', 'error' , 'processing' ] }
1572
1573##
1574# @x-colo-lost-heartbeat:
1575#
1576# Tell qemu that heartbeat is lost, request it to do takeover
1577# procedures.  If this command is sent to the PVM, the Primary side
1578# will exit COLO mode.  If sent to the Secondary, the Secondary side
1579# will run failover work, then takes over server operation to become
1580# the service VM.
1581#
1582# Features:
1583#
1584# @unstable: This command is experimental.
1585#
1586# Since: 2.8
1587#
1588# Example:
1589#
1590#     -> { "execute": "x-colo-lost-heartbeat" }
1591#     <- { "return": {} }
1592##
1593{ 'command': 'x-colo-lost-heartbeat',
1594  'features': [ 'unstable' ],
1595  'if': 'CONFIG_REPLICATION' }
1596
1597##
1598# @migrate_cancel:
1599#
1600# Cancel the current executing migration process.
1601#
1602# Notes: This command succeeds even if there is no migration process
1603#     running.
1604#
1605# Since: 0.14
1606#
1607# Example:
1608#
1609#     -> { "execute": "migrate_cancel" }
1610#     <- { "return": {} }
1611##
1612{ 'command': 'migrate_cancel' }
1613
1614##
1615# @migrate-continue:
1616#
1617# Continue migration when it's in a paused state.
1618#
1619# @state: The state the migration is currently expected to be in
1620#
1621# Since: 2.11
1622#
1623# Example:
1624#
1625#     -> { "execute": "migrate-continue" , "arguments":
1626#          { "state": "pre-switchover" } }
1627#     <- { "return": {} }
1628##
1629{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1630
1631##
1632# @MigrationAddressType:
1633#
1634# The migration stream transport mechanisms.
1635#
1636# @socket: Migrate via socket.
1637#
1638# @exec: Direct the migration stream to another process.
1639#
1640# @rdma: Migrate via RDMA.
1641#
1642# @file: Direct the migration stream to a file.
1643#
1644# Since: 8.2
1645##
1646{ 'enum': 'MigrationAddressType',
1647  'data': [ 'socket', 'exec', 'rdma', 'file' ] }
1648
1649##
1650# @FileMigrationArgs:
1651#
1652# @filename: The file to receive the migration stream
1653#
1654# @offset: The file offset where the migration stream will start
1655#
1656# Since: 8.2
1657##
1658{ 'struct': 'FileMigrationArgs',
1659  'data': { 'filename': 'str',
1660            'offset': 'uint64' } }
1661
1662##
1663# @MigrationExecCommand:
1664#
1665# @args: command (list head) and arguments to execute.
1666#
1667# Since: 8.2
1668##
1669{ 'struct': 'MigrationExecCommand',
1670  'data': {'args': [ 'str' ] } }
1671
1672##
1673# @MigrationAddress:
1674#
1675# Migration endpoint configuration.
1676#
1677# @transport: The migration stream transport mechanism
1678#
1679# Since: 8.2
1680##
1681{ 'union': 'MigrationAddress',
1682  'base': { 'transport' : 'MigrationAddressType'},
1683  'discriminator': 'transport',
1684  'data': {
1685    'socket': 'SocketAddress',
1686    'exec': 'MigrationExecCommand',
1687    'rdma': 'InetSocketAddress',
1688    'file': 'FileMigrationArgs' } }
1689
1690##
1691# @MigrationChannelType:
1692#
1693# The migration channel-type request options.
1694#
1695# @main: Main outbound migration channel.
1696#
1697# Since: 8.1
1698##
1699{ 'enum': 'MigrationChannelType',
1700  'data': [ 'main' ] }
1701
1702##
1703# @MigrationChannel:
1704#
1705# Migration stream channel parameters.
1706#
1707# @channel-type: Channel type for transferring packet information.
1708#
1709# @addr: Migration endpoint configuration on destination interface.
1710#
1711# Since: 8.1
1712##
1713{ 'struct': 'MigrationChannel',
1714  'data': {
1715      'channel-type': 'MigrationChannelType',
1716      'addr': 'MigrationAddress' } }
1717
1718##
1719# @migrate:
1720#
1721# Migrates the current running guest to another Virtual Machine.
1722#
1723# @uri: the Uniform Resource Identifier of the destination VM
1724#
1725# @channels: list of migration stream channels with each stream in the
1726#     list connected to a destination interface endpoint.
1727#
1728# @blk: do block migration (full disk copy)
1729#
1730# @inc: incremental disk copy migration
1731#
1732# @detach: this argument exists only for compatibility reasons and is
1733#     ignored by QEMU
1734#
1735# @resume: resume one paused migration, default "off". (since 3.0)
1736#
1737# Features:
1738#
1739# @deprecated: Members @inc and @blk are deprecated.  Use
1740#     blockdev-mirror with NBD instead.
1741#
1742# Since: 0.14
1743#
1744# Notes:
1745#
1746#     1. The 'query-migrate' command should be used to check
1747#        migration's progress and final result (this information is
1748#        provided by the 'status' member)
1749#
1750#     2. All boolean arguments default to false
1751#
1752#     3. The user Monitor's "detach" argument is invalid in QMP and
1753#        should not be used
1754#
1755#     4. The uri argument should have the Uniform Resource Identifier
1756#        of default destination VM. This connection will be bound to
1757#        default network.
1758#
1759#     5. For now, number of migration streams is restricted to one,
1760#        i.e number of items in 'channels' list is just 1.
1761#
1762#     6. The 'uri' and 'channels' arguments are mutually exclusive;
1763#        exactly one of the two should be present.
1764#
1765# Example:
1766#
1767#     -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1768#     <- { "return": {} }
1769#
1770#     -> { "execute": "migrate",
1771#          "arguments": {
1772#              "channels": [ { "channel-type": "main",
1773#                              "addr": { "transport": "socket",
1774#                                        "type": "inet",
1775#                                        "host": "10.12.34.9",
1776#                                        "port": "1050" } } ] } }
1777#     <- { "return": {} }
1778#
1779#     -> { "execute": "migrate",
1780#          "arguments": {
1781#              "channels": [ { "channel-type": "main",
1782#                              "addr": { "transport": "exec",
1783#                                        "args": [ "/bin/nc", "-p", "6000",
1784#                                                  "/some/sock" ] } } ] } }
1785#     <- { "return": {} }
1786#
1787#     -> { "execute": "migrate",
1788#          "arguments": {
1789#              "channels": [ { "channel-type": "main",
1790#                              "addr": { "transport": "rdma",
1791#                                        "host": "10.12.34.9",
1792#                                        "port": "1050" } } ] } }
1793#     <- { "return": {} }
1794#
1795#     -> { "execute": "migrate",
1796#          "arguments": {
1797#              "channels": [ { "channel-type": "main",
1798#                              "addr": { "transport": "file",
1799#                                        "filename": "/tmp/migfile",
1800#                                        "offset": "0x1000" } } ] } }
1801#     <- { "return": {} }
1802#
1803##
1804{ 'command': 'migrate',
1805  'data': {'*uri': 'str',
1806           '*channels': [ 'MigrationChannel' ],
1807           '*blk': { 'type': 'bool', 'features': [ 'deprecated' ] },
1808           '*inc': { 'type': 'bool', 'features': [ 'deprecated' ] },
1809           '*detach': 'bool', '*resume': 'bool' } }
1810
1811##
1812# @migrate-incoming:
1813#
1814# Start an incoming migration, the qemu must have been started with
1815# -incoming defer
1816#
1817# @uri: The Uniform Resource Identifier identifying the source or
1818#     address to listen on
1819#
1820# @channels: list of migration stream channels with each stream in the
1821#     list connected to a destination interface endpoint.
1822#
1823# Since: 2.3
1824#
1825# Notes:
1826#
1827#     1. It's a bad idea to use a string for the uri, but it needs to
1828#        stay compatible with -incoming and the format of the uri is
1829#        already exposed above libvirt.
1830#
1831#     2. QEMU must be started with -incoming defer to allow
1832#        migrate-incoming to be used.
1833#
1834#     3. The uri format is the same as for -incoming
1835#
1836#     4. For now, number of migration streams is restricted to one,
1837#        i.e number of items in 'channels' list is just 1.
1838#
1839#     5. The 'uri' and 'channels' arguments are mutually exclusive;
1840#        exactly one of the two should be present.
1841#
1842# Example:
1843#
1844#     -> { "execute": "migrate-incoming",
1845#          "arguments": { "uri": "tcp:0:4446" } }
1846#     <- { "return": {} }
1847#
1848#     -> { "execute": "migrate-incoming",
1849#          "arguments": {
1850#              "channels": [ { "channel-type": "main",
1851#                              "addr": { "transport": "socket",
1852#                                        "type": "inet",
1853#                                        "host": "10.12.34.9",
1854#                                        "port": "1050" } } ] } }
1855#     <- { "return": {} }
1856#
1857#     -> { "execute": "migrate-incoming",
1858#          "arguments": {
1859#              "channels": [ { "channel-type": "main",
1860#                              "addr": { "transport": "exec",
1861#                                        "args": [ "/bin/nc", "-p", "6000",
1862#                                                  "/some/sock" ] } } ] } }
1863#     <- { "return": {} }
1864#
1865#     -> { "execute": "migrate-incoming",
1866#          "arguments": {
1867#              "channels": [ { "channel-type": "main",
1868#                              "addr": { "transport": "rdma",
1869#                                        "host": "10.12.34.9",
1870#                                        "port": "1050" } } ] } }
1871#     <- { "return": {} }
1872##
1873{ 'command': 'migrate-incoming',
1874             'data': {'*uri': 'str',
1875                      '*channels': [ 'MigrationChannel' ] } }
1876
1877##
1878# @xen-save-devices-state:
1879#
1880# Save the state of all devices to file.  The RAM and the block
1881# devices of the VM are not saved by this command.
1882#
1883# @filename: the file to save the state of the devices to as binary
1884#     data.  See xen-save-devices-state.txt for a description of the
1885#     binary format.
1886#
1887# @live: Optional argument to ask QEMU to treat this command as part
1888#     of a live migration.  Default to true.  (since 2.11)
1889#
1890# Since: 1.1
1891#
1892# Example:
1893#
1894#     -> { "execute": "xen-save-devices-state",
1895#          "arguments": { "filename": "/tmp/save" } }
1896#     <- { "return": {} }
1897##
1898{ 'command': 'xen-save-devices-state',
1899  'data': {'filename': 'str', '*live':'bool' } }
1900
1901##
1902# @xen-set-global-dirty-log:
1903#
1904# Enable or disable the global dirty log mode.
1905#
1906# @enable: true to enable, false to disable.
1907#
1908# Since: 1.3
1909#
1910# Example:
1911#
1912#     -> { "execute": "xen-set-global-dirty-log",
1913#          "arguments": { "enable": true } }
1914#     <- { "return": {} }
1915##
1916{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1917
1918##
1919# @xen-load-devices-state:
1920#
1921# Load the state of all devices from file.  The RAM and the block
1922# devices of the VM are not loaded by this command.
1923#
1924# @filename: the file to load the state of the devices from as binary
1925#     data.  See xen-save-devices-state.txt for a description of the
1926#     binary format.
1927#
1928# Since: 2.7
1929#
1930# Example:
1931#
1932#     -> { "execute": "xen-load-devices-state",
1933#          "arguments": { "filename": "/tmp/resume" } }
1934#     <- { "return": {} }
1935##
1936{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1937
1938##
1939# @xen-set-replication:
1940#
1941# Enable or disable replication.
1942#
1943# @enable: true to enable, false to disable.
1944#
1945# @primary: true for primary or false for secondary.
1946#
1947# @failover: true to do failover, false to stop.  but cannot be
1948#     specified if 'enable' is true.  default value is false.
1949#
1950# Example:
1951#
1952#     -> { "execute": "xen-set-replication",
1953#          "arguments": {"enable": true, "primary": false} }
1954#     <- { "return": {} }
1955#
1956# Since: 2.9
1957##
1958{ 'command': 'xen-set-replication',
1959  'data': { 'enable': 'bool', 'primary': 'bool', '*failover': 'bool' },
1960  'if': 'CONFIG_REPLICATION' }
1961
1962##
1963# @ReplicationStatus:
1964#
1965# The result format for 'query-xen-replication-status'.
1966#
1967# @error: true if an error happened, false if replication is normal.
1968#
1969# @desc: the human readable error description string, when @error is
1970#     'true'.
1971#
1972# Since: 2.9
1973##
1974{ 'struct': 'ReplicationStatus',
1975  'data': { 'error': 'bool', '*desc': 'str' },
1976  'if': 'CONFIG_REPLICATION' }
1977
1978##
1979# @query-xen-replication-status:
1980#
1981# Query replication status while the vm is running.
1982#
1983# Returns: A @ReplicationStatus object showing the status.
1984#
1985# Example:
1986#
1987#     -> { "execute": "query-xen-replication-status" }
1988#     <- { "return": { "error": false } }
1989#
1990# Since: 2.9
1991##
1992{ 'command': 'query-xen-replication-status',
1993  'returns': 'ReplicationStatus',
1994  'if': 'CONFIG_REPLICATION' }
1995
1996##
1997# @xen-colo-do-checkpoint:
1998#
1999# Xen uses this command to notify replication to trigger a checkpoint.
2000#
2001# Example:
2002#
2003#     -> { "execute": "xen-colo-do-checkpoint" }
2004#     <- { "return": {} }
2005#
2006# Since: 2.9
2007##
2008{ 'command': 'xen-colo-do-checkpoint',
2009  'if': 'CONFIG_REPLICATION' }
2010
2011##
2012# @COLOStatus:
2013#
2014# The result format for 'query-colo-status'.
2015#
2016# @mode: COLO running mode.  If COLO is running, this field will
2017#     return 'primary' or 'secondary'.
2018#
2019# @last-mode: COLO last running mode.  If COLO is running, this field
2020#     will return same like mode field, after failover we can use this
2021#     field to get last colo mode.  (since 4.0)
2022#
2023# @reason: describes the reason for the COLO exit.
2024#
2025# Since: 3.1
2026##
2027{ 'struct': 'COLOStatus',
2028  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
2029            'reason': 'COLOExitReason' },
2030  'if': 'CONFIG_REPLICATION' }
2031
2032##
2033# @query-colo-status:
2034#
2035# Query COLO status while the vm is running.
2036#
2037# Returns: A @COLOStatus object showing the status.
2038#
2039# Example:
2040#
2041#     -> { "execute": "query-colo-status" }
2042#     <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
2043#
2044# Since: 3.1
2045##
2046{ 'command': 'query-colo-status',
2047  'returns': 'COLOStatus',
2048  'if': 'CONFIG_REPLICATION' }
2049
2050##
2051# @migrate-recover:
2052#
2053# Provide a recovery migration stream URI.
2054#
2055# @uri: the URI to be used for the recovery of migration stream.
2056#
2057# Example:
2058#
2059#     -> { "execute": "migrate-recover",
2060#          "arguments": { "uri": "tcp:192.168.1.200:12345" } }
2061#     <- { "return": {} }
2062#
2063# Since: 3.0
2064##
2065{ 'command': 'migrate-recover',
2066  'data': { 'uri': 'str' },
2067  'allow-oob': true }
2068
2069##
2070# @migrate-pause:
2071#
2072# Pause a migration.  Currently it only supports postcopy.
2073#
2074# Example:
2075#
2076#     -> { "execute": "migrate-pause" }
2077#     <- { "return": {} }
2078#
2079# Since: 3.0
2080##
2081{ 'command': 'migrate-pause', 'allow-oob': true }
2082
2083##
2084# @UNPLUG_PRIMARY:
2085#
2086# Emitted from source side of a migration when migration state is
2087# WAIT_UNPLUG. Device was unplugged by guest operating system.  Device
2088# resources in QEMU are kept on standby to be able to re-plug it in
2089# case of migration failure.
2090#
2091# @device-id: QEMU device id of the unplugged device
2092#
2093# Since: 4.2
2094#
2095# Example:
2096#
2097#     <- { "event": "UNPLUG_PRIMARY",
2098#          "data": { "device-id": "hostdev0" },
2099#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
2100##
2101{ 'event': 'UNPLUG_PRIMARY',
2102  'data': { 'device-id': 'str' } }
2103
2104##
2105# @DirtyRateVcpu:
2106#
2107# Dirty rate of vcpu.
2108#
2109# @id: vcpu index.
2110#
2111# @dirty-rate: dirty rate.
2112#
2113# Since: 6.2
2114##
2115{ 'struct': 'DirtyRateVcpu',
2116  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
2117
2118##
2119# @DirtyRateStatus:
2120#
2121# Dirty page rate measurement status.
2122#
2123# @unstarted: measuring thread has not been started yet
2124#
2125# @measuring: measuring thread is running
2126#
2127# @measured: dirty page rate is measured and the results are available
2128#
2129# Since: 5.2
2130##
2131{ 'enum': 'DirtyRateStatus',
2132  'data': [ 'unstarted', 'measuring', 'measured'] }
2133
2134##
2135# @DirtyRateMeasureMode:
2136#
2137# Method used to measure dirty page rate.  Differences between
2138# available methods are explained in @calc-dirty-rate.
2139#
2140# @page-sampling: use page sampling
2141#
2142# @dirty-ring: use dirty ring
2143#
2144# @dirty-bitmap: use dirty bitmap
2145#
2146# Since: 6.2
2147##
2148{ 'enum': 'DirtyRateMeasureMode',
2149  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
2150
2151##
2152# @TimeUnit:
2153#
2154# Specifies unit in which time-related value is specified.
2155#
2156# @second: value is in seconds
2157#
2158# @millisecond: value is in milliseconds
2159#
2160# Since: 8.2
2161#
2162##
2163{ 'enum': 'TimeUnit',
2164  'data': ['second', 'millisecond'] }
2165
2166##
2167# @DirtyRateInfo:
2168#
2169# Information about measured dirty page rate.
2170#
2171# @dirty-rate: an estimate of the dirty page rate of the VM in units
2172#     of MiB/s.  Value is present only when @status is 'measured'.
2173#
2174# @status: current status of dirty page rate measurements
2175#
2176# @start-time: start time in units of second for calculation
2177#
2178# @calc-time: time period for which dirty page rate was measured,
2179#     expressed and rounded down to @calc-time-unit.
2180#
2181# @calc-time-unit: time unit of @calc-time  (Since 8.2)
2182#
2183# @sample-pages: number of sampled pages per GiB of guest memory.
2184#     Valid only in page-sampling mode (Since 6.1)
2185#
2186# @mode: mode that was used to measure dirty page rate (Since 6.2)
2187#
2188# @vcpu-dirty-rate: dirty rate for each vCPU if dirty-ring mode was
2189#     specified (Since 6.2)
2190#
2191# Since: 5.2
2192##
2193{ 'struct': 'DirtyRateInfo',
2194  'data': {'*dirty-rate': 'int64',
2195           'status': 'DirtyRateStatus',
2196           'start-time': 'int64',
2197           'calc-time': 'int64',
2198           'calc-time-unit': 'TimeUnit',
2199           'sample-pages': 'uint64',
2200           'mode': 'DirtyRateMeasureMode',
2201           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
2202
2203##
2204# @calc-dirty-rate:
2205#
2206# Start measuring dirty page rate of the VM.  Results can be retrieved
2207# with @query-dirty-rate after measurements are completed.
2208#
2209# Dirty page rate is the number of pages changed in a given time
2210# period expressed in MiB/s.  The following methods of calculation are
2211# available:
2212#
2213# 1. In page sampling mode, a random subset of pages are selected and
2214#    hashed twice: once at the beginning of measurement time period,
2215#    and once again at the end.  If two hashes for some page are
2216#    different, the page is counted as changed.  Since this method
2217#    relies on sampling and hashing, calculated dirty page rate is
2218#    only an estimate of its true value.  Increasing @sample-pages
2219#    improves estimation quality at the cost of higher computational
2220#    overhead.
2221#
2222# 2. Dirty bitmap mode captures writes to memory (for example by
2223#    temporarily revoking write access to all pages) and counting page
2224#    faults.  Information about modified pages is collected into a
2225#    bitmap, where each bit corresponds to one guest page.  This mode
2226#    requires that KVM accelerator property "dirty-ring-size" is *not*
2227#    set.
2228#
2229# 3. Dirty ring mode is similar to dirty bitmap mode, but the
2230#    information about modified pages is collected into ring buffer.
2231#    This mode tracks page modification per each vCPU separately.  It
2232#    requires that KVM accelerator property "dirty-ring-size" is set.
2233#
2234# @calc-time: time period for which dirty page rate is calculated.
2235#     By default it is specified in seconds, but the unit can be set
2236#     explicitly with @calc-time-unit.  Note that larger @calc-time
2237#     values will typically result in smaller dirty page rates because
2238#     page dirtying is a one-time event.  Once some page is counted
2239#     as dirty during @calc-time period, further writes to this page
2240#     will not increase dirty page rate anymore.
2241#
2242# @calc-time-unit: time unit in which @calc-time is specified.
2243#     By default it is seconds. (Since 8.2)
2244#
2245# @sample-pages: number of sampled pages per each GiB of guest memory.
2246#     Default value is 512.  For 4KiB guest pages this corresponds to
2247#     sampling ratio of 0.2%.  This argument is used only in page
2248#     sampling mode.  (Since 6.1)
2249#
2250# @mode: mechanism for tracking dirty pages.  Default value is
2251#     'page-sampling'.  Others are 'dirty-bitmap' and 'dirty-ring'.
2252#     (Since 6.1)
2253#
2254# Since: 5.2
2255#
2256# Example:
2257#
2258#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
2259#                                                     'sample-pages': 512} }
2260#     <- { "return": {} }
2261#
2262#     Measure dirty rate using dirty bitmap for 500 milliseconds:
2263#
2264#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 500,
2265#         "calc-time-unit": "millisecond", "mode": "dirty-bitmap"} }
2266#
2267#     <- { "return": {} }
2268##
2269{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
2270                                         '*calc-time-unit': 'TimeUnit',
2271                                         '*sample-pages': 'int',
2272                                         '*mode': 'DirtyRateMeasureMode'} }
2273
2274##
2275# @query-dirty-rate:
2276#
2277# Query results of the most recent invocation of @calc-dirty-rate.
2278#
2279# @calc-time-unit: time unit in which to report calculation time.
2280#     By default it is reported in seconds. (Since 8.2)
2281#
2282# Since: 5.2
2283#
2284# Examples:
2285#
2286#     1. Measurement is in progress:
2287#
2288#     <- {"status": "measuring", "sample-pages": 512,
2289#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2290#         "calc-time-unit": "second"}
2291#
2292#     2. Measurement has been completed:
2293#
2294#     <- {"status": "measured", "sample-pages": 512, "dirty-rate": 108,
2295#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2296#         "calc-time-unit": "second"}
2297##
2298{ 'command': 'query-dirty-rate', 'data': {'*calc-time-unit': 'TimeUnit' },
2299                                 'returns': 'DirtyRateInfo' }
2300
2301##
2302# @DirtyLimitInfo:
2303#
2304# Dirty page rate limit information of a virtual CPU.
2305#
2306# @cpu-index: index of a virtual CPU.
2307#
2308# @limit-rate: upper limit of dirty page rate (MB/s) for a virtual
2309#     CPU, 0 means unlimited.
2310#
2311# @current-rate: current dirty page rate (MB/s) for a virtual CPU.
2312#
2313# Since: 7.1
2314##
2315{ 'struct': 'DirtyLimitInfo',
2316  'data': { 'cpu-index': 'int',
2317            'limit-rate': 'uint64',
2318            'current-rate': 'uint64' } }
2319
2320##
2321# @set-vcpu-dirty-limit:
2322#
2323# Set the upper limit of dirty page rate for virtual CPUs.
2324#
2325# Requires KVM with accelerator property "dirty-ring-size" set.  A
2326# virtual CPU's dirty page rate is a measure of its memory load.  To
2327# observe dirty page rates, use @calc-dirty-rate.
2328#
2329# @cpu-index: index of a virtual CPU, default is all.
2330#
2331# @dirty-rate: upper limit of dirty page rate (MB/s) for virtual CPUs.
2332#
2333# Since: 7.1
2334#
2335# Example:
2336#
2337#     -> {"execute": "set-vcpu-dirty-limit"}
2338#         "arguments": { "dirty-rate": 200,
2339#                        "cpu-index": 1 } }
2340#     <- { "return": {} }
2341##
2342{ 'command': 'set-vcpu-dirty-limit',
2343  'data': { '*cpu-index': 'int',
2344            'dirty-rate': 'uint64' } }
2345
2346##
2347# @cancel-vcpu-dirty-limit:
2348#
2349# Cancel the upper limit of dirty page rate for virtual CPUs.
2350#
2351# Cancel the dirty page limit for the vCPU which has been set with
2352# set-vcpu-dirty-limit command.  Note that this command requires
2353# support from dirty ring, same as the "set-vcpu-dirty-limit".
2354#
2355# @cpu-index: index of a virtual CPU, default is all.
2356#
2357# Since: 7.1
2358#
2359# Example:
2360#
2361#     -> {"execute": "cancel-vcpu-dirty-limit"},
2362#         "arguments": { "cpu-index": 1 } }
2363#     <- { "return": {} }
2364##
2365{ 'command': 'cancel-vcpu-dirty-limit',
2366  'data': { '*cpu-index': 'int'} }
2367
2368##
2369# @query-vcpu-dirty-limit:
2370#
2371# Returns information about virtual CPU dirty page rate limits, if
2372# any.
2373#
2374# Since: 7.1
2375#
2376# Example:
2377#
2378#     -> {"execute": "query-vcpu-dirty-limit"}
2379#     <- {"return": [
2380#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 0},
2381#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 1}]}
2382##
2383{ 'command': 'query-vcpu-dirty-limit',
2384  'returns': [ 'DirtyLimitInfo' ] }
2385
2386##
2387# @MigrationThreadInfo:
2388#
2389# Information about migrationthreads
2390#
2391# @name: the name of migration thread
2392#
2393# @thread-id: ID of the underlying host thread
2394#
2395# Since: 7.2
2396##
2397{ 'struct': 'MigrationThreadInfo',
2398  'data': {'name': 'str',
2399           'thread-id': 'int'} }
2400
2401##
2402# @query-migrationthreads:
2403#
2404# Returns information of migration threads
2405#
2406# data: migration thread name
2407#
2408# Returns: information about migration threads
2409#
2410# Since: 7.2
2411##
2412{ 'command': 'query-migrationthreads',
2413  'returns': ['MigrationThreadInfo'] }
2414
2415##
2416# @snapshot-save:
2417#
2418# Save a VM snapshot
2419#
2420# @job-id: identifier for the newly created job
2421#
2422# @tag: name of the snapshot to create
2423#
2424# @vmstate: block device node name to save vmstate to
2425#
2426# @devices: list of block device node names to save a snapshot to
2427#
2428# Applications should not assume that the snapshot save is complete
2429# when this command returns.  The job commands / events must be used
2430# to determine completion and to fetch details of any errors that
2431# arise.
2432#
2433# Note that execution of the guest CPUs may be stopped during the time
2434# it takes to save the snapshot.  A future version of QEMU may ensure
2435# CPUs are executing continuously.
2436#
2437# It is strongly recommended that @devices contain all writable block
2438# device nodes if a consistent snapshot is required.
2439#
2440# If @tag already exists, an error will be reported
2441#
2442# Example:
2443#
2444#     -> { "execute": "snapshot-save",
2445#          "arguments": {
2446#             "job-id": "snapsave0",
2447#             "tag": "my-snap",
2448#             "vmstate": "disk0",
2449#             "devices": ["disk0", "disk1"]
2450#          }
2451#        }
2452#     <- { "return": { } }
2453#     <- {"event": "JOB_STATUS_CHANGE",
2454#         "timestamp": {"seconds": 1432121972, "microseconds": 744001},
2455#         "data": {"status": "created", "id": "snapsave0"}}
2456#     <- {"event": "JOB_STATUS_CHANGE",
2457#         "timestamp": {"seconds": 1432122172, "microseconds": 744001},
2458#         "data": {"status": "running", "id": "snapsave0"}}
2459#     <- {"event": "STOP",
2460#         "timestamp": {"seconds": 1432122372, "microseconds": 744001} }
2461#     <- {"event": "RESUME",
2462#         "timestamp": {"seconds": 1432122572, "microseconds": 744001} }
2463#     <- {"event": "JOB_STATUS_CHANGE",
2464#         "timestamp": {"seconds": 1432122772, "microseconds": 744001},
2465#         "data": {"status": "waiting", "id": "snapsave0"}}
2466#     <- {"event": "JOB_STATUS_CHANGE",
2467#         "timestamp": {"seconds": 1432122972, "microseconds": 744001},
2468#         "data": {"status": "pending", "id": "snapsave0"}}
2469#     <- {"event": "JOB_STATUS_CHANGE",
2470#         "timestamp": {"seconds": 1432123172, "microseconds": 744001},
2471#         "data": {"status": "concluded", "id": "snapsave0"}}
2472#     -> {"execute": "query-jobs"}
2473#     <- {"return": [{"current-progress": 1,
2474#                     "status": "concluded",
2475#                     "total-progress": 1,
2476#                     "type": "snapshot-save",
2477#                     "id": "snapsave0"}]}
2478#
2479# Since: 6.0
2480##
2481{ 'command': 'snapshot-save',
2482  'data': { 'job-id': 'str',
2483            'tag': 'str',
2484            'vmstate': 'str',
2485            'devices': ['str'] } }
2486
2487##
2488# @snapshot-load:
2489#
2490# Load a VM snapshot
2491#
2492# @job-id: identifier for the newly created job
2493#
2494# @tag: name of the snapshot to load.
2495#
2496# @vmstate: block device node name to load vmstate from
2497#
2498# @devices: list of block device node names to load a snapshot from
2499#
2500# Applications should not assume that the snapshot load is complete
2501# when this command returns.  The job commands / events must be used
2502# to determine completion and to fetch details of any errors that
2503# arise.
2504#
2505# Note that execution of the guest CPUs will be stopped during the
2506# time it takes to load the snapshot.
2507#
2508# It is strongly recommended that @devices contain all writable block
2509# device nodes that can have changed since the original @snapshot-save
2510# command execution.
2511#
2512# Example:
2513#
2514#     -> { "execute": "snapshot-load",
2515#          "arguments": {
2516#             "job-id": "snapload0",
2517#             "tag": "my-snap",
2518#             "vmstate": "disk0",
2519#             "devices": ["disk0", "disk1"]
2520#          }
2521#        }
2522#     <- { "return": { } }
2523#     <- {"event": "JOB_STATUS_CHANGE",
2524#         "timestamp": {"seconds": 1472124172, "microseconds": 744001},
2525#         "data": {"status": "created", "id": "snapload0"}}
2526#     <- {"event": "JOB_STATUS_CHANGE",
2527#         "timestamp": {"seconds": 1472125172, "microseconds": 744001},
2528#         "data": {"status": "running", "id": "snapload0"}}
2529#     <- {"event": "STOP",
2530#         "timestamp": {"seconds": 1472125472, "microseconds": 744001} }
2531#     <- {"event": "RESUME",
2532#         "timestamp": {"seconds": 1472125872, "microseconds": 744001} }
2533#     <- {"event": "JOB_STATUS_CHANGE",
2534#         "timestamp": {"seconds": 1472126172, "microseconds": 744001},
2535#         "data": {"status": "waiting", "id": "snapload0"}}
2536#     <- {"event": "JOB_STATUS_CHANGE",
2537#         "timestamp": {"seconds": 1472127172, "microseconds": 744001},
2538#         "data": {"status": "pending", "id": "snapload0"}}
2539#     <- {"event": "JOB_STATUS_CHANGE",
2540#         "timestamp": {"seconds": 1472128172, "microseconds": 744001},
2541#         "data": {"status": "concluded", "id": "snapload0"}}
2542#     -> {"execute": "query-jobs"}
2543#     <- {"return": [{"current-progress": 1,
2544#                     "status": "concluded",
2545#                     "total-progress": 1,
2546#                     "type": "snapshot-load",
2547#                     "id": "snapload0"}]}
2548#
2549# Since: 6.0
2550##
2551{ 'command': 'snapshot-load',
2552  'data': { 'job-id': 'str',
2553            'tag': 'str',
2554            'vmstate': 'str',
2555            'devices': ['str'] } }
2556
2557##
2558# @snapshot-delete:
2559#
2560# Delete a VM snapshot
2561#
2562# @job-id: identifier for the newly created job
2563#
2564# @tag: name of the snapshot to delete.
2565#
2566# @devices: list of block device node names to delete a snapshot from
2567#
2568# Applications should not assume that the snapshot delete is complete
2569# when this command returns.  The job commands / events must be used
2570# to determine completion and to fetch details of any errors that
2571# arise.
2572#
2573# Example:
2574#
2575#     -> { "execute": "snapshot-delete",
2576#          "arguments": {
2577#             "job-id": "snapdelete0",
2578#             "tag": "my-snap",
2579#             "devices": ["disk0", "disk1"]
2580#          }
2581#        }
2582#     <- { "return": { } }
2583#     <- {"event": "JOB_STATUS_CHANGE",
2584#         "timestamp": {"seconds": 1442124172, "microseconds": 744001},
2585#         "data": {"status": "created", "id": "snapdelete0"}}
2586#     <- {"event": "JOB_STATUS_CHANGE",
2587#         "timestamp": {"seconds": 1442125172, "microseconds": 744001},
2588#         "data": {"status": "running", "id": "snapdelete0"}}
2589#     <- {"event": "JOB_STATUS_CHANGE",
2590#         "timestamp": {"seconds": 1442126172, "microseconds": 744001},
2591#         "data": {"status": "waiting", "id": "snapdelete0"}}
2592#     <- {"event": "JOB_STATUS_CHANGE",
2593#         "timestamp": {"seconds": 1442127172, "microseconds": 744001},
2594#         "data": {"status": "pending", "id": "snapdelete0"}}
2595#     <- {"event": "JOB_STATUS_CHANGE",
2596#         "timestamp": {"seconds": 1442128172, "microseconds": 744001},
2597#         "data": {"status": "concluded", "id": "snapdelete0"}}
2598#     -> {"execute": "query-jobs"}
2599#     <- {"return": [{"current-progress": 1,
2600#                     "status": "concluded",
2601#                     "total-progress": 1,
2602#                     "type": "snapshot-delete",
2603#                     "id": "snapdelete0"}]}
2604#
2605# Since: 6.0
2606##
2607{ 'command': 'snapshot-delete',
2608  'data': { 'job-id': 'str',
2609            'tag': 'str',
2610            'devices': ['str'] } }
2611