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