xref: /openbmc/qemu/qapi/migration.json (revision 0a923be2)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# = Migration
7##
8
9{ 'include': 'common.json' }
10{ 'include': 'sockets.json' }
11
12##
13# @MigrationStats:
14#
15# Detailed migration status.
16#
17# @transferred: amount of bytes already transferred to the target VM
18#
19# @remaining: amount of bytes remaining to be transferred to the target VM
20#
21# @total: total amount of bytes involved in the migration process
22#
23# @duplicate: number of duplicate (zero) pages (since 1.2)
24#
25# @skipped: number of skipped zero pages (since 1.5)
26#
27# @normal: number of normal pages (since 1.2)
28#
29# @normal-bytes: number of normal bytes sent (since 1.2)
30#
31# @dirty-pages-rate: number of pages dirtied by second by the
32#                    guest (since 1.3)
33#
34# @mbps: throughput in megabits/sec. (since 1.6)
35#
36# @dirty-sync-count: number of times that dirty ram was synchronized (since 2.1)
37#
38# @postcopy-requests: The number of page requests received from the destination
39#                     (since 2.7)
40#
41# @page-size: The number of bytes per page for the various page-based
42#             statistics (since 2.10)
43#
44# @multifd-bytes: The number of bytes sent through multifd (since 3.0)
45#
46# @pages-per-second: the number of memory pages transferred per second
47#                    (Since 4.0)
48#
49# @precopy-bytes: The number of bytes sent in the pre-copy phase
50#                 (since 7.0).
51#
52# @downtime-bytes: The number of bytes sent while the guest is paused
53#                  (since 7.0).
54#
55# @postcopy-bytes: The number of bytes sent during the post-copy phase
56#                  (since 7.0).
57#
58# Since: 0.14
59##
60{ 'struct': 'MigrationStats',
61  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
62           'duplicate': 'int', 'skipped': 'int', 'normal': 'int',
63           'normal-bytes': 'int', 'dirty-pages-rate' : 'int',
64           'mbps' : 'number', 'dirty-sync-count' : 'int',
65           'postcopy-requests' : 'int', 'page-size' : 'int',
66           'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64',
67           'precopy-bytes' : 'uint64', 'downtime-bytes' : 'uint64',
68           'postcopy-bytes' : 'uint64' } }
69
70##
71# @XBZRLECacheStats:
72#
73# Detailed XBZRLE migration cache statistics
74#
75# @cache-size: XBZRLE cache size
76#
77# @bytes: amount of bytes already transferred to the target VM
78#
79# @pages: amount of pages transferred to the target VM
80#
81# @cache-miss: number of cache miss
82#
83# @cache-miss-rate: rate of cache miss (since 2.1)
84#
85# @encoding-rate: rate of encoded bytes (since 5.1)
86#
87# @overflow: number of overflows
88#
89# Since: 1.2
90##
91{ 'struct': 'XBZRLECacheStats',
92  'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
93           'cache-miss': 'int', 'cache-miss-rate': 'number',
94           'encoding-rate': 'number', 'overflow': 'int' } }
95
96##
97# @CompressionStats:
98#
99# Detailed migration compression statistics
100#
101# @pages: amount of pages compressed and transferred to the target VM
102#
103# @busy: count of times that no free thread was available to compress data
104#
105# @busy-rate: rate of thread busy
106#
107# @compressed-size: amount of bytes after compression
108#
109# @compression-rate: rate of compressed size
110#
111# Since: 3.1
112##
113{ 'struct': 'CompressionStats',
114  'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
115           'compressed-size': 'int', 'compression-rate': 'number' } }
116
117##
118# @MigrationStatus:
119#
120# An enumeration of migration status.
121#
122# @none: no migration has ever happened.
123#
124# @setup: migration process has been initiated.
125#
126# @cancelling: in the process of cancelling migration.
127#
128# @cancelled: cancelling migration is finished.
129#
130# @active: in the process of doing migration.
131#
132# @postcopy-active: like active, but now in postcopy mode. (since 2.5)
133#
134# @postcopy-paused: during postcopy but paused. (since 3.0)
135#
136# @postcopy-recover: trying to recover from a paused postcopy. (since 3.0)
137#
138# @completed: migration is finished.
139#
140# @failed: some error occurred during migration process.
141#
142# @colo: VM is in the process of fault tolerance, VM can not get into this
143#        state unless colo capability is enabled for migration. (since 2.8)
144#
145# @pre-switchover: Paused before device serialisation. (since 2.11)
146#
147# @device: During device serialisation when pause-before-switchover is enabled
148#          (since 2.11)
149#
150# @wait-unplug: wait for device unplug request by guest OS to be completed.
151#               (since 4.2)
152#
153# Since: 2.3
154#
155##
156{ 'enum': 'MigrationStatus',
157  'data': [ 'none', 'setup', 'cancelling', 'cancelled',
158            'active', 'postcopy-active', 'postcopy-paused',
159            'postcopy-recover', 'completed', 'failed', 'colo',
160            'pre-switchover', 'device', 'wait-unplug' ] }
161##
162# @VfioStats:
163#
164# Detailed VFIO devices migration statistics
165#
166# @transferred: amount of bytes transferred to the target VM by VFIO devices
167#
168# Since: 5.2
169#
170##
171{ 'struct': 'VfioStats',
172  'data': {'transferred': 'int' } }
173
174##
175# @MigrationInfo:
176#
177# Information about current migration process.
178#
179# @status: @MigrationStatus describing the current migration status.
180#          If this field is not returned, no migration process
181#          has been initiated
182#
183# @ram: @MigrationStats containing detailed migration
184#       status, only returned if status is 'active' or
185#       'completed'(since 1.2)
186#
187# @disk: @MigrationStats containing detailed disk migration
188#        status, only returned if status is 'active' and it is a block
189#        migration
190#
191# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
192#                migration statistics, only returned if XBZRLE feature is on and
193#                status is 'active' or 'completed' (since 1.2)
194#
195# @total-time: total amount of milliseconds since migration started.
196#              If migration has ended, it returns the total migration
197#              time. (since 1.2)
198#
199# @downtime: only present when migration finishes correctly
200#            total downtime in milliseconds for the guest.
201#            (since 1.3)
202#
203# @expected-downtime: only present while migration is active
204#                     expected downtime in milliseconds for the guest in last walk
205#                     of the dirty bitmap. (since 1.3)
206#
207# @setup-time: amount of setup time in milliseconds *before* the
208#              iterations begin but *after* the QMP command is issued. This is designed
209#              to provide an accounting of any activities (such as RDMA pinning) which
210#              may be expensive, but do not actually occur during the iterative
211#              migration rounds themselves. (since 1.6)
212#
213# @cpu-throttle-percentage: percentage of time guest cpus are being
214#                           throttled during auto-converge. This is only present when auto-converge
215#                           has started throttling guest cpus. (Since 2.7)
216#
217# @error-desc: the human readable error description string, when
218#              @status is 'failed'. Clients should not attempt to parse the
219#              error strings. (Since 2.7)
220#
221# @postcopy-blocktime: total time when all vCPU were blocked during postcopy
222#                      live migration. This is only present when the postcopy-blocktime
223#                      migration capability is enabled. (Since 3.0)
224#
225# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.  This is
226#                           only present when the postcopy-blocktime migration capability
227#                           is enabled. (Since 3.0)
228#
229# @compression: migration compression statistics, only returned if compression
230#               feature is on and status is 'active' or 'completed' (Since 3.1)
231#
232# @socket-address: Only used for tcp, to know what the real port is (Since 4.0)
233#
234# @vfio: @VfioStats containing detailed VFIO devices migration statistics,
235#        only returned if VFIO device is present, migration is supported by all
236#        VFIO devices and status is 'active' or 'completed' (since 5.2)
237#
238# @blocked-reasons: A list of reasons an outgoing migration is blocked.
239#                   Present and non-empty when migration is blocked.
240#                   (since 6.0)
241#
242# Since: 0.14
243##
244{ 'struct': 'MigrationInfo',
245  'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
246           '*disk': 'MigrationStats',
247           '*vfio': 'VfioStats',
248           '*xbzrle-cache': 'XBZRLECacheStats',
249           '*total-time': 'int',
250           '*expected-downtime': 'int',
251           '*downtime': 'int',
252           '*setup-time': 'int',
253           '*cpu-throttle-percentage': 'int',
254           '*error-desc': 'str',
255           '*blocked-reasons': ['str'],
256           '*postcopy-blocktime' : 'uint32',
257           '*postcopy-vcpu-blocktime': ['uint32'],
258           '*compression': 'CompressionStats',
259           '*socket-address': ['SocketAddress'] } }
260
261##
262# @query-migrate:
263#
264# Returns information about current migration process. If migration
265# is active there will be another json-object with RAM migration
266# status and if block migration is active another one with block
267# migration status.
268#
269# Returns: @MigrationInfo
270#
271# Since: 0.14
272#
273# Example:
274#
275# 1. Before the first migration
276#
277# -> { "execute": "query-migrate" }
278# <- { "return": {} }
279#
280# 2. Migration is done and has succeeded
281#
282# -> { "execute": "query-migrate" }
283# <- { "return": {
284#         "status": "completed",
285#         "total-time":12345,
286#         "setup-time":12345,
287#         "downtime":12345,
288#         "ram":{
289#           "transferred":123,
290#           "remaining":123,
291#           "total":246,
292#           "duplicate":123,
293#           "normal":123,
294#           "normal-bytes":123456,
295#           "dirty-sync-count":15
296#         }
297#      }
298#    }
299#
300# 3. Migration is done and has failed
301#
302# -> { "execute": "query-migrate" }
303# <- { "return": { "status": "failed" } }
304#
305# 4. Migration is being performed and is not a block migration:
306#
307# -> { "execute": "query-migrate" }
308# <- {
309#       "return":{
310#          "status":"active",
311#          "total-time":12345,
312#          "setup-time":12345,
313#          "expected-downtime":12345,
314#          "ram":{
315#             "transferred":123,
316#             "remaining":123,
317#             "total":246,
318#             "duplicate":123,
319#             "normal":123,
320#             "normal-bytes":123456,
321#             "dirty-sync-count":15
322#          }
323#       }
324#    }
325#
326# 5. Migration is being performed and is a block migration:
327#
328# -> { "execute": "query-migrate" }
329# <- {
330#       "return":{
331#          "status":"active",
332#          "total-time":12345,
333#          "setup-time":12345,
334#          "expected-downtime":12345,
335#          "ram":{
336#             "total":1057024,
337#             "remaining":1053304,
338#             "transferred":3720,
339#             "duplicate":123,
340#             "normal":123,
341#             "normal-bytes":123456,
342#             "dirty-sync-count":15
343#          },
344#          "disk":{
345#             "total":20971520,
346#             "remaining":20880384,
347#             "transferred":91136
348#          }
349#       }
350#    }
351#
352# 6. Migration is being performed and XBZRLE is active:
353#
354# -> { "execute": "query-migrate" }
355# <- {
356#       "return":{
357#          "status":"active",
358#          "total-time":12345,
359#          "setup-time":12345,
360#          "expected-downtime":12345,
361#          "ram":{
362#             "total":1057024,
363#             "remaining":1053304,
364#             "transferred":3720,
365#             "duplicate":10,
366#             "normal":3333,
367#             "normal-bytes":3412992,
368#             "dirty-sync-count":15
369#          },
370#          "xbzrle-cache":{
371#             "cache-size":67108864,
372#             "bytes":20971520,
373#             "pages":2444343,
374#             "cache-miss":2244,
375#             "cache-miss-rate":0.123,
376#             "encoding-rate":80.1,
377#             "overflow":34434
378#          }
379#       }
380#    }
381#
382##
383{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
384
385##
386# @MigrationCapability:
387#
388# Migration capabilities enumeration
389#
390# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
391#          This feature allows us to minimize migration traffic for certain work
392#          loads, by sending compressed difference of the pages
393#
394# @rdma-pin-all: Controls whether or not the entire VM memory footprint is
395#                mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage.
396#                Disabled by default. (since 2.0)
397#
398# @zero-blocks: During storage migration encode blocks of zeroes efficiently. This
399#               essentially saves 1MB of zeroes per block on the wire. Enabling requires
400#               source and target VM to support this feature. To enable it is sufficient
401#               to enable the capability on the source VM. The feature is disabled by
402#               default. (since 1.6)
403#
404# @compress: Use multiple compression threads to accelerate live migration.
405#            This feature can help to reduce the migration traffic, by sending
406#            compressed pages. Please note that if compress and xbzrle are both
407#            on, compress only takes effect in the ram bulk stage, after that,
408#            it will be disabled and only xbzrle takes effect, this can help to
409#            minimize migration traffic. The feature is disabled by default.
410#            (since 2.4 )
411#
412# @events: generate events for each migration state change
413#          (since 2.4 )
414#
415# @auto-converge: If enabled, QEMU will automatically throttle down the guest
416#                 to speed up convergence of RAM migration. (since 1.6)
417#
418# @postcopy-ram: Start executing on the migration target before all of RAM has
419#                been migrated, pulling the remaining pages along as needed. The
420#                capacity must have the same setting on both source and target
421#                or migration will not even start. NOTE: If the migration fails during
422#                postcopy the VM will fail.  (since 2.6)
423#
424# @x-colo: If enabled, migration will never end, and the state of the VM on the
425#          primary side will be migrated continuously to the VM on secondary
426#          side, this process is called COarse-Grain LOck Stepping (COLO) for
427#          Non-stop Service. (since 2.8)
428#
429# @release-ram: if enabled, qemu will free the migrated ram pages on the source
430#               during postcopy-ram migration. (since 2.9)
431#
432# @block: If enabled, QEMU will also migrate the contents of all block
433#         devices.  Default is disabled.  A possible alternative uses
434#         mirror jobs to a builtin NBD server on the destination, which
435#         offers more flexibility.
436#         (Since 2.10)
437#
438# @return-path: If enabled, migration will use the return path even
439#               for precopy. (since 2.10)
440#
441# @pause-before-switchover: Pause outgoing migration before serialising device
442#                           state and before disabling block IO (since 2.11)
443#
444# @multifd: Use more than one fd for migration (since 4.0)
445#
446# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
447#                 (since 2.12)
448#
449# @postcopy-blocktime: Calculate downtime for postcopy live migration
450#                      (since 3.0)
451#
452# @late-block-activate: If enabled, the destination will not activate block
453#                       devices (and thus take locks) immediately at the end of migration.
454#                       (since 3.0)
455#
456# @x-ignore-shared: If enabled, QEMU will not migrate shared memory (since 4.0)
457#
458# @validate-uuid: Send the UUID of the source to allow the destination
459#                 to ensure it is the same. (since 4.2)
460#
461# @background-snapshot: If enabled, the migration stream will be a snapshot
462#                       of the VM exactly at the point when the migration
463#                       procedure starts. The VM RAM is saved with running VM.
464#                       (since 6.0)
465#
466# Features:
467# @unstable: Members @x-colo and @x-ignore-shared are experimental.
468#
469# Since: 1.2
470##
471{ 'enum': 'MigrationCapability',
472  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
473           'compress', 'events', 'postcopy-ram',
474           { 'name': 'x-colo', 'features': [ 'unstable' ] },
475           'release-ram',
476           'block', 'return-path', 'pause-before-switchover', 'multifd',
477           'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
478           { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] },
479           'validate-uuid', 'background-snapshot'] }
480
481##
482# @MigrationCapabilityStatus:
483#
484# Migration capability information
485#
486# @capability: capability enum
487#
488# @state: capability state bool
489#
490# Since: 1.2
491##
492{ 'struct': 'MigrationCapabilityStatus',
493  'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }
494
495##
496# @migrate-set-capabilities:
497#
498# Enable/Disable the following migration capabilities (like xbzrle)
499#
500# @capabilities: json array of capability modifications to make
501#
502# Since: 1.2
503#
504# Example:
505#
506# -> { "execute": "migrate-set-capabilities" , "arguments":
507#      { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
508#
509##
510{ 'command': 'migrate-set-capabilities',
511  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
512
513##
514# @query-migrate-capabilities:
515#
516# Returns information about the current migration capabilities status
517#
518# Returns: @MigrationCapabilitiesStatus
519#
520# Since: 1.2
521#
522# Example:
523#
524# -> { "execute": "query-migrate-capabilities" }
525# <- { "return": [
526#       {"state": false, "capability": "xbzrle"},
527#       {"state": false, "capability": "rdma-pin-all"},
528#       {"state": false, "capability": "auto-converge"},
529#       {"state": false, "capability": "zero-blocks"},
530#       {"state": false, "capability": "compress"},
531#       {"state": true, "capability": "events"},
532#       {"state": false, "capability": "postcopy-ram"},
533#       {"state": false, "capability": "x-colo"}
534#    ]}
535#
536##
537{ 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}
538
539##
540# @MultiFDCompression:
541#
542# An enumeration of multifd compression methods.
543#
544# @none: no compression.
545# @zlib: use zlib compression method.
546# @zstd: use zstd compression method.
547#
548# Since: 5.0
549#
550##
551{ 'enum': 'MultiFDCompression',
552  'data': [ 'none', 'zlib',
553            { 'name': 'zstd', 'if': 'CONFIG_ZSTD' } ] }
554
555##
556# @BitmapMigrationBitmapAliasTransform:
557#
558# @persistent: If present, the bitmap will be made persistent
559#              or transient depending on this parameter.
560#
561# Since: 6.0
562##
563{ 'struct': 'BitmapMigrationBitmapAliasTransform',
564  'data': {
565      '*persistent': 'bool'
566  } }
567
568##
569# @BitmapMigrationBitmapAlias:
570#
571# @name: The name of the bitmap.
572#
573# @alias: An alias name for migration (for example the bitmap name on
574#         the opposite site).
575#
576# @transform: Allows the modification of the migrated bitmap.
577#             (since 6.0)
578#
579# Since: 5.2
580##
581{ 'struct': 'BitmapMigrationBitmapAlias',
582  'data': {
583      'name': 'str',
584      'alias': 'str',
585      '*transform': 'BitmapMigrationBitmapAliasTransform'
586  } }
587
588##
589# @BitmapMigrationNodeAlias:
590#
591# Maps a block node name and the bitmaps it has to aliases for dirty
592# bitmap migration.
593#
594# @node-name: A block node name.
595#
596# @alias: An alias block node name for migration (for example the
597#         node name on the opposite site).
598#
599# @bitmaps: Mappings for the bitmaps on this node.
600#
601# Since: 5.2
602##
603{ 'struct': 'BitmapMigrationNodeAlias',
604  'data': {
605      'node-name': 'str',
606      'alias': 'str',
607      'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
608  } }
609
610##
611# @MigrationParameter:
612#
613# Migration parameters enumeration
614#
615# @announce-initial: Initial delay (in milliseconds) before sending the first
616#                    announce (Since 4.0)
617#
618# @announce-max: Maximum delay (in milliseconds) between packets in the
619#                announcement (Since 4.0)
620#
621# @announce-rounds: Number of self-announce packets sent after migration
622#                   (Since 4.0)
623#
624# @announce-step: Increase in delay (in milliseconds) between subsequent
625#                 packets in the announcement (Since 4.0)
626#
627# @compress-level: Set the compression level to be used in live migration,
628#                  the compression level is an integer between 0 and 9, where 0 means
629#                  no compression, 1 means the best compression speed, and 9 means best
630#                  compression ratio which will consume more CPU.
631#
632# @compress-threads: Set compression thread count to be used in live migration,
633#                    the compression thread count is an integer between 1 and 255.
634#
635# @compress-wait-thread: Controls behavior when all compression threads are
636#                        currently busy. If true (default), wait for a free
637#                        compression thread to become available; otherwise,
638#                        send the page uncompressed. (Since 3.1)
639#
640# @decompress-threads: Set decompression thread count to be used in live
641#                      migration, the decompression thread count is an integer between 1
642#                      and 255. Usually, decompression is at least 4 times as fast as
643#                      compression, so set the decompress-threads to the number about 1/4
644#                      of compress-threads is adequate.
645#
646# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
647#                              to trigger throttling. It is expressed as percentage.
648#                              The default value is 50. (Since 5.0)
649#
650# @cpu-throttle-initial: Initial percentage of time guest cpus are throttled
651#                        when migration auto-converge is activated. The
652#                        default value is 20. (Since 2.7)
653#
654# @cpu-throttle-increment: throttle percentage increase each time
655#                          auto-converge detects that migration is not making
656#                          progress. The default value is 10. (Since 2.7)
657#
658# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
659#                         At the tail stage of throttling, the Guest is very
660#                         sensitive to CPU percentage while the @cpu-throttle
661#                         -increment is excessive usually at tail stage.
662#                         If this parameter is true, we will compute the ideal
663#                         CPU percentage used by the Guest, which may exactly make
664#                         the dirty rate match the dirty rate threshold. Then we
665#                         will choose a smaller throttle increment between the
666#                         one specified by @cpu-throttle-increment and the one
667#                         generated by ideal CPU percentage.
668#                         Therefore, it is compatible to traditional throttling,
669#                         meanwhile the throttle increment won't be excessive
670#                         at tail stage.
671#                         The default value is false. (Since 5.1)
672#
673# @tls-creds: ID of the 'tls-creds' object that provides credentials for
674#             establishing a TLS connection over the migration data channel.
675#             On the outgoing side of the migration, the credentials must
676#             be for a 'client' endpoint, while for the incoming side the
677#             credentials must be for a 'server' endpoint. Setting this
678#             will enable TLS for all migrations. The default is unset,
679#             resulting in unsecured migration at the QEMU level. (Since 2.7)
680#
681# @tls-hostname: hostname of the target host for the migration. This is
682#                required when using x509 based TLS credentials and the
683#                migration URI does not already include a hostname. For
684#                example if using fd: or exec: based migration, the
685#                hostname must be provided so that the server's x509
686#                certificate identity can be validated. (Since 2.7)
687#
688# @tls-authz: ID of the 'authz' object subclass that provides access control
689#             checking of the TLS x509 certificate distinguished name.
690#             This object is only resolved at time of use, so can be deleted
691#             and recreated on the fly while the migration server is active.
692#             If missing, it will default to denying access (Since 4.0)
693#
694# @max-bandwidth: to set maximum speed for migration. maximum speed in
695#                 bytes per second. (Since 2.8)
696#
697# @downtime-limit: set maximum tolerated downtime for migration. maximum
698#                  downtime in milliseconds (Since 2.8)
699#
700# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
701#                      periodic mode. (Since 2.8)
702#
703# @block-incremental: Affects how much storage is migrated when the
704#                     block migration capability is enabled.  When false, the entire
705#                     storage backing chain is migrated into a flattened image at
706#                     the destination; when true, only the active qcow2 layer is
707#                     migrated and the destination must already have access to the
708#                     same backing chain as was used on the source.  (since 2.10)
709#
710# @multifd-channels: Number of channels used to migrate data in
711#                    parallel. This is the same number that the
712#                    number of sockets used for migration.  The
713#                    default value is 2 (since 4.0)
714#
715# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
716#                     needs to be a multiple of the target page size
717#                     and a power of 2
718#                     (Since 2.11)
719#
720# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
721#                          Defaults to 0 (unlimited).  In bytes per second.
722#                          (Since 3.0)
723#
724# @max-cpu-throttle: maximum cpu throttle percentage.
725#                    Defaults to 99. (Since 3.1)
726#
727# @multifd-compression: Which compression method to use.
728#                       Defaults to none. (Since 5.0)
729#
730# @multifd-zlib-level: Set the compression level to be used in live
731#                      migration, the compression level is an integer between 0
732#                      and 9, where 0 means no compression, 1 means the best
733#                      compression speed, and 9 means best compression ratio which
734#                      will consume more CPU.
735#                      Defaults to 1. (Since 5.0)
736#
737# @multifd-zstd-level: Set the compression level to be used in live
738#                      migration, the compression level is an integer between 0
739#                      and 20, where 0 means no compression, 1 means the best
740#                      compression speed, and 20 means best compression ratio which
741#                      will consume more CPU.
742#                      Defaults to 1. (Since 5.0)
743#
744# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
745#                        aliases for the purpose of dirty bitmap migration.  Such
746#                        aliases may for example be the corresponding names on the
747#                        opposite site.
748#                        The mapping must be one-to-one, but not necessarily
749#                        complete: On the source, unmapped bitmaps and all bitmaps
750#                        on unmapped nodes will be ignored.  On the destination,
751#                        encountering an unmapped alias in the incoming migration
752#                        stream will result in a report, and all further bitmap
753#                        migration data will then be discarded.
754#                        Note that the destination does not know about bitmaps it
755#                        does not receive, so there is no limitation or requirement
756#                        regarding the number of bitmaps received, or how they are
757#                        named, or on which nodes they are placed.
758#                        By default (when this parameter has never been set), bitmap
759#                        names are mapped to themselves.  Nodes are mapped to their
760#                        block device name if there is one, and to their node name
761#                        otherwise. (Since 5.2)
762#
763# Features:
764# @unstable: Member @x-checkpoint-delay is experimental.
765#
766# Since: 2.4
767##
768{ 'enum': 'MigrationParameter',
769  'data': ['announce-initial', 'announce-max',
770           'announce-rounds', 'announce-step',
771           'compress-level', 'compress-threads', 'decompress-threads',
772           'compress-wait-thread', 'throttle-trigger-threshold',
773           'cpu-throttle-initial', 'cpu-throttle-increment',
774           'cpu-throttle-tailslow',
775           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
776           'downtime-limit',
777           { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
778           'block-incremental',
779           'multifd-channels',
780           'xbzrle-cache-size', 'max-postcopy-bandwidth',
781           'max-cpu-throttle', 'multifd-compression',
782           'multifd-zlib-level' ,'multifd-zstd-level',
783           'block-bitmap-mapping' ] }
784
785##
786# @MigrateSetParameters:
787#
788# @announce-initial: Initial delay (in milliseconds) before sending the first
789#                    announce (Since 4.0)
790#
791# @announce-max: Maximum delay (in milliseconds) between packets in the
792#                announcement (Since 4.0)
793#
794# @announce-rounds: Number of self-announce packets sent after migration
795#                   (Since 4.0)
796#
797# @announce-step: Increase in delay (in milliseconds) between subsequent
798#                 packets in the announcement (Since 4.0)
799#
800# @compress-level: compression level
801#
802# @compress-threads: compression thread count
803#
804# @compress-wait-thread: Controls behavior when all compression threads are
805#                        currently busy. If true (default), wait for a free
806#                        compression thread to become available; otherwise,
807#                        send the page uncompressed. (Since 3.1)
808#
809# @decompress-threads: decompression thread count
810#
811# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
812#                              to trigger throttling. It is expressed as percentage.
813#                              The default value is 50. (Since 5.0)
814#
815# @cpu-throttle-initial: Initial percentage of time guest cpus are
816#                        throttled when migration auto-converge is activated.
817#                        The default value is 20. (Since 2.7)
818#
819# @cpu-throttle-increment: throttle percentage increase each time
820#                          auto-converge detects that migration is not making
821#                          progress. The default value is 10. (Since 2.7)
822#
823# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
824#                         At the tail stage of throttling, the Guest is very
825#                         sensitive to CPU percentage while the @cpu-throttle
826#                         -increment is excessive usually at tail stage.
827#                         If this parameter is true, we will compute the ideal
828#                         CPU percentage used by the Guest, which may exactly make
829#                         the dirty rate match the dirty rate threshold. Then we
830#                         will choose a smaller throttle increment between the
831#                         one specified by @cpu-throttle-increment and the one
832#                         generated by ideal CPU percentage.
833#                         Therefore, it is compatible to traditional throttling,
834#                         meanwhile the throttle increment won't be excessive
835#                         at tail stage.
836#                         The default value is false. (Since 5.1)
837#
838# @tls-creds: ID of the 'tls-creds' object that provides credentials
839#             for establishing a TLS connection over the migration data
840#             channel. On the outgoing side of the migration, the credentials
841#             must be for a 'client' endpoint, while for the incoming side the
842#             credentials must be for a 'server' endpoint. Setting this
843#             to a non-empty string enables TLS for all migrations.
844#             An empty string means that QEMU will use plain text mode for
845#             migration, rather than TLS (Since 2.9)
846#             Previously (since 2.7), this was reported by omitting
847#             tls-creds instead.
848#
849# @tls-hostname: hostname of the target host for the migration. This
850#                is required when using x509 based TLS credentials and the
851#                migration URI does not already include a hostname. For
852#                example if using fd: or exec: based migration, the
853#                hostname must be provided so that the server's x509
854#                certificate identity can be validated. (Since 2.7)
855#                An empty string means that QEMU will use the hostname
856#                associated with the migration URI, if any. (Since 2.9)
857#                Previously (since 2.7), this was reported by omitting
858#                tls-hostname instead.
859#
860# @max-bandwidth: to set maximum speed for migration. maximum speed in
861#                 bytes per second. (Since 2.8)
862#
863# @downtime-limit: set maximum tolerated downtime for migration. maximum
864#                  downtime in milliseconds (Since 2.8)
865#
866# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
867#
868# @block-incremental: Affects how much storage is migrated when the
869#                     block migration capability is enabled.  When false, the entire
870#                     storage backing chain is migrated into a flattened image at
871#                     the destination; when true, only the active qcow2 layer is
872#                     migrated and the destination must already have access to the
873#                     same backing chain as was used on the source.  (since 2.10)
874#
875# @multifd-channels: Number of channels used to migrate data in
876#                    parallel. This is the same number that the
877#                    number of sockets used for migration.  The
878#                    default value is 2 (since 4.0)
879#
880# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
881#                     needs to be a multiple of the target page size
882#                     and a power of 2
883#                     (Since 2.11)
884#
885# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
886#                          Defaults to 0 (unlimited).  In bytes per second.
887#                          (Since 3.0)
888#
889# @max-cpu-throttle: maximum cpu throttle percentage.
890#                    The default value is 99. (Since 3.1)
891#
892# @multifd-compression: Which compression method to use.
893#                       Defaults to none. (Since 5.0)
894#
895# @multifd-zlib-level: Set the compression level to be used in live
896#                      migration, the compression level is an integer between 0
897#                      and 9, where 0 means no compression, 1 means the best
898#                      compression speed, and 9 means best compression ratio which
899#                      will consume more CPU.
900#                      Defaults to 1. (Since 5.0)
901#
902# @multifd-zstd-level: Set the compression level to be used in live
903#                      migration, the compression level is an integer between 0
904#                      and 20, where 0 means no compression, 1 means the best
905#                      compression speed, and 20 means best compression ratio which
906#                      will consume more CPU.
907#                      Defaults to 1. (Since 5.0)
908#
909# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
910#                        aliases for the purpose of dirty bitmap migration.  Such
911#                        aliases may for example be the corresponding names on the
912#                        opposite site.
913#                        The mapping must be one-to-one, but not necessarily
914#                        complete: On the source, unmapped bitmaps and all bitmaps
915#                        on unmapped nodes will be ignored.  On the destination,
916#                        encountering an unmapped alias in the incoming migration
917#                        stream will result in a report, and all further bitmap
918#                        migration data will then be discarded.
919#                        Note that the destination does not know about bitmaps it
920#                        does not receive, so there is no limitation or requirement
921#                        regarding the number of bitmaps received, or how they are
922#                        named, or on which nodes they are placed.
923#                        By default (when this parameter has never been set), bitmap
924#                        names are mapped to themselves.  Nodes are mapped to their
925#                        block device name if there is one, and to their node name
926#                        otherwise. (Since 5.2)
927#
928# Features:
929# @unstable: Member @x-checkpoint-delay is experimental.
930#
931# Since: 2.4
932##
933# TODO either fuse back into MigrationParameters, or make
934# MigrationParameters members mandatory
935{ 'struct': 'MigrateSetParameters',
936  'data': { '*announce-initial': 'size',
937            '*announce-max': 'size',
938            '*announce-rounds': 'size',
939            '*announce-step': 'size',
940            '*compress-level': 'uint8',
941            '*compress-threads': 'uint8',
942            '*compress-wait-thread': 'bool',
943            '*decompress-threads': 'uint8',
944            '*throttle-trigger-threshold': 'uint8',
945            '*cpu-throttle-initial': 'uint8',
946            '*cpu-throttle-increment': 'uint8',
947            '*cpu-throttle-tailslow': 'bool',
948            '*tls-creds': 'StrOrNull',
949            '*tls-hostname': 'StrOrNull',
950            '*tls-authz': 'StrOrNull',
951            '*max-bandwidth': 'size',
952            '*downtime-limit': 'uint64',
953            '*x-checkpoint-delay': { 'type': 'uint32',
954                                     'features': [ 'unstable' ] },
955            '*block-incremental': 'bool',
956            '*multifd-channels': 'uint8',
957            '*xbzrle-cache-size': 'size',
958            '*max-postcopy-bandwidth': 'size',
959            '*max-cpu-throttle': 'uint8',
960            '*multifd-compression': 'MultiFDCompression',
961            '*multifd-zlib-level': 'uint8',
962            '*multifd-zstd-level': 'uint8',
963            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
964
965##
966# @migrate-set-parameters:
967#
968# Set various migration parameters.
969#
970# Since: 2.4
971#
972# Example:
973#
974# -> { "execute": "migrate-set-parameters" ,
975#      "arguments": { "compress-level": 1 } }
976#
977##
978{ 'command': 'migrate-set-parameters', 'boxed': true,
979  'data': 'MigrateSetParameters' }
980
981##
982# @MigrationParameters:
983#
984# The optional members aren't actually optional.
985#
986# @announce-initial: Initial delay (in milliseconds) before sending the
987#                    first announce (Since 4.0)
988#
989# @announce-max: Maximum delay (in milliseconds) between packets in the
990#                announcement (Since 4.0)
991#
992# @announce-rounds: Number of self-announce packets sent after migration
993#                   (Since 4.0)
994#
995# @announce-step: Increase in delay (in milliseconds) between subsequent
996#                 packets in the announcement (Since 4.0)
997#
998# @compress-level: compression level
999#
1000# @compress-threads: compression thread count
1001#
1002# @compress-wait-thread: Controls behavior when all compression threads are
1003#                        currently busy. If true (default), wait for a free
1004#                        compression thread to become available; otherwise,
1005#                        send the page uncompressed. (Since 3.1)
1006#
1007# @decompress-threads: decompression thread count
1008#
1009# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
1010#                              to trigger throttling. It is expressed as percentage.
1011#                              The default value is 50. (Since 5.0)
1012#
1013# @cpu-throttle-initial: Initial percentage of time guest cpus are
1014#                        throttled when migration auto-converge is activated.
1015#                        (Since 2.7)
1016#
1017# @cpu-throttle-increment: throttle percentage increase each time
1018#                          auto-converge detects that migration is not making
1019#                          progress. (Since 2.7)
1020#
1021# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
1022#                         At the tail stage of throttling, the Guest is very
1023#                         sensitive to CPU percentage while the @cpu-throttle
1024#                         -increment is excessive usually at tail stage.
1025#                         If this parameter is true, we will compute the ideal
1026#                         CPU percentage used by the Guest, which may exactly make
1027#                         the dirty rate match the dirty rate threshold. Then we
1028#                         will choose a smaller throttle increment between the
1029#                         one specified by @cpu-throttle-increment and the one
1030#                         generated by ideal CPU percentage.
1031#                         Therefore, it is compatible to traditional throttling,
1032#                         meanwhile the throttle increment won't be excessive
1033#                         at tail stage.
1034#                         The default value is false. (Since 5.1)
1035#
1036# @tls-creds: ID of the 'tls-creds' object that provides credentials
1037#             for establishing a TLS connection over the migration data
1038#             channel. On the outgoing side of the migration, the credentials
1039#             must be for a 'client' endpoint, while for the incoming side the
1040#             credentials must be for a 'server' endpoint.
1041#             An empty string means that QEMU will use plain text mode for
1042#             migration, rather than TLS (Since 2.7)
1043#             Note: 2.8 reports this by omitting tls-creds instead.
1044#
1045# @tls-hostname: hostname of the target host for the migration. This
1046#                is required when using x509 based TLS credentials and the
1047#                migration URI does not already include a hostname. For
1048#                example if using fd: or exec: based migration, the
1049#                hostname must be provided so that the server's x509
1050#                certificate identity can be validated. (Since 2.7)
1051#                An empty string means that QEMU will use the hostname
1052#                associated with the migration URI, if any. (Since 2.9)
1053#                Note: 2.8 reports this by omitting tls-hostname instead.
1054#
1055# @tls-authz: ID of the 'authz' object subclass that provides access control
1056#             checking of the TLS x509 certificate distinguished name. (Since
1057#             4.0)
1058#
1059# @max-bandwidth: to set maximum speed for migration. maximum speed in
1060#                 bytes per second. (Since 2.8)
1061#
1062# @downtime-limit: set maximum tolerated downtime for migration. maximum
1063#                  downtime in milliseconds (Since 2.8)
1064#
1065# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
1066#
1067# @block-incremental: Affects how much storage is migrated when the
1068#                     block migration capability is enabled.  When false, the entire
1069#                     storage backing chain is migrated into a flattened image at
1070#                     the destination; when true, only the active qcow2 layer is
1071#                     migrated and the destination must already have access to the
1072#                     same backing chain as was used on the source.  (since 2.10)
1073#
1074# @multifd-channels: Number of channels used to migrate data in
1075#                    parallel. This is the same number that the
1076#                    number of sockets used for migration.
1077#                    The default value is 2 (since 4.0)
1078#
1079# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1080#                     needs to be a multiple of the target page size
1081#                     and a power of 2
1082#                     (Since 2.11)
1083#
1084# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
1085#                          Defaults to 0 (unlimited).  In bytes per second.
1086#                          (Since 3.0)
1087#
1088# @max-cpu-throttle: maximum cpu throttle percentage.
1089#                    Defaults to 99.
1090#                    (Since 3.1)
1091#
1092# @multifd-compression: Which compression method to use.
1093#                       Defaults to none. (Since 5.0)
1094#
1095# @multifd-zlib-level: Set the compression level to be used in live
1096#                      migration, the compression level is an integer between 0
1097#                      and 9, where 0 means no compression, 1 means the best
1098#                      compression speed, and 9 means best compression ratio which
1099#                      will consume more CPU.
1100#                      Defaults to 1. (Since 5.0)
1101#
1102# @multifd-zstd-level: Set the compression level to be used in live
1103#                      migration, the compression level is an integer between 0
1104#                      and 20, where 0 means no compression, 1 means the best
1105#                      compression speed, and 20 means best compression ratio which
1106#                      will consume more CPU.
1107#                      Defaults to 1. (Since 5.0)
1108#
1109# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1110#                        aliases for the purpose of dirty bitmap migration.  Such
1111#                        aliases may for example be the corresponding names on the
1112#                        opposite site.
1113#                        The mapping must be one-to-one, but not necessarily
1114#                        complete: On the source, unmapped bitmaps and all bitmaps
1115#                        on unmapped nodes will be ignored.  On the destination,
1116#                        encountering an unmapped alias in the incoming migration
1117#                        stream will result in a report, and all further bitmap
1118#                        migration data will then be discarded.
1119#                        Note that the destination does not know about bitmaps it
1120#                        does not receive, so there is no limitation or requirement
1121#                        regarding the number of bitmaps received, or how they are
1122#                        named, or on which nodes they are placed.
1123#                        By default (when this parameter has never been set), bitmap
1124#                        names are mapped to themselves.  Nodes are mapped to their
1125#                        block device name if there is one, and to their node name
1126#                        otherwise. (Since 5.2)
1127#
1128# Features:
1129# @unstable: Member @x-checkpoint-delay is experimental.
1130#
1131# Since: 2.4
1132##
1133{ 'struct': 'MigrationParameters',
1134  'data': { '*announce-initial': 'size',
1135            '*announce-max': 'size',
1136            '*announce-rounds': 'size',
1137            '*announce-step': 'size',
1138            '*compress-level': 'uint8',
1139            '*compress-threads': 'uint8',
1140            '*compress-wait-thread': 'bool',
1141            '*decompress-threads': 'uint8',
1142            '*throttle-trigger-threshold': 'uint8',
1143            '*cpu-throttle-initial': 'uint8',
1144            '*cpu-throttle-increment': 'uint8',
1145            '*cpu-throttle-tailslow': 'bool',
1146            '*tls-creds': 'str',
1147            '*tls-hostname': 'str',
1148            '*tls-authz': 'str',
1149            '*max-bandwidth': 'size',
1150            '*downtime-limit': 'uint64',
1151            '*x-checkpoint-delay': { 'type': 'uint32',
1152                                     'features': [ 'unstable' ] },
1153            '*block-incremental': 'bool',
1154            '*multifd-channels': 'uint8',
1155            '*xbzrle-cache-size': 'size',
1156            '*max-postcopy-bandwidth': 'size',
1157            '*max-cpu-throttle': 'uint8',
1158            '*multifd-compression': 'MultiFDCompression',
1159            '*multifd-zlib-level': 'uint8',
1160            '*multifd-zstd-level': 'uint8',
1161            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } }
1162
1163##
1164# @query-migrate-parameters:
1165#
1166# Returns information about the current migration parameters
1167#
1168# Returns: @MigrationParameters
1169#
1170# Since: 2.4
1171#
1172# Example:
1173#
1174# -> { "execute": "query-migrate-parameters" }
1175# <- { "return": {
1176#          "decompress-threads": 2,
1177#          "cpu-throttle-increment": 10,
1178#          "compress-threads": 8,
1179#          "compress-level": 1,
1180#          "cpu-throttle-initial": 20,
1181#          "max-bandwidth": 33554432,
1182#          "downtime-limit": 300
1183#       }
1184#    }
1185#
1186##
1187{ 'command': 'query-migrate-parameters',
1188  'returns': 'MigrationParameters' }
1189
1190##
1191# @client_migrate_info:
1192#
1193# Set migration information for remote display.  This makes the server
1194# ask the client to automatically reconnect using the new parameters
1195# once migration finished successfully.  Only implemented for SPICE.
1196#
1197# @protocol:     must be "spice"
1198# @hostname:     migration target hostname
1199# @port:         spice tcp port for plaintext channels
1200# @tls-port:     spice tcp port for tls-secured channels
1201# @cert-subject: server certificate subject
1202#
1203# Since: 0.14
1204#
1205# Example:
1206#
1207# -> { "execute": "client_migrate_info",
1208#      "arguments": { "protocol": "spice",
1209#                     "hostname": "virt42.lab.kraxel.org",
1210#                     "port": 1234 } }
1211# <- { "return": {} }
1212#
1213##
1214{ 'command': 'client_migrate_info',
1215  'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
1216            '*tls-port': 'int', '*cert-subject': 'str' } }
1217
1218##
1219# @migrate-start-postcopy:
1220#
1221# Followup to a migration command to switch the migration to postcopy mode.
1222# The postcopy-ram capability must be set on both source and destination
1223# before the original migration command.
1224#
1225# Since: 2.5
1226#
1227# Example:
1228#
1229# -> { "execute": "migrate-start-postcopy" }
1230# <- { "return": {} }
1231#
1232##
1233{ 'command': 'migrate-start-postcopy' }
1234
1235##
1236# @MIGRATION:
1237#
1238# Emitted when a migration event happens
1239#
1240# @status: @MigrationStatus describing the current migration status.
1241#
1242# Since: 2.4
1243#
1244# Example:
1245#
1246# <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1247#     "event": "MIGRATION",
1248#     "data": {"status": "completed"} }
1249#
1250##
1251{ 'event': 'MIGRATION',
1252  'data': {'status': 'MigrationStatus'}}
1253
1254##
1255# @MIGRATION_PASS:
1256#
1257# Emitted from the source side of a migration at the start of each pass
1258# (when it syncs the dirty bitmap)
1259#
1260# @pass: An incrementing count (starting at 1 on the first pass)
1261#
1262# Since: 2.6
1263#
1264# Example:
1265#
1266# { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1267#   "event": "MIGRATION_PASS", "data": {"pass": 2} }
1268#
1269##
1270{ 'event': 'MIGRATION_PASS',
1271  'data': { 'pass': 'int' } }
1272
1273##
1274# @COLOMessage:
1275#
1276# The message transmission between Primary side and Secondary side.
1277#
1278# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1279#
1280# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for checkpointing
1281#
1282# @checkpoint-reply: SVM gets PVM's checkpoint request
1283#
1284# @vmstate-send: VM's state will be sent by PVM.
1285#
1286# @vmstate-size: The total size of VMstate.
1287#
1288# @vmstate-received: VM's state has been received by SVM.
1289#
1290# @vmstate-loaded: VM's state has been loaded by SVM.
1291#
1292# Since: 2.8
1293##
1294{ 'enum': 'COLOMessage',
1295  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1296            'vmstate-send', 'vmstate-size', 'vmstate-received',
1297            'vmstate-loaded' ] }
1298
1299##
1300# @COLOMode:
1301#
1302# The COLO current mode.
1303#
1304# @none: COLO is disabled.
1305#
1306# @primary: COLO node in primary side.
1307#
1308# @secondary: COLO node in slave side.
1309#
1310# Since: 2.8
1311##
1312{ 'enum': 'COLOMode',
1313  'data': [ 'none', 'primary', 'secondary'] }
1314
1315##
1316# @FailoverStatus:
1317#
1318# An enumeration of COLO failover status
1319#
1320# @none: no failover has ever happened
1321#
1322# @require: got failover requirement but not handled
1323#
1324# @active: in the process of doing failover
1325#
1326# @completed: finish the process of failover
1327#
1328# @relaunch: restart the failover process, from 'none' -> 'completed' (Since 2.9)
1329#
1330# Since: 2.8
1331##
1332{ 'enum': 'FailoverStatus',
1333  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1334
1335##
1336# @COLO_EXIT:
1337#
1338# Emitted when VM finishes COLO mode due to some errors happening or
1339# at the request of users.
1340#
1341# @mode: report COLO mode when COLO exited.
1342#
1343# @reason: describes the reason for the COLO exit.
1344#
1345# Since: 3.1
1346#
1347# Example:
1348#
1349# <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1350#      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1351#
1352##
1353{ 'event': 'COLO_EXIT',
1354  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1355
1356##
1357# @COLOExitReason:
1358#
1359# The reason for a COLO exit.
1360#
1361# @none: failover has never happened. This state does not occur
1362#        in the COLO_EXIT event, and is only visible in the result of
1363#        query-colo-status.
1364#
1365# @request: COLO exit is due to an external request.
1366#
1367# @error: COLO exit is due to an internal error.
1368#
1369# @processing: COLO is currently handling a failover (since 4.0).
1370#
1371# Since: 3.1
1372##
1373{ 'enum': 'COLOExitReason',
1374  'data': [ 'none', 'request', 'error' , 'processing' ] }
1375
1376##
1377# @x-colo-lost-heartbeat:
1378#
1379# Tell qemu that heartbeat is lost, request it to do takeover procedures.
1380# If this command is sent to the PVM, the Primary side will exit COLO mode.
1381# If sent to the Secondary, the Secondary side will run failover work,
1382# then takes over server operation to become the service VM.
1383#
1384# Features:
1385# @unstable: This command is experimental.
1386#
1387# Since: 2.8
1388#
1389# Example:
1390#
1391# -> { "execute": "x-colo-lost-heartbeat" }
1392# <- { "return": {} }
1393#
1394##
1395{ 'command': 'x-colo-lost-heartbeat',
1396  'features': [ 'unstable' ] }
1397
1398##
1399# @migrate_cancel:
1400#
1401# Cancel the current executing migration process.
1402#
1403# Returns: nothing on success
1404#
1405# Notes: This command succeeds even if there is no migration process running.
1406#
1407# Since: 0.14
1408#
1409# Example:
1410#
1411# -> { "execute": "migrate_cancel" }
1412# <- { "return": {} }
1413#
1414##
1415{ 'command': 'migrate_cancel' }
1416
1417##
1418# @migrate-continue:
1419#
1420# Continue migration when it's in a paused state.
1421#
1422# @state: The state the migration is currently expected to be in
1423#
1424# Returns: nothing on success
1425# Since: 2.11
1426# Example:
1427#
1428# -> { "execute": "migrate-continue" , "arguments":
1429#      { "state": "pre-switchover" } }
1430# <- { "return": {} }
1431##
1432{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1433
1434##
1435# @migrate:
1436#
1437# Migrates the current running guest to another Virtual Machine.
1438#
1439# @uri: the Uniform Resource Identifier of the destination VM
1440#
1441# @blk: do block migration (full disk copy)
1442#
1443# @inc: incremental disk copy migration
1444#
1445# @detach: this argument exists only for compatibility reasons and
1446#          is ignored by QEMU
1447#
1448# @resume: resume one paused migration, default "off". (since 3.0)
1449#
1450# Returns: nothing on success
1451#
1452# Since: 0.14
1453#
1454# Notes:
1455#
1456# 1. The 'query-migrate' command should be used to check migration's progress
1457#    and final result (this information is provided by the 'status' member)
1458#
1459# 2. All boolean arguments default to false
1460#
1461# 3. The user Monitor's "detach" argument is invalid in QMP and should not
1462#    be used
1463#
1464# Example:
1465#
1466# -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1467# <- { "return": {} }
1468#
1469##
1470{ 'command': 'migrate',
1471  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
1472           '*detach': 'bool', '*resume': 'bool' } }
1473
1474##
1475# @migrate-incoming:
1476#
1477# Start an incoming migration, the qemu must have been started
1478# with -incoming defer
1479#
1480# @uri: The Uniform Resource Identifier identifying the source or
1481#       address to listen on
1482#
1483# Returns: nothing on success
1484#
1485# Since: 2.3
1486#
1487# Notes:
1488#
1489# 1. It's a bad idea to use a string for the uri, but it needs to stay
1490#    compatible with -incoming and the format of the uri is already exposed
1491#    above libvirt.
1492#
1493# 2. QEMU must be started with -incoming defer to allow migrate-incoming to
1494#    be used.
1495#
1496# 3. The uri format is the same as for -incoming
1497#
1498# Example:
1499#
1500# -> { "execute": "migrate-incoming",
1501#      "arguments": { "uri": "tcp::4446" } }
1502# <- { "return": {} }
1503#
1504##
1505{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
1506
1507##
1508# @xen-save-devices-state:
1509#
1510# Save the state of all devices to file. The RAM and the block devices
1511# of the VM are not saved by this command.
1512#
1513# @filename: the file to save the state of the devices to as binary
1514#            data. See xen-save-devices-state.txt for a description of the binary
1515#            format.
1516#
1517# @live: Optional argument to ask QEMU to treat this command as part of a live
1518#        migration. Default to true. (since 2.11)
1519#
1520# Returns: Nothing on success
1521#
1522# Since: 1.1
1523#
1524# Example:
1525#
1526# -> { "execute": "xen-save-devices-state",
1527#      "arguments": { "filename": "/tmp/save" } }
1528# <- { "return": {} }
1529#
1530##
1531{ 'command': 'xen-save-devices-state',
1532  'data': {'filename': 'str', '*live':'bool' } }
1533
1534##
1535# @xen-set-global-dirty-log:
1536#
1537# Enable or disable the global dirty log mode.
1538#
1539# @enable: true to enable, false to disable.
1540#
1541# Returns: nothing
1542#
1543# Since: 1.3
1544#
1545# Example:
1546#
1547# -> { "execute": "xen-set-global-dirty-log",
1548#      "arguments": { "enable": true } }
1549# <- { "return": {} }
1550#
1551##
1552{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1553
1554##
1555# @xen-load-devices-state:
1556#
1557# Load the state of all devices from file. The RAM and the block devices
1558# of the VM are not loaded by this command.
1559#
1560# @filename: the file to load the state of the devices from as binary
1561#            data. See xen-save-devices-state.txt for a description of the binary
1562#            format.
1563#
1564# Since: 2.7
1565#
1566# Example:
1567#
1568# -> { "execute": "xen-load-devices-state",
1569#      "arguments": { "filename": "/tmp/resume" } }
1570# <- { "return": {} }
1571#
1572##
1573{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1574
1575##
1576# @xen-set-replication:
1577#
1578# Enable or disable replication.
1579#
1580# @enable: true to enable, false to disable.
1581#
1582# @primary: true for primary or false for secondary.
1583#
1584# @failover: true to do failover, false to stop. but cannot be
1585#            specified if 'enable' is true. default value is false.
1586#
1587# Returns: nothing.
1588#
1589# Example:
1590#
1591# -> { "execute": "xen-set-replication",
1592#      "arguments": {"enable": true, "primary": false} }
1593# <- { "return": {} }
1594#
1595# Since: 2.9
1596##
1597{ 'command': 'xen-set-replication',
1598  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
1599  'if': 'CONFIG_REPLICATION' }
1600
1601##
1602# @ReplicationStatus:
1603#
1604# The result format for 'query-xen-replication-status'.
1605#
1606# @error: true if an error happened, false if replication is normal.
1607#
1608# @desc: the human readable error description string, when
1609#        @error is 'true'.
1610#
1611# Since: 2.9
1612##
1613{ 'struct': 'ReplicationStatus',
1614  'data': { 'error': 'bool', '*desc': 'str' },
1615  'if': 'CONFIG_REPLICATION' }
1616
1617##
1618# @query-xen-replication-status:
1619#
1620# Query replication status while the vm is running.
1621#
1622# Returns: A @ReplicationStatus object showing the status.
1623#
1624# Example:
1625#
1626# -> { "execute": "query-xen-replication-status" }
1627# <- { "return": { "error": false } }
1628#
1629# Since: 2.9
1630##
1631{ 'command': 'query-xen-replication-status',
1632  'returns': 'ReplicationStatus',
1633  'if': 'CONFIG_REPLICATION' }
1634
1635##
1636# @xen-colo-do-checkpoint:
1637#
1638# Xen uses this command to notify replication to trigger a checkpoint.
1639#
1640# Returns: nothing.
1641#
1642# Example:
1643#
1644# -> { "execute": "xen-colo-do-checkpoint" }
1645# <- { "return": {} }
1646#
1647# Since: 2.9
1648##
1649{ 'command': 'xen-colo-do-checkpoint',
1650  'if': 'CONFIG_REPLICATION' }
1651
1652##
1653# @COLOStatus:
1654#
1655# The result format for 'query-colo-status'.
1656#
1657# @mode: COLO running mode. If COLO is running, this field will return
1658#        'primary' or 'secondary'.
1659#
1660# @last-mode: COLO last running mode. If COLO is running, this field
1661#             will return same like mode field, after failover we can
1662#             use this field to get last colo mode. (since 4.0)
1663#
1664# @reason: describes the reason for the COLO exit.
1665#
1666# Since: 3.1
1667##
1668{ 'struct': 'COLOStatus',
1669  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1670            'reason': 'COLOExitReason' } }
1671
1672##
1673# @query-colo-status:
1674#
1675# Query COLO status while the vm is running.
1676#
1677# Returns: A @COLOStatus object showing the status.
1678#
1679# Example:
1680#
1681# -> { "execute": "query-colo-status" }
1682# <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
1683#
1684# Since: 3.1
1685##
1686{ 'command': 'query-colo-status',
1687  'returns': 'COLOStatus' }
1688
1689##
1690# @migrate-recover:
1691#
1692# Provide a recovery migration stream URI.
1693#
1694# @uri: the URI to be used for the recovery of migration stream.
1695#
1696# Returns: nothing.
1697#
1698# Example:
1699#
1700# -> { "execute": "migrate-recover",
1701#      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1702# <- { "return": {} }
1703#
1704# Since: 3.0
1705##
1706{ 'command': 'migrate-recover',
1707  'data': { 'uri': 'str' },
1708  'allow-oob': true }
1709
1710##
1711# @migrate-pause:
1712#
1713# Pause a migration.  Currently it only supports postcopy.
1714#
1715# Returns: nothing.
1716#
1717# Example:
1718#
1719# -> { "execute": "migrate-pause" }
1720# <- { "return": {} }
1721#
1722# Since: 3.0
1723##
1724{ 'command': 'migrate-pause', 'allow-oob': true }
1725
1726##
1727# @UNPLUG_PRIMARY:
1728#
1729# Emitted from source side of a migration when migration state is
1730# WAIT_UNPLUG. Device was unplugged by guest operating system.
1731# Device resources in QEMU are kept on standby to be able to re-plug it in case
1732# of migration failure.
1733#
1734# @device-id: QEMU device id of the unplugged device
1735#
1736# Since: 4.2
1737#
1738# Example:
1739# <- { "event": "UNPLUG_PRIMARY",
1740#      "data": { "device-id": "hostdev0" },
1741#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
1742#
1743##
1744{ 'event': 'UNPLUG_PRIMARY',
1745  'data': { 'device-id': 'str' } }
1746
1747##
1748# @DirtyRateVcpu:
1749#
1750# Dirty rate of vcpu.
1751#
1752# @id: vcpu index.
1753#
1754# @dirty-rate: dirty rate.
1755#
1756# Since: 6.2
1757#
1758##
1759{ 'struct': 'DirtyRateVcpu',
1760  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
1761
1762##
1763# @DirtyRateStatus:
1764#
1765# An enumeration of dirtyrate status.
1766#
1767# @unstarted: the dirtyrate thread has not been started.
1768#
1769# @measuring: the dirtyrate thread is measuring.
1770#
1771# @measured: the dirtyrate thread has measured and results are available.
1772#
1773# Since: 5.2
1774#
1775##
1776{ 'enum': 'DirtyRateStatus',
1777  'data': [ 'unstarted', 'measuring', 'measured'] }
1778
1779##
1780# @DirtyRateMeasureMode:
1781#
1782# An enumeration of mode of measuring dirtyrate.
1783#
1784# @page-sampling: calculate dirtyrate by sampling pages.
1785#
1786# @dirty-ring: calculate dirtyrate by dirty ring.
1787#
1788# @dirty-bitmap: calculate dirtyrate by dirty bitmap.
1789#
1790# Since: 6.2
1791#
1792##
1793{ 'enum': 'DirtyRateMeasureMode',
1794  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
1795
1796##
1797# @DirtyRateInfo:
1798#
1799# Information about current dirty page rate of vm.
1800#
1801# @dirty-rate: an estimate of the dirty page rate of the VM in units of
1802#              MB/s, present only when estimating the rate has completed.
1803#
1804# @status: status containing dirtyrate query status includes
1805#          'unstarted' or 'measuring' or 'measured'
1806#
1807# @start-time: start time in units of second for calculation
1808#
1809# @calc-time: time in units of second for sample dirty pages
1810#
1811# @sample-pages: page count per GB for sample dirty pages
1812#                the default value is 512 (since 6.1)
1813#
1814# @mode: mode containing method of calculate dirtyrate includes
1815#        'page-sampling' and 'dirty-ring' (Since 6.2)
1816#
1817# @vcpu-dirty-rate: dirtyrate for each vcpu if dirty-ring
1818#                   mode specified (Since 6.2)
1819#
1820# Since: 5.2
1821#
1822##
1823{ 'struct': 'DirtyRateInfo',
1824  'data': {'*dirty-rate': 'int64',
1825           'status': 'DirtyRateStatus',
1826           'start-time': 'int64',
1827           'calc-time': 'int64',
1828           'sample-pages': 'uint64',
1829           'mode': 'DirtyRateMeasureMode',
1830           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
1831
1832##
1833# @calc-dirty-rate:
1834#
1835# start calculating dirty page rate for vm
1836#
1837# @calc-time: time in units of second for sample dirty pages
1838#
1839# @sample-pages: page count per GB for sample dirty pages
1840#                the default value is 512 (since 6.1)
1841#
1842# @mode: mechanism of calculating dirtyrate includes
1843#        'page-sampling' and 'dirty-ring' (Since 6.1)
1844#
1845# Since: 5.2
1846#
1847# Example:
1848#   {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
1849#                                                'sample-pages': 512} }
1850#
1851##
1852{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
1853                                         '*sample-pages': 'int',
1854                                         '*mode': 'DirtyRateMeasureMode'} }
1855
1856##
1857# @query-dirty-rate:
1858#
1859# query dirty page rate in units of MB/s for vm
1860#
1861# Since: 5.2
1862##
1863{ 'command': 'query-dirty-rate', 'returns': 'DirtyRateInfo' }
1864
1865##
1866# @snapshot-save:
1867#
1868# Save a VM snapshot
1869#
1870# @job-id: identifier for the newly created job
1871# @tag: name of the snapshot to create
1872# @vmstate: block device node name to save vmstate to
1873# @devices: list of block device node names to save a snapshot to
1874#
1875# Applications should not assume that the snapshot save is complete
1876# when this command returns. The job commands / events must be used
1877# to determine completion and to fetch details of any errors that arise.
1878#
1879# Note that execution of the guest CPUs may be stopped during the
1880# time it takes to save the snapshot. A future version of QEMU
1881# may ensure CPUs are executing continuously.
1882#
1883# It is strongly recommended that @devices contain all writable
1884# block device nodes if a consistent snapshot is required.
1885#
1886# If @tag already exists, an error will be reported
1887#
1888# Returns: nothing
1889#
1890# Example:
1891#
1892# -> { "execute": "snapshot-save",
1893#      "arguments": {
1894#         "job-id": "snapsave0",
1895#         "tag": "my-snap",
1896#         "vmstate": "disk0",
1897#         "devices": ["disk0", "disk1"]
1898#      }
1899#    }
1900# <- { "return": { } }
1901# <- {"event": "JOB_STATUS_CHANGE",
1902#     "data": {"status": "created", "id": "snapsave0"}}
1903# <- {"event": "JOB_STATUS_CHANGE",
1904#     "data": {"status": "running", "id": "snapsave0"}}
1905# <- {"event": "STOP"}
1906# <- {"event": "RESUME"}
1907# <- {"event": "JOB_STATUS_CHANGE",
1908#     "data": {"status": "waiting", "id": "snapsave0"}}
1909# <- {"event": "JOB_STATUS_CHANGE",
1910#     "data": {"status": "pending", "id": "snapsave0"}}
1911# <- {"event": "JOB_STATUS_CHANGE",
1912#     "data": {"status": "concluded", "id": "snapsave0"}}
1913# -> {"execute": "query-jobs"}
1914# <- {"return": [{"current-progress": 1,
1915#                 "status": "concluded",
1916#                 "total-progress": 1,
1917#                 "type": "snapshot-save",
1918#                 "id": "snapsave0"}]}
1919#
1920# Since: 6.0
1921##
1922{ 'command': 'snapshot-save',
1923  'data': { 'job-id': 'str',
1924            'tag': 'str',
1925            'vmstate': 'str',
1926            'devices': ['str'] } }
1927
1928##
1929# @snapshot-load:
1930#
1931# Load a VM snapshot
1932#
1933# @job-id: identifier for the newly created job
1934# @tag: name of the snapshot to load.
1935# @vmstate: block device node name to load vmstate from
1936# @devices: list of block device node names to load a snapshot from
1937#
1938# Applications should not assume that the snapshot load is complete
1939# when this command returns. The job commands / events must be used
1940# to determine completion and to fetch details of any errors that arise.
1941#
1942# Note that execution of the guest CPUs will be stopped during the
1943# time it takes to load the snapshot.
1944#
1945# It is strongly recommended that @devices contain all writable
1946# block device nodes that can have changed since the original
1947# @snapshot-save command execution.
1948#
1949# Returns: nothing
1950#
1951# Example:
1952#
1953# -> { "execute": "snapshot-load",
1954#      "arguments": {
1955#         "job-id": "snapload0",
1956#         "tag": "my-snap",
1957#         "vmstate": "disk0",
1958#         "devices": ["disk0", "disk1"]
1959#      }
1960#    }
1961# <- { "return": { } }
1962# <- {"event": "JOB_STATUS_CHANGE",
1963#     "data": {"status": "created", "id": "snapload0"}}
1964# <- {"event": "JOB_STATUS_CHANGE",
1965#     "data": {"status": "running", "id": "snapload0"}}
1966# <- {"event": "STOP"}
1967# <- {"event": "RESUME"}
1968# <- {"event": "JOB_STATUS_CHANGE",
1969#     "data": {"status": "waiting", "id": "snapload0"}}
1970# <- {"event": "JOB_STATUS_CHANGE",
1971#     "data": {"status": "pending", "id": "snapload0"}}
1972# <- {"event": "JOB_STATUS_CHANGE",
1973#     "data": {"status": "concluded", "id": "snapload0"}}
1974# -> {"execute": "query-jobs"}
1975# <- {"return": [{"current-progress": 1,
1976#                 "status": "concluded",
1977#                 "total-progress": 1,
1978#                 "type": "snapshot-load",
1979#                 "id": "snapload0"}]}
1980#
1981# Since: 6.0
1982##
1983{ 'command': 'snapshot-load',
1984  'data': { 'job-id': 'str',
1985            'tag': 'str',
1986            'vmstate': 'str',
1987            'devices': ['str'] } }
1988
1989##
1990# @snapshot-delete:
1991#
1992# Delete a VM snapshot
1993#
1994# @job-id: identifier for the newly created job
1995# @tag: name of the snapshot to delete.
1996# @devices: list of block device node names to delete a snapshot from
1997#
1998# Applications should not assume that the snapshot delete is complete
1999# when this command returns. The job commands / events must be used
2000# to determine completion and to fetch details of any errors that arise.
2001#
2002# Returns: nothing
2003#
2004# Example:
2005#
2006# -> { "execute": "snapshot-delete",
2007#      "arguments": {
2008#         "job-id": "snapdelete0",
2009#         "tag": "my-snap",
2010#         "devices": ["disk0", "disk1"]
2011#      }
2012#    }
2013# <- { "return": { } }
2014# <- {"event": "JOB_STATUS_CHANGE",
2015#     "data": {"status": "created", "id": "snapdelete0"}}
2016# <- {"event": "JOB_STATUS_CHANGE",
2017#     "data": {"status": "running", "id": "snapdelete0"}}
2018# <- {"event": "JOB_STATUS_CHANGE",
2019#     "data": {"status": "waiting", "id": "snapdelete0"}}
2020# <- {"event": "JOB_STATUS_CHANGE",
2021#     "data": {"status": "pending", "id": "snapdelete0"}}
2022# <- {"event": "JOB_STATUS_CHANGE",
2023#     "data": {"status": "concluded", "id": "snapdelete0"}}
2024# -> {"execute": "query-jobs"}
2025# <- {"return": [{"current-progress": 1,
2026#                 "status": "concluded",
2027#                 "total-progress": 1,
2028#                 "type": "snapshot-delete",
2029#                 "id": "snapdelete0"}]}
2030#
2031# Since: 6.0
2032##
2033{ 'command': 'snapshot-delete',
2034  'data': { 'job-id': 'str',
2035            'tag': 'str',
2036            'devices': ['str'] } }
2037