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