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