xref: /openbmc/qemu/qapi/migration.json (revision 4a9b31b8)
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 current mode.
927#
928# @none: COLO is disabled.
929#
930# @primary: COLO node in primary side.
931#
932# @secondary: COLO node in slave side.
933#
934# Since: 2.8
935##
936{ 'enum': 'COLOMode',
937  'data': [ 'none', '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# @COLO_EXIT:
961#
962# Emitted when VM finishes COLO mode due to some errors happening or
963# at the request of users.
964#
965# @mode: report COLO mode when COLO exited.
966#
967# @reason: describes the reason for the COLO exit.
968#
969# Since: 3.1
970#
971# Example:
972#
973# <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
974#      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
975#
976##
977{ 'event': 'COLO_EXIT',
978  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
979
980##
981# @COLOExitReason:
982#
983# The reason for a COLO exit
984#
985# @none: no failover has ever happened. This can't occur in the
986# COLO_EXIT event, only in the result of query-colo-status.
987#
988# @request: COLO exit is due to an external request
989#
990# @error: COLO exit is due to an internal error
991#
992# Since: 3.1
993##
994{ 'enum': 'COLOExitReason',
995  'data': [ 'none', 'request', 'error' ] }
996
997##
998# @x-colo-lost-heartbeat:
999#
1000# Tell qemu that heartbeat is lost, request it to do takeover procedures.
1001# If this command is sent to the PVM, the Primary side will exit COLO mode.
1002# If sent to the Secondary, the Secondary side will run failover work,
1003# then takes over server operation to become the service VM.
1004#
1005# Since: 2.8
1006#
1007# Example:
1008#
1009# -> { "execute": "x-colo-lost-heartbeat" }
1010# <- { "return": {} }
1011#
1012##
1013{ 'command': 'x-colo-lost-heartbeat' }
1014
1015##
1016# @migrate_cancel:
1017#
1018# Cancel the current executing migration process.
1019#
1020# Returns: nothing on success
1021#
1022# Notes: This command succeeds even if there is no migration process running.
1023#
1024# Since: 0.14.0
1025#
1026# Example:
1027#
1028# -> { "execute": "migrate_cancel" }
1029# <- { "return": {} }
1030#
1031##
1032{ 'command': 'migrate_cancel' }
1033
1034##
1035# @migrate-continue:
1036#
1037# Continue migration when it's in a paused state.
1038#
1039# @state: The state the migration is currently expected to be in
1040#
1041# Returns: nothing on success
1042# Since: 2.11
1043# Example:
1044#
1045# -> { "execute": "migrate-continue" , "arguments":
1046#      { "state": "pre-switchover" } }
1047# <- { "return": {} }
1048##
1049{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1050
1051##
1052# @migrate_set_downtime:
1053#
1054# Set maximum tolerated downtime for migration.
1055#
1056# @value: maximum downtime in seconds
1057#
1058# Returns: nothing on success
1059#
1060# Notes: This command is deprecated in favor of 'migrate-set-parameters'
1061#
1062# Since: 0.14.0
1063#
1064# Example:
1065#
1066# -> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
1067# <- { "return": {} }
1068#
1069##
1070{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'} }
1071
1072##
1073# @migrate_set_speed:
1074#
1075# Set maximum speed for migration.
1076#
1077# @value: maximum speed in bytes per second.
1078#
1079# Returns: nothing on success
1080#
1081# Notes: This command is deprecated in favor of 'migrate-set-parameters'
1082#
1083# Since: 0.14.0
1084#
1085# Example:
1086#
1087# -> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
1088# <- { "return": {} }
1089#
1090##
1091{ 'command': 'migrate_set_speed', 'data': {'value': 'int'} }
1092
1093##
1094# @migrate-set-cache-size:
1095#
1096# Set cache size to be used by XBZRLE migration
1097#
1098# @value: cache size in bytes
1099#
1100# The size will be rounded down to the nearest power of 2.
1101# The cache size can be modified before and during ongoing migration
1102#
1103# Returns: nothing on success
1104#
1105# Notes: This command is deprecated in favor of 'migrate-set-parameters'
1106#
1107# Since: 1.2
1108#
1109# Example:
1110#
1111# -> { "execute": "migrate-set-cache-size",
1112#      "arguments": { "value": 536870912 } }
1113# <- { "return": {} }
1114#
1115##
1116{ 'command': 'migrate-set-cache-size', 'data': {'value': 'int'} }
1117
1118##
1119# @query-migrate-cache-size:
1120#
1121# Query migration XBZRLE cache size
1122#
1123# Returns: XBZRLE cache size in bytes
1124#
1125# Notes: This command is deprecated in favor of 'query-migrate-parameters'
1126#
1127# Since: 1.2
1128#
1129# Example:
1130#
1131# -> { "execute": "query-migrate-cache-size" }
1132# <- { "return": 67108864 }
1133#
1134##
1135{ 'command': 'query-migrate-cache-size', 'returns': 'int' }
1136
1137##
1138# @migrate:
1139#
1140# Migrates the current running guest to another Virtual Machine.
1141#
1142# @uri: the Uniform Resource Identifier of the destination VM
1143#
1144# @blk: do block migration (full disk copy)
1145#
1146# @inc: incremental disk copy migration
1147#
1148# @detach: this argument exists only for compatibility reasons and
1149#          is ignored by QEMU
1150#
1151# @resume: resume one paused migration, default "off". (since 3.0)
1152#
1153# Returns: nothing on success
1154#
1155# Since: 0.14.0
1156#
1157# Notes:
1158#
1159# 1. The 'query-migrate' command should be used to check migration's progress
1160#    and final result (this information is provided by the 'status' member)
1161#
1162# 2. All boolean arguments default to false
1163#
1164# 3. The user Monitor's "detach" argument is invalid in QMP and should not
1165#    be used
1166#
1167# Example:
1168#
1169# -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1170# <- { "return": {} }
1171#
1172##
1173{ 'command': 'migrate',
1174  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
1175           '*detach': 'bool', '*resume': 'bool' } }
1176
1177##
1178# @migrate-incoming:
1179#
1180# Start an incoming migration, the qemu must have been started
1181# with -incoming defer
1182#
1183# @uri: The Uniform Resource Identifier identifying the source or
1184#       address to listen on
1185#
1186# Returns: nothing on success
1187#
1188# Since: 2.3
1189#
1190# Notes:
1191#
1192# 1. It's a bad idea to use a string for the uri, but it needs to stay
1193#    compatible with -incoming and the format of the uri is already exposed
1194#    above libvirt.
1195#
1196# 2. QEMU must be started with -incoming defer to allow migrate-incoming to
1197#    be used.
1198#
1199# 3. The uri format is the same as for -incoming
1200#
1201# Example:
1202#
1203# -> { "execute": "migrate-incoming",
1204#      "arguments": { "uri": "tcp::4446" } }
1205# <- { "return": {} }
1206#
1207##
1208{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
1209
1210##
1211# @xen-save-devices-state:
1212#
1213# Save the state of all devices to file. The RAM and the block devices
1214# of the VM are not saved by this command.
1215#
1216# @filename: the file to save the state of the devices to as binary
1217# data. See xen-save-devices-state.txt for a description of the binary
1218# format.
1219#
1220# @live: Optional argument to ask QEMU to treat this command as part of a live
1221# migration. Default to true. (since 2.11)
1222#
1223# Returns: Nothing on success
1224#
1225# Since: 1.1
1226#
1227# Example:
1228#
1229# -> { "execute": "xen-save-devices-state",
1230#      "arguments": { "filename": "/tmp/save" } }
1231# <- { "return": {} }
1232#
1233##
1234{ 'command': 'xen-save-devices-state',
1235  'data': {'filename': 'str', '*live':'bool' } }
1236
1237##
1238# @xen-set-replication:
1239#
1240# Enable or disable replication.
1241#
1242# @enable: true to enable, false to disable.
1243#
1244# @primary: true for primary or false for secondary.
1245#
1246# @failover: true to do failover, false to stop. but cannot be
1247#            specified if 'enable' is true. default value is false.
1248#
1249# Returns: nothing.
1250#
1251# Example:
1252#
1253# -> { "execute": "xen-set-replication",
1254#      "arguments": {"enable": true, "primary": false} }
1255# <- { "return": {} }
1256#
1257# Since: 2.9
1258##
1259{ 'command': 'xen-set-replication',
1260  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }
1261
1262##
1263# @ReplicationStatus:
1264#
1265# The result format for 'query-xen-replication-status'.
1266#
1267# @error: true if an error happened, false if replication is normal.
1268#
1269# @desc: the human readable error description string, when
1270#        @error is 'true'.
1271#
1272# Since: 2.9
1273##
1274{ 'struct': 'ReplicationStatus',
1275  'data': { 'error': 'bool', '*desc': 'str' } }
1276
1277##
1278# @query-xen-replication-status:
1279#
1280# Query replication status while the vm is running.
1281#
1282# Returns: A @ReplicationResult object showing the status.
1283#
1284# Example:
1285#
1286# -> { "execute": "query-xen-replication-status" }
1287# <- { "return": { "error": false } }
1288#
1289# Since: 2.9
1290##
1291{ 'command': 'query-xen-replication-status',
1292  'returns': 'ReplicationStatus' }
1293
1294##
1295# @xen-colo-do-checkpoint:
1296#
1297# Xen uses this command to notify replication to trigger a checkpoint.
1298#
1299# Returns: nothing.
1300#
1301# Example:
1302#
1303# -> { "execute": "xen-colo-do-checkpoint" }
1304# <- { "return": {} }
1305#
1306# Since: 2.9
1307##
1308{ 'command': 'xen-colo-do-checkpoint' }
1309
1310##
1311# @COLOStatus:
1312#
1313# The result format for 'query-colo-status'.
1314#
1315# @mode: COLO running mode. If COLO is running, this field will return
1316#        'primary' or 'secondary'.
1317#
1318# @reason: describes the reason for the COLO exit.
1319#
1320# Since: 3.0
1321##
1322{ 'struct': 'COLOStatus',
1323  'data': { 'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1324
1325##
1326# @query-colo-status:
1327#
1328# Query COLO status while the vm is running.
1329#
1330# Returns: A @COLOStatus object showing the status.
1331#
1332# Example:
1333#
1334# -> { "execute": "query-colo-status" }
1335# <- { "return": { "mode": "primary", "active": true, "reason": "request" } }
1336#
1337# Since: 3.0
1338##
1339{ 'command': 'query-colo-status',
1340  'returns': 'COLOStatus' }
1341
1342##
1343# @migrate-recover:
1344#
1345# Provide a recovery migration stream URI.
1346#
1347# @uri: the URI to be used for the recovery of migration stream.
1348#
1349# Returns: nothing.
1350#
1351# Example:
1352#
1353# -> { "execute": "migrate-recover",
1354#      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1355# <- { "return": {} }
1356#
1357# Since: 3.0
1358##
1359{ 'command': 'migrate-recover', 'data': { 'uri': 'str' },
1360  'allow-oob': true }
1361
1362##
1363# @migrate-pause:
1364#
1365# Pause a migration.  Currently it only supports postcopy.
1366#
1367# Returns: nothing.
1368#
1369# Example:
1370#
1371# -> { "execute": "migrate-pause" }
1372# <- { "return": {} }
1373#
1374# Since: 3.0
1375##
1376{ 'command': 'migrate-pause', 'allow-oob': true }
1377