xref: /openbmc/qemu/qapi/migration.json (revision 0694dabe)
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_set_downtime:
1403#
1404# Set maximum tolerated downtime for migration.
1405#
1406# @value: maximum downtime in seconds
1407#
1408# Features:
1409# @deprecated: This command is deprecated.  Use
1410#              'migrate-set-parameters' instead.
1411#
1412# Returns: nothing on success
1413#
1414# Since: 0.14
1415#
1416# Example:
1417#
1418# -> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
1419# <- { "return": {} }
1420#
1421##
1422{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'},
1423  'features': [ 'deprecated' ] }
1424
1425##
1426# @migrate_set_speed:
1427#
1428# Set maximum speed for migration.
1429#
1430# @value: maximum speed in bytes per second.
1431#
1432# Features:
1433# @deprecated: This command is deprecated.  Use
1434#              'migrate-set-parameters' instead.
1435#
1436# Returns: nothing on success
1437#
1438# Since: 0.14
1439#
1440# Example:
1441#
1442# -> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
1443# <- { "return": {} }
1444#
1445##
1446{ 'command': 'migrate_set_speed', 'data': {'value': 'int'},
1447  'features': [ 'deprecated' ] }
1448
1449##
1450# @migrate-set-cache-size:
1451#
1452# Set cache size to be used by XBZRLE migration
1453#
1454# @value: cache size in bytes
1455#
1456# Features:
1457# @deprecated: This command is deprecated.  Use
1458#              'migrate-set-parameters' instead.
1459#
1460# The size will be rounded down to the nearest power of 2.
1461# The cache size can be modified before and during ongoing migration
1462#
1463# Returns: nothing on success
1464#
1465# Since: 1.2
1466#
1467# Example:
1468#
1469# -> { "execute": "migrate-set-cache-size",
1470#      "arguments": { "value": 536870912 } }
1471# <- { "return": {} }
1472#
1473##
1474{ 'command': 'migrate-set-cache-size', 'data': {'value': 'int'},
1475  'features': [ 'deprecated' ] }
1476
1477##
1478# @query-migrate-cache-size:
1479#
1480# Query migration XBZRLE cache size
1481#
1482# Features:
1483# @deprecated: This command is deprecated.  Use
1484#              'query-migrate-parameters' instead.
1485#
1486# Returns: XBZRLE cache size in bytes
1487#
1488# Since: 1.2
1489#
1490# Example:
1491#
1492# -> { "execute": "query-migrate-cache-size" }
1493# <- { "return": 67108864 }
1494#
1495##
1496{ 'command': 'query-migrate-cache-size', 'returns': 'size',
1497  'features': [ 'deprecated' ] }
1498
1499##
1500# @migrate:
1501#
1502# Migrates the current running guest to another Virtual Machine.
1503#
1504# @uri: the Uniform Resource Identifier of the destination VM
1505#
1506# @blk: do block migration (full disk copy)
1507#
1508# @inc: incremental disk copy migration
1509#
1510# @detach: this argument exists only for compatibility reasons and
1511#          is ignored by QEMU
1512#
1513# @resume: resume one paused migration, default "off". (since 3.0)
1514#
1515# Returns: nothing on success
1516#
1517# Since: 0.14
1518#
1519# Notes:
1520#
1521# 1. The 'query-migrate' command should be used to check migration's progress
1522#    and final result (this information is provided by the 'status' member)
1523#
1524# 2. All boolean arguments default to false
1525#
1526# 3. The user Monitor's "detach" argument is invalid in QMP and should not
1527#    be used
1528#
1529# Example:
1530#
1531# -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1532# <- { "return": {} }
1533#
1534##
1535{ 'command': 'migrate',
1536  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
1537           '*detach': 'bool', '*resume': 'bool' } }
1538
1539##
1540# @migrate-incoming:
1541#
1542# Start an incoming migration, the qemu must have been started
1543# with -incoming defer
1544#
1545# @uri: The Uniform Resource Identifier identifying the source or
1546#       address to listen on
1547#
1548# Returns: nothing on success
1549#
1550# Since: 2.3
1551#
1552# Notes:
1553#
1554# 1. It's a bad idea to use a string for the uri, but it needs to stay
1555#    compatible with -incoming and the format of the uri is already exposed
1556#    above libvirt.
1557#
1558# 2. QEMU must be started with -incoming defer to allow migrate-incoming to
1559#    be used.
1560#
1561# 3. The uri format is the same as for -incoming
1562#
1563# Example:
1564#
1565# -> { "execute": "migrate-incoming",
1566#      "arguments": { "uri": "tcp::4446" } }
1567# <- { "return": {} }
1568#
1569##
1570{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
1571
1572##
1573# @xen-save-devices-state:
1574#
1575# Save the state of all devices to file. The RAM and the block devices
1576# of the VM are not saved by this command.
1577#
1578# @filename: the file to save the state of the devices to as binary
1579#            data. See xen-save-devices-state.txt for a description of the binary
1580#            format.
1581#
1582# @live: Optional argument to ask QEMU to treat this command as part of a live
1583#        migration. Default to true. (since 2.11)
1584#
1585# Returns: Nothing on success
1586#
1587# Since: 1.1
1588#
1589# Example:
1590#
1591# -> { "execute": "xen-save-devices-state",
1592#      "arguments": { "filename": "/tmp/save" } }
1593# <- { "return": {} }
1594#
1595##
1596{ 'command': 'xen-save-devices-state',
1597  'data': {'filename': 'str', '*live':'bool' } }
1598
1599##
1600# @xen-set-global-dirty-log:
1601#
1602# Enable or disable the global dirty log mode.
1603#
1604# @enable: true to enable, false to disable.
1605#
1606# Returns: nothing
1607#
1608# Since: 1.3
1609#
1610# Example:
1611#
1612# -> { "execute": "xen-set-global-dirty-log",
1613#      "arguments": { "enable": true } }
1614# <- { "return": {} }
1615#
1616##
1617{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1618
1619##
1620# @xen-load-devices-state:
1621#
1622# Load the state of all devices from file. The RAM and the block devices
1623# of the VM are not loaded by this command.
1624#
1625# @filename: the file to load the state of the devices from as binary
1626#            data. See xen-save-devices-state.txt for a description of the binary
1627#            format.
1628#
1629# Since: 2.7
1630#
1631# Example:
1632#
1633# -> { "execute": "xen-load-devices-state",
1634#      "arguments": { "filename": "/tmp/resume" } }
1635# <- { "return": {} }
1636#
1637##
1638{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1639
1640##
1641# @xen-set-replication:
1642#
1643# Enable or disable replication.
1644#
1645# @enable: true to enable, false to disable.
1646#
1647# @primary: true for primary or false for secondary.
1648#
1649# @failover: true to do failover, false to stop. but cannot be
1650#            specified if 'enable' is true. default value is false.
1651#
1652# Returns: nothing.
1653#
1654# Example:
1655#
1656# -> { "execute": "xen-set-replication",
1657#      "arguments": {"enable": true, "primary": false} }
1658# <- { "return": {} }
1659#
1660# Since: 2.9
1661##
1662{ 'command': 'xen-set-replication',
1663  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
1664  'if': 'defined(CONFIG_REPLICATION)' }
1665
1666##
1667# @ReplicationStatus:
1668#
1669# The result format for 'query-xen-replication-status'.
1670#
1671# @error: true if an error happened, false if replication is normal.
1672#
1673# @desc: the human readable error description string, when
1674#        @error is 'true'.
1675#
1676# Since: 2.9
1677##
1678{ 'struct': 'ReplicationStatus',
1679  'data': { 'error': 'bool', '*desc': 'str' },
1680  'if': 'defined(CONFIG_REPLICATION)' }
1681
1682##
1683# @query-xen-replication-status:
1684#
1685# Query replication status while the vm is running.
1686#
1687# Returns: A @ReplicationResult object showing the status.
1688#
1689# Example:
1690#
1691# -> { "execute": "query-xen-replication-status" }
1692# <- { "return": { "error": false } }
1693#
1694# Since: 2.9
1695##
1696{ 'command': 'query-xen-replication-status',
1697  'returns': 'ReplicationStatus',
1698  'if': 'defined(CONFIG_REPLICATION)' }
1699
1700##
1701# @xen-colo-do-checkpoint:
1702#
1703# Xen uses this command to notify replication to trigger a checkpoint.
1704#
1705# Returns: nothing.
1706#
1707# Example:
1708#
1709# -> { "execute": "xen-colo-do-checkpoint" }
1710# <- { "return": {} }
1711#
1712# Since: 2.9
1713##
1714{ 'command': 'xen-colo-do-checkpoint',
1715  'if': 'defined(CONFIG_REPLICATION)' }
1716
1717##
1718# @COLOStatus:
1719#
1720# The result format for 'query-colo-status'.
1721#
1722# @mode: COLO running mode. If COLO is running, this field will return
1723#        'primary' or 'secondary'.
1724#
1725# @last-mode: COLO last running mode. If COLO is running, this field
1726#             will return same like mode field, after failover we can
1727#             use this field to get last colo mode. (since 4.0)
1728#
1729# @reason: describes the reason for the COLO exit.
1730#
1731# Since: 3.1
1732##
1733{ 'struct': 'COLOStatus',
1734  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1735            'reason': 'COLOExitReason' } }
1736
1737##
1738# @query-colo-status:
1739#
1740# Query COLO status while the vm is running.
1741#
1742# Returns: A @COLOStatus object showing the status.
1743#
1744# Example:
1745#
1746# -> { "execute": "query-colo-status" }
1747# <- { "return": { "mode": "primary", "reason": "request" } }
1748#
1749# Since: 3.1
1750##
1751{ 'command': 'query-colo-status',
1752  'returns': 'COLOStatus' }
1753
1754##
1755# @migrate-recover:
1756#
1757# Provide a recovery migration stream URI.
1758#
1759# @uri: the URI to be used for the recovery of migration stream.
1760#
1761# Returns: nothing.
1762#
1763# Example:
1764#
1765# -> { "execute": "migrate-recover",
1766#      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1767# <- { "return": {} }
1768#
1769# Since: 3.0
1770##
1771{ 'command': 'migrate-recover',
1772  'data': { 'uri': 'str' },
1773  'allow-oob': true }
1774
1775##
1776# @migrate-pause:
1777#
1778# Pause a migration.  Currently it only supports postcopy.
1779#
1780# Returns: nothing.
1781#
1782# Example:
1783#
1784# -> { "execute": "migrate-pause" }
1785# <- { "return": {} }
1786#
1787# Since: 3.0
1788##
1789{ 'command': 'migrate-pause', 'allow-oob': true }
1790
1791##
1792# @UNPLUG_PRIMARY:
1793#
1794# Emitted from source side of a migration when migration state is
1795# WAIT_UNPLUG. Device was unplugged by guest operating system.
1796# Device resources in QEMU are kept on standby to be able to re-plug it in case
1797# of migration failure.
1798#
1799# @device-id: QEMU device id of the unplugged device
1800#
1801# Since: 4.2
1802#
1803# Example:
1804#   {"event": "UNPLUG_PRIMARY", "data": {"device-id": "hostdev0"} }
1805#
1806##
1807{ 'event': 'UNPLUG_PRIMARY',
1808  'data': { 'device-id': 'str' } }
1809
1810##
1811# @DirtyRateStatus:
1812#
1813# An enumeration of dirtyrate status.
1814#
1815# @unstarted: the dirtyrate thread has not been started.
1816#
1817# @measuring: the dirtyrate thread is measuring.
1818#
1819# @measured: the dirtyrate thread has measured and results are available.
1820#
1821# Since: 5.2
1822#
1823##
1824{ 'enum': 'DirtyRateStatus',
1825  'data': [ 'unstarted', 'measuring', 'measured'] }
1826
1827##
1828# @DirtyRateInfo:
1829#
1830# Information about current dirty page rate of vm.
1831#
1832# @dirty-rate: an estimate of the dirty page rate of the VM in units of
1833#              MB/s, present only when estimating the rate has completed.
1834#
1835# @status: status containing dirtyrate query status includes
1836#          'unstarted' or 'measuring' or 'measured'
1837#
1838# @start-time: start time in units of second for calculation
1839#
1840# @calc-time: time in units of second for sample dirty pages
1841#
1842# Since: 5.2
1843#
1844##
1845{ 'struct': 'DirtyRateInfo',
1846  'data': {'*dirty-rate': 'int64',
1847           'status': 'DirtyRateStatus',
1848           'start-time': 'int64',
1849           'calc-time': 'int64'} }
1850
1851##
1852# @calc-dirty-rate:
1853#
1854# start calculating dirty page rate for vm
1855#
1856# @calc-time: time in units of second for sample dirty pages
1857#
1858# Since: 5.2
1859#
1860# Example:
1861#   {"command": "calc-dirty-rate", "data": {"calc-time": 1} }
1862#
1863##
1864{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64'} }
1865
1866##
1867# @query-dirty-rate:
1868#
1869# query dirty page rate in units of MB/s for vm
1870#
1871# Since: 5.2
1872##
1873{ 'command': 'query-dirty-rate', 'returns': 'DirtyRateInfo' }
1874
1875##
1876# @snapshot-save:
1877#
1878# Save a VM snapshot
1879#
1880# @job-id: identifier for the newly created job
1881# @tag: name of the snapshot to create
1882# @vmstate: block device node name to save vmstate to
1883# @devices: list of block device node names to save a snapshot to
1884#
1885# Applications should not assume that the snapshot save is complete
1886# when this command returns. The job commands / events must be used
1887# to determine completion and to fetch details of any errors that arise.
1888#
1889# Note that execution of the guest CPUs may be stopped during the
1890# time it takes to save the snapshot. A future version of QEMU
1891# may ensure CPUs are executing continuously.
1892#
1893# It is strongly recommended that @devices contain all writable
1894# block device nodes if a consistent snapshot is required.
1895#
1896# If @tag already exists, an error will be reported
1897#
1898# Returns: nothing
1899#
1900# Example:
1901#
1902# -> { "execute": "snapshot-save",
1903#      "data": {
1904#         "job-id": "snapsave0",
1905#         "tag": "my-snap",
1906#         "vmstate": "disk0",
1907#         "devices": ["disk0", "disk1"]
1908#      }
1909#    }
1910# <- { "return": { } }
1911# <- {"event": "JOB_STATUS_CHANGE",
1912#     "data": {"status": "created", "id": "snapsave0"}}
1913# <- {"event": "JOB_STATUS_CHANGE",
1914#     "data": {"status": "running", "id": "snapsave0"}}
1915# <- {"event": "STOP"}
1916# <- {"event": "RESUME"}
1917# <- {"event": "JOB_STATUS_CHANGE",
1918#     "data": {"status": "waiting", "id": "snapsave0"}}
1919# <- {"event": "JOB_STATUS_CHANGE",
1920#     "data": {"status": "pending", "id": "snapsave0"}}
1921# <- {"event": "JOB_STATUS_CHANGE",
1922#     "data": {"status": "concluded", "id": "snapsave0"}}
1923# -> {"execute": "query-jobs"}
1924# <- {"return": [{"current-progress": 1,
1925#                 "status": "concluded",
1926#                 "total-progress": 1,
1927#                 "type": "snapshot-save",
1928#                 "id": "snapsave0"}]}
1929#
1930# Since: 6.0
1931##
1932{ 'command': 'snapshot-save',
1933  'data': { 'job-id': 'str',
1934            'tag': 'str',
1935            'vmstate': 'str',
1936            'devices': ['str'] } }
1937
1938##
1939# @snapshot-load:
1940#
1941# Load a VM snapshot
1942#
1943# @job-id: identifier for the newly created job
1944# @tag: name of the snapshot to load.
1945# @vmstate: block device node name to load vmstate from
1946# @devices: list of block device node names to load a snapshot from
1947#
1948# Applications should not assume that the snapshot load is complete
1949# when this command returns. The job commands / events must be used
1950# to determine completion and to fetch details of any errors that arise.
1951#
1952# Note that execution of the guest CPUs will be stopped during the
1953# time it takes to load the snapshot.
1954#
1955# It is strongly recommended that @devices contain all writable
1956# block device nodes that can have changed since the original
1957# @snapshot-save command execution.
1958#
1959# Returns: nothing
1960#
1961# Example:
1962#
1963# -> { "execute": "snapshot-load",
1964#      "data": {
1965#         "job-id": "snapload0",
1966#         "tag": "my-snap",
1967#         "vmstate": "disk0",
1968#         "devices": ["disk0", "disk1"]
1969#      }
1970#    }
1971# <- { "return": { } }
1972# <- {"event": "JOB_STATUS_CHANGE",
1973#     "data": {"status": "created", "id": "snapload0"}}
1974# <- {"event": "JOB_STATUS_CHANGE",
1975#     "data": {"status": "running", "id": "snapload0"}}
1976# <- {"event": "STOP"}
1977# <- {"event": "RESUME"}
1978# <- {"event": "JOB_STATUS_CHANGE",
1979#     "data": {"status": "waiting", "id": "snapload0"}}
1980# <- {"event": "JOB_STATUS_CHANGE",
1981#     "data": {"status": "pending", "id": "snapload0"}}
1982# <- {"event": "JOB_STATUS_CHANGE",
1983#     "data": {"status": "concluded", "id": "snapload0"}}
1984# -> {"execute": "query-jobs"}
1985# <- {"return": [{"current-progress": 1,
1986#                 "status": "concluded",
1987#                 "total-progress": 1,
1988#                 "type": "snapshot-load",
1989#                 "id": "snapload0"}]}
1990#
1991# Since: 6.0
1992##
1993{ 'command': 'snapshot-load',
1994  'data': { 'job-id': 'str',
1995            'tag': 'str',
1996            'vmstate': 'str',
1997            'devices': ['str'] } }
1998
1999##
2000# @snapshot-delete:
2001#
2002# Delete a VM snapshot
2003#
2004# @job-id: identifier for the newly created job
2005# @tag: name of the snapshot to delete.
2006# @devices: list of block device node names to delete a snapshot from
2007#
2008# Applications should not assume that the snapshot delete is complete
2009# when this command returns. The job commands / events must be used
2010# to determine completion and to fetch details of any errors that arise.
2011#
2012# Returns: nothing
2013#
2014# Example:
2015#
2016# -> { "execute": "snapshot-delete",
2017#      "data": {
2018#         "job-id": "snapdelete0",
2019#         "tag": "my-snap",
2020#         "devices": ["disk0", "disk1"]
2021#      }
2022#    }
2023# <- { "return": { } }
2024# <- {"event": "JOB_STATUS_CHANGE",
2025#     "data": {"status": "created", "id": "snapdelete0"}}
2026# <- {"event": "JOB_STATUS_CHANGE",
2027#     "data": {"status": "running", "id": "snapdelete0"}}
2028# <- {"event": "JOB_STATUS_CHANGE",
2029#     "data": {"status": "waiting", "id": "snapdelete0"}}
2030# <- {"event": "JOB_STATUS_CHANGE",
2031#     "data": {"status": "pending", "id": "snapdelete0"}}
2032# <- {"event": "JOB_STATUS_CHANGE",
2033#     "data": {"status": "concluded", "id": "snapdelete0"}}
2034# -> {"execute": "query-jobs"}
2035# <- {"return": [{"current-progress": 1,
2036#                 "status": "concluded",
2037#                 "total-progress": 1,
2038#                 "type": "snapshot-delete",
2039#                 "id": "snapdelete0"}]}
2040#
2041# Since: 6.0
2042##
2043{ 'command': 'snapshot-delete',
2044  'data': { 'job-id': 'str',
2045            'tag': 'str',
2046            'devices': ['str'] } }
2047