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