xref: /qemu/qapi/migration.json (revision 118d4ed0)
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 target VM
20#
21# @total: total amount of bytes involved in the migration process
22#
23# @duplicate: number of duplicate (zero) pages (since 1.2)
24#
25# @skipped: number of skipped zero pages (since 1.5)
26#
27# @normal: number of normal pages (since 1.2)
28#
29# @normal-bytes: number of normal bytes sent (since 1.2)
30#
31# @dirty-pages-rate: number of pages dirtied by second by the
32#                    guest (since 1.3)
33#
34# @mbps: throughput in megabits/sec. (since 1.6)
35#
36# @dirty-sync-count: number of times that dirty ram was synchronized (since 2.1)
37#
38# @postcopy-requests: The number of page requests received from the destination
39#                     (since 2.7)
40#
41# @page-size: The number of bytes per page for the various page-based
42#             statistics (since 2.10)
43#
44# @multifd-bytes: The number of bytes sent through multifd (since 3.0)
45#
46# @pages-per-second: the number of memory pages transferred per second
47#                    (Since 4.0)
48#
49# @precopy-bytes: The number of bytes sent in the pre-copy phase
50#                 (since 7.0).
51#
52# @downtime-bytes: The number of bytes sent while the guest is paused
53#                  (since 7.0).
54#
55# @postcopy-bytes: The number of bytes sent during the post-copy phase
56#                  (since 7.0).
57#
58# Since: 0.14
59##
60{ 'struct': 'MigrationStats',
61  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
62           'duplicate': 'int', 'skipped': 'int', 'normal': 'int',
63           'normal-bytes': 'int', 'dirty-pages-rate' : 'int',
64           'mbps' : 'number', 'dirty-sync-count' : 'int',
65           'postcopy-requests' : 'int', 'page-size' : 'int',
66           'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64',
67           'precopy-bytes' : 'uint64', 'downtime-bytes' : 'uint64',
68           'postcopy-bytes' : 'uint64' } }
69
70##
71# @XBZRLECacheStats:
72#
73# Detailed XBZRLE migration cache statistics
74#
75# @cache-size: XBZRLE cache size
76#
77# @bytes: amount of bytes already transferred to the target VM
78#
79# @pages: amount of pages transferred to the target VM
80#
81# @cache-miss: number of cache miss
82#
83# @cache-miss-rate: rate of cache miss (since 2.1)
84#
85# @encoding-rate: rate of encoded bytes (since 5.1)
86#
87# @overflow: number of overflows
88#
89# Since: 1.2
90##
91{ 'struct': 'XBZRLECacheStats',
92  'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
93           'cache-miss': 'int', 'cache-miss-rate': 'number',
94           'encoding-rate': 'number', 'overflow': 'int' } }
95
96##
97# @CompressionStats:
98#
99# Detailed migration compression statistics
100#
101# @pages: amount of pages compressed and transferred to the target VM
102#
103# @busy: count of times that no free thread was available to compress data
104#
105# @busy-rate: rate of thread busy
106#
107# @compressed-size: amount of bytes after compression
108#
109# @compression-rate: rate of compressed size
110#
111# Since: 3.1
112##
113{ 'struct': 'CompressionStats',
114  'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
115           'compressed-size': 'int', 'compression-rate': 'number' } }
116
117##
118# @MigrationStatus:
119#
120# An enumeration of migration status.
121#
122# @none: no migration has ever happened.
123#
124# @setup: migration process has been initiated.
125#
126# @cancelling: in the process of cancelling migration.
127#
128# @cancelled: cancelling migration is finished.
129#
130# @active: in the process of doing migration.
131#
132# @postcopy-active: like active, but now in postcopy mode. (since 2.5)
133#
134# @postcopy-paused: during postcopy but paused. (since 3.0)
135#
136# @postcopy-recover: trying to recover from a paused postcopy. (since 3.0)
137#
138# @completed: migration is finished.
139#
140# @failed: some error occurred during migration process.
141#
142# @colo: VM is in the process of fault tolerance, VM can not get into this
143#        state unless colo capability is enabled for migration. (since 2.8)
144#
145# @pre-switchover: Paused before device serialisation. (since 2.11)
146#
147# @device: During device serialisation when pause-before-switchover is enabled
148#          (since 2.11)
149#
150# @wait-unplug: wait for device unplug request by guest OS to be completed.
151#               (since 4.2)
152#
153# Since: 2.3
154##
155{ 'enum': 'MigrationStatus',
156  'data': [ 'none', 'setup', 'cancelling', 'cancelled',
157            'active', 'postcopy-active', 'postcopy-paused',
158            'postcopy-recover', 'completed', 'failed', 'colo',
159            'pre-switchover', 'device', 'wait-unplug' ] }
160##
161# @VfioStats:
162#
163# Detailed VFIO devices migration statistics
164#
165# @transferred: amount of bytes transferred to the target VM by VFIO devices
166#
167# Since: 5.2
168##
169{ 'struct': 'VfioStats',
170  'data': {'transferred': 'int' } }
171
172##
173# @MigrationInfo:
174#
175# Information about current migration process.
176#
177# @status: @MigrationStatus describing the current migration status.
178#          If this field is not returned, no migration process
179#          has been initiated
180#
181# @ram: @MigrationStats containing detailed migration
182#       status, only returned if status is 'active' or
183#       'completed'(since 1.2)
184#
185# @disk: @MigrationStats containing detailed disk migration
186#        status, only returned if status is 'active' and it is a block
187#        migration
188#
189# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
190#                migration statistics, only returned if XBZRLE feature is on and
191#                status is 'active' or 'completed' (since 1.2)
192#
193# @total-time: total amount of milliseconds since migration started.
194#              If migration has ended, it returns the total migration
195#              time. (since 1.2)
196#
197# @downtime: only present when migration finishes correctly
198#            total downtime in milliseconds for the guest.
199#            (since 1.3)
200#
201# @expected-downtime: only present while migration is active
202#                     expected downtime in milliseconds for the guest in last walk
203#                     of the dirty bitmap. (since 1.3)
204#
205# @setup-time: amount of setup time in milliseconds *before* the
206#              iterations begin but *after* the QMP command is issued. This is designed
207#              to provide an accounting of any activities (such as RDMA pinning) which
208#              may be expensive, but do not actually occur during the iterative
209#              migration rounds themselves. (since 1.6)
210#
211# @cpu-throttle-percentage: percentage of time guest cpus are being
212#                           throttled during auto-converge. This is only present when auto-converge
213#                           has started throttling guest cpus. (Since 2.7)
214#
215# @error-desc: the human readable error description string, when
216#              @status is 'failed'. Clients should not attempt to parse the
217#              error strings. (Since 2.7)
218#
219# @postcopy-blocktime: total time when all vCPU were blocked during postcopy
220#                      live migration. This is only present when the postcopy-blocktime
221#                      migration capability is enabled. (Since 3.0)
222#
223# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.  This is
224#                           only present when the postcopy-blocktime migration capability
225#                           is enabled. (Since 3.0)
226#
227# @compression: migration compression statistics, only returned if compression
228#               feature is on and status is 'active' or 'completed' (Since 3.1)
229#
230# @socket-address: Only used for tcp, to know what the real port is (Since 4.0)
231#
232# @vfio: @VfioStats containing detailed VFIO devices migration statistics,
233#        only returned if VFIO device is present, migration is supported by all
234#        VFIO devices and status is 'active' or 'completed' (since 5.2)
235#
236# @blocked-reasons: A list of reasons an outgoing migration is blocked.
237#                   Present and non-empty when migration is blocked.
238#                   (since 6.0)
239#
240# Since: 0.14
241##
242{ 'struct': 'MigrationInfo',
243  'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
244           '*disk': 'MigrationStats',
245           '*vfio': 'VfioStats',
246           '*xbzrle-cache': 'XBZRLECacheStats',
247           '*total-time': 'int',
248           '*expected-downtime': 'int',
249           '*downtime': 'int',
250           '*setup-time': 'int',
251           '*cpu-throttle-percentage': 'int',
252           '*error-desc': 'str',
253           '*blocked-reasons': ['str'],
254           '*postcopy-blocktime' : 'uint32',
255           '*postcopy-vcpu-blocktime': ['uint32'],
256           '*compression': 'CompressionStats',
257           '*socket-address': ['SocketAddress'] } }
258
259##
260# @query-migrate:
261#
262# Returns information about current migration process. If migration
263# is active there will be another json-object with RAM migration
264# status and if block migration is active another one with block
265# migration status.
266#
267# Returns: @MigrationInfo
268#
269# Since: 0.14
270#
271# Example:
272#
273# 1. Before the first migration
274#
275# -> { "execute": "query-migrate" }
276# <- { "return": {} }
277#
278# 2. Migration is done and has succeeded
279#
280# -> { "execute": "query-migrate" }
281# <- { "return": {
282#         "status": "completed",
283#         "total-time":12345,
284#         "setup-time":12345,
285#         "downtime":12345,
286#         "ram":{
287#           "transferred":123,
288#           "remaining":123,
289#           "total":246,
290#           "duplicate":123,
291#           "normal":123,
292#           "normal-bytes":123456,
293#           "dirty-sync-count":15
294#         }
295#      }
296#    }
297#
298# 3. Migration is done and has failed
299#
300# -> { "execute": "query-migrate" }
301# <- { "return": { "status": "failed" } }
302#
303# 4. Migration is being performed and is not a block migration:
304#
305# -> { "execute": "query-migrate" }
306# <- {
307#       "return":{
308#          "status":"active",
309#          "total-time":12345,
310#          "setup-time":12345,
311#          "expected-downtime":12345,
312#          "ram":{
313#             "transferred":123,
314#             "remaining":123,
315#             "total":246,
316#             "duplicate":123,
317#             "normal":123,
318#             "normal-bytes":123456,
319#             "dirty-sync-count":15
320#          }
321#       }
322#    }
323#
324# 5. Migration is being performed and is a block migration:
325#
326# -> { "execute": "query-migrate" }
327# <- {
328#       "return":{
329#          "status":"active",
330#          "total-time":12345,
331#          "setup-time":12345,
332#          "expected-downtime":12345,
333#          "ram":{
334#             "total":1057024,
335#             "remaining":1053304,
336#             "transferred":3720,
337#             "duplicate":123,
338#             "normal":123,
339#             "normal-bytes":123456,
340#             "dirty-sync-count":15
341#          },
342#          "disk":{
343#             "total":20971520,
344#             "remaining":20880384,
345#             "transferred":91136
346#          }
347#       }
348#    }
349#
350# 6. Migration is being performed and XBZRLE is active:
351#
352# -> { "execute": "query-migrate" }
353# <- {
354#       "return":{
355#          "status":"active",
356#          "total-time":12345,
357#          "setup-time":12345,
358#          "expected-downtime":12345,
359#          "ram":{
360#             "total":1057024,
361#             "remaining":1053304,
362#             "transferred":3720,
363#             "duplicate":10,
364#             "normal":3333,
365#             "normal-bytes":3412992,
366#             "dirty-sync-count":15
367#          },
368#          "xbzrle-cache":{
369#             "cache-size":67108864,
370#             "bytes":20971520,
371#             "pages":2444343,
372#             "cache-miss":2244,
373#             "cache-miss-rate":0.123,
374#             "encoding-rate":80.1,
375#             "overflow":34434
376#          }
377#       }
378#    }
379#
380##
381{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
382
383##
384# @MigrationCapability:
385#
386# Migration capabilities enumeration
387#
388# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
389#          This feature allows us to minimize migration traffic for certain work
390#          loads, by sending compressed difference of the pages
391#
392# @rdma-pin-all: Controls whether or not the entire VM memory footprint is
393#                mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage.
394#                Disabled by default. (since 2.0)
395#
396# @zero-blocks: During storage migration encode blocks of zeroes efficiently. This
397#               essentially saves 1MB of zeroes per block on the wire. Enabling requires
398#               source and target VM to support this feature. To enable it is sufficient
399#               to enable the capability on the source VM. The feature is disabled by
400#               default. (since 1.6)
401#
402# @compress: Use multiple compression threads to accelerate live migration.
403#            This feature can help to reduce the migration traffic, by sending
404#            compressed pages. Please note that if compress and xbzrle are both
405#            on, compress only takes effect in the ram bulk stage, after that,
406#            it will be disabled and only xbzrle takes effect, this can help to
407#            minimize migration traffic. The feature is disabled by default.
408#            (since 2.4 )
409#
410# @events: generate events for each migration state change
411#          (since 2.4 )
412#
413# @auto-converge: If enabled, QEMU will automatically throttle down the guest
414#                 to speed up convergence of RAM migration. (since 1.6)
415#
416# @postcopy-ram: Start executing on the migration target before all of RAM has
417#                been migrated, pulling the remaining pages along as needed. The
418#                capacity must have the same setting on both source and target
419#                or migration will not even start. NOTE: If the migration fails during
420#                postcopy the VM will fail.  (since 2.6)
421#
422# @x-colo: If enabled, migration will never end, and the state of the VM on the
423#          primary side will be migrated continuously to the VM on secondary
424#          side, this process is called COarse-Grain LOck Stepping (COLO) for
425#          Non-stop Service. (since 2.8)
426#
427# @release-ram: if enabled, qemu will free the migrated ram pages on the source
428#               during postcopy-ram migration. (since 2.9)
429#
430# @block: If enabled, QEMU will also migrate the contents of all block
431#         devices.  Default is disabled.  A possible alternative uses
432#         mirror jobs to a builtin NBD server on the destination, which
433#         offers more flexibility.
434#         (Since 2.10)
435#
436# @return-path: If enabled, migration will use the return path even
437#               for precopy. (since 2.10)
438#
439# @pause-before-switchover: Pause outgoing migration before serialising device
440#                           state and before disabling block IO (since 2.11)
441#
442# @multifd: Use more than one fd for migration (since 4.0)
443#
444# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
445#                 (since 2.12)
446#
447# @postcopy-blocktime: Calculate downtime for postcopy live migration
448#                      (since 3.0)
449#
450# @late-block-activate: If enabled, the destination will not activate block
451#                       devices (and thus take locks) immediately at the end of migration.
452#                       (since 3.0)
453#
454# @x-ignore-shared: If enabled, QEMU will not migrate shared memory (since 4.0)
455#
456# @validate-uuid: Send the UUID of the source to allow the destination
457#                 to ensure it is the same. (since 4.2)
458#
459# @background-snapshot: If enabled, the migration stream will be a snapshot
460#                       of the VM exactly at the point when the migration
461#                       procedure starts. The VM RAM is saved with running VM.
462#                       (since 6.0)
463#
464# @zero-copy-send: Controls behavior on sending memory pages on migration.
465#                  When true, enables a zero-copy mechanism for sending
466#                  memory pages, if host supports it.
467#                  Requires that QEMU be permitted to use locked memory
468#                  for guest RAM pages.
469#                  (since 7.1)
470#
471# Features:
472# @unstable: Members @x-colo and @x-ignore-shared are experimental.
473#
474# Since: 1.2
475##
476{ 'enum': 'MigrationCapability',
477  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
478           'compress', 'events', 'postcopy-ram',
479           { 'name': 'x-colo', 'features': [ 'unstable' ] },
480           'release-ram',
481           'block', 'return-path', 'pause-before-switchover', 'multifd',
482           'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
483           { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] },
484           'validate-uuid', 'background-snapshot',
485           'zero-copy-send'] }
486
487##
488# @MigrationCapabilityStatus:
489#
490# Migration capability information
491#
492# @capability: capability enum
493#
494# @state: capability state bool
495#
496# Since: 1.2
497##
498{ 'struct': 'MigrationCapabilityStatus',
499  'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }
500
501##
502# @migrate-set-capabilities:
503#
504# Enable/Disable the following migration capabilities (like xbzrle)
505#
506# @capabilities: json array of capability modifications to make
507#
508# Since: 1.2
509#
510# Example:
511#
512# -> { "execute": "migrate-set-capabilities" , "arguments":
513#      { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
514#
515##
516{ 'command': 'migrate-set-capabilities',
517  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
518
519##
520# @query-migrate-capabilities:
521#
522# Returns information about the current migration capabilities status
523#
524# Returns: @MigrationCapabilitiesStatus
525#
526# Since: 1.2
527#
528# Example:
529#
530# -> { "execute": "query-migrate-capabilities" }
531# <- { "return": [
532#       {"state": false, "capability": "xbzrle"},
533#       {"state": false, "capability": "rdma-pin-all"},
534#       {"state": false, "capability": "auto-converge"},
535#       {"state": false, "capability": "zero-blocks"},
536#       {"state": false, "capability": "compress"},
537#       {"state": true, "capability": "events"},
538#       {"state": false, "capability": "postcopy-ram"},
539#       {"state": false, "capability": "x-colo"}
540#    ]}
541#
542##
543{ 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}
544
545##
546# @MultiFDCompression:
547#
548# An enumeration of multifd compression methods.
549#
550# @none: no compression.
551# @zlib: use zlib compression method.
552# @zstd: use zstd compression method.
553#
554# Since: 5.0
555##
556{ 'enum': 'MultiFDCompression',
557  'data': [ 'none', 'zlib',
558            { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
559
560##
561# @BitmapMigrationBitmapAliasTransform:
562#
563# @persistent: If present, the bitmap will be made persistent
564#              or transient depending on this parameter.
565#
566# Since: 6.0
567##
568{ 'struct': 'BitmapMigrationBitmapAliasTransform',
569  'data': {
570      '*persistent': 'bool'
571  } }
572
573##
574# @BitmapMigrationBitmapAlias:
575#
576# @name: The name of the bitmap.
577#
578# @alias: An alias name for migration (for example the bitmap name on
579#         the opposite site).
580#
581# @transform: Allows the modification of the migrated bitmap.
582#             (since 6.0)
583#
584# Since: 5.2
585##
586{ 'struct': 'BitmapMigrationBitmapAlias',
587  'data': {
588      'name': 'str',
589      'alias': 'str',
590      '*transform': 'BitmapMigrationBitmapAliasTransform'
591  } }
592
593##
594# @BitmapMigrationNodeAlias:
595#
596# Maps a block node name and the bitmaps it has to aliases for dirty
597# bitmap migration.
598#
599# @node-name: A block node name.
600#
601# @alias: An alias block node name for migration (for example the
602#         node name on the opposite site).
603#
604# @bitmaps: Mappings for the bitmaps on this node.
605#
606# Since: 5.2
607##
608{ 'struct': 'BitmapMigrationNodeAlias',
609  'data': {
610      'node-name': 'str',
611      'alias': 'str',
612      'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
613  } }
614
615##
616# @MigrationParameter:
617#
618# Migration parameters enumeration
619#
620# @announce-initial: Initial delay (in milliseconds) before sending the first
621#                    announce (Since 4.0)
622#
623# @announce-max: Maximum delay (in milliseconds) between packets in the
624#                announcement (Since 4.0)
625#
626# @announce-rounds: Number of self-announce packets sent after migration
627#                   (Since 4.0)
628#
629# @announce-step: Increase in delay (in milliseconds) between subsequent
630#                 packets in the announcement (Since 4.0)
631#
632# @compress-level: Set the compression level to be used in live migration,
633#                  the compression level is an integer between 0 and 9, where 0 means
634#                  no compression, 1 means the best compression speed, and 9 means best
635#                  compression ratio which will consume more CPU.
636#
637# @compress-threads: Set compression thread count to be used in live migration,
638#                    the compression thread count is an integer between 1 and 255.
639#
640# @compress-wait-thread: Controls behavior when all compression threads are
641#                        currently busy. If true (default), wait for a free
642#                        compression thread to become available; otherwise,
643#                        send the page uncompressed. (Since 3.1)
644#
645# @decompress-threads: Set decompression thread count to be used in live
646#                      migration, the decompression thread count is an integer between 1
647#                      and 255. Usually, decompression is at least 4 times as fast as
648#                      compression, so set the decompress-threads to the number about 1/4
649#                      of compress-threads is adequate.
650#
651# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
652#                              to trigger throttling. It is expressed as percentage.
653#                              The default value is 50. (Since 5.0)
654#
655# @cpu-throttle-initial: Initial percentage of time guest cpus are throttled
656#                        when migration auto-converge is activated. The
657#                        default value is 20. (Since 2.7)
658#
659# @cpu-throttle-increment: throttle percentage increase each time
660#                          auto-converge detects that migration is not making
661#                          progress. The default value is 10. (Since 2.7)
662#
663# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
664#                         At the tail stage of throttling, the Guest is very
665#                         sensitive to CPU percentage while the @cpu-throttle
666#                         -increment is excessive usually at tail stage.
667#                         If this parameter is true, we will compute the ideal
668#                         CPU percentage used by the Guest, which may exactly make
669#                         the dirty rate match the dirty rate threshold. Then we
670#                         will choose a smaller throttle increment between the
671#                         one specified by @cpu-throttle-increment and the one
672#                         generated by ideal CPU percentage.
673#                         Therefore, it is compatible to traditional throttling,
674#                         meanwhile the throttle increment won't be excessive
675#                         at tail stage.
676#                         The default value is false. (Since 5.1)
677#
678# @tls-creds: ID of the 'tls-creds' object that provides credentials for
679#             establishing a TLS connection over the migration data channel.
680#             On the outgoing side of the migration, the credentials must
681#             be for a 'client' endpoint, while for the incoming side the
682#             credentials must be for a 'server' endpoint. Setting this
683#             will enable TLS for all migrations. The default is unset,
684#             resulting in unsecured migration at the QEMU level. (Since 2.7)
685#
686# @tls-hostname: hostname of the target host for the migration. This is
687#                required when using x509 based TLS credentials and the
688#                migration URI does not already include a hostname. For
689#                example if using fd: or exec: based migration, the
690#                hostname must be provided so that the server's x509
691#                certificate identity can be validated. (Since 2.7)
692#
693# @tls-authz: ID of the 'authz' object subclass that provides access control
694#             checking of the TLS x509 certificate distinguished name.
695#             This object is only resolved at time of use, so can be deleted
696#             and recreated on the fly while the migration server is active.
697#             If missing, it will default to denying access (Since 4.0)
698#
699# @max-bandwidth: to set maximum speed for migration. maximum speed in
700#                 bytes per second. (Since 2.8)
701#
702# @downtime-limit: set maximum tolerated downtime for migration. maximum
703#                  downtime in milliseconds (Since 2.8)
704#
705# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
706#                      periodic mode. (Since 2.8)
707#
708# @block-incremental: Affects how much storage is migrated when the
709#                     block migration capability is enabled.  When false, the entire
710#                     storage backing chain is migrated into a flattened image at
711#                     the destination; when true, only the active qcow2 layer is
712#                     migrated and the destination must already have access to the
713#                     same backing chain as was used on the source.  (since 2.10)
714#
715# @multifd-channels: Number of channels used to migrate data in
716#                    parallel. This is the same number that the
717#                    number of sockets used for migration.  The
718#                    default value is 2 (since 4.0)
719#
720# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
721#                     needs to be a multiple of the target page size
722#                     and a power of 2
723#                     (Since 2.11)
724#
725# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
726#                          Defaults to 0 (unlimited).  In bytes per second.
727#                          (Since 3.0)
728#
729# @max-cpu-throttle: maximum cpu throttle percentage.
730#                    Defaults to 99. (Since 3.1)
731#
732# @multifd-compression: Which compression method to use.
733#                       Defaults to none. (Since 5.0)
734#
735# @multifd-zlib-level: Set the compression level to be used in live
736#                      migration, the compression level is an integer between 0
737#                      and 9, where 0 means no compression, 1 means the best
738#                      compression speed, and 9 means best compression ratio which
739#                      will consume more CPU.
740#                      Defaults to 1. (Since 5.0)
741#
742# @multifd-zstd-level: Set the compression level to be used in live
743#                      migration, the compression level is an integer between 0
744#                      and 20, where 0 means no compression, 1 means the best
745#                      compression speed, and 20 means best compression ratio which
746#                      will consume more CPU.
747#                      Defaults to 1. (Since 5.0)
748#
749#
750# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
751#                        aliases for the purpose of dirty bitmap migration.  Such
752#                        aliases may for example be the corresponding names on the
753#                        opposite site.
754#                        The mapping must be one-to-one, but not necessarily
755#                        complete: On the source, unmapped bitmaps and all bitmaps
756#                        on unmapped nodes will be ignored.  On the destination,
757#                        encountering an unmapped alias in the incoming migration
758#                        stream will result in a report, and all further bitmap
759#                        migration data will then be discarded.
760#                        Note that the destination does not know about bitmaps it
761#                        does not receive, so there is no limitation or requirement
762#                        regarding the number of bitmaps received, or how they are
763#                        named, or on which nodes they are placed.
764#                        By default (when this parameter has never been set), bitmap
765#                        names are mapped to themselves.  Nodes are mapped to their
766#                        block device name if there is one, and to their node name
767#                        otherwise. (Since 5.2)
768#
769# Features:
770# @unstable: Member @x-checkpoint-delay is experimental.
771#
772# Since: 2.4
773##
774{ 'enum': 'MigrationParameter',
775  'data': ['announce-initial', 'announce-max',
776           'announce-rounds', 'announce-step',
777           'compress-level', 'compress-threads', 'decompress-threads',
778           'compress-wait-thread', 'throttle-trigger-threshold',
779           'cpu-throttle-initial', 'cpu-throttle-increment',
780           'cpu-throttle-tailslow',
781           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
782           'downtime-limit',
783           { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
784           'block-incremental',
785           'multifd-channels',
786           'xbzrle-cache-size', 'max-postcopy-bandwidth',
787           'max-cpu-throttle', 'multifd-compression',
788           'multifd-zlib-level' ,'multifd-zstd-level',
789           'block-bitmap-mapping' ] }
790
791##
792# @MigrateSetParameters:
793#
794# @announce-initial: Initial delay (in milliseconds) before sending the first
795#                    announce (Since 4.0)
796#
797# @announce-max: Maximum delay (in milliseconds) between packets in the
798#                announcement (Since 4.0)
799#
800# @announce-rounds: Number of self-announce packets sent after migration
801#                   (Since 4.0)
802#
803# @announce-step: Increase in delay (in milliseconds) between subsequent
804#                 packets in the announcement (Since 4.0)
805#
806# @compress-level: compression level
807#
808# @compress-threads: compression thread count
809#
810# @compress-wait-thread: Controls behavior when all compression threads are
811#                        currently busy. If true (default), wait for a free
812#                        compression thread to become available; otherwise,
813#                        send the page uncompressed. (Since 3.1)
814#
815# @decompress-threads: decompression thread count
816#
817# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
818#                              to trigger throttling. It is expressed as percentage.
819#                              The default value is 50. (Since 5.0)
820#
821# @cpu-throttle-initial: Initial percentage of time guest cpus are
822#                        throttled when migration auto-converge is activated.
823#                        The default value is 20. (Since 2.7)
824#
825# @cpu-throttle-increment: throttle percentage increase each time
826#                          auto-converge detects that migration is not making
827#                          progress. The default value is 10. (Since 2.7)
828#
829# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
830#                         At the tail stage of throttling, the Guest is very
831#                         sensitive to CPU percentage while the @cpu-throttle
832#                         -increment is excessive usually at tail stage.
833#                         If this parameter is true, we will compute the ideal
834#                         CPU percentage used by the Guest, which may exactly make
835#                         the dirty rate match the dirty rate threshold. Then we
836#                         will choose a smaller throttle increment between the
837#                         one specified by @cpu-throttle-increment and the one
838#                         generated by ideal CPU percentage.
839#                         Therefore, it is compatible to traditional throttling,
840#                         meanwhile the throttle increment won't be excessive
841#                         at tail stage.
842#                         The default value is false. (Since 5.1)
843#
844# @tls-creds: ID of the 'tls-creds' object that provides credentials
845#             for establishing a TLS connection over the migration data
846#             channel. On the outgoing side of the migration, the credentials
847#             must be for a 'client' endpoint, while for the incoming side the
848#             credentials must be for a 'server' endpoint. Setting this
849#             to a non-empty string enables TLS for all migrations.
850#             An empty string means that QEMU will use plain text mode for
851#             migration, rather than TLS (Since 2.9)
852#             Previously (since 2.7), this was reported by omitting
853#             tls-creds instead.
854#
855# @tls-hostname: hostname of the target host for the migration. This
856#                is required when using x509 based TLS credentials and the
857#                migration URI does not already include a hostname. For
858#                example if using fd: or exec: based migration, the
859#                hostname must be provided so that the server's x509
860#                certificate identity can be validated. (Since 2.7)
861#                An empty string means that QEMU will use the hostname
862#                associated with the migration URI, if any. (Since 2.9)
863#                Previously (since 2.7), this was reported by omitting
864#                tls-hostname instead.
865#
866# @max-bandwidth: to set maximum speed for migration. maximum speed in
867#                 bytes per second. (Since 2.8)
868#
869# @downtime-limit: set maximum tolerated downtime for migration. maximum
870#                  downtime in milliseconds (Since 2.8)
871#
872# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
873#
874# @block-incremental: Affects how much storage is migrated when the
875#                     block migration capability is enabled.  When false, the entire
876#                     storage backing chain is migrated into a flattened image at
877#                     the destination; when true, only the active qcow2 layer is
878#                     migrated and the destination must already have access to the
879#                     same backing chain as was used on the source.  (since 2.10)
880#
881# @multifd-channels: Number of channels used to migrate data in
882#                    parallel. This is the same number that the
883#                    number of sockets used for migration.  The
884#                    default value is 2 (since 4.0)
885#
886# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
887#                     needs to be a multiple of the target page size
888#                     and a power of 2
889#                     (Since 2.11)
890#
891# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
892#                          Defaults to 0 (unlimited).  In bytes per second.
893#                          (Since 3.0)
894#
895# @max-cpu-throttle: maximum cpu throttle percentage.
896#                    The default value is 99. (Since 3.1)
897#
898# @multifd-compression: Which compression method to use.
899#                       Defaults to none. (Since 5.0)
900#
901# @multifd-zlib-level: Set the compression level to be used in live
902#                      migration, the compression level is an integer between 0
903#                      and 9, where 0 means no compression, 1 means the best
904#                      compression speed, and 9 means best compression ratio which
905#                      will consume more CPU.
906#                      Defaults to 1. (Since 5.0)
907#
908# @multifd-zstd-level: Set the compression level to be used in live
909#                      migration, the compression level is an integer between 0
910#                      and 20, where 0 means no compression, 1 means the best
911#                      compression speed, and 20 means best compression ratio which
912#                      will consume more CPU.
913#                      Defaults to 1. (Since 5.0)
914#
915# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
916#                        aliases for the purpose of dirty bitmap migration.  Such
917#                        aliases may for example be the corresponding names on the
918#                        opposite site.
919#                        The mapping must be one-to-one, but not necessarily
920#                        complete: On the source, unmapped bitmaps and all bitmaps
921#                        on unmapped nodes will be ignored.  On the destination,
922#                        encountering an unmapped alias in the incoming migration
923#                        stream will result in a report, and all further bitmap
924#                        migration data will then be discarded.
925#                        Note that the destination does not know about bitmaps it
926#                        does not receive, so there is no limitation or requirement
927#                        regarding the number of bitmaps received, or how they are
928#                        named, or on which nodes they are placed.
929#                        By default (when this parameter has never been set), bitmap
930#                        names are mapped to themselves.  Nodes are mapped to their
931#                        block device name if there is one, and to their node name
932#                        otherwise. (Since 5.2)
933#
934# Features:
935# @unstable: Member @x-checkpoint-delay is experimental.
936#
937# Since: 2.4
938##
939# TODO either fuse back into MigrationParameters, or make
940# MigrationParameters members mandatory
941{ 'struct': 'MigrateSetParameters',
942  'data': { '*announce-initial': 'size',
943            '*announce-max': 'size',
944            '*announce-rounds': 'size',
945            '*announce-step': 'size',
946            '*compress-level': 'uint8',
947            '*compress-threads': 'uint8',
948            '*compress-wait-thread': 'bool',
949            '*decompress-threads': 'uint8',
950            '*throttle-trigger-threshold': 'uint8',
951            '*cpu-throttle-initial': 'uint8',
952            '*cpu-throttle-increment': 'uint8',
953            '*cpu-throttle-tailslow': 'bool',
954            '*tls-creds': 'StrOrNull',
955            '*tls-hostname': 'StrOrNull',
956            '*tls-authz': 'StrOrNull',
957            '*max-bandwidth': 'size',
958            '*downtime-limit': 'uint64',
959            '*x-checkpoint-delay': { 'type': 'uint32',
960                                     'features': [ 'unstable' ] },
961            '*block-incremental': 'bool',
962            '*multifd-channels': 'uint8',
963            '*xbzrle-cache-size': 'size',
964            '*max-postcopy-bandwidth': 'size',
965            '*max-cpu-throttle': 'uint8',
966            '*multifd-compression': 'MultiFDCompression',
967            '*multifd-zlib-level': 'uint8',
968            '*multifd-zstd-level': 'uint8',
969            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
970
971##
972# @migrate-set-parameters:
973#
974# Set various migration parameters.
975#
976# Since: 2.4
977#
978# Example:
979#
980# -> { "execute": "migrate-set-parameters" ,
981#      "arguments": { "compress-level": 1 } }
982#
983##
984{ 'command': 'migrate-set-parameters', 'boxed': true,
985  'data': 'MigrateSetParameters' }
986
987##
988# @MigrationParameters:
989#
990# The optional members aren't actually optional.
991#
992# @announce-initial: Initial delay (in milliseconds) before sending the
993#                    first announce (Since 4.0)
994#
995# @announce-max: Maximum delay (in milliseconds) between packets in the
996#                announcement (Since 4.0)
997#
998# @announce-rounds: Number of self-announce packets sent after migration
999#                   (Since 4.0)
1000#
1001# @announce-step: Increase in delay (in milliseconds) between subsequent
1002#                 packets in the announcement (Since 4.0)
1003#
1004# @compress-level: compression level
1005#
1006# @compress-threads: compression thread count
1007#
1008# @compress-wait-thread: Controls behavior when all compression threads are
1009#                        currently busy. If true (default), wait for a free
1010#                        compression thread to become available; otherwise,
1011#                        send the page uncompressed. (Since 3.1)
1012#
1013# @decompress-threads: decompression thread count
1014#
1015# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
1016#                              to trigger throttling. It is expressed as percentage.
1017#                              The default value is 50. (Since 5.0)
1018#
1019# @cpu-throttle-initial: Initial percentage of time guest cpus are
1020#                        throttled when migration auto-converge is activated.
1021#                        (Since 2.7)
1022#
1023# @cpu-throttle-increment: throttle percentage increase each time
1024#                          auto-converge detects that migration is not making
1025#                          progress. (Since 2.7)
1026#
1027# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
1028#                         At the tail stage of throttling, the Guest is very
1029#                         sensitive to CPU percentage while the @cpu-throttle
1030#                         -increment is excessive usually at tail stage.
1031#                         If this parameter is true, we will compute the ideal
1032#                         CPU percentage used by the Guest, which may exactly make
1033#                         the dirty rate match the dirty rate threshold. Then we
1034#                         will choose a smaller throttle increment between the
1035#                         one specified by @cpu-throttle-increment and the one
1036#                         generated by ideal CPU percentage.
1037#                         Therefore, it is compatible to traditional throttling,
1038#                         meanwhile the throttle increment won't be excessive
1039#                         at tail stage.
1040#                         The default value is false. (Since 5.1)
1041#
1042# @tls-creds: ID of the 'tls-creds' object that provides credentials
1043#             for establishing a TLS connection over the migration data
1044#             channel. On the outgoing side of the migration, the credentials
1045#             must be for a 'client' endpoint, while for the incoming side the
1046#             credentials must be for a 'server' endpoint.
1047#             An empty string means that QEMU will use plain text mode for
1048#             migration, rather than TLS (Since 2.7)
1049#             Note: 2.8 reports this by omitting tls-creds instead.
1050#
1051# @tls-hostname: hostname of the target host for the migration. This
1052#                is required when using x509 based TLS credentials and the
1053#                migration URI does not already include a hostname. For
1054#                example if using fd: or exec: based migration, the
1055#                hostname must be provided so that the server's x509
1056#                certificate identity can be validated. (Since 2.7)
1057#                An empty string means that QEMU will use the hostname
1058#                associated with the migration URI, if any. (Since 2.9)
1059#                Note: 2.8 reports this by omitting tls-hostname instead.
1060#
1061# @tls-authz: ID of the 'authz' object subclass that provides access control
1062#             checking of the TLS x509 certificate distinguished name. (Since
1063#             4.0)
1064#
1065# @max-bandwidth: to set maximum speed for migration. maximum speed in
1066#                 bytes per second. (Since 2.8)
1067#
1068# @downtime-limit: set maximum tolerated downtime for migration. maximum
1069#                  downtime in milliseconds (Since 2.8)
1070#
1071# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
1072#
1073# @block-incremental: Affects how much storage is migrated when the
1074#                     block migration capability is enabled.  When false, the entire
1075#                     storage backing chain is migrated into a flattened image at
1076#                     the destination; when true, only the active qcow2 layer is
1077#                     migrated and the destination must already have access to the
1078#                     same backing chain as was used on the source.  (since 2.10)
1079#
1080# @multifd-channels: Number of channels used to migrate data in
1081#                    parallel. This is the same number that the
1082#                    number of sockets used for migration.
1083#                    The default value is 2 (since 4.0)
1084#
1085# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1086#                     needs to be a multiple of the target page size
1087#                     and a power of 2
1088#                     (Since 2.11)
1089#
1090# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
1091#                          Defaults to 0 (unlimited).  In bytes per second.
1092#                          (Since 3.0)
1093#
1094# @max-cpu-throttle: maximum cpu throttle percentage.
1095#                    Defaults to 99.
1096#                    (Since 3.1)
1097#
1098# @multifd-compression: Which compression method to use.
1099#                       Defaults to none. (Since 5.0)
1100#
1101# @multifd-zlib-level: Set the compression level to be used in live
1102#                      migration, the compression level is an integer between 0
1103#                      and 9, where 0 means no compression, 1 means the best
1104#                      compression speed, and 9 means best compression ratio which
1105#                      will consume more CPU.
1106#                      Defaults to 1. (Since 5.0)
1107#
1108# @multifd-zstd-level: Set the compression level to be used in live
1109#                      migration, the compression level is an integer between 0
1110#                      and 20, where 0 means no compression, 1 means the best
1111#                      compression speed, and 20 means best compression ratio which
1112#                      will consume more CPU.
1113#                      Defaults to 1. (Since 5.0)
1114#
1115# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1116#                        aliases for the purpose of dirty bitmap migration.  Such
1117#                        aliases may for example be the corresponding names on the
1118#                        opposite site.
1119#                        The mapping must be one-to-one, but not necessarily
1120#                        complete: On the source, unmapped bitmaps and all bitmaps
1121#                        on unmapped nodes will be ignored.  On the destination,
1122#                        encountering an unmapped alias in the incoming migration
1123#                        stream will result in a report, and all further bitmap
1124#                        migration data will then be discarded.
1125#                        Note that the destination does not know about bitmaps it
1126#                        does not receive, so there is no limitation or requirement
1127#                        regarding the number of bitmaps received, or how they are
1128#                        named, or on which nodes they are placed.
1129#                        By default (when this parameter has never been set), bitmap
1130#                        names are mapped to themselves.  Nodes are mapped to their
1131#                        block device name if there is one, and to their node name
1132#                        otherwise. (Since 5.2)
1133#
1134# Features:
1135# @unstable: Member @x-checkpoint-delay is experimental.
1136#
1137# Since: 2.4
1138##
1139{ 'struct': 'MigrationParameters',
1140  'data': { '*announce-initial': 'size',
1141            '*announce-max': 'size',
1142            '*announce-rounds': 'size',
1143            '*announce-step': 'size',
1144            '*compress-level': 'uint8',
1145            '*compress-threads': 'uint8',
1146            '*compress-wait-thread': 'bool',
1147            '*decompress-threads': 'uint8',
1148            '*throttle-trigger-threshold': 'uint8',
1149            '*cpu-throttle-initial': 'uint8',
1150            '*cpu-throttle-increment': 'uint8',
1151            '*cpu-throttle-tailslow': 'bool',
1152            '*tls-creds': 'str',
1153            '*tls-hostname': 'str',
1154            '*tls-authz': 'str',
1155            '*max-bandwidth': 'size',
1156            '*downtime-limit': 'uint64',
1157            '*x-checkpoint-delay': { 'type': 'uint32',
1158                                     'features': [ 'unstable' ] },
1159            '*block-incremental': 'bool',
1160            '*multifd-channels': 'uint8',
1161            '*xbzrle-cache-size': 'size',
1162            '*max-postcopy-bandwidth': 'size',
1163            '*max-cpu-throttle': 'uint8',
1164            '*multifd-compression': 'MultiFDCompression',
1165            '*multifd-zlib-level': 'uint8',
1166            '*multifd-zstd-level': 'uint8',
1167            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
1168
1169##
1170# @query-migrate-parameters:
1171#
1172# Returns information about the current migration parameters
1173#
1174# Returns: @MigrationParameters
1175#
1176# Since: 2.4
1177#
1178# Example:
1179#
1180# -> { "execute": "query-migrate-parameters" }
1181# <- { "return": {
1182#          "decompress-threads": 2,
1183#          "cpu-throttle-increment": 10,
1184#          "compress-threads": 8,
1185#          "compress-level": 1,
1186#          "cpu-throttle-initial": 20,
1187#          "max-bandwidth": 33554432,
1188#          "downtime-limit": 300
1189#       }
1190#    }
1191#
1192##
1193{ 'command': 'query-migrate-parameters',
1194  'returns': 'MigrationParameters' }
1195
1196##
1197# @client_migrate_info:
1198#
1199# Set migration information for remote display.  This makes the server
1200# ask the client to automatically reconnect using the new parameters
1201# once migration finished successfully.  Only implemented for SPICE.
1202#
1203# @protocol: must be "spice"
1204# @hostname: migration target hostname
1205# @port: spice tcp port for plaintext channels
1206# @tls-port: spice tcp port for tls-secured channels
1207# @cert-subject: server certificate subject
1208#
1209# Since: 0.14
1210#
1211# Example:
1212#
1213# -> { "execute": "client_migrate_info",
1214#      "arguments": { "protocol": "spice",
1215#                     "hostname": "virt42.lab.kraxel.org",
1216#                     "port": 1234 } }
1217# <- { "return": {} }
1218#
1219##
1220{ 'command': 'client_migrate_info',
1221  'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
1222            '*tls-port': 'int', '*cert-subject': 'str' } }
1223
1224##
1225# @migrate-start-postcopy:
1226#
1227# Followup to a migration command to switch the migration to postcopy mode.
1228# The postcopy-ram capability must be set on both source and destination
1229# before the original migration command.
1230#
1231# Since: 2.5
1232#
1233# Example:
1234#
1235# -> { "execute": "migrate-start-postcopy" }
1236# <- { "return": {} }
1237#
1238##
1239{ 'command': 'migrate-start-postcopy' }
1240
1241##
1242# @MIGRATION:
1243#
1244# Emitted when a migration event happens
1245#
1246# @status: @MigrationStatus describing the current migration status.
1247#
1248# Since: 2.4
1249#
1250# Example:
1251#
1252# <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1253#     "event": "MIGRATION",
1254#     "data": {"status": "completed"} }
1255#
1256##
1257{ 'event': 'MIGRATION',
1258  'data': {'status': 'MigrationStatus'}}
1259
1260##
1261# @MIGRATION_PASS:
1262#
1263# Emitted from the source side of a migration at the start of each pass
1264# (when it syncs the dirty bitmap)
1265#
1266# @pass: An incrementing count (starting at 1 on the first pass)
1267#
1268# Since: 2.6
1269#
1270# Example:
1271#
1272# { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1273#   "event": "MIGRATION_PASS", "data": {"pass": 2} }
1274#
1275##
1276{ 'event': 'MIGRATION_PASS',
1277  'data': { 'pass': 'int' } }
1278
1279##
1280# @COLOMessage:
1281#
1282# The message transmission between Primary side and Secondary side.
1283#
1284# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1285#
1286# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for checkpointing
1287#
1288# @checkpoint-reply: SVM gets PVM's checkpoint request
1289#
1290# @vmstate-send: VM's state will be sent by PVM.
1291#
1292# @vmstate-size: The total size of VMstate.
1293#
1294# @vmstate-received: VM's state has been received by SVM.
1295#
1296# @vmstate-loaded: VM's state has been loaded by SVM.
1297#
1298# Since: 2.8
1299##
1300{ 'enum': 'COLOMessage',
1301  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1302            'vmstate-send', 'vmstate-size', 'vmstate-received',
1303            'vmstate-loaded' ] }
1304
1305##
1306# @COLOMode:
1307#
1308# The COLO current mode.
1309#
1310# @none: COLO is disabled.
1311#
1312# @primary: COLO node in primary side.
1313#
1314# @secondary: COLO node in slave side.
1315#
1316# Since: 2.8
1317##
1318{ 'enum': 'COLOMode',
1319  'data': [ 'none', 'primary', 'secondary'] }
1320
1321##
1322# @FailoverStatus:
1323#
1324# An enumeration of COLO failover status
1325#
1326# @none: no failover has ever happened
1327#
1328# @require: got failover requirement but not handled
1329#
1330# @active: in the process of doing failover
1331#
1332# @completed: finish the process of failover
1333#
1334# @relaunch: restart the failover process, from 'none' -> 'completed' (Since 2.9)
1335#
1336# Since: 2.8
1337##
1338{ 'enum': 'FailoverStatus',
1339  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1340
1341##
1342# @COLO_EXIT:
1343#
1344# Emitted when VM finishes COLO mode due to some errors happening or
1345# at the request of users.
1346#
1347# @mode: report COLO mode when COLO exited.
1348#
1349# @reason: describes the reason for the COLO exit.
1350#
1351# Since: 3.1
1352#
1353# Example:
1354#
1355# <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1356#      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1357#
1358##
1359{ 'event': 'COLO_EXIT',
1360  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1361
1362##
1363# @COLOExitReason:
1364#
1365# The reason for a COLO exit.
1366#
1367# @none: failover has never happened. This state does not occur
1368#        in the COLO_EXIT event, and is only visible in the result of
1369#        query-colo-status.
1370#
1371# @request: COLO exit is due to an external request.
1372#
1373# @error: COLO exit is due to an internal error.
1374#
1375# @processing: COLO is currently handling a failover (since 4.0).
1376#
1377# Since: 3.1
1378##
1379{ 'enum': 'COLOExitReason',
1380  'data': [ 'none', 'request', 'error' , 'processing' ] }
1381
1382##
1383# @x-colo-lost-heartbeat:
1384#
1385# Tell qemu that heartbeat is lost, request it to do takeover procedures.
1386# If this command is sent to the PVM, the Primary side will exit COLO mode.
1387# If sent to the Secondary, the Secondary side will run failover work,
1388# then takes over server operation to become the service VM.
1389#
1390# Features:
1391# @unstable: This command is experimental.
1392#
1393# Since: 2.8
1394#
1395# Example:
1396#
1397# -> { "execute": "x-colo-lost-heartbeat" }
1398# <- { "return": {} }
1399#
1400##
1401{ 'command': 'x-colo-lost-heartbeat',
1402  'features': [ 'unstable' ] }
1403
1404##
1405# @migrate_cancel:
1406#
1407# Cancel the current executing migration process.
1408#
1409# Returns: nothing on success
1410#
1411# Notes: This command succeeds even if there is no migration process running.
1412#
1413# Since: 0.14
1414#
1415# Example:
1416#
1417# -> { "execute": "migrate_cancel" }
1418# <- { "return": {} }
1419#
1420##
1421{ 'command': 'migrate_cancel' }
1422
1423##
1424# @migrate-continue:
1425#
1426# Continue migration when it's in a paused state.
1427#
1428# @state: The state the migration is currently expected to be in
1429#
1430# Returns: nothing on success
1431#
1432# Since: 2.11
1433#
1434# Example:
1435#
1436# -> { "execute": "migrate-continue" , "arguments":
1437#      { "state": "pre-switchover" } }
1438# <- { "return": {} }
1439##
1440{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1441
1442##
1443# @migrate:
1444#
1445# Migrates the current running guest to another Virtual Machine.
1446#
1447# @uri: the Uniform Resource Identifier of the destination VM
1448#
1449# @blk: do block migration (full disk copy)
1450#
1451# @inc: incremental disk copy migration
1452#
1453# @detach: this argument exists only for compatibility reasons and
1454#          is ignored by QEMU
1455#
1456# @resume: resume one paused migration, default "off". (since 3.0)
1457#
1458# Returns: nothing on success
1459#
1460# Since: 0.14
1461#
1462# Notes:
1463#
1464# 1. The 'query-migrate' command should be used to check migration's progress
1465#    and final result (this information is provided by the 'status' member)
1466#
1467# 2. All boolean arguments default to false
1468#
1469# 3. The user Monitor's "detach" argument is invalid in QMP and should not
1470#    be used
1471#
1472# Example:
1473#
1474# -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1475# <- { "return": {} }
1476#
1477##
1478{ 'command': 'migrate',
1479  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
1480           '*detach': 'bool', '*resume': 'bool' } }
1481
1482##
1483# @migrate-incoming:
1484#
1485# Start an incoming migration, the qemu must have been started
1486# with -incoming defer
1487#
1488# @uri: The Uniform Resource Identifier identifying the source or
1489#       address to listen on
1490#
1491# Returns: nothing on success
1492#
1493# Since: 2.3
1494#
1495# Notes:
1496#
1497# 1. It's a bad idea to use a string for the uri, but it needs to stay
1498#    compatible with -incoming and the format of the uri is already exposed
1499#    above libvirt.
1500#
1501# 2. QEMU must be started with -incoming defer to allow migrate-incoming to
1502#    be used.
1503#
1504# 3. The uri format is the same as for -incoming
1505#
1506# Example:
1507#
1508# -> { "execute": "migrate-incoming",
1509#      "arguments": { "uri": "tcp::4446" } }
1510# <- { "return": {} }
1511#
1512##
1513{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
1514
1515##
1516# @xen-save-devices-state:
1517#
1518# Save the state of all devices to file. The RAM and the block devices
1519# of the VM are not saved by this command.
1520#
1521# @filename: the file to save the state of the devices to as binary
1522#            data. See xen-save-devices-state.txt for a description of the binary
1523#            format.
1524#
1525# @live: Optional argument to ask QEMU to treat this command as part of a live
1526#        migration. Default to true. (since 2.11)
1527#
1528# Returns: Nothing on success
1529#
1530# Since: 1.1
1531#
1532# Example:
1533#
1534# -> { "execute": "xen-save-devices-state",
1535#      "arguments": { "filename": "/tmp/save" } }
1536# <- { "return": {} }
1537#
1538##
1539{ 'command': 'xen-save-devices-state',
1540  'data': {'filename': 'str', '*live':'bool' } }
1541
1542##
1543# @xen-set-global-dirty-log:
1544#
1545# Enable or disable the global dirty log mode.
1546#
1547# @enable: true to enable, false to disable.
1548#
1549# Returns: nothing
1550#
1551# Since: 1.3
1552#
1553# Example:
1554#
1555# -> { "execute": "xen-set-global-dirty-log",
1556#      "arguments": { "enable": true } }
1557# <- { "return": {} }
1558#
1559##
1560{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1561
1562##
1563# @xen-load-devices-state:
1564#
1565# Load the state of all devices from file. The RAM and the block devices
1566# of the VM are not loaded by this command.
1567#
1568# @filename: the file to load the state of the devices from as binary
1569#            data. See xen-save-devices-state.txt for a description of the binary
1570#            format.
1571#
1572# Since: 2.7
1573#
1574# Example:
1575#
1576# -> { "execute": "xen-load-devices-state",
1577#      "arguments": { "filename": "/tmp/resume" } }
1578# <- { "return": {} }
1579#
1580##
1581{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1582
1583##
1584# @xen-set-replication:
1585#
1586# Enable or disable replication.
1587#
1588# @enable: true to enable, false to disable.
1589#
1590# @primary: true for primary or false for secondary.
1591#
1592# @failover: true to do failover, false to stop. but cannot be
1593#            specified if 'enable' is true. default value is false.
1594#
1595# Returns: nothing.
1596#
1597# Example:
1598#
1599# -> { "execute": "xen-set-replication",
1600#      "arguments": {"enable": true, "primary": false} }
1601# <- { "return": {} }
1602#
1603# Since: 2.9
1604##
1605{ 'command': 'xen-set-replication',
1606  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
1607  'if': 'CONFIG_REPLICATION' }
1608
1609##
1610# @ReplicationStatus:
1611#
1612# The result format for 'query-xen-replication-status'.
1613#
1614# @error: true if an error happened, false if replication is normal.
1615#
1616# @desc: the human readable error description string, when
1617#        @error is 'true'.
1618#
1619# Since: 2.9
1620##
1621{ 'struct': 'ReplicationStatus',
1622  'data': { 'error': 'bool', '*desc': 'str' },
1623  'if': 'CONFIG_REPLICATION' }
1624
1625##
1626# @query-xen-replication-status:
1627#
1628# Query replication status while the vm is running.
1629#
1630# Returns: A @ReplicationStatus object showing the status.
1631#
1632# Example:
1633#
1634# -> { "execute": "query-xen-replication-status" }
1635# <- { "return": { "error": false } }
1636#
1637# Since: 2.9
1638##
1639{ 'command': 'query-xen-replication-status',
1640  'returns': 'ReplicationStatus',
1641  'if': 'CONFIG_REPLICATION' }
1642
1643##
1644# @xen-colo-do-checkpoint:
1645#
1646# Xen uses this command to notify replication to trigger a checkpoint.
1647#
1648# Returns: nothing.
1649#
1650# Example:
1651#
1652# -> { "execute": "xen-colo-do-checkpoint" }
1653# <- { "return": {} }
1654#
1655# Since: 2.9
1656##
1657{ 'command': 'xen-colo-do-checkpoint',
1658  'if': 'CONFIG_REPLICATION' }
1659
1660##
1661# @COLOStatus:
1662#
1663# The result format for 'query-colo-status'.
1664#
1665# @mode: COLO running mode. If COLO is running, this field will return
1666#        'primary' or 'secondary'.
1667#
1668# @last-mode: COLO last running mode. If COLO is running, this field
1669#             will return same like mode field, after failover we can
1670#             use this field to get last colo mode. (since 4.0)
1671#
1672# @reason: describes the reason for the COLO exit.
1673#
1674# Since: 3.1
1675##
1676{ 'struct': 'COLOStatus',
1677  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1678            'reason': 'COLOExitReason' } }
1679
1680##
1681# @query-colo-status:
1682#
1683# Query COLO status while the vm is running.
1684#
1685# Returns: A @COLOStatus object showing the status.
1686#
1687# Example:
1688#
1689# -> { "execute": "query-colo-status" }
1690# <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
1691#
1692# Since: 3.1
1693##
1694{ 'command': 'query-colo-status',
1695  'returns': 'COLOStatus' }
1696
1697##
1698# @migrate-recover:
1699#
1700# Provide a recovery migration stream URI.
1701#
1702# @uri: the URI to be used for the recovery of migration stream.
1703#
1704# Returns: nothing.
1705#
1706# Example:
1707#
1708# -> { "execute": "migrate-recover",
1709#      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1710# <- { "return": {} }
1711#
1712# Since: 3.0
1713##
1714{ 'command': 'migrate-recover',
1715  'data': { 'uri': 'str' },
1716  'allow-oob': true }
1717
1718##
1719# @migrate-pause:
1720#
1721# Pause a migration.  Currently it only supports postcopy.
1722#
1723# Returns: nothing.
1724#
1725# Example:
1726#
1727# -> { "execute": "migrate-pause" }
1728# <- { "return": {} }
1729#
1730# Since: 3.0
1731##
1732{ 'command': 'migrate-pause', 'allow-oob': true }
1733
1734##
1735# @UNPLUG_PRIMARY:
1736#
1737# Emitted from source side of a migration when migration state is
1738# WAIT_UNPLUG. Device was unplugged by guest operating system.
1739# Device resources in QEMU are kept on standby to be able to re-plug it in case
1740# of migration failure.
1741#
1742# @device-id: QEMU device id of the unplugged device
1743#
1744# Since: 4.2
1745#
1746# Example:
1747#
1748# <- { "event": "UNPLUG_PRIMARY",
1749#      "data": { "device-id": "hostdev0" },
1750#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
1751#
1752##
1753{ 'event': 'UNPLUG_PRIMARY',
1754  'data': { 'device-id': 'str' } }
1755
1756##
1757# @DirtyRateVcpu:
1758#
1759# Dirty rate of vcpu.
1760#
1761# @id: vcpu index.
1762#
1763# @dirty-rate: dirty rate.
1764#
1765# Since: 6.2
1766##
1767{ 'struct': 'DirtyRateVcpu',
1768  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
1769
1770##
1771# @DirtyRateStatus:
1772#
1773# An enumeration of dirtyrate status.
1774#
1775# @unstarted: the dirtyrate thread has not been started.
1776#
1777# @measuring: the dirtyrate thread is measuring.
1778#
1779# @measured: the dirtyrate thread has measured and results are available.
1780#
1781# Since: 5.2
1782##
1783{ 'enum': 'DirtyRateStatus',
1784  'data': [ 'unstarted', 'measuring', 'measured'] }
1785
1786##
1787# @DirtyRateMeasureMode:
1788#
1789# An enumeration of mode of measuring dirtyrate.
1790#
1791# @page-sampling: calculate dirtyrate by sampling pages.
1792#
1793# @dirty-ring: calculate dirtyrate by dirty ring.
1794#
1795# @dirty-bitmap: calculate dirtyrate by dirty bitmap.
1796#
1797# Since: 6.2
1798##
1799{ 'enum': 'DirtyRateMeasureMode',
1800  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
1801
1802##
1803# @DirtyRateInfo:
1804#
1805# Information about current dirty page rate of vm.
1806#
1807# @dirty-rate: an estimate of the dirty page rate of the VM in units of
1808#              MB/s, present only when estimating the rate has completed.
1809#
1810# @status: status containing dirtyrate query status includes
1811#          'unstarted' or 'measuring' or 'measured'
1812#
1813# @start-time: start time in units of second for calculation
1814#
1815# @calc-time: time in units of second for sample dirty pages
1816#
1817# @sample-pages: page count per GB for sample dirty pages
1818#                the default value is 512 (since 6.1)
1819#
1820# @mode: mode containing method of calculate dirtyrate includes
1821#        'page-sampling' and 'dirty-ring' (Since 6.2)
1822#
1823# @vcpu-dirty-rate: dirtyrate for each vcpu if dirty-ring
1824#                   mode specified (Since 6.2)
1825#
1826# Since: 5.2
1827##
1828{ 'struct': 'DirtyRateInfo',
1829  'data': {'*dirty-rate': 'int64',
1830           'status': 'DirtyRateStatus',
1831           'start-time': 'int64',
1832           'calc-time': 'int64',
1833           'sample-pages': 'uint64',
1834           'mode': 'DirtyRateMeasureMode',
1835           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
1836
1837##
1838# @calc-dirty-rate:
1839#
1840# start calculating dirty page rate for vm
1841#
1842# @calc-time: time in units of second for sample dirty pages
1843#
1844# @sample-pages: page count per GB for sample dirty pages
1845#                the default value is 512 (since 6.1)
1846#
1847# @mode: mechanism of calculating dirtyrate includes
1848#        'page-sampling' and 'dirty-ring' (Since 6.1)
1849#
1850# Since: 5.2
1851#
1852# Example:
1853#
1854#   {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
1855#                                                'sample-pages': 512} }
1856#
1857##
1858{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
1859                                         '*sample-pages': 'int',
1860                                         '*mode': 'DirtyRateMeasureMode'} }
1861
1862##
1863# @query-dirty-rate:
1864#
1865# query dirty page rate in units of MB/s for vm
1866#
1867# Since: 5.2
1868##
1869{ 'command': 'query-dirty-rate', 'returns': 'DirtyRateInfo' }
1870
1871##
1872# @snapshot-save:
1873#
1874# Save a VM snapshot
1875#
1876# @job-id: identifier for the newly created job
1877# @tag: name of the snapshot to create
1878# @vmstate: block device node name to save vmstate to
1879# @devices: list of block device node names to save a snapshot to
1880#
1881# Applications should not assume that the snapshot save is complete
1882# when this command returns. The job commands / events must be used
1883# to determine completion and to fetch details of any errors that arise.
1884#
1885# Note that execution of the guest CPUs may be stopped during the
1886# time it takes to save the snapshot. A future version of QEMU
1887# may ensure CPUs are executing continuously.
1888#
1889# It is strongly recommended that @devices contain all writable
1890# block device nodes if a consistent snapshot is required.
1891#
1892# If @tag already exists, an error will be reported
1893#
1894# Returns: nothing
1895#
1896# Example:
1897#
1898# -> { "execute": "snapshot-save",
1899#      "arguments": {
1900#         "job-id": "snapsave0",
1901#         "tag": "my-snap",
1902#         "vmstate": "disk0",
1903#         "devices": ["disk0", "disk1"]
1904#      }
1905#    }
1906# <- { "return": { } }
1907# <- {"event": "JOB_STATUS_CHANGE",
1908#     "data": {"status": "created", "id": "snapsave0"}}
1909# <- {"event": "JOB_STATUS_CHANGE",
1910#     "data": {"status": "running", "id": "snapsave0"}}
1911# <- {"event": "STOP"}
1912# <- {"event": "RESUME"}
1913# <- {"event": "JOB_STATUS_CHANGE",
1914#     "data": {"status": "waiting", "id": "snapsave0"}}
1915# <- {"event": "JOB_STATUS_CHANGE",
1916#     "data": {"status": "pending", "id": "snapsave0"}}
1917# <- {"event": "JOB_STATUS_CHANGE",
1918#     "data": {"status": "concluded", "id": "snapsave0"}}
1919# -> {"execute": "query-jobs"}
1920# <- {"return": [{"current-progress": 1,
1921#                 "status": "concluded",
1922#                 "total-progress": 1,
1923#                 "type": "snapshot-save",
1924#                 "id": "snapsave0"}]}
1925#
1926# Since: 6.0
1927##
1928{ 'command': 'snapshot-save',
1929  'data': { 'job-id': 'str',
1930            'tag': 'str',
1931            'vmstate': 'str',
1932            'devices': ['str'] } }
1933
1934##
1935# @snapshot-load:
1936#
1937# Load a VM snapshot
1938#
1939# @job-id: identifier for the newly created job
1940# @tag: name of the snapshot to load.
1941# @vmstate: block device node name to load vmstate from
1942# @devices: list of block device node names to load a snapshot from
1943#
1944# Applications should not assume that the snapshot load is complete
1945# when this command returns. The job commands / events must be used
1946# to determine completion and to fetch details of any errors that arise.
1947#
1948# Note that execution of the guest CPUs will be stopped during the
1949# time it takes to load the snapshot.
1950#
1951# It is strongly recommended that @devices contain all writable
1952# block device nodes that can have changed since the original
1953# @snapshot-save command execution.
1954#
1955# Returns: nothing
1956#
1957# Example:
1958#
1959# -> { "execute": "snapshot-load",
1960#      "arguments": {
1961#         "job-id": "snapload0",
1962#         "tag": "my-snap",
1963#         "vmstate": "disk0",
1964#         "devices": ["disk0", "disk1"]
1965#      }
1966#    }
1967# <- { "return": { } }
1968# <- {"event": "JOB_STATUS_CHANGE",
1969#     "data": {"status": "created", "id": "snapload0"}}
1970# <- {"event": "JOB_STATUS_CHANGE",
1971#     "data": {"status": "running", "id": "snapload0"}}
1972# <- {"event": "STOP"}
1973# <- {"event": "RESUME"}
1974# <- {"event": "JOB_STATUS_CHANGE",
1975#     "data": {"status": "waiting", "id": "snapload0"}}
1976# <- {"event": "JOB_STATUS_CHANGE",
1977#     "data": {"status": "pending", "id": "snapload0"}}
1978# <- {"event": "JOB_STATUS_CHANGE",
1979#     "data": {"status": "concluded", "id": "snapload0"}}
1980# -> {"execute": "query-jobs"}
1981# <- {"return": [{"current-progress": 1,
1982#                 "status": "concluded",
1983#                 "total-progress": 1,
1984#                 "type": "snapshot-load",
1985#                 "id": "snapload0"}]}
1986#
1987# Since: 6.0
1988##
1989{ 'command': 'snapshot-load',
1990  'data': { 'job-id': 'str',
1991            'tag': 'str',
1992            'vmstate': 'str',
1993            'devices': ['str'] } }
1994
1995##
1996# @snapshot-delete:
1997#
1998# Delete a VM snapshot
1999#
2000# @job-id: identifier for the newly created job
2001# @tag: name of the snapshot to delete.
2002# @devices: list of block device node names to delete a snapshot from
2003#
2004# Applications should not assume that the snapshot delete is complete
2005# when this command returns. The job commands / events must be used
2006# to determine completion and to fetch details of any errors that arise.
2007#
2008# Returns: nothing
2009#
2010# Example:
2011#
2012# -> { "execute": "snapshot-delete",
2013#      "arguments": {
2014#         "job-id": "snapdelete0",
2015#         "tag": "my-snap",
2016#         "devices": ["disk0", "disk1"]
2017#      }
2018#    }
2019# <- { "return": { } }
2020# <- {"event": "JOB_STATUS_CHANGE",
2021#     "data": {"status": "created", "id": "snapdelete0"}}
2022# <- {"event": "JOB_STATUS_CHANGE",
2023#     "data": {"status": "running", "id": "snapdelete0"}}
2024# <- {"event": "JOB_STATUS_CHANGE",
2025#     "data": {"status": "waiting", "id": "snapdelete0"}}
2026# <- {"event": "JOB_STATUS_CHANGE",
2027#     "data": {"status": "pending", "id": "snapdelete0"}}
2028# <- {"event": "JOB_STATUS_CHANGE",
2029#     "data": {"status": "concluded", "id": "snapdelete0"}}
2030# -> {"execute": "query-jobs"}
2031# <- {"return": [{"current-progress": 1,
2032#                 "status": "concluded",
2033#                 "total-progress": 1,
2034#                 "type": "snapshot-delete",
2035#                 "id": "snapdelete0"}]}
2036#
2037# Since: 6.0
2038##
2039{ 'command': 'snapshot-delete',
2040  'data': { 'job-id': 'str',
2041            'tag': 'str',
2042            'devices': ['str'] } }
2043