xref: /openbmc/qemu/qapi/migration.json (revision f7160f32)
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.0
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': 'int', '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##
152# @MigrationInfo:
153#
154# Information about current migration process.
155#
156# @status: @MigrationStatus describing the current migration status.
157#          If this field is not returned, no migration process
158#          has been initiated
159#
160# @ram: @MigrationStats containing detailed migration
161#       status, only returned if status is 'active' or
162#       'completed'(since 1.2)
163#
164# @disk: @MigrationStats containing detailed disk migration
165#        status, only returned if status is 'active' and it is a block
166#        migration
167#
168# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
169#                migration statistics, only returned if XBZRLE feature is on and
170#                status is 'active' or 'completed' (since 1.2)
171#
172# @total-time: total amount of milliseconds since migration started.
173#              If migration has ended, it returns the total migration
174#              time. (since 1.2)
175#
176# @downtime: only present when migration finishes correctly
177#            total downtime in milliseconds for the guest.
178#            (since 1.3)
179#
180# @expected-downtime: only present while migration is active
181#                     expected downtime in milliseconds for the guest in last walk
182#                     of the dirty bitmap. (since 1.3)
183#
184# @setup-time: amount of setup time in milliseconds *before* the
185#              iterations begin but *after* the QMP command is issued. This is designed
186#              to provide an accounting of any activities (such as RDMA pinning) which
187#              may be expensive, but do not actually occur during the iterative
188#              migration rounds themselves. (since 1.6)
189#
190# @cpu-throttle-percentage: percentage of time guest cpus are being
191#                           throttled during auto-converge. This is only present when auto-converge
192#                           has started throttling guest cpus. (Since 2.7)
193#
194# @error-desc: the human readable error description string, when
195#              @status is 'failed'. Clients should not attempt to parse the
196#              error strings. (Since 2.7)
197#
198# @postcopy-blocktime: total time when all vCPU were blocked during postcopy
199#                      live migration. This is only present when the postcopy-blocktime
200#                      migration capability is enabled. (Since 3.0)
201#
202# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.  This is
203#                           only present when the postcopy-blocktime migration capability
204#                           is enabled. (Since 3.0)
205#
206# @compression: migration compression statistics, only returned if compression
207#               feature is on and status is 'active' or 'completed' (Since 3.1)
208#
209# @socket-address: Only used for tcp, to know what the real port is (Since 4.0)
210#
211# Since: 0.14.0
212##
213{ 'struct': 'MigrationInfo',
214  'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
215           '*disk': 'MigrationStats',
216           '*xbzrle-cache': 'XBZRLECacheStats',
217           '*total-time': 'int',
218           '*expected-downtime': 'int',
219           '*downtime': 'int',
220           '*setup-time': 'int',
221           '*cpu-throttle-percentage': 'int',
222           '*error-desc': 'str',
223           '*postcopy-blocktime' : 'uint32',
224           '*postcopy-vcpu-blocktime': ['uint32'],
225           '*compression': 'CompressionStats',
226           '*socket-address': ['SocketAddress'] } }
227
228##
229# @query-migrate:
230#
231# Returns information about current migration process. If migration
232# is active there will be another json-object with RAM migration
233# status and if block migration is active another one with block
234# migration status.
235#
236# Returns: @MigrationInfo
237#
238# Since: 0.14.0
239#
240# Example:
241#
242# 1. Before the first migration
243#
244# -> { "execute": "query-migrate" }
245# <- { "return": {} }
246#
247# 2. Migration is done and has succeeded
248#
249# -> { "execute": "query-migrate" }
250# <- { "return": {
251#         "status": "completed",
252#         "total-time":12345,
253#         "setup-time":12345,
254#         "downtime":12345,
255#         "ram":{
256#           "transferred":123,
257#           "remaining":123,
258#           "total":246,
259#           "duplicate":123,
260#           "normal":123,
261#           "normal-bytes":123456,
262#           "dirty-sync-count":15
263#         }
264#      }
265#    }
266#
267# 3. Migration is done and has failed
268#
269# -> { "execute": "query-migrate" }
270# <- { "return": { "status": "failed" } }
271#
272# 4. Migration is being performed and is not a block migration:
273#
274# -> { "execute": "query-migrate" }
275# <- {
276#       "return":{
277#          "status":"active",
278#          "total-time":12345,
279#          "setup-time":12345,
280#          "expected-downtime":12345,
281#          "ram":{
282#             "transferred":123,
283#             "remaining":123,
284#             "total":246,
285#             "duplicate":123,
286#             "normal":123,
287#             "normal-bytes":123456,
288#             "dirty-sync-count":15
289#          }
290#       }
291#    }
292#
293# 5. Migration is being performed and is a block migration:
294#
295# -> { "execute": "query-migrate" }
296# <- {
297#       "return":{
298#          "status":"active",
299#          "total-time":12345,
300#          "setup-time":12345,
301#          "expected-downtime":12345,
302#          "ram":{
303#             "total":1057024,
304#             "remaining":1053304,
305#             "transferred":3720,
306#             "duplicate":123,
307#             "normal":123,
308#             "normal-bytes":123456,
309#             "dirty-sync-count":15
310#          },
311#          "disk":{
312#             "total":20971520,
313#             "remaining":20880384,
314#             "transferred":91136
315#          }
316#       }
317#    }
318#
319# 6. Migration is being performed and XBZRLE is active:
320#
321# -> { "execute": "query-migrate" }
322# <- {
323#       "return":{
324#          "status":"active",
325#          "total-time":12345,
326#          "setup-time":12345,
327#          "expected-downtime":12345,
328#          "ram":{
329#             "total":1057024,
330#             "remaining":1053304,
331#             "transferred":3720,
332#             "duplicate":10,
333#             "normal":3333,
334#             "normal-bytes":3412992,
335#             "dirty-sync-count":15
336#          },
337#          "xbzrle-cache":{
338#             "cache-size":67108864,
339#             "bytes":20971520,
340#             "pages":2444343,
341#             "cache-miss":2244,
342#             "cache-miss-rate":0.123,
343#             "encoding-rate":80.1,
344#             "overflow":34434
345#          }
346#       }
347#    }
348#
349##
350{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
351
352##
353# @MigrationCapability:
354#
355# Migration capabilities enumeration
356#
357# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
358#          This feature allows us to minimize migration traffic for certain work
359#          loads, by sending compressed difference of the pages
360#
361# @rdma-pin-all: Controls whether or not the entire VM memory footprint is
362#                mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage.
363#                Disabled by default. (since 2.0)
364#
365# @zero-blocks: During storage migration encode blocks of zeroes efficiently. This
366#               essentially saves 1MB of zeroes per block on the wire. Enabling requires
367#               source and target VM to support this feature. To enable it is sufficient
368#               to enable the capability on the source VM. The feature is disabled by
369#               default. (since 1.6)
370#
371# @compress: Use multiple compression threads to accelerate live migration.
372#            This feature can help to reduce the migration traffic, by sending
373#            compressed pages. Please note that if compress and xbzrle are both
374#            on, compress only takes effect in the ram bulk stage, after that,
375#            it will be disabled and only xbzrle takes effect, this can help to
376#            minimize migration traffic. The feature is disabled by default.
377#            (since 2.4 )
378#
379# @events: generate events for each migration state change
380#          (since 2.4 )
381#
382# @auto-converge: If enabled, QEMU will automatically throttle down the guest
383#                 to speed up convergence of RAM migration. (since 1.6)
384#
385# @postcopy-ram: Start executing on the migration target before all of RAM has
386#                been migrated, pulling the remaining pages along as needed. The
387#                capacity must have the same setting on both source and target
388#                or migration will not even start. NOTE: If the migration fails during
389#                postcopy the VM will fail.  (since 2.6)
390#
391# @x-colo: If enabled, migration will never end, and the state of the VM on the
392#          primary side will be migrated continuously to the VM on secondary
393#          side, this process is called COarse-Grain LOck Stepping (COLO) for
394#          Non-stop Service. (since 2.8)
395#
396# @release-ram: if enabled, qemu will free the migrated ram pages on the source
397#               during postcopy-ram migration. (since 2.9)
398#
399# @block: If enabled, QEMU will also migrate the contents of all block
400#         devices.  Default is disabled.  A possible alternative uses
401#         mirror jobs to a builtin NBD server on the destination, which
402#         offers more flexibility.
403#         (Since 2.10)
404#
405# @return-path: If enabled, migration will use the return path even
406#               for precopy. (since 2.10)
407#
408# @pause-before-switchover: Pause outgoing migration before serialising device
409#                           state and before disabling block IO (since 2.11)
410#
411# @multifd: Use more than one fd for migration (since 4.0)
412#
413# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
414#                 (since 2.12)
415#
416# @postcopy-blocktime: Calculate downtime for postcopy live migration
417#                      (since 3.0)
418#
419# @late-block-activate: If enabled, the destination will not activate block
420#                       devices (and thus take locks) immediately at the end of migration.
421#                       (since 3.0)
422#
423# @x-ignore-shared: If enabled, QEMU will not migrate shared memory (since 4.0)
424#
425# @validate-uuid: Send the UUID of the source to allow the destination
426#                 to ensure it is the same. (since 4.2)
427#
428# Since: 1.2
429##
430{ 'enum': 'MigrationCapability',
431  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
432           'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
433           'block', 'return-path', 'pause-before-switchover', 'multifd',
434           'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
435           'x-ignore-shared', 'validate-uuid' ] }
436
437##
438# @MigrationCapabilityStatus:
439#
440# Migration capability information
441#
442# @capability: capability enum
443#
444# @state: capability state bool
445#
446# Since: 1.2
447##
448{ 'struct': 'MigrationCapabilityStatus',
449  'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }
450
451##
452# @migrate-set-capabilities:
453#
454# Enable/Disable the following migration capabilities (like xbzrle)
455#
456# @capabilities: json array of capability modifications to make
457#
458# Since: 1.2
459#
460# Example:
461#
462# -> { "execute": "migrate-set-capabilities" , "arguments":
463#      { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
464#
465##
466{ 'command': 'migrate-set-capabilities',
467  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
468
469##
470# @query-migrate-capabilities:
471#
472# Returns information about the current migration capabilities status
473#
474# Returns: @MigrationCapabilitiesStatus
475#
476# Since: 1.2
477#
478# Example:
479#
480# -> { "execute": "query-migrate-capabilities" }
481# <- { "return": [
482#       {"state": false, "capability": "xbzrle"},
483#       {"state": false, "capability": "rdma-pin-all"},
484#       {"state": false, "capability": "auto-converge"},
485#       {"state": false, "capability": "zero-blocks"},
486#       {"state": false, "capability": "compress"},
487#       {"state": true, "capability": "events"},
488#       {"state": false, "capability": "postcopy-ram"},
489#       {"state": false, "capability": "x-colo"}
490#    ]}
491#
492##
493{ 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}
494
495##
496# @MultiFDCompression:
497#
498# An enumeration of multifd compression methods.
499#
500# @none: no compression.
501# @zlib: use zlib compression method.
502# @zstd: use zstd compression method.
503#
504# Since: 5.0
505#
506##
507{ 'enum': 'MultiFDCompression',
508  'data': [ 'none', 'zlib',
509            { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }
510
511##
512# @MigrationParameter:
513#
514# Migration parameters enumeration
515#
516# @announce-initial: Initial delay (in milliseconds) before sending the first
517#                    announce (Since 4.0)
518#
519# @announce-max: Maximum delay (in milliseconds) between packets in the
520#                announcement (Since 4.0)
521#
522# @announce-rounds: Number of self-announce packets sent after migration
523#                   (Since 4.0)
524#
525# @announce-step: Increase in delay (in milliseconds) between subsequent
526#                 packets in the announcement (Since 4.0)
527#
528# @compress-level: Set the compression level to be used in live migration,
529#                  the compression level is an integer between 0 and 9, where 0 means
530#                  no compression, 1 means the best compression speed, and 9 means best
531#                  compression ratio which will consume more CPU.
532#
533# @compress-threads: Set compression thread count to be used in live migration,
534#                    the compression thread count is an integer between 1 and 255.
535#
536# @compress-wait-thread: Controls behavior when all compression threads are
537#                        currently busy. If true (default), wait for a free
538#                        compression thread to become available; otherwise,
539#                        send the page uncompressed. (Since 3.1)
540#
541# @decompress-threads: Set decompression thread count to be used in live
542#                      migration, the decompression thread count is an integer between 1
543#                      and 255. Usually, decompression is at least 4 times as fast as
544#                      compression, so set the decompress-threads to the number about 1/4
545#                      of compress-threads is adequate.
546#
547# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
548#                              to trigger throttling. It is expressed as percentage.
549#                              The default value is 50. (Since 5.0)
550#
551# @cpu-throttle-initial: Initial percentage of time guest cpus are throttled
552#                        when migration auto-converge is activated. The
553#                        default value is 20. (Since 2.7)
554#
555# @cpu-throttle-increment: throttle percentage increase each time
556#                          auto-converge detects that migration is not making
557#                          progress. The default value is 10. (Since 2.7)
558#
559# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
560#                         At the tail stage of throttling, the Guest is very
561#                         sensitive to CPU percentage while the @cpu-throttle
562#                         -increment is excessive usually at tail stage.
563#                         If this parameter is true, we will compute the ideal
564#                         CPU percentage used by the Guest, which may exactly make
565#                         the dirty rate match the dirty rate threshold. Then we
566#                         will choose a smaller throttle increment between the
567#                         one specified by @cpu-throttle-increment and the one
568#                         generated by ideal CPU percentage.
569#                         Therefore, it is compatible to traditional throttling,
570#                         meanwhile the throttle increment won't be excessive
571#                         at tail stage.
572#                         The default value is false. (Since 5.1)
573#
574# @tls-creds: ID of the 'tls-creds' object that provides credentials for
575#             establishing a TLS connection over the migration data channel.
576#             On the outgoing side of the migration, the credentials must
577#             be for a 'client' endpoint, while for the incoming side the
578#             credentials must be for a 'server' endpoint. Setting this
579#             will enable TLS for all migrations. The default is unset,
580#             resulting in unsecured migration at the QEMU level. (Since 2.7)
581#
582# @tls-hostname: hostname of the target host for the migration. This is
583#                required when using x509 based TLS credentials and the
584#                migration URI does not already include a hostname. For
585#                example if using fd: or exec: based migration, the
586#                hostname must be provided so that the server's x509
587#                certificate identity can be validated. (Since 2.7)
588#
589# @tls-authz: ID of the 'authz' object subclass that provides access control
590#             checking of the TLS x509 certificate distinguished name.
591#             This object is only resolved at time of use, so can be deleted
592#             and recreated on the fly while the migration server is active.
593#             If missing, it will default to denying access (Since 4.0)
594#
595# @max-bandwidth: to set maximum speed for migration. maximum speed in
596#                 bytes per second. (Since 2.8)
597#
598# @downtime-limit: set maximum tolerated downtime for migration. maximum
599#                  downtime in milliseconds (Since 2.8)
600#
601# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
602#                      periodic mode. (Since 2.8)
603#
604# @block-incremental: Affects how much storage is migrated when the
605#                     block migration capability is enabled.  When false, the entire
606#                     storage backing chain is migrated into a flattened image at
607#                     the destination; when true, only the active qcow2 layer is
608#                     migrated and the destination must already have access to the
609#                     same backing chain as was used on the source.  (since 2.10)
610#
611# @multifd-channels: Number of channels used to migrate data in
612#                    parallel. This is the same number that the
613#                    number of sockets used for migration.  The
614#                    default value is 2 (since 4.0)
615#
616# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
617#                     needs to be a multiple of the target page size
618#                     and a power of 2
619#                     (Since 2.11)
620#
621# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
622#                          Defaults to 0 (unlimited).  In bytes per second.
623#                          (Since 3.0)
624#
625# @max-cpu-throttle: maximum cpu throttle percentage.
626#                    Defaults to 99. (Since 3.1)
627#
628# @multifd-compression: Which compression method to use.
629#                       Defaults to none. (Since 5.0)
630#
631# @multifd-zlib-level: Set the compression level to be used in live
632#          migration, the compression level is an integer between 0
633#          and 9, where 0 means no compression, 1 means the best
634#          compression speed, and 9 means best compression ratio which
635#          will consume more CPU.
636#          Defaults to 1. (Since 5.0)
637#
638# @multifd-zstd-level: Set the compression level to be used in live
639#          migration, the compression level is an integer between 0
640#          and 20, where 0 means no compression, 1 means the best
641#          compression speed, and 20 means best compression ratio which
642#          will consume more CPU.
643#          Defaults to 1. (Since 5.0)
644#
645# Since: 2.4
646##
647{ 'enum': 'MigrationParameter',
648  'data': ['announce-initial', 'announce-max',
649           'announce-rounds', 'announce-step',
650           'compress-level', 'compress-threads', 'decompress-threads',
651           'compress-wait-thread', 'throttle-trigger-threshold',
652           'cpu-throttle-initial', 'cpu-throttle-increment',
653           'cpu-throttle-tailslow',
654           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
655           'downtime-limit', 'x-checkpoint-delay', 'block-incremental',
656           'multifd-channels',
657           'xbzrle-cache-size', 'max-postcopy-bandwidth',
658           'max-cpu-throttle', 'multifd-compression',
659           'multifd-zlib-level' ,'multifd-zstd-level' ] }
660
661##
662# @MigrateSetParameters:
663#
664# @announce-initial: Initial delay (in milliseconds) before sending the first
665#                    announce (Since 4.0)
666#
667# @announce-max: Maximum delay (in milliseconds) between packets in the
668#                announcement (Since 4.0)
669#
670# @announce-rounds: Number of self-announce packets sent after migration
671#                   (Since 4.0)
672#
673# @announce-step: Increase in delay (in milliseconds) between subsequent
674#                 packets in the announcement (Since 4.0)
675#
676# @compress-level: compression level
677#
678# @compress-threads: compression thread count
679#
680# @compress-wait-thread: Controls behavior when all compression threads are
681#                        currently busy. If true (default), wait for a free
682#                        compression thread to become available; otherwise,
683#                        send the page uncompressed. (Since 3.1)
684#
685# @decompress-threads: decompression thread count
686#
687# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
688#                              to trigger throttling. It is expressed as percentage.
689#                              The default value is 50. (Since 5.0)
690#
691# @cpu-throttle-initial: Initial percentage of time guest cpus are
692#                        throttled when migration auto-converge is activated.
693#                        The default value is 20. (Since 2.7)
694#
695# @cpu-throttle-increment: throttle percentage increase each time
696#                          auto-converge detects that migration is not making
697#                          progress. The default value is 10. (Since 2.7)
698#
699# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
700#                         At the tail stage of throttling, the Guest is very
701#                         sensitive to CPU percentage while the @cpu-throttle
702#                         -increment is excessive usually at tail stage.
703#                         If this parameter is true, we will compute the ideal
704#                         CPU percentage used by the Guest, which may exactly make
705#                         the dirty rate match the dirty rate threshold. Then we
706#                         will choose a smaller throttle increment between the
707#                         one specified by @cpu-throttle-increment and the one
708#                         generated by ideal CPU percentage.
709#                         Therefore, it is compatible to traditional throttling,
710#                         meanwhile the throttle increment won't be excessive
711#                         at tail stage.
712#                         The default value is false. (Since 5.1)
713#
714# @tls-creds: ID of the 'tls-creds' object that provides credentials
715#             for establishing a TLS connection over the migration data
716#             channel. On the outgoing side of the migration, the credentials
717#             must be for a 'client' endpoint, while for the incoming side the
718#             credentials must be for a 'server' endpoint. Setting this
719#             to a non-empty string enables TLS for all migrations.
720#             An empty string means that QEMU will use plain text mode for
721#             migration, rather than TLS (Since 2.9)
722#             Previously (since 2.7), this was reported by omitting
723#             tls-creds instead.
724#
725# @tls-hostname: hostname of the target host for the migration. This
726#                is required when using x509 based TLS credentials and the
727#                migration URI does not already include a hostname. For
728#                example if using fd: or exec: based migration, the
729#                hostname must be provided so that the server's x509
730#                certificate identity can be validated. (Since 2.7)
731#                An empty string means that QEMU will use the hostname
732#                associated with the migration URI, if any. (Since 2.9)
733#                Previously (since 2.7), this was reported by omitting
734#                tls-hostname instead.
735#
736# @max-bandwidth: to set maximum speed for migration. maximum speed in
737#                 bytes per second. (Since 2.8)
738#
739# @downtime-limit: set maximum tolerated downtime for migration. maximum
740#                  downtime in milliseconds (Since 2.8)
741#
742# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
743#
744# @block-incremental: Affects how much storage is migrated when the
745#                     block migration capability is enabled.  When false, the entire
746#                     storage backing chain is migrated into a flattened image at
747#                     the destination; when true, only the active qcow2 layer is
748#                     migrated and the destination must already have access to the
749#                     same backing chain as was used on the source.  (since 2.10)
750#
751# @multifd-channels: Number of channels used to migrate data in
752#                    parallel. This is the same number that the
753#                    number of sockets used for migration.  The
754#                    default value is 2 (since 4.0)
755#
756# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
757#                     needs to be a multiple of the target page size
758#                     and a power of 2
759#                     (Since 2.11)
760#
761# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
762#                          Defaults to 0 (unlimited).  In bytes per second.
763#                          (Since 3.0)
764#
765# @max-cpu-throttle: maximum cpu throttle percentage.
766#                    The default value is 99. (Since 3.1)
767#
768# @multifd-compression: Which compression method to use.
769#                       Defaults to none. (Since 5.0)
770#
771# @multifd-zlib-level: Set the compression level to be used in live
772#          migration, the compression level is an integer between 0
773#          and 9, where 0 means no compression, 1 means the best
774#          compression speed, and 9 means best compression ratio which
775#          will consume more CPU.
776#          Defaults to 1. (Since 5.0)
777#
778# @multifd-zstd-level: Set the compression level to be used in live
779#          migration, the compression level is an integer between 0
780#          and 20, where 0 means no compression, 1 means the best
781#          compression speed, and 20 means best compression ratio which
782#          will consume more CPU.
783#          Defaults to 1. (Since 5.0)
784#
785# Since: 2.4
786##
787# TODO either fuse back into MigrationParameters, or make
788# MigrationParameters members mandatory
789{ 'struct': 'MigrateSetParameters',
790  'data': { '*announce-initial': 'size',
791            '*announce-max': 'size',
792            '*announce-rounds': 'size',
793            '*announce-step': 'size',
794            '*compress-level': 'int',
795            '*compress-threads': 'int',
796            '*compress-wait-thread': 'bool',
797            '*decompress-threads': 'int',
798            '*throttle-trigger-threshold': 'int',
799            '*cpu-throttle-initial': 'int',
800            '*cpu-throttle-increment': 'int',
801            '*cpu-throttle-tailslow': 'bool',
802            '*tls-creds': 'StrOrNull',
803            '*tls-hostname': 'StrOrNull',
804            '*tls-authz': 'StrOrNull',
805            '*max-bandwidth': 'int',
806            '*downtime-limit': 'int',
807            '*x-checkpoint-delay': 'int',
808            '*block-incremental': 'bool',
809            '*multifd-channels': 'int',
810            '*xbzrle-cache-size': 'size',
811            '*max-postcopy-bandwidth': 'size',
812            '*max-cpu-throttle': 'int',
813            '*multifd-compression': 'MultiFDCompression',
814            '*multifd-zlib-level': 'int',
815            '*multifd-zstd-level': 'int' } }
816
817##
818# @migrate-set-parameters:
819#
820# Set various migration parameters.
821#
822# Since: 2.4
823#
824# Example:
825#
826# -> { "execute": "migrate-set-parameters" ,
827#      "arguments": { "compress-level": 1 } }
828#
829##
830{ 'command': 'migrate-set-parameters', 'boxed': true,
831  'data': 'MigrateSetParameters' }
832
833##
834# @MigrationParameters:
835#
836# The optional members aren't actually optional.
837#
838# @announce-initial: Initial delay (in milliseconds) before sending the
839#                    first announce (Since 4.0)
840#
841# @announce-max: Maximum delay (in milliseconds) between packets in the
842#                announcement (Since 4.0)
843#
844# @announce-rounds: Number of self-announce packets sent after migration
845#                   (Since 4.0)
846#
847# @announce-step: Increase in delay (in milliseconds) between subsequent
848#                 packets in the announcement (Since 4.0)
849#
850# @compress-level: compression level
851#
852# @compress-threads: compression thread count
853#
854# @compress-wait-thread: Controls behavior when all compression threads are
855#                        currently busy. If true (default), wait for a free
856#                        compression thread to become available; otherwise,
857#                        send the page uncompressed. (Since 3.1)
858#
859# @decompress-threads: decompression thread count
860#
861# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
862#                              to trigger throttling. It is expressed as percentage.
863#                              The default value is 50. (Since 5.0)
864#
865# @cpu-throttle-initial: Initial percentage of time guest cpus are
866#                        throttled when migration auto-converge is activated.
867#                        (Since 2.7)
868#
869# @cpu-throttle-increment: throttle percentage increase each time
870#                          auto-converge detects that migration is not making
871#                          progress. (Since 2.7)
872#
873# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
874#                         At the tail stage of throttling, the Guest is very
875#                         sensitive to CPU percentage while the @cpu-throttle
876#                         -increment is excessive usually at tail stage.
877#                         If this parameter is true, we will compute the ideal
878#                         CPU percentage used by the Guest, which may exactly make
879#                         the dirty rate match the dirty rate threshold. Then we
880#                         will choose a smaller throttle increment between the
881#                         one specified by @cpu-throttle-increment and the one
882#                         generated by ideal CPU percentage.
883#                         Therefore, it is compatible to traditional throttling,
884#                         meanwhile the throttle increment won't be excessive
885#                         at tail stage.
886#                         The default value is false. (Since 5.1)
887#
888# @tls-creds: ID of the 'tls-creds' object that provides credentials
889#             for establishing a TLS connection over the migration data
890#             channel. On the outgoing side of the migration, the credentials
891#             must be for a 'client' endpoint, while for the incoming side the
892#             credentials must be for a 'server' endpoint.
893#             An empty string means that QEMU will use plain text mode for
894#             migration, rather than TLS (Since 2.7)
895#             Note: 2.8 reports this by omitting tls-creds instead.
896#
897# @tls-hostname: hostname of the target host for the migration. This
898#                is required when using x509 based TLS credentials and the
899#                migration URI does not already include a hostname. For
900#                example if using fd: or exec: based migration, the
901#                hostname must be provided so that the server's x509
902#                certificate identity can be validated. (Since 2.7)
903#                An empty string means that QEMU will use the hostname
904#                associated with the migration URI, if any. (Since 2.9)
905#                Note: 2.8 reports this by omitting tls-hostname instead.
906#
907# @tls-authz: ID of the 'authz' object subclass that provides access control
908#             checking of the TLS x509 certificate distinguished name. (Since
909#             4.0)
910#
911# @max-bandwidth: to set maximum speed for migration. maximum speed in
912#                 bytes per second. (Since 2.8)
913#
914# @downtime-limit: set maximum tolerated downtime for migration. maximum
915#                  downtime in milliseconds (Since 2.8)
916#
917# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
918#
919# @block-incremental: Affects how much storage is migrated when the
920#                     block migration capability is enabled.  When false, the entire
921#                     storage backing chain is migrated into a flattened image at
922#                     the destination; when true, only the active qcow2 layer is
923#                     migrated and the destination must already have access to the
924#                     same backing chain as was used on the source.  (since 2.10)
925#
926# @multifd-channels: Number of channels used to migrate data in
927#                    parallel. This is the same number that the
928#                    number of sockets used for migration.
929#                    The default value is 2 (since 4.0)
930#
931# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
932#                     needs to be a multiple of the target page size
933#                     and a power of 2
934#                     (Since 2.11)
935#
936# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
937#                          Defaults to 0 (unlimited).  In bytes per second.
938#                          (Since 3.0)
939#
940# @max-cpu-throttle: maximum cpu throttle percentage.
941#                    Defaults to 99.
942#                    (Since 3.1)
943#
944# @multifd-compression: Which compression method to use.
945#                       Defaults to none. (Since 5.0)
946#
947# @multifd-zlib-level: Set the compression level to be used in live
948#          migration, the compression level is an integer between 0
949#          and 9, where 0 means no compression, 1 means the best
950#          compression speed, and 9 means best compression ratio which
951#          will consume more CPU.
952#          Defaults to 1. (Since 5.0)
953#
954# @multifd-zstd-level: Set the compression level to be used in live
955#          migration, the compression level is an integer between 0
956#          and 20, where 0 means no compression, 1 means the best
957#          compression speed, and 20 means best compression ratio which
958#          will consume more CPU.
959#          Defaults to 1. (Since 5.0)
960#
961# Since: 2.4
962##
963{ 'struct': 'MigrationParameters',
964  'data': { '*announce-initial': 'size',
965            '*announce-max': 'size',
966            '*announce-rounds': 'size',
967            '*announce-step': 'size',
968            '*compress-level': 'uint8',
969            '*compress-threads': 'uint8',
970            '*compress-wait-thread': 'bool',
971            '*decompress-threads': 'uint8',
972            '*throttle-trigger-threshold': 'uint8',
973            '*cpu-throttle-initial': 'uint8',
974            '*cpu-throttle-increment': 'uint8',
975            '*cpu-throttle-tailslow': 'bool',
976            '*tls-creds': 'str',
977            '*tls-hostname': 'str',
978            '*tls-authz': 'str',
979            '*max-bandwidth': 'size',
980            '*downtime-limit': 'uint64',
981            '*x-checkpoint-delay': 'uint32',
982            '*block-incremental': 'bool' ,
983            '*multifd-channels': 'uint8',
984            '*xbzrle-cache-size': 'size',
985            '*max-postcopy-bandwidth': 'size',
986            '*max-cpu-throttle': 'uint8',
987            '*multifd-compression': 'MultiFDCompression',
988            '*multifd-zlib-level': 'uint8',
989            '*multifd-zstd-level': 'uint8' } }
990
991##
992# @query-migrate-parameters:
993#
994# Returns information about the current migration parameters
995#
996# Returns: @MigrationParameters
997#
998# Since: 2.4
999#
1000# Example:
1001#
1002# -> { "execute": "query-migrate-parameters" }
1003# <- { "return": {
1004#          "decompress-threads": 2,
1005#          "cpu-throttle-increment": 10,
1006#          "compress-threads": 8,
1007#          "compress-level": 1,
1008#          "cpu-throttle-initial": 20,
1009#          "max-bandwidth": 33554432,
1010#          "downtime-limit": 300
1011#       }
1012#    }
1013#
1014##
1015{ 'command': 'query-migrate-parameters',
1016  'returns': 'MigrationParameters' }
1017
1018##
1019# @client_migrate_info:
1020#
1021# Set migration information for remote display.  This makes the server
1022# ask the client to automatically reconnect using the new parameters
1023# once migration finished successfully.  Only implemented for SPICE.
1024#
1025# @protocol:     must be "spice"
1026# @hostname:     migration target hostname
1027# @port:         spice tcp port for plaintext channels
1028# @tls-port:     spice tcp port for tls-secured channels
1029# @cert-subject: server certificate subject
1030#
1031# Since: 0.14.0
1032#
1033# Example:
1034#
1035# -> { "execute": "client_migrate_info",
1036#      "arguments": { "protocol": "spice",
1037#                     "hostname": "virt42.lab.kraxel.org",
1038#                     "port": 1234 } }
1039# <- { "return": {} }
1040#
1041##
1042{ 'command': 'client_migrate_info',
1043  'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
1044            '*tls-port': 'int', '*cert-subject': 'str' } }
1045
1046##
1047# @migrate-start-postcopy:
1048#
1049# Followup to a migration command to switch the migration to postcopy mode.
1050# The postcopy-ram capability must be set on both source and destination
1051# before the original migration command.
1052#
1053# Since: 2.5
1054#
1055# Example:
1056#
1057# -> { "execute": "migrate-start-postcopy" }
1058# <- { "return": {} }
1059#
1060##
1061{ 'command': 'migrate-start-postcopy' }
1062
1063##
1064# @MIGRATION:
1065#
1066# Emitted when a migration event happens
1067#
1068# @status: @MigrationStatus describing the current migration status.
1069#
1070# Since: 2.4
1071#
1072# Example:
1073#
1074# <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1075#     "event": "MIGRATION",
1076#     "data": {"status": "completed"} }
1077#
1078##
1079{ 'event': 'MIGRATION',
1080  'data': {'status': 'MigrationStatus'}}
1081
1082##
1083# @MIGRATION_PASS:
1084#
1085# Emitted from the source side of a migration at the start of each pass
1086# (when it syncs the dirty bitmap)
1087#
1088# @pass: An incrementing count (starting at 1 on the first pass)
1089#
1090# Since: 2.6
1091#
1092# Example:
1093#
1094# { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1095#   "event": "MIGRATION_PASS", "data": {"pass": 2} }
1096#
1097##
1098{ 'event': 'MIGRATION_PASS',
1099  'data': { 'pass': 'int' } }
1100
1101##
1102# @COLOMessage:
1103#
1104# The message transmission between Primary side and Secondary side.
1105#
1106# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1107#
1108# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for checkpointing
1109#
1110# @checkpoint-reply: SVM gets PVM's checkpoint request
1111#
1112# @vmstate-send: VM's state will be sent by PVM.
1113#
1114# @vmstate-size: The total size of VMstate.
1115#
1116# @vmstate-received: VM's state has been received by SVM.
1117#
1118# @vmstate-loaded: VM's state has been loaded by SVM.
1119#
1120# Since: 2.8
1121##
1122{ 'enum': 'COLOMessage',
1123  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1124            'vmstate-send', 'vmstate-size', 'vmstate-received',
1125            'vmstate-loaded' ] }
1126
1127##
1128# @COLOMode:
1129#
1130# The COLO current mode.
1131#
1132# @none: COLO is disabled.
1133#
1134# @primary: COLO node in primary side.
1135#
1136# @secondary: COLO node in slave side.
1137#
1138# Since: 2.8
1139##
1140{ 'enum': 'COLOMode',
1141  'data': [ 'none', 'primary', 'secondary'] }
1142
1143##
1144# @FailoverStatus:
1145#
1146# An enumeration of COLO failover status
1147#
1148# @none: no failover has ever happened
1149#
1150# @require: got failover requirement but not handled
1151#
1152# @active: in the process of doing failover
1153#
1154# @completed: finish the process of failover
1155#
1156# @relaunch: restart the failover process, from 'none' -> 'completed' (Since 2.9)
1157#
1158# Since: 2.8
1159##
1160{ 'enum': 'FailoverStatus',
1161  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1162
1163##
1164# @COLO_EXIT:
1165#
1166# Emitted when VM finishes COLO mode due to some errors happening or
1167# at the request of users.
1168#
1169# @mode: report COLO mode when COLO exited.
1170#
1171# @reason: describes the reason for the COLO exit.
1172#
1173# Since: 3.1
1174#
1175# Example:
1176#
1177# <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1178#      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1179#
1180##
1181{ 'event': 'COLO_EXIT',
1182  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1183
1184##
1185# @COLOExitReason:
1186#
1187# The reason for a COLO exit.
1188#
1189# @none: failover has never happened. This state does not occur
1190#        in the COLO_EXIT event, and is only visible in the result of
1191#        query-colo-status.
1192#
1193# @request: COLO exit is due to an external request.
1194#
1195# @error: COLO exit is due to an internal error.
1196#
1197# @processing: COLO is currently handling a failover (since 4.0).
1198#
1199# Since: 3.1
1200##
1201{ 'enum': 'COLOExitReason',
1202  'data': [ 'none', 'request', 'error' , 'processing' ] }
1203
1204##
1205# @x-colo-lost-heartbeat:
1206#
1207# Tell qemu that heartbeat is lost, request it to do takeover procedures.
1208# If this command is sent to the PVM, the Primary side will exit COLO mode.
1209# If sent to the Secondary, the Secondary side will run failover work,
1210# then takes over server operation to become the service VM.
1211#
1212# Since: 2.8
1213#
1214# Example:
1215#
1216# -> { "execute": "x-colo-lost-heartbeat" }
1217# <- { "return": {} }
1218#
1219##
1220{ 'command': 'x-colo-lost-heartbeat' }
1221
1222##
1223# @migrate_cancel:
1224#
1225# Cancel the current executing migration process.
1226#
1227# Returns: nothing on success
1228#
1229# Notes: This command succeeds even if there is no migration process running.
1230#
1231# Since: 0.14.0
1232#
1233# Example:
1234#
1235# -> { "execute": "migrate_cancel" }
1236# <- { "return": {} }
1237#
1238##
1239{ 'command': 'migrate_cancel' }
1240
1241##
1242# @migrate-continue:
1243#
1244# Continue migration when it's in a paused state.
1245#
1246# @state: The state the migration is currently expected to be in
1247#
1248# Returns: nothing on success
1249# Since: 2.11
1250# Example:
1251#
1252# -> { "execute": "migrate-continue" , "arguments":
1253#      { "state": "pre-switchover" } }
1254# <- { "return": {} }
1255##
1256{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1257
1258##
1259# @migrate_set_downtime:
1260#
1261# Set maximum tolerated downtime for migration.
1262#
1263# @value: maximum downtime in seconds
1264#
1265# Features:
1266# @deprecated: This command is deprecated.  Use
1267#     'migrate-set-parameters' instead.
1268#
1269# Returns: nothing on success
1270#
1271# Since: 0.14.0
1272#
1273# Example:
1274#
1275# -> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
1276# <- { "return": {} }
1277#
1278##
1279{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'},
1280  'features': [ 'deprecated' ] }
1281
1282##
1283# @migrate_set_speed:
1284#
1285# Set maximum speed for migration.
1286#
1287# @value: maximum speed in bytes per second.
1288#
1289# Features:
1290# @deprecated: This command is deprecated.  Use
1291#     'migrate-set-parameters' instead.
1292#
1293# Returns: nothing on success
1294#
1295# Since: 0.14.0
1296#
1297# Example:
1298#
1299# -> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
1300# <- { "return": {} }
1301#
1302##
1303{ 'command': 'migrate_set_speed', 'data': {'value': 'int'},
1304  'features': [ 'deprecated' ] }
1305
1306##
1307# @migrate-set-cache-size:
1308#
1309# Set cache size to be used by XBZRLE migration
1310#
1311# @value: cache size in bytes
1312#
1313# Features:
1314# @deprecated: This command is deprecated.  Use
1315#     'migrate-set-parameters' instead.
1316#
1317# The size will be rounded down to the nearest power of 2.
1318# The cache size can be modified before and during ongoing migration
1319#
1320# Returns: nothing on success
1321#
1322# Since: 1.2
1323#
1324# Example:
1325#
1326# -> { "execute": "migrate-set-cache-size",
1327#      "arguments": { "value": 536870912 } }
1328# <- { "return": {} }
1329#
1330##
1331{ 'command': 'migrate-set-cache-size', 'data': {'value': 'int'},
1332  'features': [ 'deprecated' ] }
1333
1334##
1335# @query-migrate-cache-size:
1336#
1337# Query migration XBZRLE cache size
1338#
1339# Features:
1340# @deprecated: This command is deprecated.  Use
1341#     'query-migrate-parameters' instead.
1342#
1343# Returns: XBZRLE cache size in bytes
1344#
1345# Since: 1.2
1346#
1347# Example:
1348#
1349# -> { "execute": "query-migrate-cache-size" }
1350# <- { "return": 67108864 }
1351#
1352##
1353{ 'command': 'query-migrate-cache-size', 'returns': 'int',
1354  'features': [ 'deprecated' ] }
1355
1356##
1357# @migrate:
1358#
1359# Migrates the current running guest to another Virtual Machine.
1360#
1361# @uri: the Uniform Resource Identifier of the destination VM
1362#
1363# @blk: do block migration (full disk copy)
1364#
1365# @inc: incremental disk copy migration
1366#
1367# @detach: this argument exists only for compatibility reasons and
1368#          is ignored by QEMU
1369#
1370# @resume: resume one paused migration, default "off". (since 3.0)
1371#
1372# Returns: nothing on success
1373#
1374# Since: 0.14.0
1375#
1376# Notes:
1377#
1378# 1. The 'query-migrate' command should be used to check migration's progress
1379#    and final result (this information is provided by the 'status' member)
1380#
1381# 2. All boolean arguments default to false
1382#
1383# 3. The user Monitor's "detach" argument is invalid in QMP and should not
1384#    be used
1385#
1386# Example:
1387#
1388# -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1389# <- { "return": {} }
1390#
1391##
1392{ 'command': 'migrate',
1393  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
1394           '*detach': 'bool', '*resume': 'bool' } }
1395
1396##
1397# @migrate-incoming:
1398#
1399# Start an incoming migration, the qemu must have been started
1400# with -incoming defer
1401#
1402# @uri: The Uniform Resource Identifier identifying the source or
1403#       address to listen on
1404#
1405# Returns: nothing on success
1406#
1407# Since: 2.3
1408#
1409# Notes:
1410#
1411# 1. It's a bad idea to use a string for the uri, but it needs to stay
1412#    compatible with -incoming and the format of the uri is already exposed
1413#    above libvirt.
1414#
1415# 2. QEMU must be started with -incoming defer to allow migrate-incoming to
1416#    be used.
1417#
1418# 3. The uri format is the same as for -incoming
1419#
1420# Example:
1421#
1422# -> { "execute": "migrate-incoming",
1423#      "arguments": { "uri": "tcp::4446" } }
1424# <- { "return": {} }
1425#
1426##
1427{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
1428
1429##
1430# @xen-save-devices-state:
1431#
1432# Save the state of all devices to file. The RAM and the block devices
1433# of the VM are not saved by this command.
1434#
1435# @filename: the file to save the state of the devices to as binary
1436#            data. See xen-save-devices-state.txt for a description of the binary
1437#            format.
1438#
1439# @live: Optional argument to ask QEMU to treat this command as part of a live
1440#        migration. Default to true. (since 2.11)
1441#
1442# Returns: Nothing on success
1443#
1444# Since: 1.1
1445#
1446# Example:
1447#
1448# -> { "execute": "xen-save-devices-state",
1449#      "arguments": { "filename": "/tmp/save" } }
1450# <- { "return": {} }
1451#
1452##
1453{ 'command': 'xen-save-devices-state',
1454  'data': {'filename': 'str', '*live':'bool' } }
1455
1456##
1457# @xen-set-replication:
1458#
1459# Enable or disable replication.
1460#
1461# @enable: true to enable, false to disable.
1462#
1463# @primary: true for primary or false for secondary.
1464#
1465# @failover: true to do failover, false to stop. but cannot be
1466#            specified if 'enable' is true. default value is false.
1467#
1468# Returns: nothing.
1469#
1470# Example:
1471#
1472# -> { "execute": "xen-set-replication",
1473#      "arguments": {"enable": true, "primary": false} }
1474# <- { "return": {} }
1475#
1476# Since: 2.9
1477##
1478{ 'command': 'xen-set-replication',
1479  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
1480  'if': 'defined(CONFIG_REPLICATION)' }
1481
1482##
1483# @ReplicationStatus:
1484#
1485# The result format for 'query-xen-replication-status'.
1486#
1487# @error: true if an error happened, false if replication is normal.
1488#
1489# @desc: the human readable error description string, when
1490#        @error is 'true'.
1491#
1492# Since: 2.9
1493##
1494{ 'struct': 'ReplicationStatus',
1495  'data': { 'error': 'bool', '*desc': 'str' },
1496  'if': 'defined(CONFIG_REPLICATION)' }
1497
1498##
1499# @query-xen-replication-status:
1500#
1501# Query replication status while the vm is running.
1502#
1503# Returns: A @ReplicationResult object showing the status.
1504#
1505# Example:
1506#
1507# -> { "execute": "query-xen-replication-status" }
1508# <- { "return": { "error": false } }
1509#
1510# Since: 2.9
1511##
1512{ 'command': 'query-xen-replication-status',
1513  'returns': 'ReplicationStatus',
1514  'if': 'defined(CONFIG_REPLICATION)' }
1515
1516##
1517# @xen-colo-do-checkpoint:
1518#
1519# Xen uses this command to notify replication to trigger a checkpoint.
1520#
1521# Returns: nothing.
1522#
1523# Example:
1524#
1525# -> { "execute": "xen-colo-do-checkpoint" }
1526# <- { "return": {} }
1527#
1528# Since: 2.9
1529##
1530{ 'command': 'xen-colo-do-checkpoint',
1531  'if': 'defined(CONFIG_REPLICATION)' }
1532
1533##
1534# @COLOStatus:
1535#
1536# The result format for 'query-colo-status'.
1537#
1538# @mode: COLO running mode. If COLO is running, this field will return
1539#        'primary' or 'secondary'.
1540#
1541# @last-mode: COLO last running mode. If COLO is running, this field
1542#             will return same like mode field, after failover we can
1543#             use this field to get last colo mode. (since 4.0)
1544#
1545# @reason: describes the reason for the COLO exit.
1546#
1547# Since: 3.1
1548##
1549{ 'struct': 'COLOStatus',
1550  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1551            'reason': 'COLOExitReason' } }
1552
1553##
1554# @query-colo-status:
1555#
1556# Query COLO status while the vm is running.
1557#
1558# Returns: A @COLOStatus object showing the status.
1559#
1560# Example:
1561#
1562# -> { "execute": "query-colo-status" }
1563# <- { "return": { "mode": "primary", "reason": "request" } }
1564#
1565# Since: 3.1
1566##
1567{ 'command': 'query-colo-status',
1568  'returns': 'COLOStatus' }
1569
1570##
1571# @migrate-recover:
1572#
1573# Provide a recovery migration stream URI.
1574#
1575# @uri: the URI to be used for the recovery of migration stream.
1576#
1577# Returns: nothing.
1578#
1579# Example:
1580#
1581# -> { "execute": "migrate-recover",
1582#      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1583# <- { "return": {} }
1584#
1585# Since: 3.0
1586##
1587{ 'command': 'migrate-recover',
1588  'data': { 'uri': 'str' },
1589  'allow-oob': true }
1590
1591##
1592# @migrate-pause:
1593#
1594# Pause a migration.  Currently it only supports postcopy.
1595#
1596# Returns: nothing.
1597#
1598# Example:
1599#
1600# -> { "execute": "migrate-pause" }
1601# <- { "return": {} }
1602#
1603# Since: 3.0
1604##
1605{ 'command': 'migrate-pause', 'allow-oob': true }
1606
1607##
1608# @UNPLUG_PRIMARY:
1609#
1610# Emitted from source side of a migration when migration state is
1611# WAIT_UNPLUG. Device was unplugged by guest operating system.
1612# Device resources in QEMU are kept on standby to be able to re-plug it in case
1613# of migration failure.
1614#
1615# @device-id: QEMU device id of the unplugged device
1616#
1617# Since: 4.2
1618#
1619# Example:
1620#   {"event": "UNPLUG_PRIMARY", "data": {"device-id": "hostdev0"} }
1621#
1622##
1623{ 'event': 'UNPLUG_PRIMARY',
1624  'data': { 'device-id': 'str' } }
1625