xref: /qemu/qapi/migration.json (revision 70ce076fa6dff60585c229a4b641b13e64bf03cf)
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.  (since
61#     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.  (since
141#     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.  (since
149#     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# Returns 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 (since
426#     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# Returns 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.  Devices and their pinned
624#     pages will also be preserved in a future QEMU release.
625#
626#     The user starts new QEMU on the same host as old QEMU, with
627#     command-line arguments to create the same machine, plus the
628#     -incoming option for the main migration channel, like normal
629#     live migration.  In addition, the user adds a second -incoming
630#     option with channel type "cpr".  This CPR channel must support
631#     file descriptor transfer with SCM_RIGHTS, i.e. it must be a
632#     UNIX domain socket.
633#
634#     To initiate CPR, the user issues a migrate command to old QEMU,
635#     adding a second migration channel of type "cpr" in the channels
636#     argument.  Old QEMU stops the VM, saves state to the migration
637#     channels, and enters the postmigrate state.  Execution resumes
638#     in new QEMU.
639#
640#     New QEMU reads the CPR channel before opening a monitor, hence
641#     the CPR channel cannot be specified in the list of channels for
642#     a migrate-incoming command.  It may only be specified on the
643#     command line.
644#
645#     The main channel address cannot be a file type, and for an
646#     inet socket, the port cannot be 0 (meaning dynamically choose
647#     a port).
648#
649#     Memory-backend objects must have the share=on attribute, but
650#     memory-backend-epc is not supported.  The VM must be started
651#     with the '-machine aux-ram-share=on' option.
652#
653#     When using -incoming defer, you must issue the migrate command
654#     to old QEMU before issuing any monitor commands to new QEMU.
655#     However, new QEMU does not open and read the migration stream
656#     until you issue the migrate incoming command.
657#
658#     (since 10.0)
659##
660{ 'enum': 'MigMode',
661  'data': [ 'normal', 'cpr-reboot', 'cpr-transfer' ] }
662
663##
664# @ZeroPageDetection:
665#
666# @none: Do not perform zero page checking.
667#
668# @legacy: Perform zero page checking in main migration thread.
669#
670# @multifd: Perform zero page checking in multifd sender thread if
671#     multifd migration is enabled, else in the main migration thread
672#     as for @legacy.
673#
674# Since: 9.0
675##
676{ 'enum': 'ZeroPageDetection',
677  'data': [ 'none', 'legacy', 'multifd' ] }
678
679##
680# @BitmapMigrationBitmapAliasTransform:
681#
682# @persistent: If present, the bitmap will be made persistent or
683#     transient depending on this parameter.
684#
685# Since: 6.0
686##
687{ 'struct': 'BitmapMigrationBitmapAliasTransform',
688  'data': {
689      '*persistent': 'bool'
690  } }
691
692##
693# @BitmapMigrationBitmapAlias:
694#
695# @name: The name of the bitmap.
696#
697# @alias: An alias name for migration (for example the bitmap name on
698#     the opposite site).
699#
700# @transform: Allows the modification of the migrated bitmap.  (since
701#     6.0)
702#
703# Since: 5.2
704##
705{ 'struct': 'BitmapMigrationBitmapAlias',
706  'data': {
707      'name': 'str',
708      'alias': 'str',
709      '*transform': 'BitmapMigrationBitmapAliasTransform'
710  } }
711
712##
713# @BitmapMigrationNodeAlias:
714#
715# Maps a block node name and the bitmaps it has to aliases for dirty
716# bitmap migration.
717#
718# @node-name: A block node name.
719#
720# @alias: An alias block node name for migration (for example the node
721#     name on the opposite site).
722#
723# @bitmaps: Mappings for the bitmaps on this node.
724#
725# Since: 5.2
726##
727{ 'struct': 'BitmapMigrationNodeAlias',
728  'data': {
729      'node-name': 'str',
730      'alias': 'str',
731      'bitmaps': [ 'BitmapMigrationBitmapAlias' ]
732  } }
733
734##
735# @MigrationParameter:
736#
737# Migration parameters enumeration
738#
739# @announce-initial: Initial delay (in milliseconds) before sending
740#     the first announce (Since 4.0)
741#
742# @announce-max: Maximum delay (in milliseconds) between packets in
743#     the announcement (Since 4.0)
744#
745# @announce-rounds: Number of self-announce packets sent after
746#     migration (Since 4.0)
747#
748# @announce-step: Increase in delay (in milliseconds) between
749#     subsequent packets in the announcement (Since 4.0)
750#
751# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
752#     bytes_xfer_period to trigger throttling.  It is expressed as
753#     percentage.  The default value is 50.  (Since 5.0)
754#
755# @cpu-throttle-initial: Initial percentage of time guest cpus are
756#     throttled when migration auto-converge is activated.  The
757#     default value is 20.  (Since 2.7)
758#
759# @cpu-throttle-increment: throttle percentage increase each time
760#     auto-converge detects that migration is not making progress.
761#     The default value is 10.  (Since 2.7)
762#
763# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At
764#     the tail stage of throttling, the Guest is very sensitive to CPU
765#     percentage while the @cpu-throttle -increment is excessive
766#     usually at tail stage.  If this parameter is true, we will
767#     compute the ideal CPU percentage used by the Guest, which may
768#     exactly make the dirty rate match the dirty rate threshold.
769#     Then we will choose a smaller throttle increment between the one
770#     specified by @cpu-throttle-increment and the one generated by
771#     ideal CPU percentage.  Therefore, it is compatible to
772#     traditional throttling, meanwhile the throttle increment won't
773#     be excessive at tail stage.  The default value is false.  (Since
774#     5.1)
775#
776# @tls-creds: ID of the 'tls-creds' object that provides credentials
777#     for establishing a TLS connection over the migration data
778#     channel.  On the outgoing side of the migration, the credentials
779#     must be for a 'client' endpoint, while for the incoming side the
780#     credentials must be for a 'server' endpoint.  Setting this to a
781#     non-empty string enables TLS for all migrations.  An empty
782#     string means that QEMU will use plain text mode for migration,
783#     rather than TLS.  (Since 2.7)
784#
785# @tls-hostname: migration target's hostname for validating the
786#     server's x509 certificate identity.  If empty, QEMU will use the
787#     hostname from the migration URI, if any.  A non-empty value is
788#     required when using x509 based TLS credentials and the migration
789#     URI does not include a hostname, such as fd: or exec: based
790#     migration.  (Since 2.7)
791#
792#     Note: empty value works only since 2.9.
793#
794# @tls-authz: ID of the 'authz' object subclass that provides access
795#     control checking of the TLS x509 certificate distinguished name.
796#     This object is only resolved at time of use, so can be deleted
797#     and recreated on the fly while the migration server is active.
798#     If missing, it will default to denying access (Since 4.0)
799#
800# @max-bandwidth: maximum speed for migration, in bytes per second.
801#     (Since 2.8)
802#
803# @avail-switchover-bandwidth: to set the available bandwidth that
804#     migration can use during switchover phase.  NOTE!  This does not
805#     limit the bandwidth during switchover, but only for calculations
806#     when making decisions to switchover.  By default, this value is
807#     zero, which means QEMU will estimate the bandwidth
808#     automatically.  This can be set when the estimated value is not
809#     accurate, while the user is able to guarantee such bandwidth is
810#     available when switching over.  When specified correctly, this
811#     can make the switchover decision much more accurate.
812#     (Since 8.2)
813#
814# @downtime-limit: set maximum tolerated downtime for migration.
815#     maximum downtime in milliseconds (Since 2.8)
816#
817# @x-checkpoint-delay: The delay time (in ms) between two COLO
818#     checkpoints in periodic mode.  (Since 2.8)
819#
820# @multifd-channels: Number of channels used to migrate data in
821#     parallel.  This is the same number that the number of sockets
822#     used for migration.  The default value is 2 (since 4.0)
823#
824# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
825#     needs to be a multiple of the target page size and a power of 2
826#     (Since 2.11)
827#
828# @max-postcopy-bandwidth: Background transfer bandwidth during
829#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
830#     (Since 3.0)
831#
832# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
833#     (Since 3.1)
834#
835# @multifd-compression: Which compression method to use.  Defaults to
836#     none.  (Since 5.0)
837#
838# @multifd-zlib-level: Set the compression level to be used in live
839#     migration, the compression level is an integer between 0 and 9,
840#     where 0 means no compression, 1 means the best compression
841#     speed, and 9 means best compression ratio which will consume
842#     more CPU.  Defaults to 1.  (Since 5.0)
843#
844# @multifd-qatzip-level: Set the compression level to be used in live
845#     migration. The level is an integer between 1 and 9, where 1 means
846#     the best compression speed, and 9 means the best compression
847#     ratio which will consume more CPU. Defaults to 1.  (Since 9.2)
848#
849# @multifd-zstd-level: Set the compression level to be used in live
850#     migration, the compression level is an integer between 0 and 20,
851#     where 0 means no compression, 1 means the best compression
852#     speed, and 20 means best compression ratio which will consume
853#     more CPU.  Defaults to 1.  (Since 5.0)
854#
855# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
856#     aliases for the purpose of dirty bitmap migration.  Such aliases
857#     may for example be the corresponding names on the opposite site.
858#     The mapping must be one-to-one, but not necessarily complete: On
859#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
860#     will be ignored.  On the destination, encountering an unmapped
861#     alias in the incoming migration stream will result in a report,
862#     and all further bitmap migration data will then be discarded.
863#     Note that the destination does not know about bitmaps it does
864#     not receive, so there is no limitation or requirement regarding
865#     the number of bitmaps received, or how they are named, or on
866#     which nodes they are placed.  By default (when this parameter
867#     has never been set), bitmap names are mapped to themselves.
868#     Nodes are mapped to their block device name if there is one, and
869#     to their node name otherwise.  (Since 5.2)
870#
871# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
872#     limit during live migration.  Should be in the range 1 to
873#     1000ms.  Defaults to 1000ms.  (Since 8.1)
874#
875# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
876#     Defaults to 1.  (Since 8.1)
877#
878# @mode: Migration mode.  See description in @MigMode.  Default is
879#     'normal'.  (Since 8.2)
880#
881# @zero-page-detection: Whether and how to detect zero pages.
882#     See description in @ZeroPageDetection.  Default is 'multifd'.
883#     (since 9.0)
884#
885# @direct-io: Open migration files with O_DIRECT when possible.  This
886#     only has effect if the @mapped-ram capability is enabled.
887#     (Since 9.1)
888#
889# Features:
890#
891# @unstable: Members @x-checkpoint-delay and
892#     @x-vcpu-dirty-limit-period are experimental.
893#
894# Since: 2.4
895##
896{ 'enum': 'MigrationParameter',
897  'data': ['announce-initial', 'announce-max',
898           'announce-rounds', 'announce-step',
899           'throttle-trigger-threshold',
900           'cpu-throttle-initial', 'cpu-throttle-increment',
901           'cpu-throttle-tailslow',
902           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
903           'avail-switchover-bandwidth', 'downtime-limit',
904           { 'name': 'x-checkpoint-delay', 'features': [ 'unstable' ] },
905           'multifd-channels',
906           'xbzrle-cache-size', 'max-postcopy-bandwidth',
907           'max-cpu-throttle', 'multifd-compression',
908           'multifd-zlib-level', 'multifd-zstd-level',
909           'multifd-qatzip-level',
910           'block-bitmap-mapping',
911           { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable'] },
912           'vcpu-dirty-limit',
913           'mode',
914           'zero-page-detection',
915           'direct-io'] }
916
917##
918# @MigrateSetParameters:
919#
920# @announce-initial: Initial delay (in milliseconds) before sending
921#     the first announce (Since 4.0)
922#
923# @announce-max: Maximum delay (in milliseconds) between packets in
924#     the announcement (Since 4.0)
925#
926# @announce-rounds: Number of self-announce packets sent after
927#     migration (Since 4.0)
928#
929# @announce-step: Increase in delay (in milliseconds) between
930#     subsequent packets in the announcement (Since 4.0)
931#
932# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
933#     bytes_xfer_period to trigger throttling.  It is expressed as
934#     percentage.  The default value is 50.  (Since 5.0)
935#
936# @cpu-throttle-initial: Initial percentage of time guest cpus are
937#     throttled when migration auto-converge is activated.  The
938#     default value is 20.  (Since 2.7)
939#
940# @cpu-throttle-increment: throttle percentage increase each time
941#     auto-converge detects that migration is not making progress.
942#     The default value is 10.  (Since 2.7)
943#
944# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At
945#     the tail stage of throttling, the Guest is very sensitive to CPU
946#     percentage while the @cpu-throttle -increment is excessive
947#     usually at tail stage.  If this parameter is true, we will
948#     compute the ideal CPU percentage used by the Guest, which may
949#     exactly make the dirty rate match the dirty rate threshold.
950#     Then we will choose a smaller throttle increment between the one
951#     specified by @cpu-throttle-increment and the one generated by
952#     ideal CPU percentage.  Therefore, it is compatible to
953#     traditional throttling, meanwhile the throttle increment won't
954#     be excessive at tail stage.  The default value is false.  (Since
955#     5.1)
956#
957# @tls-creds: ID of the 'tls-creds' object that provides credentials
958#     for establishing a TLS connection over the migration data
959#     channel.  On the outgoing side of the migration, the credentials
960#     must be for a 'client' endpoint, while for the incoming side the
961#     credentials must be for a 'server' endpoint.  Setting this to a
962#     non-empty string enables TLS for all migrations.  An empty
963#     string means that QEMU will use plain text mode for migration,
964#     rather than TLS.  This is the default.  (Since 2.7)
965#
966# @tls-hostname: migration target's hostname for validating the
967#     server's x509 certificate identity.  If empty, QEMU will use the
968#     hostname from the migration URI, if any.  A non-empty value is
969#     required when using x509 based TLS credentials and the migration
970#     URI does not include a hostname, such as fd: or exec: based
971#     migration.  (Since 2.7)
972#
973#     Note: empty value works only since 2.9.
974#
975# @tls-authz: ID of the 'authz' object subclass that provides access
976#     control checking of the TLS x509 certificate distinguished name.
977#     This object is only resolved at time of use, so can be deleted
978#     and recreated on the fly while the migration server is active.
979#     If missing, it will default to denying access (Since 4.0)
980#
981# @max-bandwidth: maximum speed for migration, in bytes per second.
982#     (Since 2.8)
983#
984# @avail-switchover-bandwidth: to set the available bandwidth that
985#     migration can use during switchover phase.  NOTE!  This does not
986#     limit the bandwidth during switchover, but only for calculations
987#     when making decisions to switchover.  By default, this value is
988#     zero, which means QEMU will estimate the bandwidth
989#     automatically.  This can be set when the estimated value is not
990#     accurate, while the user is able to guarantee such bandwidth is
991#     available when switching over.  When specified correctly, this
992#     can make the switchover decision much more accurate.
993#     (Since 8.2)
994#
995# @downtime-limit: set maximum tolerated downtime for migration.
996#     maximum downtime in milliseconds (Since 2.8)
997#
998# @x-checkpoint-delay: The delay time (in ms) between two COLO
999#     checkpoints in periodic mode.  (Since 2.8)
1000#
1001# @multifd-channels: Number of channels used to migrate data in
1002#     parallel.  This is the same number that the number of sockets
1003#     used for migration.  The default value is 2 (since 4.0)
1004#
1005# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1006#     needs to be a multiple of the target page size and a power of 2
1007#     (Since 2.11)
1008#
1009# @max-postcopy-bandwidth: Background transfer bandwidth during
1010#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1011#     (Since 3.0)
1012#
1013# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1014#     (Since 3.1)
1015#
1016# @multifd-compression: Which compression method to use.  Defaults to
1017#     none.  (Since 5.0)
1018#
1019# @multifd-zlib-level: Set the compression level to be used in live
1020#     migration, the compression level is an integer between 0 and 9,
1021#     where 0 means no compression, 1 means the best compression
1022#     speed, and 9 means best compression ratio which will consume
1023#     more CPU.  Defaults to 1.  (Since 5.0)
1024#
1025# @multifd-qatzip-level: Set the compression level to be used in live
1026#     migration. The level is an integer between 1 and 9, where 1 means
1027#     the best compression speed, and 9 means the best compression
1028#     ratio which will consume more CPU. Defaults to 1.  (Since 9.2)
1029#
1030# @multifd-zstd-level: Set the compression level to be used in live
1031#     migration, the compression level is an integer between 0 and 20,
1032#     where 0 means no compression, 1 means the best compression
1033#     speed, and 20 means best compression ratio which will consume
1034#     more CPU.  Defaults to 1.  (Since 5.0)
1035#
1036# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1037#     aliases for the purpose of dirty bitmap migration.  Such aliases
1038#     may for example be the corresponding names on the opposite site.
1039#     The mapping must be one-to-one, but not necessarily complete: On
1040#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1041#     will be ignored.  On the destination, encountering an unmapped
1042#     alias in the incoming migration stream will result in a report,
1043#     and all further bitmap migration data will then be discarded.
1044#     Note that the destination does not know about bitmaps it does
1045#     not receive, so there is no limitation or requirement regarding
1046#     the number of bitmaps received, or how they are named, or on
1047#     which nodes they are placed.  By default (when this parameter
1048#     has never been set), bitmap names are mapped to themselves.
1049#     Nodes are mapped to their block device name if there is one, and
1050#     to their node name otherwise.  (Since 5.2)
1051#
1052# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1053#     limit during live migration.  Should be in the range 1 to
1054#     1000ms.  Defaults to 1000ms.  (Since 8.1)
1055#
1056# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1057#     Defaults to 1.  (Since 8.1)
1058#
1059# @mode: Migration mode.  See description in @MigMode.  Default is
1060#     'normal'.  (Since 8.2)
1061#
1062# @zero-page-detection: Whether and how to detect zero pages.
1063#     See description in @ZeroPageDetection.  Default is 'multifd'.
1064#     (since 9.0)
1065#
1066# @direct-io: Open migration files with O_DIRECT when possible.  This
1067#     only has effect if the @mapped-ram capability is enabled.
1068#     (Since 9.1)
1069#
1070# Features:
1071#
1072# @unstable: Members @x-checkpoint-delay and
1073#     @x-vcpu-dirty-limit-period are experimental.
1074#
1075# TODO: either fuse back into MigrationParameters, or make
1076#     MigrationParameters members mandatory
1077#
1078# Since: 2.4
1079##
1080{ 'struct': 'MigrateSetParameters',
1081  'data': { '*announce-initial': 'size',
1082            '*announce-max': 'size',
1083            '*announce-rounds': 'size',
1084            '*announce-step': 'size',
1085            '*throttle-trigger-threshold': 'uint8',
1086            '*cpu-throttle-initial': 'uint8',
1087            '*cpu-throttle-increment': 'uint8',
1088            '*cpu-throttle-tailslow': 'bool',
1089            '*tls-creds': 'StrOrNull',
1090            '*tls-hostname': 'StrOrNull',
1091            '*tls-authz': 'StrOrNull',
1092            '*max-bandwidth': 'size',
1093            '*avail-switchover-bandwidth': 'size',
1094            '*downtime-limit': 'uint64',
1095            '*x-checkpoint-delay': { 'type': 'uint32',
1096                                     'features': [ 'unstable' ] },
1097            '*multifd-channels': 'uint8',
1098            '*xbzrle-cache-size': 'size',
1099            '*max-postcopy-bandwidth': 'size',
1100            '*max-cpu-throttle': 'uint8',
1101            '*multifd-compression': 'MultiFDCompression',
1102            '*multifd-zlib-level': 'uint8',
1103            '*multifd-qatzip-level': 'uint8',
1104            '*multifd-zstd-level': 'uint8',
1105            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1106            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1107                                            'features': [ 'unstable' ] },
1108            '*vcpu-dirty-limit': 'uint64',
1109            '*mode': 'MigMode',
1110            '*zero-page-detection': 'ZeroPageDetection',
1111            '*direct-io': 'bool' } }
1112
1113##
1114# @migrate-set-parameters:
1115#
1116# Set various migration parameters.
1117#
1118# Since: 2.4
1119#
1120# .. qmp-example::
1121#
1122#     -> { "execute": "migrate-set-parameters" ,
1123#          "arguments": { "multifd-channels": 5 } }
1124#     <- { "return": {} }
1125##
1126{ 'command': 'migrate-set-parameters', 'boxed': true,
1127  'data': 'MigrateSetParameters' }
1128
1129##
1130# @MigrationParameters:
1131#
1132# The optional members aren't actually optional.
1133#
1134# @announce-initial: Initial delay (in milliseconds) before sending
1135#     the first announce (Since 4.0)
1136#
1137# @announce-max: Maximum delay (in milliseconds) between packets in
1138#     the announcement (Since 4.0)
1139#
1140# @announce-rounds: Number of self-announce packets sent after
1141#     migration (Since 4.0)
1142#
1143# @announce-step: Increase in delay (in milliseconds) between
1144#     subsequent packets in the announcement (Since 4.0)
1145#
1146# @throttle-trigger-threshold: The ratio of bytes_dirty_period and
1147#     bytes_xfer_period to trigger throttling.  It is expressed as
1148#     percentage.  The default value is 50.  (Since 5.0)
1149#
1150# @cpu-throttle-initial: Initial percentage of time guest cpus are
1151#     throttled when migration auto-converge is activated.  (Since
1152#     2.7)
1153#
1154# @cpu-throttle-increment: throttle percentage increase each time
1155#     auto-converge detects that migration is not making progress.
1156#     (Since 2.7)
1157#
1158# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage At
1159#     the tail stage of throttling, the Guest is very sensitive to CPU
1160#     percentage while the @cpu-throttle -increment is excessive
1161#     usually at tail stage.  If this parameter is true, we will
1162#     compute the ideal CPU percentage used by the Guest, which may
1163#     exactly make the dirty rate match the dirty rate threshold.
1164#     Then we will choose a smaller throttle increment between the one
1165#     specified by @cpu-throttle-increment and the one generated by
1166#     ideal CPU percentage.  Therefore, it is compatible to
1167#     traditional throttling, meanwhile the throttle increment won't
1168#     be excessive at tail stage.  The default value is false.  (Since
1169#     5.1)
1170#
1171# @tls-creds: ID of the 'tls-creds' object that provides credentials
1172#     for establishing a TLS connection over the migration data
1173#     channel.  On the outgoing side of the migration, the credentials
1174#     must be for a 'client' endpoint, while for the incoming side the
1175#     credentials must be for a 'server' endpoint.  An empty string
1176#     means that QEMU will use plain text mode for migration, rather
1177#     than TLS.  (Since 2.7)
1178#
1179#     Note: 2.8 omits empty @tls-creds instead.
1180#
1181# @tls-hostname: migration target's hostname for validating the
1182#     server's x509 certificate identity.  If empty, QEMU will use the
1183#     hostname from the migration URI, if any.  (Since 2.7)
1184#
1185#     Note: 2.8 omits empty @tls-hostname instead.
1186#
1187# @tls-authz: ID of the 'authz' object subclass that provides access
1188#     control checking of the TLS x509 certificate distinguished name.
1189#     (Since 4.0)
1190#
1191# @max-bandwidth: maximum speed for migration, in bytes per second.
1192#     (Since 2.8)
1193#
1194# @avail-switchover-bandwidth: to set the available bandwidth that
1195#     migration can use during switchover phase.  NOTE!  This does not
1196#     limit the bandwidth during switchover, but only for calculations
1197#     when making decisions to switchover.  By default, this value is
1198#     zero, which means QEMU will estimate the bandwidth
1199#     automatically.  This can be set when the estimated value is not
1200#     accurate, while the user is able to guarantee such bandwidth is
1201#     available when switching over.  When specified correctly, this
1202#     can make the switchover decision much more accurate.
1203#     (Since 8.2)
1204#
1205# @downtime-limit: set maximum tolerated downtime for migration.
1206#     maximum downtime in milliseconds (Since 2.8)
1207#
1208# @x-checkpoint-delay: the delay time between two COLO checkpoints.
1209#     (Since 2.8)
1210#
1211# @multifd-channels: Number of channels used to migrate data in
1212#     parallel.  This is the same number that the number of sockets
1213#     used for migration.  The default value is 2 (since 4.0)
1214#
1215# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
1216#     needs to be a multiple of the target page size and a power of 2
1217#     (Since 2.11)
1218#
1219# @max-postcopy-bandwidth: Background transfer bandwidth during
1220#     postcopy.  Defaults to 0 (unlimited).  In bytes per second.
1221#     (Since 3.0)
1222#
1223# @max-cpu-throttle: maximum cpu throttle percentage.  Defaults to 99.
1224#     (Since 3.1)
1225#
1226# @multifd-compression: Which compression method to use.  Defaults to
1227#     none.  (Since 5.0)
1228#
1229# @multifd-zlib-level: Set the compression level to be used in live
1230#     migration, the compression level is an integer between 0 and 9,
1231#     where 0 means no compression, 1 means the best compression
1232#     speed, and 9 means best compression ratio which will consume
1233#     more CPU.  Defaults to 1.  (Since 5.0)
1234#
1235# @multifd-qatzip-level: Set the compression level to be used in live
1236#     migration. The level is an integer between 1 and 9, where 1 means
1237#     the best compression speed, and 9 means the best compression
1238#     ratio which will consume more CPU. Defaults to 1.  (Since 9.2)
1239#
1240# @multifd-zstd-level: Set the compression level to be used in live
1241#     migration, the compression level is an integer between 0 and 20,
1242#     where 0 means no compression, 1 means the best compression
1243#     speed, and 20 means best compression ratio which will consume
1244#     more CPU.  Defaults to 1.  (Since 5.0)
1245#
1246# @block-bitmap-mapping: Maps block nodes and bitmaps on them to
1247#     aliases for the purpose of dirty bitmap migration.  Such aliases
1248#     may for example be the corresponding names on the opposite site.
1249#     The mapping must be one-to-one, but not necessarily complete: On
1250#     the source, unmapped bitmaps and all bitmaps on unmapped nodes
1251#     will be ignored.  On the destination, encountering an unmapped
1252#     alias in the incoming migration stream will result in a report,
1253#     and all further bitmap migration data will then be discarded.
1254#     Note that the destination does not know about bitmaps it does
1255#     not receive, so there is no limitation or requirement regarding
1256#     the number of bitmaps received, or how they are named, or on
1257#     which nodes they are placed.  By default (when this parameter
1258#     has never been set), bitmap names are mapped to themselves.
1259#     Nodes are mapped to their block device name if there is one, and
1260#     to their node name otherwise.  (Since 5.2)
1261#
1262# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty
1263#     limit during live migration.  Should be in the range 1 to
1264#     1000ms.  Defaults to 1000ms.  (Since 8.1)
1265#
1266# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration.
1267#     Defaults to 1.  (Since 8.1)
1268#
1269# @mode: Migration mode.  See description in @MigMode.  Default is
1270#     'normal'.  (Since 8.2)
1271#
1272# @zero-page-detection: Whether and how to detect zero pages.
1273#     See description in @ZeroPageDetection.  Default is 'multifd'.
1274#     (since 9.0)
1275#
1276# @direct-io: Open migration files with O_DIRECT when possible.  This
1277#     only has effect if the @mapped-ram capability is enabled.
1278#     (Since 9.1)
1279#
1280# Features:
1281#
1282# @unstable: Members @x-checkpoint-delay and
1283#     @x-vcpu-dirty-limit-period are experimental.
1284#
1285# Since: 2.4
1286##
1287{ 'struct': 'MigrationParameters',
1288  'data': { '*announce-initial': 'size',
1289            '*announce-max': 'size',
1290            '*announce-rounds': 'size',
1291            '*announce-step': 'size',
1292            '*throttle-trigger-threshold': 'uint8',
1293            '*cpu-throttle-initial': 'uint8',
1294            '*cpu-throttle-increment': 'uint8',
1295            '*cpu-throttle-tailslow': 'bool',
1296            '*tls-creds': 'str',
1297            '*tls-hostname': 'str',
1298            '*tls-authz': 'str',
1299            '*max-bandwidth': 'size',
1300            '*avail-switchover-bandwidth': 'size',
1301            '*downtime-limit': 'uint64',
1302            '*x-checkpoint-delay': { 'type': 'uint32',
1303                                     'features': [ 'unstable' ] },
1304            '*multifd-channels': 'uint8',
1305            '*xbzrle-cache-size': 'size',
1306            '*max-postcopy-bandwidth': 'size',
1307            '*max-cpu-throttle': 'uint8',
1308            '*multifd-compression': 'MultiFDCompression',
1309            '*multifd-zlib-level': 'uint8',
1310            '*multifd-qatzip-level': 'uint8',
1311            '*multifd-zstd-level': 'uint8',
1312            '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ],
1313            '*x-vcpu-dirty-limit-period': { 'type': 'uint64',
1314                                            'features': [ 'unstable' ] },
1315            '*vcpu-dirty-limit': 'uint64',
1316            '*mode': 'MigMode',
1317            '*zero-page-detection': 'ZeroPageDetection',
1318            '*direct-io': 'bool' } }
1319
1320##
1321# @query-migrate-parameters:
1322#
1323# Returns information about the current migration parameters
1324#
1325# Returns: @MigrationParameters
1326#
1327# Since: 2.4
1328#
1329# .. qmp-example::
1330#
1331#     -> { "execute": "query-migrate-parameters" }
1332#     <- { "return": {
1333#              "multifd-channels": 2,
1334#              "cpu-throttle-increment": 10,
1335#              "cpu-throttle-initial": 20,
1336#              "max-bandwidth": 33554432,
1337#              "downtime-limit": 300
1338#           }
1339#        }
1340##
1341{ 'command': 'query-migrate-parameters',
1342  'returns': 'MigrationParameters' }
1343
1344##
1345# @migrate-start-postcopy:
1346#
1347# Followup to a migration command to switch the migration to postcopy
1348# mode.  The postcopy-ram capability must be set on both source and
1349# destination before the original migration command.
1350#
1351# Since: 2.5
1352#
1353# .. qmp-example::
1354#
1355#     -> { "execute": "migrate-start-postcopy" }
1356#     <- { "return": {} }
1357##
1358{ 'command': 'migrate-start-postcopy' }
1359
1360##
1361# @MIGRATION:
1362#
1363# Emitted when a migration event happens
1364#
1365# @status: @MigrationStatus describing the current migration status.
1366#
1367# Since: 2.4
1368#
1369# .. qmp-example::
1370#
1371#     <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
1372#         "event": "MIGRATION",
1373#         "data": {"status": "completed"} }
1374##
1375{ 'event': 'MIGRATION',
1376  'data': {'status': 'MigrationStatus'}}
1377
1378##
1379# @MIGRATION_PASS:
1380#
1381# Emitted from the source side of a migration at the start of each
1382# pass (when it syncs the dirty bitmap)
1383#
1384# @pass: An incrementing count (starting at 1 on the first pass)
1385#
1386# Since: 2.6
1387#
1388# .. qmp-example::
1389#
1390#     <- { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
1391#           "event": "MIGRATION_PASS", "data": {"pass": 2} }
1392##
1393{ 'event': 'MIGRATION_PASS',
1394  'data': { 'pass': 'int' } }
1395
1396##
1397# @COLOMessage:
1398#
1399# The message transmission between Primary side and Secondary side.
1400#
1401# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
1402#
1403# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for
1404#     checkpointing
1405#
1406# @checkpoint-reply: SVM gets PVM's checkpoint request
1407#
1408# @vmstate-send: VM's state will be sent by PVM.
1409#
1410# @vmstate-size: The total size of VMstate.
1411#
1412# @vmstate-received: VM's state has been received by SVM.
1413#
1414# @vmstate-loaded: VM's state has been loaded by SVM.
1415#
1416# Since: 2.8
1417##
1418{ 'enum': 'COLOMessage',
1419  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
1420            'vmstate-send', 'vmstate-size', 'vmstate-received',
1421            'vmstate-loaded' ] }
1422
1423##
1424# @COLOMode:
1425#
1426# The COLO current mode.
1427#
1428# @none: COLO is disabled.
1429#
1430# @primary: COLO node in primary side.
1431#
1432# @secondary: COLO node in slave side.
1433#
1434# Since: 2.8
1435##
1436{ 'enum': 'COLOMode',
1437  'data': [ 'none', 'primary', 'secondary'] }
1438
1439##
1440# @FailoverStatus:
1441#
1442# An enumeration of COLO failover status
1443#
1444# @none: no failover has ever happened
1445#
1446# @require: got failover requirement but not handled
1447#
1448# @active: in the process of doing failover
1449#
1450# @completed: finish the process of failover
1451#
1452# @relaunch: restart the failover process, from 'none' -> 'completed'
1453#     (Since 2.9)
1454#
1455# Since: 2.8
1456##
1457{ 'enum': 'FailoverStatus',
1458  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1459
1460##
1461# @COLO_EXIT:
1462#
1463# Emitted when VM finishes COLO mode due to some errors happening or
1464# at the request of users.
1465#
1466# @mode: report COLO mode when COLO exited.
1467#
1468# @reason: describes the reason for the COLO exit.
1469#
1470# Since: 3.1
1471#
1472# .. qmp-example::
1473#
1474#     <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1475#          "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1476##
1477{ 'event': 'COLO_EXIT',
1478  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1479
1480##
1481# @COLOExitReason:
1482#
1483# The reason for a COLO exit.
1484#
1485# @none: failover has never happened.  This state does not occur in
1486#     the COLO_EXIT event, and is only visible in the result of
1487#     query-colo-status.
1488#
1489# @request: COLO exit is due to an external request.
1490#
1491# @error: COLO exit is due to an internal error.
1492#
1493# @processing: COLO is currently handling a failover (since 4.0).
1494#
1495# Since: 3.1
1496##
1497{ 'enum': 'COLOExitReason',
1498  'data': [ 'none', 'request', 'error' , 'processing' ] }
1499
1500##
1501# @x-colo-lost-heartbeat:
1502#
1503# Tell qemu that heartbeat is lost, request it to do takeover
1504# procedures.  If this command is sent to the PVM, the Primary side
1505# will exit COLO mode.  If sent to the Secondary, the Secondary side
1506# will run failover work, then takes over server operation to become
1507# the service VM.
1508#
1509# Features:
1510#
1511# @unstable: This command is experimental.
1512#
1513# Since: 2.8
1514#
1515# .. qmp-example::
1516#
1517#     -> { "execute": "x-colo-lost-heartbeat" }
1518#     <- { "return": {} }
1519##
1520{ 'command': 'x-colo-lost-heartbeat',
1521  'features': [ 'unstable' ],
1522  'if': 'CONFIG_REPLICATION' }
1523
1524##
1525# @migrate_cancel:
1526#
1527# Cancel the currently executing migration process.  Allows a new
1528# migration to be started right after.  When postcopy-ram is in use,
1529# cancelling is not allowed after the postcopy phase has started.
1530#
1531# .. note:: This command succeeds even if there is no migration
1532#    process running.
1533#
1534# Since: 0.14
1535#
1536# .. qmp-example::
1537#
1538#     -> { "execute": "migrate_cancel" }
1539#     <- { "return": {} }
1540##
1541{ 'command': 'migrate_cancel' }
1542
1543##
1544# @migrate-continue:
1545#
1546# Continue migration when it's in a paused state.
1547#
1548# @state: The state the migration is currently expected to be in
1549#
1550# Since: 2.11
1551#
1552# .. qmp-example::
1553#
1554#     -> { "execute": "migrate-continue" , "arguments":
1555#          { "state": "pre-switchover" } }
1556#     <- { "return": {} }
1557##
1558{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1559
1560##
1561# @MigrationAddressType:
1562#
1563# The migration stream transport mechanisms.
1564#
1565# @socket: Migrate via socket.
1566#
1567# @exec: Direct the migration stream to another process.
1568#
1569# @rdma: Migrate via RDMA.
1570#
1571# @file: Direct the migration stream to a file.
1572#
1573# Since: 8.2
1574##
1575{ 'enum': 'MigrationAddressType',
1576  'data': [ 'socket', 'exec', 'rdma', 'file' ] }
1577
1578##
1579# @FileMigrationArgs:
1580#
1581# @filename: The file to receive the migration stream
1582#
1583# @offset: The file offset where the migration stream will start
1584#
1585# Since: 8.2
1586##
1587{ 'struct': 'FileMigrationArgs',
1588  'data': { 'filename': 'str',
1589            'offset': 'uint64' } }
1590
1591##
1592# @MigrationExecCommand:
1593#
1594# @args: command (list head) and arguments to execute.
1595#
1596# Since: 8.2
1597##
1598{ 'struct': 'MigrationExecCommand',
1599  'data': {'args': [ 'str' ] } }
1600
1601##
1602# @MigrationAddress:
1603#
1604# Migration endpoint configuration.
1605#
1606# @transport: The migration stream transport mechanism
1607#
1608# Since: 8.2
1609##
1610{ 'union': 'MigrationAddress',
1611  'base': { 'transport' : 'MigrationAddressType'},
1612  'discriminator': 'transport',
1613  'data': {
1614    'socket': 'SocketAddress',
1615    'exec': 'MigrationExecCommand',
1616    'rdma': 'InetSocketAddress',
1617    'file': 'FileMigrationArgs' } }
1618
1619##
1620# @MigrationChannelType:
1621#
1622# The migration channel-type request options.
1623#
1624# @main: Main outbound migration channel.
1625# @cpr: Checkpoint and restart state channel.
1626#
1627# Since: 8.1
1628##
1629{ 'enum': 'MigrationChannelType',
1630  'data': [ 'main', 'cpr' ] }
1631
1632##
1633# @MigrationChannel:
1634#
1635# Migration stream channel parameters.
1636#
1637# @channel-type: Channel type for transferring packet information.
1638#
1639# @addr: Migration endpoint configuration on destination interface.
1640#
1641# Since: 8.1
1642##
1643{ 'struct': 'MigrationChannel',
1644  'data': {
1645      'channel-type': 'MigrationChannelType',
1646      'addr': 'MigrationAddress' } }
1647
1648##
1649# @migrate:
1650#
1651# Migrates the current running guest to another Virtual Machine.
1652#
1653# @uri: the Uniform Resource Identifier of the destination VM
1654#
1655# @channels: list of migration stream channels with each stream in the
1656#     list connected to a destination interface endpoint.
1657#
1658# @detach: this argument exists only for compatibility reasons and is
1659#     ignored by QEMU
1660#
1661# @resume: resume one paused migration, default "off".  (since 3.0)
1662#
1663# Since: 0.14
1664#
1665# .. admonition:: Notes
1666#
1667#     1. The 'query-migrate' command should be used to check
1668#        migration's progress and final result (this information is
1669#        provided by the 'status' member).
1670#
1671#     2. All boolean arguments default to false.
1672#
1673#     3. The user Monitor's "detach" argument is invalid in QMP and
1674#        should not be used.
1675#
1676#     4. The uri argument should have the Uniform Resource Identifier
1677#        of default destination VM.  This connection will be bound to
1678#        default network.
1679#
1680#     5. For now, number of migration streams is restricted to one,
1681#        i.e. number of items in 'channels' list is just 1.
1682#
1683#     6. The 'uri' and 'channels' arguments are mutually exclusive;
1684#        exactly one of the two should be present.
1685#
1686# .. qmp-example::
1687#
1688#     -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1689#     <- { "return": {} }
1690#
1691#     -> { "execute": "migrate",
1692#          "arguments": {
1693#              "channels": [ { "channel-type": "main",
1694#                              "addr": { "transport": "socket",
1695#                                        "type": "inet",
1696#                                        "host": "10.12.34.9",
1697#                                        "port": "1050" } } ] } }
1698#     <- { "return": {} }
1699#
1700#     -> { "execute": "migrate",
1701#          "arguments": {
1702#              "channels": [ { "channel-type": "main",
1703#                              "addr": { "transport": "exec",
1704#                                        "args": [ "/bin/nc", "-p", "6000",
1705#                                                  "/some/sock" ] } } ] } }
1706#     <- { "return": {} }
1707#
1708#     -> { "execute": "migrate",
1709#          "arguments": {
1710#              "channels": [ { "channel-type": "main",
1711#                              "addr": { "transport": "rdma",
1712#                                        "host": "10.12.34.9",
1713#                                        "port": "1050" } } ] } }
1714#     <- { "return": {} }
1715#
1716#     -> { "execute": "migrate",
1717#          "arguments": {
1718#              "channels": [ { "channel-type": "main",
1719#                              "addr": { "transport": "file",
1720#                                        "filename": "/tmp/migfile",
1721#                                        "offset": "0x1000" } } ] } }
1722#     <- { "return": {} }
1723##
1724{ 'command': 'migrate',
1725  'data': {'*uri': 'str',
1726           '*channels': [ 'MigrationChannel' ],
1727           '*detach': 'bool', '*resume': 'bool' } }
1728
1729##
1730# @migrate-incoming:
1731#
1732# Start an incoming migration, the qemu must have been started with
1733# -incoming defer
1734#
1735# @uri: The Uniform Resource Identifier identifying the source or
1736#     address to listen on
1737#
1738# @channels: list of migration stream channels with each stream in the
1739#     list connected to a destination interface endpoint.
1740#
1741# @exit-on-error: Exit on incoming migration failure.  Default true.
1742#     When set to false, the failure triggers a MIGRATION event, and
1743#     error details could be retrieved with query-migrate.
1744#     (since 9.1)
1745#
1746# Since: 2.3
1747#
1748# .. admonition:: Notes
1749#
1750#     1. It's a bad idea to use a string for the uri, but it needs to
1751#        stay compatible with -incoming and the format of the uri is
1752#        already exposed above libvirt.
1753#
1754#     2. QEMU must be started with -incoming defer to allow
1755#        migrate-incoming to be used.
1756#
1757#     3. The uri format is the same as for -incoming
1758#
1759#     4. For now, number of migration streams is restricted to one,
1760#        i.e. number of items in 'channels' list is just 1.
1761#
1762#     5. The 'uri' and 'channels' arguments are mutually exclusive;
1763#        exactly one of the two should be present.
1764#
1765# .. qmp-example::
1766#
1767#     -> { "execute": "migrate-incoming",
1768#          "arguments": { "uri": "tcp:0:4446" } }
1769#     <- { "return": {} }
1770#
1771#     -> { "execute": "migrate-incoming",
1772#          "arguments": {
1773#              "channels": [ { "channel-type": "main",
1774#                              "addr": { "transport": "socket",
1775#                                        "type": "inet",
1776#                                        "host": "10.12.34.9",
1777#                                        "port": "1050" } } ] } }
1778#     <- { "return": {} }
1779#
1780#     -> { "execute": "migrate-incoming",
1781#          "arguments": {
1782#              "channels": [ { "channel-type": "main",
1783#                              "addr": { "transport": "exec",
1784#                                        "args": [ "/bin/nc", "-p", "6000",
1785#                                                  "/some/sock" ] } } ] } }
1786#     <- { "return": {} }
1787#
1788#     -> { "execute": "migrate-incoming",
1789#          "arguments": {
1790#              "channels": [ { "channel-type": "main",
1791#                              "addr": { "transport": "rdma",
1792#                                        "host": "10.12.34.9",
1793#                                        "port": "1050" } } ] } }
1794#     <- { "return": {} }
1795##
1796{ 'command': 'migrate-incoming',
1797             'data': {'*uri': 'str',
1798                      '*channels': [ 'MigrationChannel' ],
1799                      '*exit-on-error': 'bool' } }
1800
1801##
1802# @xen-save-devices-state:
1803#
1804# Save the state of all devices to file.  The RAM and the block
1805# devices of the VM are not saved by this command.
1806#
1807# @filename: the file to save the state of the devices to as binary
1808#     data.  See xen-save-devices-state.txt for a description of the
1809#     binary format.
1810#
1811# @live: Optional argument to ask QEMU to treat this command as part
1812#     of a live migration.  Default to true.  (since 2.11)
1813#
1814# Since: 1.1
1815#
1816# .. qmp-example::
1817#
1818#     -> { "execute": "xen-save-devices-state",
1819#          "arguments": { "filename": "/tmp/save" } }
1820#     <- { "return": {} }
1821##
1822{ 'command': 'xen-save-devices-state',
1823  'data': {'filename': 'str', '*live':'bool' } }
1824
1825##
1826# @xen-set-global-dirty-log:
1827#
1828# Enable or disable the global dirty log mode.
1829#
1830# @enable: true to enable, false to disable.
1831#
1832# Since: 1.3
1833#
1834# .. qmp-example::
1835#
1836#     -> { "execute": "xen-set-global-dirty-log",
1837#          "arguments": { "enable": true } }
1838#     <- { "return": {} }
1839##
1840{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1841
1842##
1843# @xen-load-devices-state:
1844#
1845# Load the state of all devices from file.  The RAM and the block
1846# devices of the VM are not loaded by this command.
1847#
1848# @filename: the file to load the state of the devices from as binary
1849#     data.  See xen-save-devices-state.txt for a description of the
1850#     binary format.
1851#
1852# Since: 2.7
1853#
1854# .. qmp-example::
1855#
1856#     -> { "execute": "xen-load-devices-state",
1857#          "arguments": { "filename": "/tmp/resume" } }
1858#     <- { "return": {} }
1859##
1860{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1861
1862##
1863# @xen-set-replication:
1864#
1865# Enable or disable replication.
1866#
1867# @enable: true to enable, false to disable.
1868#
1869# @primary: true for primary or false for secondary.
1870#
1871# @failover: true to do failover, false to stop.  Cannot be specified
1872#     if 'enable' is true.  Default value is false.
1873#
1874# .. qmp-example::
1875#
1876#     -> { "execute": "xen-set-replication",
1877#          "arguments": {"enable": true, "primary": false} }
1878#     <- { "return": {} }
1879#
1880# Since: 2.9
1881##
1882{ 'command': 'xen-set-replication',
1883  'data': { 'enable': 'bool', 'primary': 'bool', '*failover': 'bool' },
1884  'if': 'CONFIG_REPLICATION' }
1885
1886##
1887# @ReplicationStatus:
1888#
1889# The result format for 'query-xen-replication-status'.
1890#
1891# @error: true if an error happened, false if replication is normal.
1892#
1893# @desc: the human readable error description string, when @error is
1894#     'true'.
1895#
1896# Since: 2.9
1897##
1898{ 'struct': 'ReplicationStatus',
1899  'data': { 'error': 'bool', '*desc': 'str' },
1900  'if': 'CONFIG_REPLICATION' }
1901
1902##
1903# @query-xen-replication-status:
1904#
1905# Query replication status while the vm is running.
1906#
1907# Returns: A @ReplicationStatus object showing the status.
1908#
1909# .. qmp-example::
1910#
1911#     -> { "execute": "query-xen-replication-status" }
1912#     <- { "return": { "error": false } }
1913#
1914# Since: 2.9
1915##
1916{ 'command': 'query-xen-replication-status',
1917  'returns': 'ReplicationStatus',
1918  'if': 'CONFIG_REPLICATION' }
1919
1920##
1921# @xen-colo-do-checkpoint:
1922#
1923# Xen uses this command to notify replication to trigger a checkpoint.
1924#
1925# .. qmp-example::
1926#
1927#     -> { "execute": "xen-colo-do-checkpoint" }
1928#     <- { "return": {} }
1929#
1930# Since: 2.9
1931##
1932{ 'command': 'xen-colo-do-checkpoint',
1933  'if': 'CONFIG_REPLICATION' }
1934
1935##
1936# @COLOStatus:
1937#
1938# The result format for 'query-colo-status'.
1939#
1940# @mode: COLO running mode.  If COLO is running, this field will
1941#     return 'primary' or 'secondary'.
1942#
1943# @last-mode: COLO last running mode.  If COLO is running, this field
1944#     will return same like mode field, after failover we can use this
1945#     field to get last colo mode.  (since 4.0)
1946#
1947# @reason: describes the reason for the COLO exit.
1948#
1949# Since: 3.1
1950##
1951{ 'struct': 'COLOStatus',
1952  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1953            'reason': 'COLOExitReason' },
1954  'if': 'CONFIG_REPLICATION' }
1955
1956##
1957# @query-colo-status:
1958#
1959# Query COLO status while the vm is running.
1960#
1961# Returns: A @COLOStatus object showing the status.
1962#
1963# .. qmp-example::
1964#
1965#     -> { "execute": "query-colo-status" }
1966#     <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
1967#
1968# Since: 3.1
1969##
1970{ 'command': 'query-colo-status',
1971  'returns': 'COLOStatus',
1972  'if': 'CONFIG_REPLICATION' }
1973
1974##
1975# @migrate-recover:
1976#
1977# Provide a recovery migration stream URI.
1978#
1979# @uri: the URI to be used for the recovery of migration stream.
1980#
1981# .. qmp-example::
1982#
1983#     -> { "execute": "migrate-recover",
1984#          "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1985#     <- { "return": {} }
1986#
1987# Since: 3.0
1988##
1989{ 'command': 'migrate-recover',
1990  'data': { 'uri': 'str' },
1991  'allow-oob': true }
1992
1993##
1994# @migrate-pause:
1995#
1996# Pause a migration.  Currently it only supports postcopy.
1997#
1998# .. qmp-example::
1999#
2000#     -> { "execute": "migrate-pause" }
2001#     <- { "return": {} }
2002#
2003# Since: 3.0
2004##
2005{ 'command': 'migrate-pause', 'allow-oob': true }
2006
2007##
2008# @UNPLUG_PRIMARY:
2009#
2010# Emitted from source side of a migration when migration state is
2011# WAIT_UNPLUG.  Device was unplugged by guest operating system.
2012# Device resources in QEMU are kept on standby to be able to re-plug
2013# it in case of migration failure.
2014#
2015# @device-id: QEMU device id of the unplugged device
2016#
2017# Since: 4.2
2018#
2019# .. qmp-example::
2020#
2021#     <- { "event": "UNPLUG_PRIMARY",
2022#          "data": { "device-id": "hostdev0" },
2023#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
2024##
2025{ 'event': 'UNPLUG_PRIMARY',
2026  'data': { 'device-id': 'str' } }
2027
2028##
2029# @DirtyRateVcpu:
2030#
2031# Dirty rate of vcpu.
2032#
2033# @id: vcpu index.
2034#
2035# @dirty-rate: dirty rate.
2036#
2037# Since: 6.2
2038##
2039{ 'struct': 'DirtyRateVcpu',
2040  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
2041
2042##
2043# @DirtyRateStatus:
2044#
2045# Dirty page rate measurement status.
2046#
2047# @unstarted: measuring thread has not been started yet
2048#
2049# @measuring: measuring thread is running
2050#
2051# @measured: dirty page rate is measured and the results are available
2052#
2053# Since: 5.2
2054##
2055{ 'enum': 'DirtyRateStatus',
2056  'data': [ 'unstarted', 'measuring', 'measured'] }
2057
2058##
2059# @DirtyRateMeasureMode:
2060#
2061# Method used to measure dirty page rate.  Differences between
2062# available methods are explained in @calc-dirty-rate.
2063#
2064# @page-sampling: use page sampling
2065#
2066# @dirty-ring: use dirty ring
2067#
2068# @dirty-bitmap: use dirty bitmap
2069#
2070# Since: 6.2
2071##
2072{ 'enum': 'DirtyRateMeasureMode',
2073  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
2074
2075##
2076# @TimeUnit:
2077#
2078# Specifies unit in which time-related value is specified.
2079#
2080# @second: value is in seconds
2081#
2082# @millisecond: value is in milliseconds
2083#
2084# Since: 8.2
2085##
2086{ 'enum': 'TimeUnit',
2087  'data': ['second', 'millisecond'] }
2088
2089##
2090# @DirtyRateInfo:
2091#
2092# Information about measured dirty page rate.
2093#
2094# @dirty-rate: an estimate of the dirty page rate of the VM in units
2095#     of MiB/s.  Value is present only when @status is 'measured'.
2096#
2097# @status: current status of dirty page rate measurements
2098#
2099# @start-time: start time in units of second for calculation
2100#
2101# @calc-time: time period for which dirty page rate was measured,
2102#     expressed and rounded down to @calc-time-unit.
2103#
2104# @calc-time-unit: time unit of @calc-time  (Since 8.2)
2105#
2106# @sample-pages: number of sampled pages per GiB of guest memory.
2107#     Valid only in page-sampling mode (Since 6.1)
2108#
2109# @mode: mode that was used to measure dirty page rate (Since 6.2)
2110#
2111# @vcpu-dirty-rate: dirty rate for each vCPU if dirty-ring mode was
2112#     specified (Since 6.2)
2113#
2114# Since: 5.2
2115##
2116{ 'struct': 'DirtyRateInfo',
2117  'data': {'*dirty-rate': 'int64',
2118           'status': 'DirtyRateStatus',
2119           'start-time': 'int64',
2120           'calc-time': 'int64',
2121           'calc-time-unit': 'TimeUnit',
2122           'sample-pages': 'uint64',
2123           'mode': 'DirtyRateMeasureMode',
2124           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
2125
2126##
2127# @calc-dirty-rate:
2128#
2129# Start measuring dirty page rate of the VM.  Results can be retrieved
2130# with @query-dirty-rate after measurements are completed.
2131#
2132# Dirty page rate is the number of pages changed in a given time
2133# period expressed in MiB/s.  The following methods of calculation are
2134# available:
2135#
2136# 1. In page sampling mode, a random subset of pages are selected and
2137#    hashed twice: once at the beginning of measurement time period,
2138#    and once again at the end.  If two hashes for some page are
2139#    different, the page is counted as changed.  Since this method
2140#    relies on sampling and hashing, calculated dirty page rate is
2141#    only an estimate of its true value.  Increasing @sample-pages
2142#    improves estimation quality at the cost of higher computational
2143#    overhead.
2144#
2145# 2. Dirty bitmap mode captures writes to memory (for example by
2146#    temporarily revoking write access to all pages) and counting page
2147#    faults.  Information about modified pages is collected into a
2148#    bitmap, where each bit corresponds to one guest page.  This mode
2149#    requires that KVM accelerator property "dirty-ring-size" is *not*
2150#    set.
2151#
2152# 3. Dirty ring mode is similar to dirty bitmap mode, but the
2153#    information about modified pages is collected into ring buffer.
2154#    This mode tracks page modification per each vCPU separately.  It
2155#    requires that KVM accelerator property "dirty-ring-size" is set.
2156#
2157# @calc-time: time period for which dirty page rate is calculated.  By
2158#     default it is specified in seconds, but the unit can be set
2159#     explicitly with @calc-time-unit.  Note that larger @calc-time
2160#     values will typically result in smaller dirty page rates because
2161#     page dirtying is a one-time event.  Once some page is counted as
2162#     dirty during @calc-time period, further writes to this page will
2163#     not increase dirty page rate anymore.
2164#
2165# @calc-time-unit: time unit in which @calc-time is specified.  By
2166#     default it is seconds.  (Since 8.2)
2167#
2168# @sample-pages: number of sampled pages per each GiB of guest memory.
2169#     Default value is 512.  For 4KiB guest pages this corresponds to
2170#     sampling ratio of 0.2%.  This argument is used only in page
2171#     sampling mode.  (Since 6.1)
2172#
2173# @mode: mechanism for tracking dirty pages.  Default value is
2174#     'page-sampling'.  Others are 'dirty-bitmap' and 'dirty-ring'.
2175#     (Since 6.1)
2176#
2177# Since: 5.2
2178#
2179# .. qmp-example::
2180#
2181#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
2182#                                                     "sample-pages": 512} }
2183#     <- { "return": {} }
2184#
2185# .. qmp-example::
2186#    :annotated:
2187#
2188#    Measure dirty rate using dirty bitmap for 500 milliseconds::
2189#
2190#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 500,
2191#         "calc-time-unit": "millisecond", "mode": "dirty-bitmap"} }
2192#
2193#     <- { "return": {} }
2194##
2195{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
2196                                         '*calc-time-unit': 'TimeUnit',
2197                                         '*sample-pages': 'int',
2198                                         '*mode': 'DirtyRateMeasureMode'} }
2199
2200##
2201# @query-dirty-rate:
2202#
2203# Query results of the most recent invocation of @calc-dirty-rate.
2204#
2205# @calc-time-unit: time unit in which to report calculation time.
2206#     By default it is reported in seconds.  (Since 8.2)
2207#
2208# Since: 5.2
2209#
2210# .. qmp-example::
2211#    :title: Measurement is in progress
2212#
2213#     <- {"status": "measuring", "sample-pages": 512,
2214#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2215#         "calc-time-unit": "second"}
2216#
2217# .. qmp-example::
2218#    :title: Measurement has been completed
2219#
2220#     <- {"status": "measured", "sample-pages": 512, "dirty-rate": 108,
2221#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2222#         "calc-time-unit": "second"}
2223##
2224{ 'command': 'query-dirty-rate', 'data': {'*calc-time-unit': 'TimeUnit' },
2225                                 'returns': 'DirtyRateInfo' }
2226
2227##
2228# @DirtyLimitInfo:
2229#
2230# Dirty page rate limit information of a virtual CPU.
2231#
2232# @cpu-index: index of a virtual CPU.
2233#
2234# @limit-rate: upper limit of dirty page rate (MB/s) for a virtual
2235#     CPU, 0 means unlimited.
2236#
2237# @current-rate: current dirty page rate (MB/s) for a virtual CPU.
2238#
2239# Since: 7.1
2240##
2241{ 'struct': 'DirtyLimitInfo',
2242  'data': { 'cpu-index': 'int',
2243            'limit-rate': 'uint64',
2244            'current-rate': 'uint64' } }
2245
2246##
2247# @set-vcpu-dirty-limit:
2248#
2249# Set the upper limit of dirty page rate for virtual CPUs.
2250#
2251# Requires KVM with accelerator property "dirty-ring-size" set.  A
2252# virtual CPU's dirty page rate is a measure of its memory load.  To
2253# observe dirty page rates, use @calc-dirty-rate.
2254#
2255# @cpu-index: index of a virtual CPU, default is all.
2256#
2257# @dirty-rate: upper limit of dirty page rate (MB/s) for virtual CPUs.
2258#
2259# Since: 7.1
2260#
2261# .. qmp-example::
2262#
2263#     -> {"execute": "set-vcpu-dirty-limit"}
2264#         "arguments": { "dirty-rate": 200,
2265#                        "cpu-index": 1 } }
2266#     <- { "return": {} }
2267##
2268{ 'command': 'set-vcpu-dirty-limit',
2269  'data': { '*cpu-index': 'int',
2270            'dirty-rate': 'uint64' } }
2271
2272##
2273# @cancel-vcpu-dirty-limit:
2274#
2275# Cancel the upper limit of dirty page rate for virtual CPUs.
2276#
2277# Cancel the dirty page limit for the vCPU which has been set with
2278# set-vcpu-dirty-limit command.  Note that this command requires
2279# support from dirty ring, same as the "set-vcpu-dirty-limit".
2280#
2281# @cpu-index: index of a virtual CPU, default is all.
2282#
2283# Since: 7.1
2284#
2285# .. qmp-example::
2286#
2287#     -> {"execute": "cancel-vcpu-dirty-limit"},
2288#         "arguments": { "cpu-index": 1 } }
2289#     <- { "return": {} }
2290##
2291{ 'command': 'cancel-vcpu-dirty-limit',
2292  'data': { '*cpu-index': 'int'} }
2293
2294##
2295# @query-vcpu-dirty-limit:
2296#
2297# Returns information about virtual CPU dirty page rate limits, if
2298# any.
2299#
2300# Since: 7.1
2301#
2302# .. qmp-example::
2303#
2304#     -> {"execute": "query-vcpu-dirty-limit"}
2305#     <- {"return": [
2306#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 0},
2307#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 1}]}
2308##
2309{ 'command': 'query-vcpu-dirty-limit',
2310  'returns': [ 'DirtyLimitInfo' ] }
2311
2312##
2313# @MigrationThreadInfo:
2314#
2315# Information about migrationthreads
2316#
2317# @name: the name of migration thread
2318#
2319# @thread-id: ID of the underlying host thread
2320#
2321# Since: 7.2
2322##
2323{ 'struct': 'MigrationThreadInfo',
2324  'data': {'name': 'str',
2325           'thread-id': 'int'} }
2326
2327##
2328# @query-migrationthreads:
2329#
2330# Returns information of migration threads
2331#
2332# Features:
2333#
2334# @deprecated: This command is deprecated with no replacement yet.
2335#
2336# Returns: @MigrationThreadInfo
2337#
2338# Since: 7.2
2339##
2340{ 'command': 'query-migrationthreads',
2341  'returns': ['MigrationThreadInfo'],
2342  'features': ['deprecated'] }
2343
2344##
2345# @snapshot-save:
2346#
2347# Save a VM snapshot
2348#
2349# @job-id: identifier for the newly created job
2350#
2351# @tag: name of the snapshot to create
2352#
2353# @vmstate: block device node name to save vmstate to
2354#
2355# @devices: list of block device node names to save a snapshot to
2356#
2357# Applications should not assume that the snapshot save is complete
2358# when this command returns.  The job commands / events must be used
2359# to determine completion and to fetch details of any errors that
2360# arise.
2361#
2362# Note that execution of the guest CPUs may be stopped during the time
2363# it takes to save the snapshot.  A future version of QEMU may ensure
2364# CPUs are executing continuously.
2365#
2366# It is strongly recommended that @devices contain all writable block
2367# device nodes if a consistent snapshot is required.
2368#
2369# If @tag already exists, an error will be reported
2370#
2371# .. qmp-example::
2372#
2373#     -> { "execute": "snapshot-save",
2374#          "arguments": {
2375#             "job-id": "snapsave0",
2376#             "tag": "my-snap",
2377#             "vmstate": "disk0",
2378#             "devices": ["disk0", "disk1"]
2379#          }
2380#        }
2381#     <- { "return": { } }
2382#     <- {"event": "JOB_STATUS_CHANGE",
2383#         "timestamp": {"seconds": 1432121972, "microseconds": 744001},
2384#         "data": {"status": "created", "id": "snapsave0"}}
2385#     <- {"event": "JOB_STATUS_CHANGE",
2386#         "timestamp": {"seconds": 1432122172, "microseconds": 744001},
2387#         "data": {"status": "running", "id": "snapsave0"}}
2388#     <- {"event": "STOP",
2389#         "timestamp": {"seconds": 1432122372, "microseconds": 744001} }
2390#     <- {"event": "RESUME",
2391#         "timestamp": {"seconds": 1432122572, "microseconds": 744001} }
2392#     <- {"event": "JOB_STATUS_CHANGE",
2393#         "timestamp": {"seconds": 1432122772, "microseconds": 744001},
2394#         "data": {"status": "waiting", "id": "snapsave0"}}
2395#     <- {"event": "JOB_STATUS_CHANGE",
2396#         "timestamp": {"seconds": 1432122972, "microseconds": 744001},
2397#         "data": {"status": "pending", "id": "snapsave0"}}
2398#     <- {"event": "JOB_STATUS_CHANGE",
2399#         "timestamp": {"seconds": 1432123172, "microseconds": 744001},
2400#         "data": {"status": "concluded", "id": "snapsave0"}}
2401#     -> {"execute": "query-jobs"}
2402#     <- {"return": [{"current-progress": 1,
2403#                     "status": "concluded",
2404#                     "total-progress": 1,
2405#                     "type": "snapshot-save",
2406#                     "id": "snapsave0"}]}
2407#
2408# Since: 6.0
2409##
2410{ 'command': 'snapshot-save',
2411  'data': { 'job-id': 'str',
2412            'tag': 'str',
2413            'vmstate': 'str',
2414            'devices': ['str'] } }
2415
2416##
2417# @snapshot-load:
2418#
2419# Load a VM snapshot
2420#
2421# @job-id: identifier for the newly created job
2422#
2423# @tag: name of the snapshot to load.
2424#
2425# @vmstate: block device node name to load vmstate from
2426#
2427# @devices: list of block device node names to load a snapshot from
2428#
2429# Applications should not assume that the snapshot load is complete
2430# when this command returns.  The job commands / events must be used
2431# to determine completion and to fetch details of any errors that
2432# arise.
2433#
2434# Note that execution of the guest CPUs will be stopped during the
2435# time it takes to load the snapshot.
2436#
2437# It is strongly recommended that @devices contain all writable block
2438# device nodes that can have changed since the original @snapshot-save
2439# command execution.
2440#
2441# .. qmp-example::
2442#
2443#     -> { "execute": "snapshot-load",
2444#          "arguments": {
2445#             "job-id": "snapload0",
2446#             "tag": "my-snap",
2447#             "vmstate": "disk0",
2448#             "devices": ["disk0", "disk1"]
2449#          }
2450#        }
2451#     <- { "return": { } }
2452#     <- {"event": "JOB_STATUS_CHANGE",
2453#         "timestamp": {"seconds": 1472124172, "microseconds": 744001},
2454#         "data": {"status": "created", "id": "snapload0"}}
2455#     <- {"event": "JOB_STATUS_CHANGE",
2456#         "timestamp": {"seconds": 1472125172, "microseconds": 744001},
2457#         "data": {"status": "running", "id": "snapload0"}}
2458#     <- {"event": "STOP",
2459#         "timestamp": {"seconds": 1472125472, "microseconds": 744001} }
2460#     <- {"event": "RESUME",
2461#         "timestamp": {"seconds": 1472125872, "microseconds": 744001} }
2462#     <- {"event": "JOB_STATUS_CHANGE",
2463#         "timestamp": {"seconds": 1472126172, "microseconds": 744001},
2464#         "data": {"status": "waiting", "id": "snapload0"}}
2465#     <- {"event": "JOB_STATUS_CHANGE",
2466#         "timestamp": {"seconds": 1472127172, "microseconds": 744001},
2467#         "data": {"status": "pending", "id": "snapload0"}}
2468#     <- {"event": "JOB_STATUS_CHANGE",
2469#         "timestamp": {"seconds": 1472128172, "microseconds": 744001},
2470#         "data": {"status": "concluded", "id": "snapload0"}}
2471#     -> {"execute": "query-jobs"}
2472#     <- {"return": [{"current-progress": 1,
2473#                     "status": "concluded",
2474#                     "total-progress": 1,
2475#                     "type": "snapshot-load",
2476#                     "id": "snapload0"}]}
2477#
2478# Since: 6.0
2479##
2480{ 'command': 'snapshot-load',
2481  'data': { 'job-id': 'str',
2482            'tag': 'str',
2483            'vmstate': 'str',
2484            'devices': ['str'] } }
2485
2486##
2487# @snapshot-delete:
2488#
2489# Delete a VM snapshot
2490#
2491# @job-id: identifier for the newly created job
2492#
2493# @tag: name of the snapshot to delete.
2494#
2495# @devices: list of block device node names to delete a snapshot from
2496#
2497# Applications should not assume that the snapshot delete is complete
2498# when this command returns.  The job commands / events must be used
2499# to determine completion and to fetch details of any errors that
2500# arise.
2501#
2502# .. qmp-example::
2503#
2504#     -> { "execute": "snapshot-delete",
2505#          "arguments": {
2506#             "job-id": "snapdelete0",
2507#             "tag": "my-snap",
2508#             "devices": ["disk0", "disk1"]
2509#          }
2510#        }
2511#     <- { "return": { } }
2512#     <- {"event": "JOB_STATUS_CHANGE",
2513#         "timestamp": {"seconds": 1442124172, "microseconds": 744001},
2514#         "data": {"status": "created", "id": "snapdelete0"}}
2515#     <- {"event": "JOB_STATUS_CHANGE",
2516#         "timestamp": {"seconds": 1442125172, "microseconds": 744001},
2517#         "data": {"status": "running", "id": "snapdelete0"}}
2518#     <- {"event": "JOB_STATUS_CHANGE",
2519#         "timestamp": {"seconds": 1442126172, "microseconds": 744001},
2520#         "data": {"status": "waiting", "id": "snapdelete0"}}
2521#     <- {"event": "JOB_STATUS_CHANGE",
2522#         "timestamp": {"seconds": 1442127172, "microseconds": 744001},
2523#         "data": {"status": "pending", "id": "snapdelete0"}}
2524#     <- {"event": "JOB_STATUS_CHANGE",
2525#         "timestamp": {"seconds": 1442128172, "microseconds": 744001},
2526#         "data": {"status": "concluded", "id": "snapdelete0"}}
2527#     -> {"execute": "query-jobs"}
2528#     <- {"return": [{"current-progress": 1,
2529#                     "status": "concluded",
2530#                     "total-progress": 1,
2531#                     "type": "snapshot-delete",
2532#                     "id": "snapdelete0"}]}
2533#
2534# Since: 6.0
2535##
2536{ 'command': 'snapshot-delete',
2537  'data': { 'job-id': 'str',
2538            'tag': 'str',
2539            'devices': ['str'] } }
2540