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