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