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