xref: /qemu/qapi/migration.json (revision 537600df6141640d411cda5deea742081d2f9962)
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 current executing migration process.
1528#
1529# .. note:: This command succeeds even if there is no migration
1530#    process running.
1531#
1532# Since: 0.14
1533#
1534# .. qmp-example::
1535#
1536#     -> { "execute": "migrate_cancel" }
1537#     <- { "return": {} }
1538##
1539{ 'command': 'migrate_cancel' }
1540
1541##
1542# @migrate-continue:
1543#
1544# Continue migration when it's in a paused state.
1545#
1546# @state: The state the migration is currently expected to be in
1547#
1548# Since: 2.11
1549#
1550# .. qmp-example::
1551#
1552#     -> { "execute": "migrate-continue" , "arguments":
1553#          { "state": "pre-switchover" } }
1554#     <- { "return": {} }
1555##
1556{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1557
1558##
1559# @MigrationAddressType:
1560#
1561# The migration stream transport mechanisms.
1562#
1563# @socket: Migrate via socket.
1564#
1565# @exec: Direct the migration stream to another process.
1566#
1567# @rdma: Migrate via RDMA.
1568#
1569# @file: Direct the migration stream to a file.
1570#
1571# Since: 8.2
1572##
1573{ 'enum': 'MigrationAddressType',
1574  'data': [ 'socket', 'exec', 'rdma', 'file' ] }
1575
1576##
1577# @FileMigrationArgs:
1578#
1579# @filename: The file to receive the migration stream
1580#
1581# @offset: The file offset where the migration stream will start
1582#
1583# Since: 8.2
1584##
1585{ 'struct': 'FileMigrationArgs',
1586  'data': { 'filename': 'str',
1587            'offset': 'uint64' } }
1588
1589##
1590# @MigrationExecCommand:
1591#
1592# @args: command (list head) and arguments to execute.
1593#
1594# Since: 8.2
1595##
1596{ 'struct': 'MigrationExecCommand',
1597  'data': {'args': [ 'str' ] } }
1598
1599##
1600# @MigrationAddress:
1601#
1602# Migration endpoint configuration.
1603#
1604# @transport: The migration stream transport mechanism
1605#
1606# Since: 8.2
1607##
1608{ 'union': 'MigrationAddress',
1609  'base': { 'transport' : 'MigrationAddressType'},
1610  'discriminator': 'transport',
1611  'data': {
1612    'socket': 'SocketAddress',
1613    'exec': 'MigrationExecCommand',
1614    'rdma': 'InetSocketAddress',
1615    'file': 'FileMigrationArgs' } }
1616
1617##
1618# @MigrationChannelType:
1619#
1620# The migration channel-type request options.
1621#
1622# @main: Main outbound migration channel.
1623# @cpr: Checkpoint and restart state channel.
1624#
1625# Since: 8.1
1626##
1627{ 'enum': 'MigrationChannelType',
1628  'data': [ 'main', 'cpr' ] }
1629
1630##
1631# @MigrationChannel:
1632#
1633# Migration stream channel parameters.
1634#
1635# @channel-type: Channel type for transferring packet information.
1636#
1637# @addr: Migration endpoint configuration on destination interface.
1638#
1639# Since: 8.1
1640##
1641{ 'struct': 'MigrationChannel',
1642  'data': {
1643      'channel-type': 'MigrationChannelType',
1644      'addr': 'MigrationAddress' } }
1645
1646##
1647# @migrate:
1648#
1649# Migrates the current running guest to another Virtual Machine.
1650#
1651# @uri: the Uniform Resource Identifier of the destination VM
1652#
1653# @channels: list of migration stream channels with each stream in the
1654#     list connected to a destination interface endpoint.
1655#
1656# @detach: this argument exists only for compatibility reasons and is
1657#     ignored by QEMU
1658#
1659# @resume: resume one paused migration, default "off".  (since 3.0)
1660#
1661# Since: 0.14
1662#
1663# .. admonition:: Notes
1664#
1665#     1. The 'query-migrate' command should be used to check
1666#        migration's progress and final result (this information is
1667#        provided by the 'status' member).
1668#
1669#     2. All boolean arguments default to false.
1670#
1671#     3. The user Monitor's "detach" argument is invalid in QMP and
1672#        should not be used.
1673#
1674#     4. The uri argument should have the Uniform Resource Identifier
1675#        of default destination VM.  This connection will be bound to
1676#        default network.
1677#
1678#     5. For now, number of migration streams is restricted to one,
1679#        i.e. number of items in 'channels' list is just 1.
1680#
1681#     6. The 'uri' and 'channels' arguments are mutually exclusive;
1682#        exactly one of the two should be present.
1683#
1684# .. qmp-example::
1685#
1686#     -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1687#     <- { "return": {} }
1688#
1689#     -> { "execute": "migrate",
1690#          "arguments": {
1691#              "channels": [ { "channel-type": "main",
1692#                              "addr": { "transport": "socket",
1693#                                        "type": "inet",
1694#                                        "host": "10.12.34.9",
1695#                                        "port": "1050" } } ] } }
1696#     <- { "return": {} }
1697#
1698#     -> { "execute": "migrate",
1699#          "arguments": {
1700#              "channels": [ { "channel-type": "main",
1701#                              "addr": { "transport": "exec",
1702#                                        "args": [ "/bin/nc", "-p", "6000",
1703#                                                  "/some/sock" ] } } ] } }
1704#     <- { "return": {} }
1705#
1706#     -> { "execute": "migrate",
1707#          "arguments": {
1708#              "channels": [ { "channel-type": "main",
1709#                              "addr": { "transport": "rdma",
1710#                                        "host": "10.12.34.9",
1711#                                        "port": "1050" } } ] } }
1712#     <- { "return": {} }
1713#
1714#     -> { "execute": "migrate",
1715#          "arguments": {
1716#              "channels": [ { "channel-type": "main",
1717#                              "addr": { "transport": "file",
1718#                                        "filename": "/tmp/migfile",
1719#                                        "offset": "0x1000" } } ] } }
1720#     <- { "return": {} }
1721##
1722{ 'command': 'migrate',
1723  'data': {'*uri': 'str',
1724           '*channels': [ 'MigrationChannel' ],
1725           '*detach': 'bool', '*resume': 'bool' } }
1726
1727##
1728# @migrate-incoming:
1729#
1730# Start an incoming migration, the qemu must have been started with
1731# -incoming defer
1732#
1733# @uri: The Uniform Resource Identifier identifying the source or
1734#     address to listen on
1735#
1736# @channels: list of migration stream channels with each stream in the
1737#     list connected to a destination interface endpoint.
1738#
1739# @exit-on-error: Exit on incoming migration failure.  Default true.
1740#     When set to false, the failure triggers a MIGRATION event, and
1741#     error details could be retrieved with query-migrate.
1742#     (since 9.1)
1743#
1744# Since: 2.3
1745#
1746# .. admonition:: Notes
1747#
1748#     1. It's a bad idea to use a string for the uri, but it needs to
1749#        stay compatible with -incoming and the format of the uri is
1750#        already exposed above libvirt.
1751#
1752#     2. QEMU must be started with -incoming defer to allow
1753#        migrate-incoming to be used.
1754#
1755#     3. The uri format is the same as for -incoming
1756#
1757#     4. For now, number of migration streams is restricted to one,
1758#        i.e. number of items in 'channels' list is just 1.
1759#
1760#     5. The 'uri' and 'channels' arguments are mutually exclusive;
1761#        exactly one of the two should be present.
1762#
1763# .. qmp-example::
1764#
1765#     -> { "execute": "migrate-incoming",
1766#          "arguments": { "uri": "tcp:0:4446" } }
1767#     <- { "return": {} }
1768#
1769#     -> { "execute": "migrate-incoming",
1770#          "arguments": {
1771#              "channels": [ { "channel-type": "main",
1772#                              "addr": { "transport": "socket",
1773#                                        "type": "inet",
1774#                                        "host": "10.12.34.9",
1775#                                        "port": "1050" } } ] } }
1776#     <- { "return": {} }
1777#
1778#     -> { "execute": "migrate-incoming",
1779#          "arguments": {
1780#              "channels": [ { "channel-type": "main",
1781#                              "addr": { "transport": "exec",
1782#                                        "args": [ "/bin/nc", "-p", "6000",
1783#                                                  "/some/sock" ] } } ] } }
1784#     <- { "return": {} }
1785#
1786#     -> { "execute": "migrate-incoming",
1787#          "arguments": {
1788#              "channels": [ { "channel-type": "main",
1789#                              "addr": { "transport": "rdma",
1790#                                        "host": "10.12.34.9",
1791#                                        "port": "1050" } } ] } }
1792#     <- { "return": {} }
1793##
1794{ 'command': 'migrate-incoming',
1795             'data': {'*uri': 'str',
1796                      '*channels': [ 'MigrationChannel' ],
1797                      '*exit-on-error': 'bool' } }
1798
1799##
1800# @xen-save-devices-state:
1801#
1802# Save the state of all devices to file.  The RAM and the block
1803# devices of the VM are not saved by this command.
1804#
1805# @filename: the file to save the state of the devices to as binary
1806#     data.  See xen-save-devices-state.txt for a description of the
1807#     binary format.
1808#
1809# @live: Optional argument to ask QEMU to treat this command as part
1810#     of a live migration.  Default to true.  (since 2.11)
1811#
1812# Since: 1.1
1813#
1814# .. qmp-example::
1815#
1816#     -> { "execute": "xen-save-devices-state",
1817#          "arguments": { "filename": "/tmp/save" } }
1818#     <- { "return": {} }
1819##
1820{ 'command': 'xen-save-devices-state',
1821  'data': {'filename': 'str', '*live':'bool' } }
1822
1823##
1824# @xen-set-global-dirty-log:
1825#
1826# Enable or disable the global dirty log mode.
1827#
1828# @enable: true to enable, false to disable.
1829#
1830# Since: 1.3
1831#
1832# .. qmp-example::
1833#
1834#     -> { "execute": "xen-set-global-dirty-log",
1835#          "arguments": { "enable": true } }
1836#     <- { "return": {} }
1837##
1838{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
1839
1840##
1841# @xen-load-devices-state:
1842#
1843# Load the state of all devices from file.  The RAM and the block
1844# devices of the VM are not loaded by this command.
1845#
1846# @filename: the file to load the state of the devices from as binary
1847#     data.  See xen-save-devices-state.txt for a description of the
1848#     binary format.
1849#
1850# Since: 2.7
1851#
1852# .. qmp-example::
1853#
1854#     -> { "execute": "xen-load-devices-state",
1855#          "arguments": { "filename": "/tmp/resume" } }
1856#     <- { "return": {} }
1857##
1858{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
1859
1860##
1861# @xen-set-replication:
1862#
1863# Enable or disable replication.
1864#
1865# @enable: true to enable, false to disable.
1866#
1867# @primary: true for primary or false for secondary.
1868#
1869# @failover: true to do failover, false to stop.  Cannot be specified
1870#     if 'enable' is true.  Default value is false.
1871#
1872# .. qmp-example::
1873#
1874#     -> { "execute": "xen-set-replication",
1875#          "arguments": {"enable": true, "primary": false} }
1876#     <- { "return": {} }
1877#
1878# Since: 2.9
1879##
1880{ 'command': 'xen-set-replication',
1881  'data': { 'enable': 'bool', 'primary': 'bool', '*failover': 'bool' },
1882  'if': 'CONFIG_REPLICATION' }
1883
1884##
1885# @ReplicationStatus:
1886#
1887# The result format for 'query-xen-replication-status'.
1888#
1889# @error: true if an error happened, false if replication is normal.
1890#
1891# @desc: the human readable error description string, when @error is
1892#     'true'.
1893#
1894# Since: 2.9
1895##
1896{ 'struct': 'ReplicationStatus',
1897  'data': { 'error': 'bool', '*desc': 'str' },
1898  'if': 'CONFIG_REPLICATION' }
1899
1900##
1901# @query-xen-replication-status:
1902#
1903# Query replication status while the vm is running.
1904#
1905# Returns: A @ReplicationStatus object showing the status.
1906#
1907# .. qmp-example::
1908#
1909#     -> { "execute": "query-xen-replication-status" }
1910#     <- { "return": { "error": false } }
1911#
1912# Since: 2.9
1913##
1914{ 'command': 'query-xen-replication-status',
1915  'returns': 'ReplicationStatus',
1916  'if': 'CONFIG_REPLICATION' }
1917
1918##
1919# @xen-colo-do-checkpoint:
1920#
1921# Xen uses this command to notify replication to trigger a checkpoint.
1922#
1923# .. qmp-example::
1924#
1925#     -> { "execute": "xen-colo-do-checkpoint" }
1926#     <- { "return": {} }
1927#
1928# Since: 2.9
1929##
1930{ 'command': 'xen-colo-do-checkpoint',
1931  'if': 'CONFIG_REPLICATION' }
1932
1933##
1934# @COLOStatus:
1935#
1936# The result format for 'query-colo-status'.
1937#
1938# @mode: COLO running mode.  If COLO is running, this field will
1939#     return 'primary' or 'secondary'.
1940#
1941# @last-mode: COLO last running mode.  If COLO is running, this field
1942#     will return same like mode field, after failover we can use this
1943#     field to get last colo mode.  (since 4.0)
1944#
1945# @reason: describes the reason for the COLO exit.
1946#
1947# Since: 3.1
1948##
1949{ 'struct': 'COLOStatus',
1950  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1951            'reason': 'COLOExitReason' },
1952  'if': 'CONFIG_REPLICATION' }
1953
1954##
1955# @query-colo-status:
1956#
1957# Query COLO status while the vm is running.
1958#
1959# Returns: A @COLOStatus object showing the status.
1960#
1961# .. qmp-example::
1962#
1963#     -> { "execute": "query-colo-status" }
1964#     <- { "return": { "mode": "primary", "last-mode": "none", "reason": "request" } }
1965#
1966# Since: 3.1
1967##
1968{ 'command': 'query-colo-status',
1969  'returns': 'COLOStatus',
1970  'if': 'CONFIG_REPLICATION' }
1971
1972##
1973# @migrate-recover:
1974#
1975# Provide a recovery migration stream URI.
1976#
1977# @uri: the URI to be used for the recovery of migration stream.
1978#
1979# .. qmp-example::
1980#
1981#     -> { "execute": "migrate-recover",
1982#          "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1983#     <- { "return": {} }
1984#
1985# Since: 3.0
1986##
1987{ 'command': 'migrate-recover',
1988  'data': { 'uri': 'str' },
1989  'allow-oob': true }
1990
1991##
1992# @migrate-pause:
1993#
1994# Pause a migration.  Currently it only supports postcopy.
1995#
1996# .. qmp-example::
1997#
1998#     -> { "execute": "migrate-pause" }
1999#     <- { "return": {} }
2000#
2001# Since: 3.0
2002##
2003{ 'command': 'migrate-pause', 'allow-oob': true }
2004
2005##
2006# @UNPLUG_PRIMARY:
2007#
2008# Emitted from source side of a migration when migration state is
2009# WAIT_UNPLUG.  Device was unplugged by guest operating system.
2010# Device resources in QEMU are kept on standby to be able to re-plug
2011# it in case of migration failure.
2012#
2013# @device-id: QEMU device id of the unplugged device
2014#
2015# Since: 4.2
2016#
2017# .. qmp-example::
2018#
2019#     <- { "event": "UNPLUG_PRIMARY",
2020#          "data": { "device-id": "hostdev0" },
2021#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
2022##
2023{ 'event': 'UNPLUG_PRIMARY',
2024  'data': { 'device-id': 'str' } }
2025
2026##
2027# @DirtyRateVcpu:
2028#
2029# Dirty rate of vcpu.
2030#
2031# @id: vcpu index.
2032#
2033# @dirty-rate: dirty rate.
2034#
2035# Since: 6.2
2036##
2037{ 'struct': 'DirtyRateVcpu',
2038  'data': { 'id': 'int', 'dirty-rate': 'int64' } }
2039
2040##
2041# @DirtyRateStatus:
2042#
2043# Dirty page rate measurement status.
2044#
2045# @unstarted: measuring thread has not been started yet
2046#
2047# @measuring: measuring thread is running
2048#
2049# @measured: dirty page rate is measured and the results are available
2050#
2051# Since: 5.2
2052##
2053{ 'enum': 'DirtyRateStatus',
2054  'data': [ 'unstarted', 'measuring', 'measured'] }
2055
2056##
2057# @DirtyRateMeasureMode:
2058#
2059# Method used to measure dirty page rate.  Differences between
2060# available methods are explained in @calc-dirty-rate.
2061#
2062# @page-sampling: use page sampling
2063#
2064# @dirty-ring: use dirty ring
2065#
2066# @dirty-bitmap: use dirty bitmap
2067#
2068# Since: 6.2
2069##
2070{ 'enum': 'DirtyRateMeasureMode',
2071  'data': ['page-sampling', 'dirty-ring', 'dirty-bitmap'] }
2072
2073##
2074# @TimeUnit:
2075#
2076# Specifies unit in which time-related value is specified.
2077#
2078# @second: value is in seconds
2079#
2080# @millisecond: value is in milliseconds
2081#
2082# Since: 8.2
2083##
2084{ 'enum': 'TimeUnit',
2085  'data': ['second', 'millisecond'] }
2086
2087##
2088# @DirtyRateInfo:
2089#
2090# Information about measured dirty page rate.
2091#
2092# @dirty-rate: an estimate of the dirty page rate of the VM in units
2093#     of MiB/s.  Value is present only when @status is 'measured'.
2094#
2095# @status: current status of dirty page rate measurements
2096#
2097# @start-time: start time in units of second for calculation
2098#
2099# @calc-time: time period for which dirty page rate was measured,
2100#     expressed and rounded down to @calc-time-unit.
2101#
2102# @calc-time-unit: time unit of @calc-time  (Since 8.2)
2103#
2104# @sample-pages: number of sampled pages per GiB of guest memory.
2105#     Valid only in page-sampling mode (Since 6.1)
2106#
2107# @mode: mode that was used to measure dirty page rate (Since 6.2)
2108#
2109# @vcpu-dirty-rate: dirty rate for each vCPU if dirty-ring mode was
2110#     specified (Since 6.2)
2111#
2112# Since: 5.2
2113##
2114{ 'struct': 'DirtyRateInfo',
2115  'data': {'*dirty-rate': 'int64',
2116           'status': 'DirtyRateStatus',
2117           'start-time': 'int64',
2118           'calc-time': 'int64',
2119           'calc-time-unit': 'TimeUnit',
2120           'sample-pages': 'uint64',
2121           'mode': 'DirtyRateMeasureMode',
2122           '*vcpu-dirty-rate': [ 'DirtyRateVcpu' ] } }
2123
2124##
2125# @calc-dirty-rate:
2126#
2127# Start measuring dirty page rate of the VM.  Results can be retrieved
2128# with @query-dirty-rate after measurements are completed.
2129#
2130# Dirty page rate is the number of pages changed in a given time
2131# period expressed in MiB/s.  The following methods of calculation are
2132# available:
2133#
2134# 1. In page sampling mode, a random subset of pages are selected and
2135#    hashed twice: once at the beginning of measurement time period,
2136#    and once again at the end.  If two hashes for some page are
2137#    different, the page is counted as changed.  Since this method
2138#    relies on sampling and hashing, calculated dirty page rate is
2139#    only an estimate of its true value.  Increasing @sample-pages
2140#    improves estimation quality at the cost of higher computational
2141#    overhead.
2142#
2143# 2. Dirty bitmap mode captures writes to memory (for example by
2144#    temporarily revoking write access to all pages) and counting page
2145#    faults.  Information about modified pages is collected into a
2146#    bitmap, where each bit corresponds to one guest page.  This mode
2147#    requires that KVM accelerator property "dirty-ring-size" is *not*
2148#    set.
2149#
2150# 3. Dirty ring mode is similar to dirty bitmap mode, but the
2151#    information about modified pages is collected into ring buffer.
2152#    This mode tracks page modification per each vCPU separately.  It
2153#    requires that KVM accelerator property "dirty-ring-size" is set.
2154#
2155# @calc-time: time period for which dirty page rate is calculated.  By
2156#     default it is specified in seconds, but the unit can be set
2157#     explicitly with @calc-time-unit.  Note that larger @calc-time
2158#     values will typically result in smaller dirty page rates because
2159#     page dirtying is a one-time event.  Once some page is counted as
2160#     dirty during @calc-time period, further writes to this page will
2161#     not increase dirty page rate anymore.
2162#
2163# @calc-time-unit: time unit in which @calc-time is specified.  By
2164#     default it is seconds.  (Since 8.2)
2165#
2166# @sample-pages: number of sampled pages per each GiB of guest memory.
2167#     Default value is 512.  For 4KiB guest pages this corresponds to
2168#     sampling ratio of 0.2%.  This argument is used only in page
2169#     sampling mode.  (Since 6.1)
2170#
2171# @mode: mechanism for tracking dirty pages.  Default value is
2172#     'page-sampling'.  Others are 'dirty-bitmap' and 'dirty-ring'.
2173#     (Since 6.1)
2174#
2175# Since: 5.2
2176#
2177# .. qmp-example::
2178#
2179#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 1,
2180#                                                     "sample-pages": 512} }
2181#     <- { "return": {} }
2182#
2183# .. qmp-example::
2184#    :annotated:
2185#
2186#    Measure dirty rate using dirty bitmap for 500 milliseconds::
2187#
2188#     -> {"execute": "calc-dirty-rate", "arguments": {"calc-time": 500,
2189#         "calc-time-unit": "millisecond", "mode": "dirty-bitmap"} }
2190#
2191#     <- { "return": {} }
2192##
2193{ 'command': 'calc-dirty-rate', 'data': {'calc-time': 'int64',
2194                                         '*calc-time-unit': 'TimeUnit',
2195                                         '*sample-pages': 'int',
2196                                         '*mode': 'DirtyRateMeasureMode'} }
2197
2198##
2199# @query-dirty-rate:
2200#
2201# Query results of the most recent invocation of @calc-dirty-rate.
2202#
2203# @calc-time-unit: time unit in which to report calculation time.
2204#     By default it is reported in seconds.  (Since 8.2)
2205#
2206# Since: 5.2
2207#
2208# .. qmp-example::
2209#    :title: Measurement is in progress
2210#
2211#     <- {"status": "measuring", "sample-pages": 512,
2212#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2213#         "calc-time-unit": "second"}
2214#
2215# .. qmp-example::
2216#    :title: Measurement has been completed
2217#
2218#     <- {"status": "measured", "sample-pages": 512, "dirty-rate": 108,
2219#         "mode": "page-sampling", "start-time": 1693900454, "calc-time": 10,
2220#         "calc-time-unit": "second"}
2221##
2222{ 'command': 'query-dirty-rate', 'data': {'*calc-time-unit': 'TimeUnit' },
2223                                 'returns': 'DirtyRateInfo' }
2224
2225##
2226# @DirtyLimitInfo:
2227#
2228# Dirty page rate limit information of a virtual CPU.
2229#
2230# @cpu-index: index of a virtual CPU.
2231#
2232# @limit-rate: upper limit of dirty page rate (MB/s) for a virtual
2233#     CPU, 0 means unlimited.
2234#
2235# @current-rate: current dirty page rate (MB/s) for a virtual CPU.
2236#
2237# Since: 7.1
2238##
2239{ 'struct': 'DirtyLimitInfo',
2240  'data': { 'cpu-index': 'int',
2241            'limit-rate': 'uint64',
2242            'current-rate': 'uint64' } }
2243
2244##
2245# @set-vcpu-dirty-limit:
2246#
2247# Set the upper limit of dirty page rate for virtual CPUs.
2248#
2249# Requires KVM with accelerator property "dirty-ring-size" set.  A
2250# virtual CPU's dirty page rate is a measure of its memory load.  To
2251# observe dirty page rates, use @calc-dirty-rate.
2252#
2253# @cpu-index: index of a virtual CPU, default is all.
2254#
2255# @dirty-rate: upper limit of dirty page rate (MB/s) for virtual CPUs.
2256#
2257# Since: 7.1
2258#
2259# .. qmp-example::
2260#
2261#     -> {"execute": "set-vcpu-dirty-limit"}
2262#         "arguments": { "dirty-rate": 200,
2263#                        "cpu-index": 1 } }
2264#     <- { "return": {} }
2265##
2266{ 'command': 'set-vcpu-dirty-limit',
2267  'data': { '*cpu-index': 'int',
2268            'dirty-rate': 'uint64' } }
2269
2270##
2271# @cancel-vcpu-dirty-limit:
2272#
2273# Cancel the upper limit of dirty page rate for virtual CPUs.
2274#
2275# Cancel the dirty page limit for the vCPU which has been set with
2276# set-vcpu-dirty-limit command.  Note that this command requires
2277# support from dirty ring, same as the "set-vcpu-dirty-limit".
2278#
2279# @cpu-index: index of a virtual CPU, default is all.
2280#
2281# Since: 7.1
2282#
2283# .. qmp-example::
2284#
2285#     -> {"execute": "cancel-vcpu-dirty-limit"},
2286#         "arguments": { "cpu-index": 1 } }
2287#     <- { "return": {} }
2288##
2289{ 'command': 'cancel-vcpu-dirty-limit',
2290  'data': { '*cpu-index': 'int'} }
2291
2292##
2293# @query-vcpu-dirty-limit:
2294#
2295# Returns information about virtual CPU dirty page rate limits, if
2296# any.
2297#
2298# Since: 7.1
2299#
2300# .. qmp-example::
2301#
2302#     -> {"execute": "query-vcpu-dirty-limit"}
2303#     <- {"return": [
2304#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 0},
2305#            { "limit-rate": 60, "current-rate": 3, "cpu-index": 1}]}
2306##
2307{ 'command': 'query-vcpu-dirty-limit',
2308  'returns': [ 'DirtyLimitInfo' ] }
2309
2310##
2311# @MigrationThreadInfo:
2312#
2313# Information about migrationthreads
2314#
2315# @name: the name of migration thread
2316#
2317# @thread-id: ID of the underlying host thread
2318#
2319# Since: 7.2
2320##
2321{ 'struct': 'MigrationThreadInfo',
2322  'data': {'name': 'str',
2323           'thread-id': 'int'} }
2324
2325##
2326# @query-migrationthreads:
2327#
2328# Returns information of migration threads
2329#
2330# Features:
2331#
2332# @deprecated: This command is deprecated with no replacement yet.
2333#
2334# Returns: @MigrationThreadInfo
2335#
2336# Since: 7.2
2337##
2338{ 'command': 'query-migrationthreads',
2339  'returns': ['MigrationThreadInfo'],
2340  'features': ['deprecated'] }
2341
2342##
2343# @snapshot-save:
2344#
2345# Save a VM snapshot
2346#
2347# @job-id: identifier for the newly created job
2348#
2349# @tag: name of the snapshot to create
2350#
2351# @vmstate: block device node name to save vmstate to
2352#
2353# @devices: list of block device node names to save a snapshot to
2354#
2355# Applications should not assume that the snapshot save is complete
2356# when this command returns.  The job commands / events must be used
2357# to determine completion and to fetch details of any errors that
2358# arise.
2359#
2360# Note that execution of the guest CPUs may be stopped during the time
2361# it takes to save the snapshot.  A future version of QEMU may ensure
2362# CPUs are executing continuously.
2363#
2364# It is strongly recommended that @devices contain all writable block
2365# device nodes if a consistent snapshot is required.
2366#
2367# If @tag already exists, an error will be reported
2368#
2369# .. qmp-example::
2370#
2371#     -> { "execute": "snapshot-save",
2372#          "arguments": {
2373#             "job-id": "snapsave0",
2374#             "tag": "my-snap",
2375#             "vmstate": "disk0",
2376#             "devices": ["disk0", "disk1"]
2377#          }
2378#        }
2379#     <- { "return": { } }
2380#     <- {"event": "JOB_STATUS_CHANGE",
2381#         "timestamp": {"seconds": 1432121972, "microseconds": 744001},
2382#         "data": {"status": "created", "id": "snapsave0"}}
2383#     <- {"event": "JOB_STATUS_CHANGE",
2384#         "timestamp": {"seconds": 1432122172, "microseconds": 744001},
2385#         "data": {"status": "running", "id": "snapsave0"}}
2386#     <- {"event": "STOP",
2387#         "timestamp": {"seconds": 1432122372, "microseconds": 744001} }
2388#     <- {"event": "RESUME",
2389#         "timestamp": {"seconds": 1432122572, "microseconds": 744001} }
2390#     <- {"event": "JOB_STATUS_CHANGE",
2391#         "timestamp": {"seconds": 1432122772, "microseconds": 744001},
2392#         "data": {"status": "waiting", "id": "snapsave0"}}
2393#     <- {"event": "JOB_STATUS_CHANGE",
2394#         "timestamp": {"seconds": 1432122972, "microseconds": 744001},
2395#         "data": {"status": "pending", "id": "snapsave0"}}
2396#     <- {"event": "JOB_STATUS_CHANGE",
2397#         "timestamp": {"seconds": 1432123172, "microseconds": 744001},
2398#         "data": {"status": "concluded", "id": "snapsave0"}}
2399#     -> {"execute": "query-jobs"}
2400#     <- {"return": [{"current-progress": 1,
2401#                     "status": "concluded",
2402#                     "total-progress": 1,
2403#                     "type": "snapshot-save",
2404#                     "id": "snapsave0"}]}
2405#
2406# Since: 6.0
2407##
2408{ 'command': 'snapshot-save',
2409  'data': { 'job-id': 'str',
2410            'tag': 'str',
2411            'vmstate': 'str',
2412            'devices': ['str'] } }
2413
2414##
2415# @snapshot-load:
2416#
2417# Load a VM snapshot
2418#
2419# @job-id: identifier for the newly created job
2420#
2421# @tag: name of the snapshot to load.
2422#
2423# @vmstate: block device node name to load vmstate from
2424#
2425# @devices: list of block device node names to load a snapshot from
2426#
2427# Applications should not assume that the snapshot load is complete
2428# when this command returns.  The job commands / events must be used
2429# to determine completion and to fetch details of any errors that
2430# arise.
2431#
2432# Note that execution of the guest CPUs will be stopped during the
2433# time it takes to load the snapshot.
2434#
2435# It is strongly recommended that @devices contain all writable block
2436# device nodes that can have changed since the original @snapshot-save
2437# command execution.
2438#
2439# .. qmp-example::
2440#
2441#     -> { "execute": "snapshot-load",
2442#          "arguments": {
2443#             "job-id": "snapload0",
2444#             "tag": "my-snap",
2445#             "vmstate": "disk0",
2446#             "devices": ["disk0", "disk1"]
2447#          }
2448#        }
2449#     <- { "return": { } }
2450#     <- {"event": "JOB_STATUS_CHANGE",
2451#         "timestamp": {"seconds": 1472124172, "microseconds": 744001},
2452#         "data": {"status": "created", "id": "snapload0"}}
2453#     <- {"event": "JOB_STATUS_CHANGE",
2454#         "timestamp": {"seconds": 1472125172, "microseconds": 744001},
2455#         "data": {"status": "running", "id": "snapload0"}}
2456#     <- {"event": "STOP",
2457#         "timestamp": {"seconds": 1472125472, "microseconds": 744001} }
2458#     <- {"event": "RESUME",
2459#         "timestamp": {"seconds": 1472125872, "microseconds": 744001} }
2460#     <- {"event": "JOB_STATUS_CHANGE",
2461#         "timestamp": {"seconds": 1472126172, "microseconds": 744001},
2462#         "data": {"status": "waiting", "id": "snapload0"}}
2463#     <- {"event": "JOB_STATUS_CHANGE",
2464#         "timestamp": {"seconds": 1472127172, "microseconds": 744001},
2465#         "data": {"status": "pending", "id": "snapload0"}}
2466#     <- {"event": "JOB_STATUS_CHANGE",
2467#         "timestamp": {"seconds": 1472128172, "microseconds": 744001},
2468#         "data": {"status": "concluded", "id": "snapload0"}}
2469#     -> {"execute": "query-jobs"}
2470#     <- {"return": [{"current-progress": 1,
2471#                     "status": "concluded",
2472#                     "total-progress": 1,
2473#                     "type": "snapshot-load",
2474#                     "id": "snapload0"}]}
2475#
2476# Since: 6.0
2477##
2478{ 'command': 'snapshot-load',
2479  'data': { 'job-id': 'str',
2480            'tag': 'str',
2481            'vmstate': 'str',
2482            'devices': ['str'] } }
2483
2484##
2485# @snapshot-delete:
2486#
2487# Delete a VM snapshot
2488#
2489# @job-id: identifier for the newly created job
2490#
2491# @tag: name of the snapshot to delete.
2492#
2493# @devices: list of block device node names to delete a snapshot from
2494#
2495# Applications should not assume that the snapshot delete is complete
2496# when this command returns.  The job commands / events must be used
2497# to determine completion and to fetch details of any errors that
2498# arise.
2499#
2500# .. qmp-example::
2501#
2502#     -> { "execute": "snapshot-delete",
2503#          "arguments": {
2504#             "job-id": "snapdelete0",
2505#             "tag": "my-snap",
2506#             "devices": ["disk0", "disk1"]
2507#          }
2508#        }
2509#     <- { "return": { } }
2510#     <- {"event": "JOB_STATUS_CHANGE",
2511#         "timestamp": {"seconds": 1442124172, "microseconds": 744001},
2512#         "data": {"status": "created", "id": "snapdelete0"}}
2513#     <- {"event": "JOB_STATUS_CHANGE",
2514#         "timestamp": {"seconds": 1442125172, "microseconds": 744001},
2515#         "data": {"status": "running", "id": "snapdelete0"}}
2516#     <- {"event": "JOB_STATUS_CHANGE",
2517#         "timestamp": {"seconds": 1442126172, "microseconds": 744001},
2518#         "data": {"status": "waiting", "id": "snapdelete0"}}
2519#     <- {"event": "JOB_STATUS_CHANGE",
2520#         "timestamp": {"seconds": 1442127172, "microseconds": 744001},
2521#         "data": {"status": "pending", "id": "snapdelete0"}}
2522#     <- {"event": "JOB_STATUS_CHANGE",
2523#         "timestamp": {"seconds": 1442128172, "microseconds": 744001},
2524#         "data": {"status": "concluded", "id": "snapdelete0"}}
2525#     -> {"execute": "query-jobs"}
2526#     <- {"return": [{"current-progress": 1,
2527#                     "status": "concluded",
2528#                     "total-progress": 1,
2529#                     "type": "snapshot-delete",
2530#                     "id": "snapdelete0"}]}
2531#
2532# Since: 6.0
2533##
2534{ 'command': 'snapshot-delete',
2535  'data': { 'job-id': 'str',
2536            'tag': 'str',
2537            'devices': ['str'] } }
2538