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