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