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