xref: /openbmc/qemu/qapi/migration.json (revision 584f722eb3ab4896ce9e3913c49f4f22e8b51f2b)
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
20#     target VM
21#
22# @total: total amount of bytes involved in the migration process
23#
24# @duplicate: number of duplicate (zero) pages (since 1.2)
25#
26# @normal: number of normal pages (since 1.2)
27#
28# @normal-bytes: number of normal bytes sent (since 1.2)
29#
30# @dirty-pages-rate: number of pages dirtied by second by the guest
31#     (since 1.3)
32#
33# @mbps: throughput in megabits/sec.  (since 1.6)
34#
35# @dirty-sync-count: number of times that dirty ram was synchronized
36#     (since 2.1)
37#
38# @postcopy-requests: The number of page requests received from the
39#     destination (since 2.7)
40#
41# @page-size: The number of bytes per page for the various page-based
42#     statistics (since 2.10)
43#
44# @multifd-bytes: The number of bytes sent through multifd (since 3.0)
45#
46# @pages-per-second: the number of memory pages transferred per second
47#     (Since 4.0)
48#
49# @precopy-bytes: The number of bytes sent in the pre-copy phase
50#     (since 7.0).
51#
52# @downtime-bytes: The number of bytes sent while the guest is paused
53#     (since 7.0).
54#
55# @postcopy-bytes: The number of bytes sent during the post-copy phase
56#     (since 7.0).
57#
58# @dirty-sync-missed-zero-copy: Number of times dirty RAM
59#     synchronization could not avoid copying dirty pages.  This is
60#     between 0 and @dirty-sync-count * @multifd-channels.
61#     (since 7.1)
62#
63# Since: 0.14
64##
65{ 'struct': 'MigrationStats',
66  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
67           'duplicate': 'int',
68           'normal': 'int',
69           'normal-bytes': 'int', 'dirty-pages-rate': 'int',
70           'mbps': 'number', 'dirty-sync-count': 'int',
71           'postcopy-requests': 'int', 'page-size': 'int',
72           'multifd-bytes': 'uint64', 'pages-per-second': 'uint64',
73           'precopy-bytes': 'uint64', 'downtime-bytes': 'uint64',
74           'postcopy-bytes': 'uint64',
75           'dirty-sync-missed-zero-copy': 'uint64' } }
76
77##
78# @XBZRLECacheStats:
79#
80# Detailed XBZRLE migration cache statistics
81#
82# @cache-size: XBZRLE cache size
83#
84# @bytes: amount of bytes already transferred to the target VM
85#
86# @pages: amount of pages transferred to the target VM
87#
88# @cache-miss: number of cache miss
89#
90# @cache-miss-rate: rate of cache miss (since 2.1)
91#
92# @encoding-rate: rate of encoded bytes (since 5.1)
93#
94# @overflow: number of overflows
95#
96# Since: 1.2
97##
98{ 'struct': 'XBZRLECacheStats',
99  'data': {'cache-size': 'size', 'bytes': 'int', 'pages': 'int',
100           'cache-miss': 'int', 'cache-miss-rate': 'number',
101           'encoding-rate': 'number', 'overflow': 'int' } }
102
103##
104# @CompressionStats:
105#
106# Detailed migration compression statistics
107#
108# @pages: amount of pages compressed and transferred to the target VM
109#
110# @busy: count of times that no free thread was available to compress
111#     data
112#
113# @busy-rate: rate of thread busy
114#
115# @compressed-size: amount of bytes after compression
116#
117# @compression-rate: rate of compressed size
118#
119# Since: 3.1
120##
121{ 'struct': 'CompressionStats',
122  'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
123           'compressed-size': 'int', 'compression-rate': 'number' } }
124
125##
126# @MigrationStatus:
127#
128# An enumeration of migration status.
129#
130# @none: no migration has ever happened.
131#
132# @setup: migration process has been initiated.
133#
134# @cancelling: in the process of cancelling migration.
135#
136# @cancelled: cancelling migration is finished.
137#
138# @active: in the process of doing migration.
139#
140# @postcopy-active: like active, but now in postcopy mode.
141#     (since 2.5)
142#
143# @postcopy-paused: during postcopy but paused.  (since 3.0)
144#
145# @postcopy-recover-setup: setup phase for a postcopy recovery
146#     process, preparing for a recovery phase to start.  (since 9.1)
147#
148# @postcopy-recover: trying to recover from a paused postcopy.
149#     (since 3.0)
150#
151# @completed: migration is finished.
152#
153# @failed: some error occurred during migration process.
154#
155# @colo: VM is in the process of fault tolerance, VM can not get into
156#     this state unless colo capability is enabled for migration.
157#     (since 2.8)
158#
159# @pre-switchover: Paused before device serialisation.  (since 2.11)
160#
161# @device: During device serialisation (also known as switchover phase).
162#     Before 9.2, this is only used when (1) in precopy, and (2) when
163#     pre-switchover capability is enabled.  After 10.0, this state will
164#     always be present for every migration procedure as the switchover
165#     phase.  (since 2.11)
166#
167# @wait-unplug: wait for device unplug request by guest OS to be
168#     completed.  (since 4.2)
169#
170# Since: 2.3
171##
172{ 'enum': 'MigrationStatus',
173  'data': [ 'none', 'setup', 'cancelling', 'cancelled',
174            'active', 'postcopy-active', 'postcopy-paused',
175            'postcopy-recover-setup',
176            'postcopy-recover', 'completed', 'failed', 'colo',
177            'pre-switchover', 'device', 'wait-unplug' ] }
178##
179# @VfioStats:
180#
181# Detailed VFIO devices migration statistics
182#
183# @transferred: amount of bytes transferred to the target VM by VFIO
184#     devices
185#
186# Since: 5.2
187##
188{ 'struct': 'VfioStats',
189  'data': {'transferred': 'int' } }
190
191##
192# @MigrationInfo:
193#
194# Information about current migration process.
195#
196# @status: @MigrationStatus describing the current migration status.
197#     If this field is not returned, no migration process has been
198#     initiated
199#
200# @ram: @MigrationStats containing detailed migration status, only
201#     returned if status is 'active' or 'completed'(since 1.2)
202#
203# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
204#     migration statistics, only returned if XBZRLE feature is on and
205#     status is 'active' or 'completed' (since 1.2)
206#
207# @total-time: total amount of milliseconds since migration started.
208#     If migration has ended, it returns the total migration time.
209#     (since 1.2)
210#
211# @downtime: only present when migration finishes correctly total
212#     downtime in milliseconds for the guest.  (since 1.3)
213#
214# @expected-downtime: only present while migration is active expected
215#     downtime in milliseconds for the guest in last walk of the dirty
216#     bitmap.  (since 1.3)
217#
218# @setup-time: amount of setup time in milliseconds *before* the
219#     iterations begin but *after* the QMP command is issued.  This is
220#     designed to provide an accounting of any activities (such as
221#     RDMA pinning) which may be expensive, but do not actually occur
222#     during the iterative migration rounds themselves.  (since 1.6)
223#
224# @cpu-throttle-percentage: percentage of time guest cpus are being
225#     throttled during auto-converge.  This is only present when
226#     auto-converge has started throttling guest cpus.  (Since 2.7)
227#
228# @error-desc: the human readable error description string.  Clients
229#     should not attempt to parse the error strings.  (Since 2.7)
230#
231# @postcopy-blocktime: total time when all vCPU were blocked during
232#     postcopy live migration.  This is only present when the
233#     postcopy-blocktime migration capability is enabled.  (Since 3.0)
234#
235# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.
236#     This is only present when the postcopy-blocktime migration
237#     capability is enabled.  (Since 3.0)
238#
239# @socket-address: Only used for tcp, to know what the real port is
240#     (Since 4.0)
241#
242# @vfio: @VfioStats containing detailed VFIO devices migration
243#     statistics, only returned if VFIO device is present, migration
244#     is supported by all VFIO devices and status is 'active' or
245#     'completed' (since 5.2)
246#
247# @blocked-reasons: A list of reasons an outgoing migration is
248#     blocked.  Present and non-empty when migration is blocked.
249#     (since 6.0)
250#
251# @dirty-limit-throttle-time-per-round: Maximum throttle time (in
252#     microseconds) of virtual CPUs each dirty ring full round, which
253#     shows how MigrationCapability dirty-limit affects the guest
254#     during live migration.  (Since 8.1)
255#
256# @dirty-limit-ring-full-time: Estimated average dirty ring full time
257#     (in microseconds) for each dirty ring full round.  The value
258#     equals the dirty ring memory size divided by the average dirty
259#     page rate of the virtual CPU, which can be used to observe the
260#     average memory load of the virtual CPU indirectly.  Note that
261#     zero means guest doesn't dirty memory.  (Since 8.1)
262#
263# Since: 0.14
264##
265{ 'struct': 'MigrationInfo',
266  'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
267           '*vfio': 'VfioStats',
268           '*xbzrle-cache': 'XBZRLECacheStats',
269           '*total-time': 'int',
270           '*expected-downtime': 'int',
271           '*downtime': 'int',
272           '*setup-time': 'int',
273           '*cpu-throttle-percentage': 'int',
274           '*error-desc': 'str',
275           '*blocked-reasons': ['str'],
276           '*postcopy-blocktime': 'uint32',
277           '*postcopy-vcpu-blocktime': ['uint32'],
278           '*socket-address': ['SocketAddress'],
279           '*dirty-limit-throttle-time-per-round': 'uint64',
280           '*dirty-limit-ring-full-time': 'uint64'} }
281
282##
283# @query-migrate:
284#
285# Return information about current migration process.  If migration
286# is active there will be another json-object with RAM migration
287# status.
288#
289# Returns: @MigrationInfo
290#
291# Since: 0.14
292#
293# .. qmp-example::
294#    :title: Before the first migration
295#
296#     -> { "execute": "query-migrate" }
297#     <- { "return": {} }
298#
299# .. qmp-example::
300#    :title: Migration is done and has succeeded
301#
302#     -> { "execute": "query-migrate" }
303#     <- { "return": {
304#             "status": "completed",
305#             "total-time":12345,
306#             "setup-time":12345,
307#             "downtime":12345,
308#             "ram":{
309#               "transferred":123,
310#               "remaining":123,
311#               "total":246,
312#               "duplicate":123,
313#               "normal":123,
314#               "normal-bytes":123456,
315#               "dirty-sync-count":15
316#             }
317#          }
318#        }
319#
320# .. qmp-example::
321#    :title: Migration is done and has failed
322#
323#     -> { "execute": "query-migrate" }
324#     <- { "return": { "status": "failed" } }
325#
326# .. qmp-example::
327#    :title: Migration is being performed
328#
329#     -> { "execute": "query-migrate" }
330#     <- {
331#           "return":{
332#              "status":"active",
333#              "total-time":12345,
334#              "setup-time":12345,
335#              "expected-downtime":12345,
336#              "ram":{
337#                 "transferred":123,
338#                 "remaining":123,
339#                 "total":246,
340#                 "duplicate":123,
341#                 "normal":123,
342#                 "normal-bytes":123456,
343#                 "dirty-sync-count":15
344#              }
345#           }
346#        }
347#
348# .. qmp-example::
349#    :title: Migration is being performed and XBZRLE is active
350#
351#     -> { "execute": "query-migrate" }
352#     <- {
353#           "return":{
354#              "status":"active",
355#              "total-time":12345,
356#              "setup-time":12345,
357#              "expected-downtime":12345,
358#              "ram":{
359#                 "total":1057024,
360#                 "remaining":1053304,
361#                 "transferred":3720,
362#                 "duplicate":10,
363#                 "normal":3333,
364#                 "normal-bytes":3412992,
365#                 "dirty-sync-count":15
366#              },
367#              "xbzrle-cache":{
368#                 "cache-size":67108864,
369#                 "bytes":20971520,
370#                 "pages":2444343,
371#                 "cache-miss":2244,
372#                 "cache-miss-rate":0.123,
373#                 "encoding-rate":80.1,
374#                 "overflow":34434
375#              }
376#           }
377#        }
378##
379{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
380
381##
382# @MigrationCapability:
383#
384# Migration capabilities enumeration
385#
386# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length
387#     Encoding).  This feature allows us to minimize migration traffic
388#     for certain work loads, by sending compressed difference of the
389#     pages
390#
391# @rdma-pin-all: Controls whether or not the entire VM memory
392#     footprint is mlock()'d on demand or all at once.  Refer to
393#     docs/rdma.txt for usage.  Disabled by default.  (since 2.0)
394#
395# @zero-blocks: During storage migration encode blocks of zeroes
396#     efficiently.  This essentially saves 1MB of zeroes per block on
397#     the wire.  Enabling requires source and target VM to support
398#     this feature.  To enable it is sufficient to enable the
399#     capability on the source VM.  The feature is disabled by
400#     default.  (since 1.6)
401#
402# @events: generate events for each migration state change (since 2.4)
403#
404# @auto-converge: If enabled, QEMU will automatically throttle down
405#     the guest to speed up convergence of RAM migration.  (since 1.6)
406#
407# @postcopy-ram: Start executing on the migration target before all of
408#     RAM has been migrated, pulling the remaining pages along as
409#     needed.  The capacity must have the same setting on both source
410#     and target or migration will not even start.  **Note:** if the
411#     migration fails during postcopy the VM will fail.  (since 2.6)
412#
413# @x-colo: If enabled, migration will never end, and the state of the
414#     VM on the primary side will be migrated continuously to the VM
415#     on secondary side, this process is called COarse-Grain LOck
416#     Stepping (COLO) for Non-stop Service.  (since 2.8)
417#
418# @release-ram: if enabled, QEMU will free the migrated ram pages on
419#     the source during postcopy-ram migration.  (since 2.9)
420#
421# @return-path: If enabled, migration will use the return path even
422#     for precopy.  (since 2.10)
423#
424# @pause-before-switchover: Pause outgoing migration before
425#     serialising device state and before disabling block IO
426#     (since 2.11)
427#
428# @multifd: Use more than one fd for migration (since 4.0)
429#
430# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
431#     (since 2.12)
432#
433# @postcopy-blocktime: Calculate downtime for postcopy live migration
434#     (since 3.0)
435#
436# @late-block-activate: If enabled, the destination will not activate
437#     block devices (and thus take locks) immediately at the end of
438#     migration.  (since 3.0)
439#
440# @x-ignore-shared: If enabled, QEMU will not migrate shared memory
441#     that is accessible on the destination machine.  (since 4.0)
442#
443# @validate-uuid: Send the UUID of the source to allow the destination
444#     to ensure it is the same.  (since 4.2)
445#
446# @background-snapshot: If enabled, the migration stream will be a
447#     snapshot of the VM exactly at the point when the migration
448#     procedure starts.  The VM RAM is saved with running VM.
449#     (since 6.0)
450#
451# @zero-copy-send: Controls behavior on sending memory pages on
452#     migration.  When true, enables a zero-copy mechanism for sending
453#     memory pages, if host supports it.  Requires that QEMU be
454#     permitted to use locked memory for guest RAM pages.  (since 7.1)
455#
456# @postcopy-preempt: If enabled, the migration process will allow
457#     postcopy requests to preempt precopy stream, so postcopy
458#     requests will be handled faster.  This is a performance feature
459#     and should not affect the correctness of postcopy migration.
460#     (since 7.1)
461#
462# @switchover-ack: If enabled, migration will not stop the source VM
463#     and complete the migration until an ACK is received from the
464#     destination that it's OK to do so.  Exactly when this ACK is
465#     sent depends on the migrated devices that use this feature.  For
466#     example, a device can use it to make sure some of its data is
467#     sent and loaded in the destination before doing switchover.
468#     This can reduce downtime if devices that support this capability
469#     are present.  'return-path' capability must be enabled to use
470#     it.  (since 8.1)
471#
472# @dirty-limit: If enabled, migration will throttle vCPUs as needed to
473#     keep their dirty page rate within @vcpu-dirty-limit.  This can
474#     improve responsiveness of large guests during live migration,
475#     and can result in more stable read performance.  Requires KVM
476#     with accelerator property "dirty-ring-size" set.  (Since 8.1)
477#
478# @mapped-ram: Migrate using fixed offsets in the migration file for
479#     each RAM page.  Requires a migration URI that supports seeking,
480#     such as a file.  (since 9.0)
481#
482# Features:
483#
484# @unstable: Members @x-colo and @x-ignore-shared are experimental.
485# @deprecated: Member @zero-blocks is deprecated as being part of
486#     block migration which was already removed.
487#
488# Since: 1.2
489##
490{ 'enum': 'MigrationCapability',
491  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge',
492           { 'name': 'zero-blocks', 'features': [ 'deprecated' ] },
493           'events', 'postcopy-ram',
494           { 'name': 'x-colo', 'features': [ 'unstable' ] },
495           'release-ram',
496           'return-path', 'pause-before-switchover', 'multifd',
497           'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
498           { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] },
499           'validate-uuid', 'background-snapshot',
500           'zero-copy-send', 'postcopy-preempt', 'switchover-ack',
501           'dirty-limit', 'mapped-ram'] }
502
503##
504# @MigrationCapabilityStatus:
505#
506# Migration capability information
507#
508# @capability: capability enum
509#
510# @state: capability state bool
511#
512# Since: 1.2
513##
514{ 'struct': 'MigrationCapabilityStatus',
515  'data': { 'capability': 'MigrationCapability', 'state': 'bool' } }
516
517##
518# @migrate-set-capabilities:
519#
520# Enable/Disable the following migration capabilities (like xbzrle)
521#
522# @capabilities: json array of capability modifications to make
523#
524# Since: 1.2
525#
526# .. qmp-example::
527#
528#     -> { "execute": "migrate-set-capabilities" , "arguments":
529#          { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
530#     <- { "return": {} }
531##
532{ 'command': 'migrate-set-capabilities',
533  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
534
535##
536# @query-migrate-capabilities:
537#
538# Return information about the current migration capabilities status
539#
540# Returns: @MigrationCapabilityStatus
541#
542# Since: 1.2
543#
544# .. qmp-example::
545#
546#     -> { "execute": "query-migrate-capabilities" }
547#     <- { "return": [
548#           {"state": false, "capability": "xbzrle"},
549#           {"state": false, "capability": "rdma-pin-all"},
550#           {"state": false, "capability": "auto-converge"},
551#           {"state": false, "capability": "zero-blocks"},
552#           {"state": true, "capability": "events"},
553#           {"state": false, "capability": "postcopy-ram"},
554#           {"state": false, "capability": "x-colo"}
555#        ]}
556##
557{ 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}
558
559##
560# @MultiFDCompression:
561#
562# An enumeration of multifd compression methods.
563#
564# @none: no compression.
565#
566# @zlib: use zlib compression method.
567#
568# @zstd: use zstd compression method.
569#
570# @qatzip: use qatzip compression method.  (Since 9.2)
571#
572# @qpl: use qpl compression method.  Query Processing Library(qpl) is
573#     based on the deflate compression algorithm and use the Intel
574#     In-Memory Analytics Accelerator(IAA) accelerated compression and
575#     decompression.  (Since 9.1)
576#
577# @uadk: use UADK library compression method.  (Since 9.1)
578#
579# Since: 5.0
580##
581{ 'enum': 'MultiFDCompression',
582  'prefix': 'MULTIFD_COMPRESSION',
583  'data': [ 'none', 'zlib',
584            { 'name': 'zstd', 'if': 'CONFIG_ZSTD' },
585            { 'name': 'qatzip', 'if': 'CONFIG_QATZIP'},
586            { 'name': 'qpl', 'if': 'CONFIG_QPL' },
587            { 'name': 'uadk', 'if': 'CONFIG_UADK' } ] }
588
589##
590# @MigMode:
591#
592# @normal: the original form of migration.  (since 8.2)
593#
594# @cpr-reboot: The migrate command stops the VM and saves state to the
595#     URI.  After quitting QEMU, the user resumes by running QEMU
596#     -incoming.
597#
598#     This mode allows the user to quit QEMU, optionally update and
599#     reboot the OS, and restart QEMU.  If the user reboots, the URI
600#     must persist across the reboot, such as by using a file.
601#
602#     Unlike normal mode, the use of certain local storage options
603#     does not block the migration, but the user must not modify the
604#     contents of guest block devices between the quit and restart.
605#
606#     This mode supports VFIO devices provided the user first puts the
607#     guest in the suspended runstate, such as by issuing
608#     guest-suspend-ram to the QEMU guest agent.
609#
610#     Best performance is achieved when the memory backend is shared
611#     and the @x-ignore-shared migration capability is set, but this
612#     is not required.  Further, if the user reboots before restarting
613#     such a configuration, the shared memory must persist across the
614#     reboot, such as by backing it with a dax device.
615#
616#     @cpr-reboot may not be used with postcopy, background-snapshot,
617#     or COLO.
618#
619#     (since 8.2)
620#
621# @cpr-transfer: This mode allows the user to transfer a guest to a
622#     new QEMU instance on the same host with minimal guest pause
623#     time by preserving guest RAM in place.
624#
625#     Devices and their pinned pages are also preserved for VFIO and
626#     IOMMUFD. (since 10.1)
627#
628#     The user starts new QEMU on the same host as old QEMU, with
629#     command-line arguments to create the same machine, plus the
630#     -incoming option for the main migration channel, like normal
631#     live migration.  In addition, the user adds a second -incoming
632#     option with channel type "cpr".  This CPR channel must support
633#     file descriptor transfer with SCM_RIGHTS, i.e. it must be a
634#     UNIX domain socket.
635#
636#     To initiate CPR, the user issues a migrate command to old QEMU,
637#     adding a second migration channel of type "cpr" in the channels
638#     argument.  Old QEMU stops the VM, saves state to the migration
639#     channels, and enters the postmigrate state.  Execution resumes
640#     in new QEMU.
641#
642#     New QEMU reads the CPR channel before opening a monitor, hence
643#     the CPR channel cannot be specified in the list of channels for
644#     a migrate-incoming command.  It may only be specified on the
645#     command line.
646#
647#     The main channel address cannot be a file type, and for an
648#     inet socket, the port cannot be 0 (meaning dynamically choose
649#     a port).
650#
651#     Memory-backend objects must have the share=on attribute, but
652#     memory-backend-epc is not supported.  The VM must be started
653#     with the '-machine aux-ram-share=on' option.
654#
655#     When using -incoming defer, you must issue the migrate command
656#     to old QEMU before issuing any monitor commands to new QEMU.
657#     However, new QEMU does not open and read the migration stream
658#     until you issue the migrate incoming command.
659#
660#     (since 10.0)
661##
662{ 'enum': 'MigMode',
663  'data': [ 'normal', 'cpr-reboot', 'cpr-transfer' ] }
664
665##
666# @ZeroPageDetection:
667#
668# @none: Do not perform zero page checking.
669#
670# @legacy: Perform zero page checking in main migration thread.
671#
672# @multifd: Perform zero page checking in multifd sender thread if
673#     multifd migration is enabled, else in the main migration thread
674#     as for @legacy.
675#
676# Since: 9.0
677##
678{ 'enum': 'ZeroPageDetection',
679  'data': [ 'none', 'legacy', 'multifd' ] }
680
681##
682# @BitmapMigrationBitmapAliasTransform:
683#
684# @persistent: If present, the bitmap will be made persistent or
685#     transient depending on this parameter.
686#
687# Since: 6.0
688##
689{ 'struct': 'BitmapMigrationBitmapAliasTransform',
690  'data': {
691      '*persistent': 'bool'
692  } }
693
694##
695# @BitmapMigrationBitmapAlias:
696#
697# @name: The name of the bitmap.
698#
699# @alias: An alias name for migration (for example the bitmap name on
700#     the opposite site).
701#
702# @transform: Allows the modification of the migrated bitmap.
703#     (since 6.0)
704#
705# Since: 5.2
706##
707{ 'struct': 'BitmapMigrationBitmapAlias',
708  'data': {
709      'name': 'str',
710      'alias': 'str',
711      '*transform': 'BitmapMigrationBitmapAliasTransform'
712  } }
713
714##
715# @BitmapMigrationNodeAlias:
716#
717# Maps a block node name and the bitmaps it has to aliases for dirty
718# bitmap migration.
719#
720# @node-name: A block node name.
721#
722# @alias: An alias block node name for migration (for example the node
723#     name on the opposite site).
724#
725# @bitmaps: Mappings for the bitmaps on this node.
726#
727# Since: 5.2
728##
729{ 'struct': 'BitmapMigrationNodeAlias',
730  'data': {
731      'node-name': 'str',
732      'alias': 'str',
733      'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
734  } }
735
736##
737# @MigrationParameter:
738#
739# Migration parameters enumeration
740#
741# @announce-initial: Initial delay (in milliseconds) before sending
742#     the first announce (Since 4.0)
743#
744# @announce-max: Maximum delay (in milliseconds) between packets in
745#     the announcement (Since 4.0)
746#
747# @announce-rounds: Number of self-announce packets sent after
748#     migration (Since 4.0)
749#
750# @announce-step: Increase in delay (in milliseconds) between
751#     subsequent packets in the announcement (Since 4.0)
752#
753# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
754#     bytes_xfer_period to trigger throttling.  It is expressed as
755#     percentage.  The default value is 50.  (Since 5.0)
756#
757# @cpu-throttle-initial: Initial percentage of time guest cpus are
758#     throttled when migration auto-converge is activated.  The
759#     default value is 20.  (Since 2.7)
760#
761# @cpu-throttle-increment: throttle percentage increase each time
762#     auto-converge detects that migration is not making progress.
763#     The default value is 10.  (Since 2.7)
764#
765# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage.
766#     At the tail stage of throttling, the Guest is very sensitive to
767#     CPU percentage while the @cpu-throttle -increment is excessive
768#     usually at tail stage.  If this parameter is true, we will
769#     compute the ideal CPU percentage used by the Guest, which may
770#     exactly make the dirty rate match the dirty rate threshold.
771#     Then we will choose a smaller throttle increment between the one
772#     specified by @cpu-throttle-increment and the one generated by
773#     ideal CPU percentage.  Therefore, it is compatible to
774#     traditional throttling, meanwhile the throttle increment won't
775#     be excessive at tail stage.  The default value is false.
776#     (Since 5.1)
777#
778# @tls-creds: ID of the 'tls-creds' object that provides credentials
779#     for establishing a TLS connection over the migration data
780#     channel.  On the outgoing side of the migration, the credentials
781#     must be for a 'client' endpoint, while for the incoming side the
782#     credentials must be for a 'server' endpoint.  Setting this to a
783#     non-empty string enables TLS for all migrations.  An empty
784#     string means that QEMU will use plain text mode for migration,
785#     rather than TLS.  (Since 2.7)
786#
787# @tls-hostname: migration target's hostname for validating the
788#     server's x509 certificate identity.  If empty, QEMU will use the
789#     hostname from the migration URI, if any.  A non-empty value is
790#     required when using x509 based TLS credentials and the migration
791#     URI does not include a hostname, such as fd: or exec: based
792#     migration.  (Since 2.7)
793#
794#     Note: empty value works only since 2.9.
795#
796# @tls-authz: ID of the 'authz' object subclass that provides access
797#     control checking of the TLS x509 certificate distinguished name.
798#     This object is only resolved at time of use, so can be deleted
799#     and recreated on the fly while the migration server is active.
800#     If missing, it will default to denying access (Since 4.0)
801#
802# @max-bandwidth: maximum speed for migration, in bytes per second.
803#     (Since 2.8)
804#
805# @avail-switchover-bandwidth: to set the available bandwidth that
806#     migration can use during switchover phase.  **Note:** this does
807#     not limit the bandwidth during switchover, but only for
808#     calculations when making decisions to switchover.  By default,
809#     this value is zero, which means QEMU will estimate the bandwidth
810#     automatically.  This can be set when the estimated value is not
811#     accurate, while the user is able to guarantee such bandwidth is
812#     available when switching over.  When specified correctly, this
813#     can make the switchover decision much more accurate.
814#     (Since 8.2)
815#
816# @downtime-limit: set maximum tolerated downtime for migration.
817#     maximum downtime in milliseconds (Since 2.8)
818#
819# @x-checkpoint-delay: The delay time (in ms) between two COLO
820#     checkpoints in periodic mode.  (Since 2.8)
821#
822# @multifd-channels: Number of channels used to migrate data in
823#     parallel.  This is the same number that the number of sockets
824#     used for migration.  The default value is 2 (since 4.0)
825#
826# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
827#     needs to be a multiple of the target page size and a power of 2
828#     (Since 2.11)
829#
830# @max-postcopy-bandwidth: Background transfer bandwidth during
831#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
832#     (Since 3.0)
833#
834# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
835#     (Since 3.1)
836#
837# @multifd-compression: Which compression method to use.  Defaults to
838#     none.  (Since 5.0)
839#
840# @multifd-zlib-level: Set the compression level to be used in live
841#     migration, the compression level is an integer between 0 and 9,
842#     where 0 means no compression, 1 means the best compression
843#     speed, and 9 means best compression ratio which will consume
844#     more CPU.  Defaults to 1.  (Since 5.0)
845#
846# @multifd-qatzip-level: Set the compression level to be used in live
847#     migration.  The level is an integer between 1 and 9, where 1 means
848#     the best compression speed, and 9 means the best compression
849#     ratio which will consume more CPU.  Defaults to 1.  (Since 9.2)
850#
851# @multifd-zstd-level: Set the compression level to be used in live
852#     migration, the compression level is an integer between 0 and 20,
853#     where 0 means no compression, 1 means the best compression
854#     speed, and 20 means best compression ratio which will consume
855#     more CPU.  Defaults to 1.  (Since 5.0)
856#
857# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
858#     aliases for the purpose of dirty bitmap migration.  Such aliases
859#     may for example be the corresponding names on the opposite site.
860#     The mapping must be one-to-one, but not necessarily complete: On
861#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
862#     will be ignored.  On the destination, encountering an unmapped
863#     alias in the incoming migration stream will result in a report,
864#     and all further bitmap migration data will then be discarded.
865#     Note that the destination does not know about bitmaps it does
866#     not receive, so there is no limitation or requirement regarding
867#     the number of bitmaps received, or how they are named, or on
868#     which nodes they are placed.  By default (when this parameter
869#     has never been set), bitmap names are mapped to themselves.
870#     Nodes are mapped to their block device name if there is one, and
871#     to their node name otherwise.  (Since 5.2)
872#
873# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
874#     limit during live migration.  Should be in the range 1 to
875#     1000ms.  Defaults to 1000ms.  (Since 8.1)
876#
877# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
878#     Defaults to 1.  (Since 8.1)
879#
880# @mode: Migration mode.  See description in @MigMode.  Default is
881#     'normal'.  (Since 8.2)
882#
883# @zero-page-detection: Whether and how to detect zero pages.
884#     See description in @ZeroPageDetection.  Default is 'multifd'.
885#     (since 9.0)
886#
887# @direct-io: Open migration files with O_DIRECT when possible.  This
888#     only has effect if the @mapped-ram capability is enabled.
889#     (Since 9.1)
890#
891# Features:
892#
893# @unstable: Members @x-checkpoint-delay and
894#     @x-vcpu-dirty-limit-period are experimental.
895#
896# Since: 2.4
897##
898{ 'enum': 'MigrationParameter',
899  'data': ['announce-initial', 'announce-max',
900           'announce-rounds', 'announce-step',
901           'throttle-trigger-threshold',
902           'cpu-throttle-initial', 'cpu-throttle-increment',
903           'cpu-throttle-tailslow',
904           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
905           'avail-switchover-bandwidth', 'downtime-limit',
906           { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
907           'multifd-channels',
908           'xbzrle-cache-size', 'max-postcopy-bandwidth',
909           'max-cpu-throttle', 'multifd-compression',
910           'multifd-zlib-level', 'multifd-zstd-level',
911           'multifd-qatzip-level',
912           'block-bitmap-mapping',
913           { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
914           'vcpu-dirty-limit',
915           'mode',
916           'zero-page-detection',
917           'direct-io'] }
918
919##
920# @MigrateSetParameters:
921#
922# @announce-initial: Initial delay (in milliseconds) before sending
923#     the first announce (Since 4.0)
924#
925# @announce-max: Maximum delay (in milliseconds) between packets in
926#     the announcement (Since 4.0)
927#
928# @announce-rounds: Number of self-announce packets sent after
929#     migration (Since 4.0)
930#
931# @announce-step: Increase in delay (in milliseconds) between
932#     subsequent packets in the announcement (Since 4.0)
933#
934# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
935#     bytes_xfer_period to trigger throttling.  It is expressed as
936#     percentage.  The default value is 50.  (Since 5.0)
937#
938# @cpu-throttle-initial: Initial percentage of time guest cpus are
939#     throttled when migration auto-converge is activated.  The
940#     default value is 20.  (Since 2.7)
941#
942# @cpu-throttle-increment: throttle percentage increase each time
943#     auto-converge detects that migration is not making progress.
944#     The default value is 10.  (Since 2.7)
945#
946# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage.
947#     At the tail stage of throttling, the Guest is very sensitive to
948#     CPU percentage while the @cpu-throttle -increment is excessive
949#     usually at tail stage.  If this parameter is true, we will
950#     compute the ideal CPU percentage used by the Guest, which may
951#     exactly make the dirty rate match the dirty rate threshold.
952#     Then we will choose a smaller throttle increment between the one
953#     specified by @cpu-throttle-increment and the one generated by
954#     ideal CPU percentage.  Therefore, it is compatible to
955#     traditional throttling, meanwhile the throttle increment won't
956#     be excessive at tail stage.  The default value is false.
957#     (Since 5.1)
958#
959# @tls-creds: ID of the 'tls-creds' object that provides credentials
960#     for establishing a TLS connection over the migration data
961#     channel.  On the outgoing side of the migration, the credentials
962#     must be for a 'client' endpoint, while for the incoming side the
963#     credentials must be for a 'server' endpoint.  Setting this to a
964#     non-empty string enables TLS for all migrations.  An empty
965#     string means that QEMU will use plain text mode for migration,
966#     rather than TLS.  This is the default.  (Since 2.7)
967#
968# @tls-hostname: migration target's hostname for validating the
969#     server's x509 certificate identity.  If empty, QEMU will use the
970#     hostname from the migration URI, if any.  A non-empty value is
971#     required when using x509 based TLS credentials and the migration
972#     URI does not include a hostname, such as fd: or exec: based
973#     migration.  (Since 2.7)
974#
975#     Note: empty value works only since 2.9.
976#
977# @tls-authz: ID of the 'authz' object subclass that provides access
978#     control checking of the TLS x509 certificate distinguished name.
979#     This object is only resolved at time of use, so can be deleted
980#     and recreated on the fly while the migration server is active.
981#     If missing, it will default to denying access (Since 4.0)
982#
983# @max-bandwidth: maximum speed for migration, in bytes per second.
984#     (Since 2.8)
985#
986# @avail-switchover-bandwidth: to set the available bandwidth that
987#     migration can use during switchover phase.  **Note:** this does
988#     not limit the bandwidth during switchover, but only for
989#     calculations when making decisions to switchover.  By default,
990#     this value is zero, which means QEMU will estimate the bandwidth
991#     automatically.  This can be set when the estimated value is not
992#     accurate, while the user is able to guarantee such bandwidth is
993#     available when switching over.  When specified correctly, this
994#     can make the switchover decision much more accurate.
995#     (Since 8.2)
996#
997# @downtime-limit: set maximum tolerated downtime for migration.
998#     maximum downtime in milliseconds (Since 2.8)
999#
1000# @x-checkpoint-delay: The delay time (in ms) between two COLO
1001#     checkpoints in periodic mode.  (Since 2.8)
1002#
1003# @multifd-channels: Number of channels used to migrate data in
1004#     parallel.  This is the same number that the number of sockets
1005#     used for migration.  The default value is 2 (since 4.0)
1006#
1007# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1008#     needs to be a multiple of the target page size and a power of 2
1009#     (Since 2.11)
1010#
1011# @max-postcopy-bandwidth: Background transfer bandwidth during
1012#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1013#     (Since 3.0)
1014#
1015# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1016#     (Since 3.1)
1017#
1018# @multifd-compression: Which compression method to use.  Defaults to
1019#     none.  (Since 5.0)
1020#
1021# @multifd-zlib-level: Set the compression level to be used in live
1022#     migration, the compression level is an integer between 0 and 9,
1023#     where 0 means no compression, 1 means the best compression
1024#     speed, and 9 means best compression ratio which will consume
1025#     more CPU.  Defaults to 1.  (Since 5.0)
1026#
1027# @multifd-qatzip-level: Set the compression level to be used in live
1028#     migration.  The level is an integer between 1 and 9, where 1 means
1029#     the best compression speed, and 9 means the best compression
1030#     ratio which will consume more CPU.  Defaults to 1.  (Since 9.2)
1031#
1032# @multifd-zstd-level: Set the compression level to be used in live
1033#     migration, the compression level is an integer between 0 and 20,
1034#     where 0 means no compression, 1 means the best compression
1035#     speed, and 20 means best compression ratio which will consume
1036#     more CPU.  Defaults to 1.  (Since 5.0)
1037#
1038# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1039#     aliases for the purpose of dirty bitmap migration.  Such aliases
1040#     may for example be the corresponding names on the opposite site.
1041#     The mapping must be one-to-one, but not necessarily complete: On
1042#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1043#     will be ignored.  On the destination, encountering an unmapped
1044#     alias in the incoming migration stream will result in a report,
1045#     and all further bitmap migration data will then be discarded.
1046#     Note that the destination does not know about bitmaps it does
1047#     not receive, so there is no limitation or requirement regarding
1048#     the number of bitmaps received, or how they are named, or on
1049#     which nodes they are placed.  By default (when this parameter
1050#     has never been set), bitmap names are mapped to themselves.
1051#     Nodes are mapped to their block device name if there is one, and
1052#     to their node name otherwise.  (Since 5.2)
1053#
1054# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1055#     limit during live migration.  Should be in the range 1 to
1056#     1000ms.  Defaults to 1000ms.  (Since 8.1)
1057#
1058# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1059#     Defaults to 1.  (Since 8.1)
1060#
1061# @mode: Migration mode.  See description in @MigMode.  Default is
1062#     'normal'.  (Since 8.2)
1063#
1064# @zero-page-detection: Whether and how to detect zero pages.
1065#     See description in @ZeroPageDetection.  Default is 'multifd'.
1066#     (since 9.0)
1067#
1068# @direct-io: Open migration files with O_DIRECT when possible.  This
1069#     only has effect if the @mapped-ram capability is enabled.
1070#     (Since 9.1)
1071#
1072# Features:
1073#
1074# @unstable: Members @x-checkpoint-delay and
1075#     @x-vcpu-dirty-limit-period are experimental.
1076#
1077# TODO: either fuse back into MigrationParameters, or make
1078#     MigrationParameters members mandatory
1079#
1080# Since: 2.4
1081##
1082{ 'struct': 'MigrateSetParameters',
1083  'data': { '*announce-initial': 'size',
1084            '*announce-max': 'size',
1085            '*announce-rounds': 'size',
1086            '*announce-step': 'size',
1087            '*throttle-trigger-threshold': 'uint8',
1088            '*cpu-throttle-initial': 'uint8',
1089            '*cpu-throttle-increment': 'uint8',
1090            '*cpu-throttle-tailslow': 'bool',
1091            '*tls-creds': 'StrOrNull',
1092            '*tls-hostname': 'StrOrNull',
1093            '*tls-authz': 'StrOrNull',
1094            '*max-bandwidth': 'size',
1095            '*avail-switchover-bandwidth': 'size',
1096            '*downtime-limit': 'uint64',
1097            '*x-checkpoint-delay': { 'type': 'uint32',
1098                                     'features': [ 'unstable' ] },
1099            '*multifd-channels': 'uint8',
1100            '*xbzrle-cache-size': 'size',
1101            '*max-postcopy-bandwidth': 'size',
1102            '*max-cpu-throttle': 'uint8',
1103            '*multifd-compression': 'MultiFDCompression',
1104            '*multifd-zlib-level': 'uint8',
1105            '*multifd-qatzip-level': 'uint8',
1106            '*multifd-zstd-level': 'uint8',
1107            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1108            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1109                                            'features': [ 'unstable' ] },
1110            '*vcpu-dirty-limit': 'uint64',
1111            '*mode': 'MigMode',
1112            '*zero-page-detection': 'ZeroPageDetection',
1113            '*direct-io': 'bool' } }
1114
1115##
1116# @migrate-set-parameters:
1117#
1118# Set various migration parameters.
1119#
1120# Since: 2.4
1121#
1122# .. qmp-example::
1123#
1124#     -> { "execute": "migrate-set-parameters" ,
1125#          "arguments": { "multifd-channels": 5 } }
1126#     <- { "return": {} }
1127##
1128{ 'command': 'migrate-set-parameters', 'boxed': true,
1129  'data': 'MigrateSetParameters' }
1130
1131##
1132# @MigrationParameters:
1133#
1134# The optional members aren't actually optional.
1135#
1136# @announce-initial: Initial delay (in milliseconds) before sending
1137#     the first announce (Since 4.0)
1138#
1139# @announce-max: Maximum delay (in milliseconds) between packets in
1140#     the announcement (Since 4.0)
1141#
1142# @announce-rounds: Number of self-announce packets sent after
1143#     migration (Since 4.0)
1144#
1145# @announce-step: Increase in delay (in milliseconds) between
1146#     subsequent packets in the announcement (Since 4.0)
1147#
1148# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
1149#     bytes_xfer_period to trigger throttling.  It is expressed as
1150#     percentage.  The default value is 50.  (Since 5.0)
1151#
1152# @cpu-throttle-initial: Initial percentage of time guest cpus are
1153#     throttled when migration auto-converge is activated.
1154#     (Since 2.7)
1155#
1156# @cpu-throttle-increment: throttle percentage increase each time
1157#     auto-converge detects that migration is not making progress.
1158#     (Since 2.7)
1159#
1160# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage.
1161#     At the tail stage of throttling, the Guest is very sensitive to
1162#     CPU percentage while the @cpu-throttle -increment is excessive
1163#     usually at tail stage.  If this parameter is true, we will
1164#     compute the ideal CPU percentage used by the Guest, which may
1165#     exactly make the dirty rate match the dirty rate threshold.
1166#     Then we will choose a smaller throttle increment between the one
1167#     specified by @cpu-throttle-increment and the one generated by
1168#     ideal CPU percentage.  Therefore, it is compatible to
1169#     traditional throttling, meanwhile the throttle increment won't
1170#     be excessive at tail stage.  The default value is false.
1171#     (Since 5.1)
1172#
1173# @tls-creds: ID of the 'tls-creds' object that provides credentials
1174#     for establishing a TLS connection over the migration data
1175#     channel.  On the outgoing side of the migration, the credentials
1176#     must be for a 'client' endpoint, while for the incoming side the
1177#     credentials must be for a 'server' endpoint.  An empty string
1178#     means that QEMU will use plain text mode for migration, rather
1179#     than TLS.  (Since 2.7)
1180#
1181#     Note: 2.8 omits empty @tls-creds instead.
1182#
1183# @tls-hostname: migration target's hostname for validating the
1184#     server's x509 certificate identity.  If empty, QEMU will use the
1185#     hostname from the migration URI, if any.  (Since 2.7)
1186#
1187#     Note: 2.8 omits empty @tls-hostname instead.
1188#
1189# @tls-authz: ID of the 'authz' object subclass that provides access
1190#     control checking of the TLS x509 certificate distinguished name.
1191#     (Since 4.0)
1192#
1193# @max-bandwidth: maximum speed for migration, in bytes per second.
1194#     (Since 2.8)
1195#
1196# @avail-switchover-bandwidth: to set the available bandwidth that
1197#     migration can use during switchover phase.  **Note:** this does
1198#     not limit the bandwidth during switchover, but only for
1199#     calculations when making decisions to switchover.  By default,
1200#     this value is zero, which means QEMU will estimate the bandwidth
1201#     automatically.  This can be set when the estimated value is not
1202#     accurate, while the user is able to guarantee such bandwidth is
1203#     available when switching over.  When specified correctly, this
1204#     can make the switchover decision much more accurate.
1205#     (Since 8.2)
1206#
1207# @downtime-limit: set maximum tolerated downtime for migration.
1208#     maximum downtime in milliseconds (Since 2.8)
1209#
1210# @x-checkpoint-delay: the delay time between two COLO checkpoints.
1211#     (Since 2.8)
1212#
1213# @multifd-channels: Number of channels used to migrate data in
1214#     parallel.  This is the same number that the number of sockets
1215#     used for migration.  The default value is 2 (since 4.0)
1216#
1217# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1218#     needs to be a multiple of the target page size and a power of 2
1219#     (Since 2.11)
1220#
1221# @max-postcopy-bandwidth: Background transfer bandwidth during
1222#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1223#     (Since 3.0)
1224#
1225# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1226#     (Since 3.1)
1227#
1228# @multifd-compression: Which compression method to use.  Defaults to
1229#     none.  (Since 5.0)
1230#
1231# @multifd-zlib-level: Set the compression level to be used in live
1232#     migration, the compression level is an integer between 0 and 9,
1233#     where 0 means no compression, 1 means the best compression
1234#     speed, and 9 means best compression ratio which will consume
1235#     more CPU.  Defaults to 1.  (Since 5.0)
1236#
1237# @multifd-qatzip-level: Set the compression level to be used in live
1238#     migration.  The level is an integer between 1 and 9, where 1 means
1239#     the best compression speed, and 9 means the best compression
1240#     ratio which will consume more CPU.  Defaults to 1.  (Since 9.2)
1241#
1242# @multifd-zstd-level: Set the compression level to be used in live
1243#     migration, the compression level is an integer between 0 and 20,
1244#     where 0 means no compression, 1 means the best compression
1245#     speed, and 20 means best compression ratio which will consume
1246#     more CPU.  Defaults to 1.  (Since 5.0)
1247#
1248# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1249#     aliases for the purpose of dirty bitmap migration.  Such aliases
1250#     may for example be the corresponding names on the opposite site.
1251#     The mapping must be one-to-one, but not necessarily complete: On
1252#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1253#     will be ignored.  On the destination, encountering an unmapped
1254#     alias in the incoming migration stream will result in a report,
1255#     and all further bitmap migration data will then be discarded.
1256#     Note that the destination does not know about bitmaps it does
1257#     not receive, so there is no limitation or requirement regarding
1258#     the number of bitmaps received, or how they are named, or on
1259#     which nodes they are placed.  By default (when this parameter
1260#     has never been set), bitmap names are mapped to themselves.
1261#     Nodes are mapped to their block device name if there is one, and
1262#     to their node name otherwise.  (Since 5.2)
1263#
1264# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1265#     limit during live migration.  Should be in the range 1 to
1266#     1000ms.  Defaults to 1000ms.  (Since 8.1)
1267#
1268# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1269#     Defaults to 1.  (Since 8.1)
1270#
1271# @mode: Migration mode.  See description in @MigMode.  Default is
1272#     'normal'.  (Since 8.2)
1273#
1274# @zero-page-detection: Whether and how to detect zero pages.
1275#     See description in @ZeroPageDetection.  Default is 'multifd'.
1276#     (since 9.0)
1277#
1278# @direct-io: Open migration files with O_DIRECT when possible.  This
1279#     only has effect if the @mapped-ram capability is enabled.
1280#     (Since 9.1)
1281#
1282# Features:
1283#
1284# @unstable: Members @x-checkpoint-delay and
1285#     @x-vcpu-dirty-limit-period are experimental.
1286#
1287# Since: 2.4
1288##
1289{ 'struct': 'MigrationParameters',
1290  'data': { '*announce-initial': 'size',
1291            '*announce-max': 'size',
1292            '*announce-rounds': 'size',
1293            '*announce-step': 'size',
1294            '*throttle-trigger-threshold': 'uint8',
1295            '*cpu-throttle-initial': 'uint8',
1296            '*cpu-throttle-increment': 'uint8',
1297            '*cpu-throttle-tailslow': 'bool',
1298            '*tls-creds': 'str',
1299            '*tls-hostname': 'str',
1300            '*tls-authz': 'str',
1301            '*max-bandwidth': 'size',
1302            '*avail-switchover-bandwidth': 'size',
1303            '*downtime-limit': 'uint64',
1304            '*x-checkpoint-delay': { 'type': 'uint32',
1305                                     'features': [ 'unstable' ] },
1306            '*multifd-channels': 'uint8',
1307            '*xbzrle-cache-size': 'size',
1308            '*max-postcopy-bandwidth': 'size',
1309            '*max-cpu-throttle': 'uint8',
1310            '*multifd-compression': 'MultiFDCompression',
1311            '*multifd-zlib-level': 'uint8',
1312            '*multifd-qatzip-level': 'uint8',
1313            '*multifd-zstd-level': 'uint8',
1314            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1315            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1316                                            'features': [ 'unstable' ] },
1317            '*vcpu-dirty-limit': 'uint64',
1318            '*mode': 'MigMode',
1319            '*zero-page-detection': 'ZeroPageDetection',
1320            '*direct-io': 'bool' } }
1321
1322##
1323# @query-migrate-parameters:
1324#
1325# Return information about the current migration parameters
1326#
1327# Returns: @MigrationParameters
1328#
1329# Since: 2.4
1330#
1331# .. qmp-example::
1332#
1333#     -> { "execute": "query-migrate-parameters" }
1334#     <- { "return": {
1335#              "multifd-channels": 2,
1336#              "cpu-throttle-increment": 10,
1337#              "cpu-throttle-initial": 20,
1338#              "max-bandwidth": 33554432,
1339#              "downtime-limit": 300
1340#           }
1341#        }
1342##
1343{ 'command': 'query-migrate-parameters',
1344  'returns': 'MigrationParameters' }
1345
1346##
1347# @migrate-start-postcopy:
1348#
1349# Followup to a migration command to switch the migration to postcopy
1350# mode.  The postcopy-ram capability must be set on both source and
1351# destination before the original migration command.
1352#
1353# Since: 2.5
1354#
1355# .. qmp-example::
1356#
1357#     -> { "execute": "migrate-start-postcopy" }
1358#     <- { "return": {} }
1359##
1360{ 'command': 'migrate-start-postcopy' }
1361
1362##
1363# @MIGRATION:
1364#
1365# Emitted when a migration event happens
1366#
1367# @status: @MigrationStatus describing the current migration status.
1368#
1369# Since: 2.4
1370#
1371# .. qmp-example::
1372#
1373#     <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1374#         "event": "MIGRATION",
1375#         "data": {"status": "completed"} }
1376##
1377{ 'event': 'MIGRATION',
1378  'data': {'status': 'MigrationStatus'}}
1379
1380##
1381# @MIGRATION_PASS:
1382#
1383# Emitted from the source side of a migration at the start of each
1384# pass (when it syncs the dirty bitmap)
1385#
1386# @pass: An incrementing count (starting at 1 on the first pass)
1387#
1388# Since: 2.6
1389#
1390# .. qmp-example::
1391#
1392#     <- { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1393#           "event": "MIGRATION_PASS", "data": {"pass": 2} }
1394##
1395{ 'event': 'MIGRATION_PASS',
1396  'data': { 'pass': 'int' } }
1397
1398##
1399# @COLOMessage:
1400#
1401# The message transmission between Primary side and Secondary side.
1402#
1403# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1404#
1405# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for
1406#     checkpointing
1407#
1408# @checkpoint-reply: SVM gets PVM's checkpoint request
1409#
1410# @vmstate-send: VM's state will be sent by PVM.
1411#
1412# @vmstate-size: The total size of VMstate.
1413#
1414# @vmstate-received: VM's state has been received by SVM.
1415#
1416# @vmstate-loaded: VM's state has been loaded by SVM.
1417#
1418# Since: 2.8
1419##
1420{ 'enum': 'COLOMessage',
1421  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1422            'vmstate-send', 'vmstate-size', 'vmstate-received',
1423            'vmstate-loaded' ] }
1424
1425##
1426# @COLOMode:
1427#
1428# The COLO current mode.
1429#
1430# @none: COLO is disabled.
1431#
1432# @primary: COLO node in primary side.
1433#
1434# @secondary: COLO node in slave side.
1435#
1436# Since: 2.8
1437##
1438{ 'enum': 'COLOMode',
1439  'data': [ 'none', 'primary', 'secondary'] }
1440
1441##
1442# @FailoverStatus:
1443#
1444# An enumeration of COLO failover status
1445#
1446# @none: no failover has ever happened
1447#
1448# @require: got failover requirement but not handled
1449#
1450# @active: in the process of doing failover
1451#
1452# @completed: finish the process of failover
1453#
1454# @relaunch: restart the failover process, from 'none' -> 'completed'
1455#     (Since 2.9)
1456#
1457# Since: 2.8
1458##
1459{ 'enum': 'FailoverStatus',
1460  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1461
1462##
1463# @COLO_EXIT:
1464#
1465# Emitted when VM finishes COLO mode due to some errors happening or
1466# at the request of users.
1467#
1468# @mode: report COLO mode when COLO exited.
1469#
1470# @reason: describes the reason for the COLO exit.
1471#
1472# Since: 3.1
1473#
1474# .. qmp-example::
1475#
1476#     <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1477#          "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1478##
1479{ 'event': 'COLO_EXIT',
1480  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1481
1482##
1483# @COLOExitReason:
1484#
1485# The reason for a COLO exit.
1486#
1487# @none: failover has never happened.  This state does not occur in
1488#     the COLO_EXIT event, and is only visible in the result of
1489#     query-colo-status.
1490#
1491# @request: COLO exit is due to an external request.
1492#
1493# @error: COLO exit is due to an internal error.
1494#
1495# @processing: COLO is currently handling a failover (since 4.0).
1496#
1497# Since: 3.1
1498##
1499{ 'enum': 'COLOExitReason',
1500  'data': [ 'none', 'request', 'error' , 'processing' ] }
1501
1502##
1503# @x-colo-lost-heartbeat:
1504#
1505# Tell QEMU that heartbeat is lost, request it to do takeover
1506# procedures.  If this command is sent to the PVM, the Primary side
1507# will exit COLO mode.  If sent to the Secondary, the Secondary side
1508# will run failover work, then takes over server operation to become
1509# the service VM.
1510#
1511# Features:
1512#
1513# @unstable: This command is experimental.
1514#
1515# Since: 2.8
1516#
1517# .. qmp-example::
1518#
1519#     -> { "execute": "x-colo-lost-heartbeat" }
1520#     <- { "return": {} }
1521##
1522{ 'command': 'x-colo-lost-heartbeat',
1523  'features': [ 'unstable' ],
1524  'if': 'CONFIG_REPLICATION' }
1525
1526##
1527# @migrate_cancel:
1528#
1529# Cancel the currently executing migration process.  Allows a new
1530# migration to be started right after.  When postcopy-ram is in use,
1531# cancelling is not allowed after the postcopy phase has started.
1532#
1533# .. note:: This command succeeds even if there is no migration
1534#    process running.
1535#
1536# Since: 0.14
1537#
1538# .. qmp-example::
1539#
1540#     -> { "execute": "migrate_cancel" }
1541#     <- { "return": {} }
1542##
1543{ 'command': 'migrate_cancel' }
1544
1545##
1546# @migrate-continue:
1547#
1548# Continue migration when it's in a paused state.
1549#
1550# @state: The state the migration is currently expected to be in
1551#
1552# Since: 2.11
1553#
1554# .. qmp-example::
1555#
1556#     -> { "execute": "migrate-continue" , "arguments":
1557#          { "state": "pre-switchover" } }
1558#     <- { "return": {} }
1559##
1560{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1561
1562##
1563# @MigrationAddressType:
1564#
1565# The migration stream transport mechanisms.
1566#
1567# @socket: Migrate via socket.
1568#
1569# @exec: Direct the migration stream to another process.
1570#
1571# @rdma: Migrate via RDMA.
1572#
1573# @file: Direct the migration stream to a file.
1574#
1575# Since: 8.2
1576##
1577{ 'enum': 'MigrationAddressType',
1578  'data': [ 'socket', 'exec', 'rdma', 'file' ] }
1579
1580##
1581# @FileMigrationArgs:
1582#
1583# @filename: The file to receive the migration stream
1584#
1585# @offset: The file offset where the migration stream will start
1586#
1587# Since: 8.2
1588##
1589{ 'struct': 'FileMigrationArgs',
1590  'data': { 'filename': 'str',
1591            'offset': 'uint64' } }
1592
1593##
1594# @MigrationExecCommand:
1595#
1596# @args: command (list head) and arguments to execute.
1597#
1598# Since: 8.2
1599##
1600{ 'struct': 'MigrationExecCommand',
1601  'data': {'args': [ 'str' ] } }
1602
1603##
1604# @MigrationAddress:
1605#
1606# Migration endpoint configuration.
1607#
1608# @transport: The migration stream transport mechanism
1609#
1610# Since: 8.2
1611##
1612{ 'union': 'MigrationAddress',
1613  'base': { 'transport' : 'MigrationAddressType'},
1614  'discriminator': 'transport',
1615  'data': {
1616    'socket': 'SocketAddress',
1617    'exec': 'MigrationExecCommand',
1618    'rdma': 'InetSocketAddress',
1619    'file': 'FileMigrationArgs' } }
1620
1621##
1622# @MigrationChannelType:
1623#
1624# The migration channel-type request options.
1625#
1626# @main: Main outbound migration channel.
1627# @cpr: Checkpoint and restart state channel.
1628#
1629# Since: 8.1
1630##
1631{ 'enum': 'MigrationChannelType',
1632  'data': [ 'main', 'cpr' ] }
1633
1634##
1635# @MigrationChannel:
1636#
1637# Migration stream channel parameters.
1638#
1639# @channel-type: Channel type for transferring packet information.
1640#
1641# @addr: Migration endpoint configuration on destination interface.
1642#
1643# Since: 8.1
1644##
1645{ 'struct': 'MigrationChannel',
1646  'data': {
1647      'channel-type': 'MigrationChannelType',
1648      'addr': 'MigrationAddress' } }
1649
1650##
1651# @migrate:
1652#
1653# Migrates the current running guest to another Virtual Machine.
1654#
1655# @uri: the Uniform Resource Identifier of the destination VM
1656#
1657# @channels: list of migration stream channels with each stream in the
1658#     list connected to a destination interface endpoint.
1659#
1660# @detach: this argument exists only for compatibility reasons and is
1661#     ignored by QEMU
1662#
1663# @resume: resume one paused migration, default "off".  (since 3.0)
1664#
1665# Features:
1666#
1667# @deprecated: Argument @detach is deprecated.
1668#
1669# Since: 0.14
1670#
1671# .. admonition:: Notes
1672#
1673#     1. The 'query-migrate' command should be used to check
1674#        migration's progress and final result (this information is
1675#        provided by the 'status' member).
1676#
1677#     2. The uri argument should have the Uniform Resource Identifier
1678#        of default destination VM.  This connection will be bound to
1679#        default network.
1680#
1681#     3. For now, number of migration streams is restricted to one,
1682#        i.e. number of items in 'channels' list is just 1.
1683#
1684#     4. The 'uri' and 'channels' arguments are mutually exclusive;
1685#        exactly one of the two should be present.
1686#
1687# .. qmp-example::
1688#
1689#     -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1690#     <- { "return": {} }
1691#
1692#     -> { "execute": "migrate",
1693#          "arguments": {
1694#              "channels": [ { "channel-type": "main",
1695#                              "addr": { "transport": "socket",
1696#                                        "type": "inet",
1697#                                        "host": "10.12.34.9",
1698#                                        "port": "1050" } } ] } }
1699#     <- { "return": {} }
1700#
1701#     -> { "execute": "migrate",
1702#          "arguments": {
1703#              "channels": [ { "channel-type": "main",
1704#                              "addr": { "transport": "exec",
1705#                                        "args": [ "/bin/nc", "-p", "6000",
1706#                                                  "/some/sock" ] } } ] } }
1707#     <- { "return": {} }
1708#
1709#     -> { "execute": "migrate",
1710#          "arguments": {
1711#              "channels": [ { "channel-type": "main",
1712#                              "addr": { "transport": "rdma",
1713#                                        "host": "10.12.34.9",
1714#                                        "port": "1050" } } ] } }
1715#     <- { "return": {} }
1716#
1717#     -> { "execute": "migrate",
1718#          "arguments": {
1719#              "channels": [ { "channel-type": "main",
1720#                              "addr": { "transport": "file",
1721#                                        "filename": "/tmp/migfile",
1722#                                        "offset": "0x1000" } } ] } }
1723#     <- { "return": {} }
1724##
1725{ 'command': 'migrate',
1726  'data': {'*uri': 'str',
1727           '*channels': [ 'MigrationChannel' ],
1728           '*detach': { 'type': 'bool', 'features': [ 'deprecated' ] },
1729           '*resume': 'bool' } }
1730
1731##
1732# @migrate-incoming:
1733#
1734# Start an incoming migration.  QEMU must have been started with
1735# -incoming defer.
1736#
1737# @uri: The Uniform Resource Identifier identifying the source or
1738#     address to listen on
1739#
1740# @channels: list of migration stream channels with each stream in the
1741#     list connected to a destination interface endpoint.
1742#
1743# @exit-on-error: Exit on incoming migration failure.  Default true.
1744#     When set to false, the failure triggers a MIGRATION event, and
1745#     error details could be retrieved with query-migrate.
1746#     (since 9.1)
1747#
1748# Since: 2.3
1749#
1750# .. admonition:: Notes
1751#
1752#     1. It's a bad idea to use a string for the uri, but it needs to
1753#        stay compatible with -incoming and the format of the uri is
1754#        already exposed above libvirt.
1755#
1756#     2. QEMU must be started with -incoming defer to allow
1757#        migrate-incoming to be used.
1758#
1759#     3. The uri format is the same as for -incoming
1760#
1761#     4. For now, number of migration streams is restricted to one,
1762#        i.e. number of items in 'channels' list is just 1.
1763#
1764#     5. The 'uri' and 'channels' arguments are mutually exclusive;
1765#        exactly one of the two should be present.
1766#
1767# .. qmp-example::
1768#
1769#     -> { "execute": "migrate-incoming",
1770#          "arguments": { "uri": "tcp:0:4446" } }
1771#     <- { "return": {} }
1772#
1773#     -> { "execute": "migrate-incoming",
1774#          "arguments": {
1775#              "channels": [ { "channel-type": "main",
1776#                              "addr": { "transport": "socket",
1777#                                        "type": "inet",
1778#                                        "host": "10.12.34.9",
1779#                                        "port": "1050" } } ] } }
1780#     <- { "return": {} }
1781#
1782#     -> { "execute": "migrate-incoming",
1783#          "arguments": {
1784#              "channels": [ { "channel-type": "main",
1785#                              "addr": { "transport": "exec",
1786#                                        "args": [ "/bin/nc", "-p", "6000",
1787#                                                  "/some/sock" ] } } ] } }
1788#     <- { "return": {} }
1789#
1790#     -> { "execute": "migrate-incoming",
1791#          "arguments": {
1792#              "channels": [ { "channel-type": "main",
1793#                              "addr": { "transport": "rdma",
1794#                                        "host": "10.12.34.9",
1795#                                        "port": "1050" } } ] } }
1796#     <- { "return": {} }
1797##
1798{ 'command': 'migrate-incoming',
1799             'data': {'*uri': 'str',
1800                      '*channels': [ 'MigrationChannel' ],
1801                      '*exit-on-error': 'bool' } }
1802
1803##
1804# @xen-save-devices-state:
1805#
1806# Save the state of all devices to file.  The RAM and the block
1807# devices of the VM are not saved by this command.
1808#
1809# @filename: the file to save the state of the devices to as binary
1810#     data.  See xen-save-devices-state.txt for a description of the
1811#     binary format.
1812#
1813# @live: Optional argument to ask QEMU to treat this command as part
1814#     of a live migration.  Default to true.  (since 2.11)
1815#
1816# Since: 1.1
1817#
1818# .. qmp-example::
1819#
1820#     -> { "execute": "xen-save-devices-state",
1821#          "arguments": { "filename": "/tmp/save" } }
1822#     <- { "return": {} }
1823##
1824{ 'command': 'xen-save-devices-state',
1825  'data': {'filename': 'str', '*live':'bool' } }
1826
1827##
1828# @xen-set-global-dirty-log:
1829#
1830# Enable or disable the global dirty log mode.
1831#
1832# @enable: true to enable, false to disable.
1833#
1834# Since: 1.3
1835#
1836# .. qmp-example::
1837#
1838#     -> { "execute": "xen-set-global-dirty-log",
1839#          "arguments": { "enable": true } }
1840#     <- { "return": {} }
1841##
1842{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1843
1844##
1845# @xen-load-devices-state:
1846#
1847# Load the state of all devices from file.  The RAM and the block
1848# devices of the VM are not loaded by this command.
1849#
1850# @filename: the file to load the state of the devices from as binary
1851#     data.  See xen-save-devices-state.txt for a description of the
1852#     binary format.
1853#
1854# Since: 2.7
1855#
1856# .. qmp-example::
1857#
1858#     -> { "execute": "xen-load-devices-state",
1859#          "arguments": { "filename": "/tmp/resume" } }
1860#     <- { "return": {} }
1861##
1862{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1863
1864##
1865# @xen-set-replication:
1866#
1867# Enable or disable replication.
1868#
1869# @enable: true to enable, false to disable.
1870#
1871# @primary: true for primary or false for secondary.
1872#
1873# @failover: true to do failover, false to stop.  Cannot be specified
1874#     if 'enable' is true.  Default value is false.
1875#
1876# .. qmp-example::
1877#
1878#     -> { "execute": "xen-set-replication",
1879#          "arguments": {"enable": true, "primary": false} }
1880#     <- { "return": {} }
1881#
1882# Since: 2.9
1883##
1884{ 'command': 'xen-set-replication',
1885  'data': { 'enable': 'bool', 'primary': 'bool', '*failover': 'bool' },
1886  'if': 'CONFIG_REPLICATION' }
1887
1888##
1889# @ReplicationStatus:
1890#
1891# The result format for 'query-xen-replication-status'.
1892#
1893# @error: true if an error happened, false if replication is normal.
1894#
1895# @desc: the human readable error description string, when @error is
1896#     'true'.
1897#
1898# Since: 2.9
1899##
1900{ 'struct': 'ReplicationStatus',
1901  'data': { 'error': 'bool', '*desc': 'str' },
1902  'if': 'CONFIG_REPLICATION' }
1903
1904##
1905# @query-xen-replication-status:
1906#
1907# Query replication status while the vm is running.
1908#
1909# Returns: A @ReplicationStatus object showing the status.
1910#
1911# .. qmp-example::
1912#
1913#     -> { "execute": "query-xen-replication-status" }
1914#     <- { "return": { "error": false } }
1915#
1916# Since: 2.9
1917##
1918{ 'command': 'query-xen-replication-status',
1919  'returns': 'ReplicationStatus',
1920  'if': 'CONFIG_REPLICATION' }
1921
1922##
1923# @xen-colo-do-checkpoint:
1924#
1925# Xen uses this command to notify replication to trigger a checkpoint.
1926#
1927# .. qmp-example::
1928#
1929#     -> { "execute": "xen-colo-do-checkpoint" }
1930#     <- { "return": {} }
1931#
1932# Since: 2.9
1933##
1934{ 'command': 'xen-colo-do-checkpoint',
1935  'if': 'CONFIG_REPLICATION' }
1936
1937##
1938# @COLOStatus:
1939#
1940# The result format for 'query-colo-status'.
1941#
1942# @mode: COLO running mode.  If COLO is running, this field will
1943#     return 'primary' or 'secondary'.
1944#
1945# @last-mode: COLO last running mode.  If COLO is running, this field
1946#     will return same like mode field, after failover we can use this
1947#     field to get last colo mode.  (since 4.0)
1948#
1949# @reason: describes the reason for the COLO exit.
1950#
1951# Since: 3.1
1952##
1953{ 'struct': 'COLOStatus',
1954  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1955            'reason': 'COLOExitReason' },
1956  'if': 'CONFIG_REPLICATION' }
1957
1958##
1959# @query-colo-status:
1960#
1961# Query COLO status while the vm is running.
1962#
1963# Returns: A @COLOStatus object showing the status.
1964#
1965# .. qmp-example::
1966#
1967#     -> { "execute": "query-colo-status" }
1968#     <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
1969#
1970# Since: 3.1
1971##
1972{ 'command': 'query-colo-status',
1973  'returns': 'COLOStatus',
1974  'if': 'CONFIG_REPLICATION' }
1975
1976##
1977# @migrate-recover:
1978#
1979# Provide a recovery migration stream URI.
1980#
1981# @uri: the URI to be used for the recovery of migration stream.
1982#
1983# .. qmp-example::
1984#
1985#     -> { "execute": "migrate-recover",
1986#          "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1987#     <- { "return": {} }
1988#
1989# Since: 3.0
1990##
1991{ 'command': 'migrate-recover',
1992  'data': { 'uri': 'str' },
1993  'allow-oob': true }
1994
1995##
1996# @migrate-pause:
1997#
1998# Pause a migration.  Currently it only supports postcopy.
1999#
2000# .. qmp-example::
2001#
2002#     -> { "execute": "migrate-pause" }
2003#     <- { "return": {} }
2004#
2005# Since: 3.0
2006##
2007{ 'command': 'migrate-pause', 'allow-oob': true }
2008
2009##
2010# @UNPLUG_PRIMARY:
2011#
2012# Emitted from source side of a migration when migration state is
2013# WAIT_UNPLUG.  Device was unplugged by guest operating system.
2014# Device resources in QEMU are kept on standby to be able to re-plug
2015# it in case of migration failure.
2016#
2017# @device-id: QEMU device id of the unplugged device
2018#
2019# Since: 4.2
2020#
2021# .. qmp-example::
2022#
2023#     <- { "event": "UNPLUG_PRIMARY",
2024#          "data": { "device-id": "hostdev0" },
2025#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
2026##
2027{ 'event': 'UNPLUG_PRIMARY',
2028  'data': { 'device-id': 'str' } }
2029
2030##
2031# @DirtyRateVcpu:
2032#
2033# Dirty rate of vcpu.
2034#
2035# @id: vcpu index.
2036#
2037# @dirty-rate: dirty rate.
2038#
2039# Since: 6.2
2040##
2041{ 'struct': 'DirtyRateVcpu',
2042  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
2043
2044##
2045# @DirtyRateStatus:
2046#
2047# Dirty page rate measurement status.
2048#
2049# @unstarted: measuring thread has not been started yet
2050#
2051# @measuring: measuring thread is running
2052#
2053# @measured: dirty page rate is measured and the results are available
2054#
2055# Since: 5.2
2056##
2057{ 'enum': 'DirtyRateStatus',
2058  'data': [ 'unstarted', 'measuring', 'measured'] }
2059
2060##
2061# @DirtyRateMeasureMode:
2062#
2063# Method used to measure dirty page rate.  Differences between
2064# available methods are explained in @calc-dirty-rate.
2065#
2066# @page-sampling: use page sampling
2067#
2068# @dirty-ring: use dirty ring
2069#
2070# @dirty-bitmap: use dirty bitmap
2071#
2072# Since: 6.2
2073##
2074{ 'enum': 'DirtyRateMeasureMode',
2075  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
2076
2077##
2078# @TimeUnit:
2079#
2080# Specifies unit in which time-related value is specified.
2081#
2082# @second: value is in seconds
2083#
2084# @millisecond: value is in milliseconds
2085#
2086# Since: 8.2
2087##
2088{ 'enum': 'TimeUnit',
2089  'data': ['second', 'millisecond'] }
2090
2091##
2092# @DirtyRateInfo:
2093#
2094# Information about measured dirty page rate.
2095#
2096# @dirty-rate: an estimate of the dirty page rate of the VM in units
2097#     of MiB/s.  Value is present only when @status is 'measured'.
2098#
2099# @status: current status of dirty page rate measurements
2100#
2101# @start-time: start time in units of second for calculation
2102#
2103# @calc-time: time period for which dirty page rate was measured,
2104#     expressed and rounded down to @calc-time-unit.
2105#
2106# @calc-time-unit: time unit of @calc-time  (Since 8.2)
2107#
2108# @sample-pages: number of sampled pages per GiB of guest memory.
2109#     Valid only in page-sampling mode (Since 6.1)
2110#
2111# @mode: mode that was used to measure dirty page rate (Since 6.2)
2112#
2113# @vcpu-dirty-rate: dirty rate for each vCPU if dirty-ring mode was
2114#     specified (Since 6.2)
2115#
2116# Since: 5.2
2117##
2118{ 'struct': 'DirtyRateInfo',
2119  'data': {'*dirty-rate': 'int64',
2120           'status': 'DirtyRateStatus',
2121           'start-time': 'int64',
2122           'calc-time': 'int64',
2123           'calc-time-unit': 'TimeUnit',
2124           'sample-pages': 'uint64',
2125           'mode': 'DirtyRateMeasureMode',
2126           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
2127
2128##
2129# @calc-dirty-rate:
2130#
2131# Start measuring dirty page rate of the VM.  Results can be retrieved
2132# with @query-dirty-rate after measurements are completed.
2133#
2134# Dirty page rate is the number of pages changed in a given time
2135# period expressed in MiB/s.  The following methods of calculation are
2136# available:
2137#
2138# 1. In page sampling mode, a random subset of pages are selected and
2139#    hashed twice: once at the beginning of measurement time period,
2140#    and once again at the end.  If two hashes for some page are
2141#    different, the page is counted as changed.  Since this method
2142#    relies on sampling and hashing, calculated dirty page rate is
2143#    only an estimate of its true value.  Increasing @sample-pages
2144#    improves estimation quality at the cost of higher computational
2145#    overhead.
2146#
2147# 2. Dirty bitmap mode captures writes to memory (for example by
2148#    temporarily revoking write access to all pages) and counting page
2149#    faults.  Information about modified pages is collected into a
2150#    bitmap, where each bit corresponds to one guest page.  This mode
2151#    requires that KVM accelerator property "dirty-ring-size" is *not*
2152#    set.
2153#
2154# 3. Dirty ring mode is similar to dirty bitmap mode, but the
2155#    information about modified pages is collected into ring buffer.
2156#    This mode tracks page modification per each vCPU separately.  It
2157#    requires that KVM accelerator property "dirty-ring-size" is set.
2158#
2159# @calc-time: time period for which dirty page rate is calculated.  By
2160#     default it is specified in seconds, but the unit can be set
2161#     explicitly with @calc-time-unit.  Note that larger @calc-time
2162#     values will typically result in smaller dirty page rates because
2163#     page dirtying is a one-time event.  Once some page is counted as
2164#     dirty during @calc-time period, further writes to this page will
2165#     not increase dirty page rate anymore.
2166#
2167# @calc-time-unit: time unit in which @calc-time is specified.  By
2168#     default it is seconds.  (Since 8.2)
2169#
2170# @sample-pages: number of sampled pages per each GiB of guest memory.
2171#     Default value is 512.  For 4KiB guest pages this corresponds to
2172#     sampling ratio of 0.2%.  This argument is used only in page
2173#     sampling mode.  (Since 6.1)
2174#
2175# @mode: mechanism for tracking dirty pages.  Default value is
2176#     'page-sampling'.  Others are 'dirty-bitmap' and 'dirty-ring'.
2177#     (Since 6.1)
2178#
2179# Since: 5.2
2180#
2181# .. qmp-example::
2182#
2183#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
2184#                                                     "sample-pages": 512} }
2185#     <- { "return": {} }
2186#
2187# .. qmp-example::
2188#    :annotated:
2189#
2190#    Measure dirty rate using dirty bitmap for 500 milliseconds::
2191#
2192#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 500,
2193#         "calc-time-unit": "millisecond", "mode": "dirty-bitmap"} }
2194#
2195#     <- { "return": {} }
2196##
2197{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
2198                                         '*calc-time-unit': 'TimeUnit',
2199                                         '*sample-pages': 'int',
2200                                         '*mode': 'DirtyRateMeasureMode'} }
2201
2202##
2203# @query-dirty-rate:
2204#
2205# Query results of the most recent invocation of @calc-dirty-rate.
2206#
2207# @calc-time-unit: time unit in which to report calculation time.
2208#     By default it is reported in seconds.  (Since 8.2)
2209#
2210# Since: 5.2
2211#
2212# .. qmp-example::
2213#    :title: Measurement is in progress
2214#
2215#     <- {"status": "measuring", "sample-pages": 512,
2216#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2217#         "calc-time-unit": "second"}
2218#
2219# .. qmp-example::
2220#    :title: Measurement has been completed
2221#
2222#     <- {"status": "measured", "sample-pages": 512, "dirty-rate": 108,
2223#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2224#         "calc-time-unit": "second"}
2225##
2226{ 'command': 'query-dirty-rate', 'data': {'*calc-time-unit': 'TimeUnit' },
2227                                 'returns': 'DirtyRateInfo' }
2228
2229##
2230# @DirtyLimitInfo:
2231#
2232# Dirty page rate limit information of a virtual CPU.
2233#
2234# @cpu-index: index of a virtual CPU.
2235#
2236# @limit-rate: upper limit of dirty page rate (MB/s) for a virtual
2237#     CPU, 0 means unlimited.
2238#
2239# @current-rate: current dirty page rate (MB/s) for a virtual CPU.
2240#
2241# Since: 7.1
2242##
2243{ 'struct': 'DirtyLimitInfo',
2244  'data': { 'cpu-index': 'int',
2245            'limit-rate': 'uint64',
2246            'current-rate': 'uint64' } }
2247
2248##
2249# @set-vcpu-dirty-limit:
2250#
2251# Set the upper limit of dirty page rate for virtual CPUs.
2252#
2253# Requires KVM with accelerator property "dirty-ring-size" set.  A
2254# virtual CPU's dirty page rate is a measure of its memory load.  To
2255# observe dirty page rates, use @calc-dirty-rate.
2256#
2257# @cpu-index: index of a virtual CPU, default is all.
2258#
2259# @dirty-rate: upper limit of dirty page rate (MB/s) for virtual CPUs.
2260#
2261# Since: 7.1
2262#
2263# .. qmp-example::
2264#
2265#     -> {"execute": "set-vcpu-dirty-limit"}
2266#         "arguments": { "dirty-rate": 200,
2267#                        "cpu-index": 1 } }
2268#     <- { "return": {} }
2269##
2270{ 'command': 'set-vcpu-dirty-limit',
2271  'data': { '*cpu-index': 'int',
2272            'dirty-rate': 'uint64' } }
2273
2274##
2275# @cancel-vcpu-dirty-limit:
2276#
2277# Cancel the upper limit of dirty page rate for virtual CPUs.
2278#
2279# Cancel the dirty page limit for the vCPU which has been set with
2280# set-vcpu-dirty-limit command.  Note that this command requires
2281# support from dirty ring, same as the "set-vcpu-dirty-limit".
2282#
2283# @cpu-index: index of a virtual CPU, default is all.
2284#
2285# Since: 7.1
2286#
2287# .. qmp-example::
2288#
2289#     -> {"execute": "cancel-vcpu-dirty-limit"},
2290#         "arguments": { "cpu-index": 1 } }
2291#     <- { "return": {} }
2292##
2293{ 'command': 'cancel-vcpu-dirty-limit',
2294  'data': { '*cpu-index': 'int'} }
2295
2296##
2297# @query-vcpu-dirty-limit:
2298#
2299# Return information about virtual CPU dirty page rate limits, if
2300# any.
2301#
2302# Since: 7.1
2303#
2304# .. qmp-example::
2305#
2306#     -> {"execute": "query-vcpu-dirty-limit"}
2307#     <- {"return": [
2308#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 0},
2309#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 1}]}
2310##
2311{ 'command': 'query-vcpu-dirty-limit',
2312  'returns': [ 'DirtyLimitInfo' ] }
2313
2314##
2315# @MigrationThreadInfo:
2316#
2317# Information about migrationthreads
2318#
2319# @name: the name of migration thread
2320#
2321# @thread-id: ID of the underlying host thread
2322#
2323# Since: 7.2
2324##
2325{ 'struct': 'MigrationThreadInfo',
2326  'data': {'name': 'str',
2327           'thread-id': 'int'} }
2328
2329##
2330# @query-migrationthreads:
2331#
2332# Return information of migration threads
2333#
2334# Features:
2335#
2336# @deprecated: This command is deprecated with no replacement yet.
2337#
2338# Returns: @MigrationThreadInfo
2339#
2340# Since: 7.2
2341##
2342{ 'command': 'query-migrationthreads',
2343  'returns': ['MigrationThreadInfo'],
2344  'features': ['deprecated'] }
2345
2346##
2347# @snapshot-save:
2348#
2349# Save a VM snapshot
2350#
2351# @job-id: identifier for the newly created job
2352#
2353# @tag: name of the snapshot to create
2354#
2355# @vmstate: block device node name to save vmstate to
2356#
2357# @devices: list of block device node names to save a snapshot to
2358#
2359# Applications should not assume that the snapshot save is complete
2360# when this command returns.  The job commands / events must be used
2361# to determine completion and to fetch details of any errors that
2362# arise.
2363#
2364# Note that execution of the guest CPUs may be stopped during the time
2365# it takes to save the snapshot.  A future version of QEMU may ensure
2366# CPUs are executing continuously.
2367#
2368# It is strongly recommended that @devices contain all writable block
2369# device nodes if a consistent snapshot is required.
2370#
2371# If @tag already exists, an error will be reported
2372#
2373# .. qmp-example::
2374#
2375#     -> { "execute": "snapshot-save",
2376#          "arguments": {
2377#             "job-id": "snapsave0",
2378#             "tag": "my-snap",
2379#             "vmstate": "disk0",
2380#             "devices": ["disk0", "disk1"]
2381#          }
2382#        }
2383#     <- { "return": { } }
2384#     <- {"event": "JOB_STATUS_CHANGE",
2385#         "timestamp": {"seconds": 1432121972, "microseconds": 744001},
2386#         "data": {"status": "created", "id": "snapsave0"}}
2387#     <- {"event": "JOB_STATUS_CHANGE",
2388#         "timestamp": {"seconds": 1432122172, "microseconds": 744001},
2389#         "data": {"status": "running", "id": "snapsave0"}}
2390#     <- {"event": "STOP",
2391#         "timestamp": {"seconds": 1432122372, "microseconds": 744001} }
2392#     <- {"event": "RESUME",
2393#         "timestamp": {"seconds": 1432122572, "microseconds": 744001} }
2394#     <- {"event": "JOB_STATUS_CHANGE",
2395#         "timestamp": {"seconds": 1432122772, "microseconds": 744001},
2396#         "data": {"status": "waiting", "id": "snapsave0"}}
2397#     <- {"event": "JOB_STATUS_CHANGE",
2398#         "timestamp": {"seconds": 1432122972, "microseconds": 744001},
2399#         "data": {"status": "pending", "id": "snapsave0"}}
2400#     <- {"event": "JOB_STATUS_CHANGE",
2401#         "timestamp": {"seconds": 1432123172, "microseconds": 744001},
2402#         "data": {"status": "concluded", "id": "snapsave0"}}
2403#     -> {"execute": "query-jobs"}
2404#     <- {"return": [{"current-progress": 1,
2405#                     "status": "concluded",
2406#                     "total-progress": 1,
2407#                     "type": "snapshot-save",
2408#                     "id": "snapsave0"}]}
2409#
2410# Since: 6.0
2411##
2412{ 'command': 'snapshot-save',
2413  'data': { 'job-id': 'str',
2414            'tag': 'str',
2415            'vmstate': 'str',
2416            'devices': ['str'] } }
2417
2418##
2419# @snapshot-load:
2420#
2421# Load a VM snapshot
2422#
2423# @job-id: identifier for the newly created job
2424#
2425# @tag: name of the snapshot to load.
2426#
2427# @vmstate: block device node name to load vmstate from
2428#
2429# @devices: list of block device node names to load a snapshot from
2430#
2431# Applications should not assume that the snapshot load is complete
2432# when this command returns.  The job commands / events must be used
2433# to determine completion and to fetch details of any errors that
2434# arise.
2435#
2436# Note that execution of the guest CPUs will be stopped during the
2437# time it takes to load the snapshot.
2438#
2439# It is strongly recommended that @devices contain all writable block
2440# device nodes that can have changed since the original @snapshot-save
2441# command execution.
2442#
2443# .. qmp-example::
2444#
2445#     -> { "execute": "snapshot-load",
2446#          "arguments": {
2447#             "job-id": "snapload0",
2448#             "tag": "my-snap",
2449#             "vmstate": "disk0",
2450#             "devices": ["disk0", "disk1"]
2451#          }
2452#        }
2453#     <- { "return": { } }
2454#     <- {"event": "JOB_STATUS_CHANGE",
2455#         "timestamp": {"seconds": 1472124172, "microseconds": 744001},
2456#         "data": {"status": "created", "id": "snapload0"}}
2457#     <- {"event": "JOB_STATUS_CHANGE",
2458#         "timestamp": {"seconds": 1472125172, "microseconds": 744001},
2459#         "data": {"status": "running", "id": "snapload0"}}
2460#     <- {"event": "STOP",
2461#         "timestamp": {"seconds": 1472125472, "microseconds": 744001} }
2462#     <- {"event": "RESUME",
2463#         "timestamp": {"seconds": 1472125872, "microseconds": 744001} }
2464#     <- {"event": "JOB_STATUS_CHANGE",
2465#         "timestamp": {"seconds": 1472126172, "microseconds": 744001},
2466#         "data": {"status": "waiting", "id": "snapload0"}}
2467#     <- {"event": "JOB_STATUS_CHANGE",
2468#         "timestamp": {"seconds": 1472127172, "microseconds": 744001},
2469#         "data": {"status": "pending", "id": "snapload0"}}
2470#     <- {"event": "JOB_STATUS_CHANGE",
2471#         "timestamp": {"seconds": 1472128172, "microseconds": 744001},
2472#         "data": {"status": "concluded", "id": "snapload0"}}
2473#     -> {"execute": "query-jobs"}
2474#     <- {"return": [{"current-progress": 1,
2475#                     "status": "concluded",
2476#                     "total-progress": 1,
2477#                     "type": "snapshot-load",
2478#                     "id": "snapload0"}]}
2479#
2480# Since: 6.0
2481##
2482{ 'command': 'snapshot-load',
2483  'data': { 'job-id': 'str',
2484            'tag': 'str',
2485            'vmstate': 'str',
2486            'devices': ['str'] } }
2487
2488##
2489# @snapshot-delete:
2490#
2491# Delete a VM snapshot
2492#
2493# @job-id: identifier for the newly created job
2494#
2495# @tag: name of the snapshot to delete.
2496#
2497# @devices: list of block device node names to delete a snapshot from
2498#
2499# Applications should not assume that the snapshot delete is complete
2500# when this command returns.  The job commands / events must be used
2501# to determine completion and to fetch details of any errors that
2502# arise.
2503#
2504# .. qmp-example::
2505#
2506#     -> { "execute": "snapshot-delete",
2507#          "arguments": {
2508#             "job-id": "snapdelete0",
2509#             "tag": "my-snap",
2510#             "devices": ["disk0", "disk1"]
2511#          }
2512#        }
2513#     <- { "return": { } }
2514#     <- {"event": "JOB_STATUS_CHANGE",
2515#         "timestamp": {"seconds": 1442124172, "microseconds": 744001},
2516#         "data": {"status": "created", "id": "snapdelete0"}}
2517#     <- {"event": "JOB_STATUS_CHANGE",
2518#         "timestamp": {"seconds": 1442125172, "microseconds": 744001},
2519#         "data": {"status": "running", "id": "snapdelete0"}}
2520#     <- {"event": "JOB_STATUS_CHANGE",
2521#         "timestamp": {"seconds": 1442126172, "microseconds": 744001},
2522#         "data": {"status": "waiting", "id": "snapdelete0"}}
2523#     <- {"event": "JOB_STATUS_CHANGE",
2524#         "timestamp": {"seconds": 1442127172, "microseconds": 744001},
2525#         "data": {"status": "pending", "id": "snapdelete0"}}
2526#     <- {"event": "JOB_STATUS_CHANGE",
2527#         "timestamp": {"seconds": 1442128172, "microseconds": 744001},
2528#         "data": {"status": "concluded", "id": "snapdelete0"}}
2529#     -> {"execute": "query-jobs"}
2530#     <- {"return": [{"current-progress": 1,
2531#                     "status": "concluded",
2532#                     "total-progress": 1,
2533#                     "type": "snapshot-delete",
2534#                     "id": "snapdelete0"}]}
2535#
2536# Since: 6.0
2537##
2538{ 'command': 'snapshot-delete',
2539  'data': { 'job-id': 'str',
2540            'tag': 'str',
2541            'devices': ['str'] } }
2542