block/qcow2: refactor encryption code
[qemu/ar7.git] / qapi / migration.json
blob82feb5bd39fef428ed99885aa740e5010ef82951
1 # -*- Mode: Python -*-
4 ##
5 # = Migration
6 ##
8 { 'include': 'common.json' }
9 { 'include': 'sockets.json' }
12 # @MigrationStats:
14 # Detailed migration status.
16 # @transferred: amount of bytes already transferred to the target VM
18 # @remaining: amount of bytes remaining to be transferred to the target VM
20 # @total: total amount of bytes involved in the migration process
22 # @duplicate: number of duplicate (zero) pages (since 1.2)
24 # @skipped: number of skipped zero pages (since 1.5)
26 # @normal: number of normal pages (since 1.2)
28 # @normal-bytes: number of normal bytes sent (since 1.2)
30 # @dirty-pages-rate: number of pages dirtied by second by the
31 #        guest (since 1.3)
33 # @mbps: throughput in megabits/sec. (since 1.6)
35 # @dirty-sync-count: number of times that dirty ram was synchronized (since 2.1)
37 # @postcopy-requests: The number of page requests received from the destination
38 #        (since 2.7)
40 # @page-size: The number of bytes per page for the various page-based
41 #        statistics (since 2.10)
43 # @multifd-bytes: The number of bytes sent through multifd (since 3.0)
45 # @pages-per-second: the number of memory pages transferred per second
46 #        (Since 4.0)
48 # Since: 0.14.0
50 { 'struct': 'MigrationStats',
51   'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
52            'duplicate': 'int', 'skipped': 'int', 'normal': 'int',
53            'normal-bytes': 'int', 'dirty-pages-rate' : 'int',
54            'mbps' : 'number', 'dirty-sync-count' : 'int',
55            'postcopy-requests' : 'int', 'page-size' : 'int',
56            'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64' } }
59 # @XBZRLECacheStats:
61 # Detailed XBZRLE migration cache statistics
63 # @cache-size: XBZRLE cache size
65 # @bytes: amount of bytes already transferred to the target VM
67 # @pages: amount of pages transferred to the target VM
69 # @cache-miss: number of cache miss
71 # @cache-miss-rate: rate of cache miss (since 2.1)
73 # @overflow: number of overflows
75 # Since: 1.2
77 { 'struct': 'XBZRLECacheStats',
78   'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
79            'cache-miss': 'int', 'cache-miss-rate': 'number',
80            'overflow': 'int' } }
83 # @CompressionStats:
85 # Detailed migration compression statistics
87 # @pages: amount of pages compressed and transferred to the target VM
89 # @busy: count of times that no free thread was available to compress data
91 # @busy-rate: rate of thread busy
93 # @compressed-size: amount of bytes after compression
95 # @compression-rate: rate of compressed size
97 # Since: 3.1
99 { 'struct': 'CompressionStats',
100   'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
101            'compressed-size': 'int', 'compression-rate': 'number' } }
104 # @MigrationStatus:
106 # An enumeration of migration status.
108 # @none: no migration has ever happened.
110 # @setup: migration process has been initiated.
112 # @cancelling: in the process of cancelling migration.
114 # @cancelled: cancelling migration is finished.
116 # @active: in the process of doing migration.
118 # @postcopy-active: like active, but now in postcopy mode. (since 2.5)
120 # @postcopy-paused: during postcopy but paused. (since 3.0)
122 # @postcopy-recover: trying to recover from a paused postcopy. (since 3.0)
124 # @completed: migration is finished.
126 # @failed: some error occurred during migration process.
128 # @colo: VM is in the process of fault tolerance, VM can not get into this
129 #        state unless colo capability is enabled for migration. (since 2.8)
131 # @pre-switchover: Paused before device serialisation. (since 2.11)
133 # @device: During device serialisation when pause-before-switchover is enabled
134 #        (since 2.11)
136 # Since: 2.3
139 { 'enum': 'MigrationStatus',
140   'data': [ 'none', 'setup', 'cancelling', 'cancelled',
141             'active', 'postcopy-active', 'postcopy-paused',
142             'postcopy-recover', 'completed', 'failed', 'colo',
143             'pre-switchover', 'device' ] }
146 # @MigrationInfo:
148 # Information about current migration process.
150 # @status: @MigrationStatus describing the current migration status.
151 #          If this field is not returned, no migration process
152 #          has been initiated
154 # @ram: @MigrationStats containing detailed migration
155 #       status, only returned if status is 'active' or
156 #       'completed'(since 1.2)
158 # @disk: @MigrationStats containing detailed disk migration
159 #        status, only returned if status is 'active' and it is a block
160 #        migration
162 # @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
163 #                migration statistics, only returned if XBZRLE feature is on and
164 #                status is 'active' or 'completed' (since 1.2)
166 # @total-time: total amount of milliseconds since migration started.
167 #        If migration has ended, it returns the total migration
168 #        time. (since 1.2)
170 # @downtime: only present when migration finishes correctly
171 #        total downtime in milliseconds for the guest.
172 #        (since 1.3)
174 # @expected-downtime: only present while migration is active
175 #        expected downtime in milliseconds for the guest in last walk
176 #        of the dirty bitmap. (since 1.3)
178 # @setup-time: amount of setup time in milliseconds _before_ the
179 #        iterations begin but _after_ the QMP command is issued. This is designed
180 #        to provide an accounting of any activities (such as RDMA pinning) which
181 #        may be expensive, but do not actually occur during the iterative
182 #        migration rounds themselves. (since 1.6)
184 # @cpu-throttle-percentage: percentage of time guest cpus are being
185 #        throttled during auto-converge. This is only present when auto-converge
186 #        has started throttling guest cpus. (Since 2.7)
188 # @error-desc: the human readable error description string, when
189 #              @status is 'failed'. Clients should not attempt to parse the
190 #              error strings. (Since 2.7)
192 # @postcopy-blocktime: total time when all vCPU were blocked during postcopy
193 #           live migration. This is only present when the postcopy-blocktime
194 #           migration capability is enabled. (Since 3.0)
196 # @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.  This is
197 #           only present when the postcopy-blocktime migration capability
198 #           is enabled. (Since 3.0)
200 # @compression: migration compression statistics, only returned if compression
201 #           feature is on and status is 'active' or 'completed' (Since 3.1)
203 # @socket-address: Only used for tcp, to know what the real port is (Since 4.0)
205 # Since: 0.14.0
207 { 'struct': 'MigrationInfo',
208   'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
209            '*disk': 'MigrationStats',
210            '*xbzrle-cache': 'XBZRLECacheStats',
211            '*total-time': 'int',
212            '*expected-downtime': 'int',
213            '*downtime': 'int',
214            '*setup-time': 'int',
215            '*cpu-throttle-percentage': 'int',
216            '*error-desc': 'str',
217            '*postcopy-blocktime' : 'uint32',
218            '*postcopy-vcpu-blocktime': ['uint32'],
219            '*compression': 'CompressionStats',
220            '*socket-address': ['SocketAddress'] } }
223 # @query-migrate:
225 # Returns information about current migration process. If migration
226 # is active there will be another json-object with RAM migration
227 # status and if block migration is active another one with block
228 # migration status.
230 # Returns: @MigrationInfo
232 # Since: 0.14.0
234 # Example:
236 # 1. Before the first migration
238 # -> { "execute": "query-migrate" }
239 # <- { "return": {} }
241 # 2. Migration is done and has succeeded
243 # -> { "execute": "query-migrate" }
244 # <- { "return": {
245 #         "status": "completed",
246 #         "total-time":12345,
247 #         "setup-time":12345,
248 #         "downtime":12345,
249 #         "ram":{
250 #           "transferred":123,
251 #           "remaining":123,
252 #           "total":246,
253 #           "duplicate":123,
254 #           "normal":123,
255 #           "normal-bytes":123456,
256 #           "dirty-sync-count":15
257 #         }
258 #      }
259 #    }
261 # 3. Migration is done and has failed
263 # -> { "execute": "query-migrate" }
264 # <- { "return": { "status": "failed" } }
266 # 4. Migration is being performed and is not a block migration:
268 # -> { "execute": "query-migrate" }
269 # <- {
270 #       "return":{
271 #          "status":"active",
272 #          "total-time":12345,
273 #          "setup-time":12345,
274 #          "expected-downtime":12345,
275 #          "ram":{
276 #             "transferred":123,
277 #             "remaining":123,
278 #             "total":246,
279 #             "duplicate":123,
280 #             "normal":123,
281 #             "normal-bytes":123456,
282 #             "dirty-sync-count":15
283 #          }
284 #       }
285 #    }
287 # 5. Migration is being performed and is a block migration:
289 # -> { "execute": "query-migrate" }
290 # <- {
291 #       "return":{
292 #          "status":"active",
293 #          "total-time":12345,
294 #          "setup-time":12345,
295 #          "expected-downtime":12345,
296 #          "ram":{
297 #             "total":1057024,
298 #             "remaining":1053304,
299 #             "transferred":3720,
300 #             "duplicate":123,
301 #             "normal":123,
302 #             "normal-bytes":123456,
303 #             "dirty-sync-count":15
304 #          },
305 #          "disk":{
306 #             "total":20971520,
307 #             "remaining":20880384,
308 #             "transferred":91136
309 #          }
310 #       }
311 #    }
313 # 6. Migration is being performed and XBZRLE is active:
315 # -> { "execute": "query-migrate" }
316 # <- {
317 #       "return":{
318 #          "status":"active",
319 #          "total-time":12345,
320 #          "setup-time":12345,
321 #          "expected-downtime":12345,
322 #          "ram":{
323 #             "total":1057024,
324 #             "remaining":1053304,
325 #             "transferred":3720,
326 #             "duplicate":10,
327 #             "normal":3333,
328 #             "normal-bytes":3412992,
329 #             "dirty-sync-count":15
330 #          },
331 #          "xbzrle-cache":{
332 #             "cache-size":67108864,
333 #             "bytes":20971520,
334 #             "pages":2444343,
335 #             "cache-miss":2244,
336 #             "cache-miss-rate":0.123,
337 #             "overflow":34434
338 #          }
339 #       }
340 #    }
343 { 'command': 'query-migrate', 'returns': 'MigrationInfo' }
346 # @MigrationCapability:
348 # Migration capabilities enumeration
350 # @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
351 #          This feature allows us to minimize migration traffic for certain work
352 #          loads, by sending compressed difference of the pages
354 # @rdma-pin-all: Controls whether or not the entire VM memory footprint is
355 #          mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage.
356 #          Disabled by default. (since 2.0)
358 # @zero-blocks: During storage migration encode blocks of zeroes efficiently. This
359 #          essentially saves 1MB of zeroes per block on the wire. Enabling requires
360 #          source and target VM to support this feature. To enable it is sufficient
361 #          to enable the capability on the source VM. The feature is disabled by
362 #          default. (since 1.6)
364 # @compress: Use multiple compression threads to accelerate live migration.
365 #          This feature can help to reduce the migration traffic, by sending
366 #          compressed pages. Please note that if compress and xbzrle are both
367 #          on, compress only takes effect in the ram bulk stage, after that,
368 #          it will be disabled and only xbzrle takes effect, this can help to
369 #          minimize migration traffic. The feature is disabled by default.
370 #          (since 2.4 )
372 # @events: generate events for each migration state change
373 #          (since 2.4 )
375 # @auto-converge: If enabled, QEMU will automatically throttle down the guest
376 #          to speed up convergence of RAM migration. (since 1.6)
378 # @postcopy-ram: Start executing on the migration target before all of RAM has
379 #          been migrated, pulling the remaining pages along as needed. The
380 #          capacity must have the same setting on both source and target
381 #          or migration will not even start. NOTE: If the migration fails during
382 #          postcopy the VM will fail.  (since 2.6)
384 # @x-colo: If enabled, migration will never end, and the state of the VM on the
385 #        primary side will be migrated continuously to the VM on secondary
386 #        side, this process is called COarse-Grain LOck Stepping (COLO) for
387 #        Non-stop Service. (since 2.8)
389 # @release-ram: if enabled, qemu will free the migrated ram pages on the source
390 #        during postcopy-ram migration. (since 2.9)
392 # @block: If enabled, QEMU will also migrate the contents of all block
393 #          devices.  Default is disabled.  A possible alternative uses
394 #          mirror jobs to a builtin NBD server on the destination, which
395 #          offers more flexibility.
396 #          (Since 2.10)
398 # @return-path: If enabled, migration will use the return path even
399 #               for precopy. (since 2.10)
401 # @pause-before-switchover: Pause outgoing migration before serialising device
402 #          state and before disabling block IO (since 2.11)
404 # @multifd: Use more than one fd for migration (since 4.0)
406 # @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
407 #                 (since 2.12)
409 # @postcopy-blocktime: Calculate downtime for postcopy live migration
410 #                     (since 3.0)
412 # @late-block-activate: If enabled, the destination will not activate block
413 #           devices (and thus take locks) immediately at the end of migration.
414 #           (since 3.0)
416 # @x-ignore-shared: If enabled, QEMU will not migrate shared memory (since 4.0)
418 # @validate-uuid: Send the UUID of the source to allow the destination
419 #                 to ensure it is the same. (since 4.2)
421 # Since: 1.2
423 { 'enum': 'MigrationCapability',
424   'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
425            'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
426            'block', 'return-path', 'pause-before-switchover', 'multifd',
427            'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
428            'x-ignore-shared', 'validate-uuid' ] }
431 # @MigrationCapabilityStatus:
433 # Migration capability information
435 # @capability: capability enum
437 # @state: capability state bool
439 # Since: 1.2
441 { 'struct': 'MigrationCapabilityStatus',
442   'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }
445 # @migrate-set-capabilities:
447 # Enable/Disable the following migration capabilities (like xbzrle)
449 # @capabilities: json array of capability modifications to make
451 # Since: 1.2
453 # Example:
455 # -> { "execute": "migrate-set-capabilities" , "arguments":
456 #      { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
459 { 'command': 'migrate-set-capabilities',
460   'data': { 'capabilities': ['MigrationCapabilityStatus'] } }
463 # @query-migrate-capabilities:
465 # Returns information about the current migration capabilities status
467 # Returns: @MigrationCapabilitiesStatus
469 # Since: 1.2
471 # Example:
473 # -> { "execute": "query-migrate-capabilities" }
474 # <- { "return": [
475 #       {"state": false, "capability": "xbzrle"},
476 #       {"state": false, "capability": "rdma-pin-all"},
477 #       {"state": false, "capability": "auto-converge"},
478 #       {"state": false, "capability": "zero-blocks"},
479 #       {"state": false, "capability": "compress"},
480 #       {"state": true, "capability": "events"},
481 #       {"state": false, "capability": "postcopy-ram"},
482 #       {"state": false, "capability": "x-colo"}
483 #    ]}
486 { 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}
489 # @MigrationParameter:
491 # Migration parameters enumeration
493 # @announce-initial: Initial delay (in milliseconds) before sending the first
494 #          announce (Since 4.0)
496 # @announce-max: Maximum delay (in milliseconds) between packets in the
497 #          announcement (Since 4.0)
499 # @announce-rounds: Number of self-announce packets sent after migration
500 #          (Since 4.0)
502 # @announce-step: Increase in delay (in milliseconds) between subsequent
503 #          packets in the announcement (Since 4.0)
505 # @compress-level: Set the compression level to be used in live migration,
506 #          the compression level is an integer between 0 and 9, where 0 means
507 #          no compression, 1 means the best compression speed, and 9 means best
508 #          compression ratio which will consume more CPU.
510 # @compress-threads: Set compression thread count to be used in live migration,
511 #          the compression thread count is an integer between 1 and 255.
513 # @compress-wait-thread: Controls behavior when all compression threads are
514 #                        currently busy. If true (default), wait for a free
515 #                        compression thread to become available; otherwise,
516 #                        send the page uncompressed. (Since 3.1)
518 # @decompress-threads: Set decompression thread count to be used in live
519 #          migration, the decompression thread count is an integer between 1
520 #          and 255. Usually, decompression is at least 4 times as fast as
521 #          compression, so set the decompress-threads to the number about 1/4
522 #          of compress-threads is adequate.
524 # @cpu-throttle-initial: Initial percentage of time guest cpus are throttled
525 #                        when migration auto-converge is activated. The
526 #                        default value is 20. (Since 2.7)
528 # @cpu-throttle-increment: throttle percentage increase each time
529 #                          auto-converge detects that migration is not making
530 #                          progress. The default value is 10. (Since 2.7)
532 # @tls-creds: ID of the 'tls-creds' object that provides credentials for
533 #             establishing a TLS connection over the migration data channel.
534 #             On the outgoing side of the migration, the credentials must
535 #             be for a 'client' endpoint, while for the incoming side the
536 #             credentials must be for a 'server' endpoint. Setting this
537 #             will enable TLS for all migrations. The default is unset,
538 #             resulting in unsecured migration at the QEMU level. (Since 2.7)
540 # @tls-hostname: hostname of the target host for the migration. This is
541 #                required when using x509 based TLS credentials and the
542 #                migration URI does not already include a hostname. For
543 #                example if using fd: or exec: based migration, the
544 #                hostname must be provided so that the server's x509
545 #                certificate identity can be validated. (Since 2.7)
547 # @tls-authz: ID of the 'authz' object subclass that provides access control
548 #             checking of the TLS x509 certificate distinguished name.
549 #             This object is only resolved at time of use, so can be deleted
550 #             and recreated on the fly while the migration server is active.
551 #             If missing, it will default to denying access (Since 4.0)
553 # @max-bandwidth: to set maximum speed for migration. maximum speed in
554 #                 bytes per second. (Since 2.8)
556 # @downtime-limit: set maximum tolerated downtime for migration. maximum
557 #                  downtime in milliseconds (Since 2.8)
559 # @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
560 #          periodic mode. (Since 2.8)
562 # @block-incremental: Affects how much storage is migrated when the
563 #       block migration capability is enabled.  When false, the entire
564 #       storage backing chain is migrated into a flattened image at
565 #       the destination; when true, only the active qcow2 layer is
566 #       migrated and the destination must already have access to the
567 #       same backing chain as was used on the source.  (since 2.10)
569 # @multifd-channels: Number of channels used to migrate data in
570 #                    parallel. This is the same number that the
571 #                    number of sockets used for migration.  The
572 #                    default value is 2 (since 4.0)
574 # @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
575 #                     needs to be a multiple of the target page size
576 #                     and a power of 2
577 #                     (Since 2.11)
579 # @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
580 #                     Defaults to 0 (unlimited).  In bytes per second.
581 #                     (Since 3.0)
583 # @max-cpu-throttle: maximum cpu throttle percentage.
584 #                    Defaults to 99. (Since 3.1)
586 # Since: 2.4
588 { 'enum': 'MigrationParameter',
589   'data': ['announce-initial', 'announce-max',
590            'announce-rounds', 'announce-step',
591            'compress-level', 'compress-threads', 'decompress-threads',
592            'compress-wait-thread',
593            'cpu-throttle-initial', 'cpu-throttle-increment',
594            'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
595            'downtime-limit', 'x-checkpoint-delay', 'block-incremental',
596            'multifd-channels',
597            'xbzrle-cache-size', 'max-postcopy-bandwidth',
598            'max-cpu-throttle' ] }
601 # @MigrateSetParameters:
603 # @announce-initial: Initial delay (in milliseconds) before sending the first
604 #          announce (Since 4.0)
606 # @announce-max: Maximum delay (in milliseconds) between packets in the
607 #          announcement (Since 4.0)
609 # @announce-rounds: Number of self-announce packets sent after migration
610 #          (Since 4.0)
612 # @announce-step: Increase in delay (in milliseconds) between subsequent
613 #          packets in the announcement (Since 4.0)
615 # @compress-level: compression level
617 # @compress-threads: compression thread count
619 # @compress-wait-thread: Controls behavior when all compression threads are
620 #                        currently busy. If true (default), wait for a free
621 #                        compression thread to become available; otherwise,
622 #                        send the page uncompressed. (Since 3.1)
624 # @decompress-threads: decompression thread count
626 # @cpu-throttle-initial: Initial percentage of time guest cpus are
627 #                        throttled when migration auto-converge is activated.
628 #                        The default value is 20. (Since 2.7)
630 # @cpu-throttle-increment: throttle percentage increase each time
631 #                          auto-converge detects that migration is not making
632 #                          progress. The default value is 10. (Since 2.7)
634 # @tls-creds: ID of the 'tls-creds' object that provides credentials
635 #             for establishing a TLS connection over the migration data
636 #             channel. On the outgoing side of the migration, the credentials
637 #             must be for a 'client' endpoint, while for the incoming side the
638 #             credentials must be for a 'server' endpoint. Setting this
639 #             to a non-empty string enables TLS for all migrations.
640 #             An empty string means that QEMU will use plain text mode for
641 #             migration, rather than TLS (Since 2.9)
642 #             Previously (since 2.7), this was reported by omitting
643 #             tls-creds instead.
645 # @tls-hostname: hostname of the target host for the migration. This
646 #                is required when using x509 based TLS credentials and the
647 #                migration URI does not already include a hostname. For
648 #                example if using fd: or exec: based migration, the
649 #                hostname must be provided so that the server's x509
650 #                certificate identity can be validated. (Since 2.7)
651 #                An empty string means that QEMU will use the hostname
652 #                associated with the migration URI, if any. (Since 2.9)
653 #                Previously (since 2.7), this was reported by omitting
654 #                tls-hostname instead.
656 # @max-bandwidth: to set maximum speed for migration. maximum speed in
657 #                 bytes per second. (Since 2.8)
659 # @downtime-limit: set maximum tolerated downtime for migration. maximum
660 #                  downtime in milliseconds (Since 2.8)
662 # @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
664 # @block-incremental: Affects how much storage is migrated when the
665 #       block migration capability is enabled.  When false, the entire
666 #       storage backing chain is migrated into a flattened image at
667 #       the destination; when true, only the active qcow2 layer is
668 #       migrated and the destination must already have access to the
669 #       same backing chain as was used on the source.  (since 2.10)
671 # @multifd-channels: Number of channels used to migrate data in
672 #                    parallel. This is the same number that the
673 #                    number of sockets used for migration.  The
674 #                    default value is 2 (since 4.0)
676 # @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
677 #                     needs to be a multiple of the target page size
678 #                     and a power of 2
679 #                     (Since 2.11)
681 # @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
682 #                     Defaults to 0 (unlimited).  In bytes per second.
683 #                     (Since 3.0)
685 # @max-cpu-throttle: maximum cpu throttle percentage.
686 #                    The default value is 99. (Since 3.1)
688 # Since: 2.4
690 # TODO either fuse back into MigrationParameters, or make
691 # MigrationParameters members mandatory
692 { 'struct': 'MigrateSetParameters',
693   'data': { '*announce-initial': 'size',
694             '*announce-max': 'size',
695             '*announce-rounds': 'size',
696             '*announce-step': 'size',
697             '*compress-level': 'int',
698             '*compress-threads': 'int',
699             '*compress-wait-thread': 'bool',
700             '*decompress-threads': 'int',
701             '*cpu-throttle-initial': 'int',
702             '*cpu-throttle-increment': 'int',
703             '*tls-creds': 'StrOrNull',
704             '*tls-hostname': 'StrOrNull',
705             '*tls-authz': 'StrOrNull',
706             '*max-bandwidth': 'int',
707             '*downtime-limit': 'int',
708             '*x-checkpoint-delay': 'int',
709             '*block-incremental': 'bool',
710             '*multifd-channels': 'int',
711             '*xbzrle-cache-size': 'size',
712             '*max-postcopy-bandwidth': 'size',
713             '*max-cpu-throttle': 'int' } }
716 # @migrate-set-parameters:
718 # Set various migration parameters.
720 # Since: 2.4
722 # Example:
724 # -> { "execute": "migrate-set-parameters" ,
725 #      "arguments": { "compress-level": 1 } }
728 { 'command': 'migrate-set-parameters', 'boxed': true,
729   'data': 'MigrateSetParameters' }
732 # @MigrationParameters:
734 # The optional members aren't actually optional.
736 # @announce-initial: Initial delay (in milliseconds) before sending the
737 #          first announce (Since 4.0)
739 # @announce-max: Maximum delay (in milliseconds) between packets in the
740 #          announcement (Since 4.0)
742 # @announce-rounds: Number of self-announce packets sent after migration
743 #          (Since 4.0)
745 # @announce-step: Increase in delay (in milliseconds) between subsequent
746 #          packets in the announcement (Since 4.0)
748 # @compress-level: compression level
750 # @compress-threads: compression thread count
752 # @compress-wait-thread: Controls behavior when all compression threads are
753 #                        currently busy. If true (default), wait for a free
754 #                        compression thread to become available; otherwise,
755 #                        send the page uncompressed. (Since 3.1)
757 # @decompress-threads: decompression thread count
759 # @cpu-throttle-initial: Initial percentage of time guest cpus are
760 #                        throttled when migration auto-converge is activated.
761 #                        (Since 2.7)
763 # @cpu-throttle-increment: throttle percentage increase each time
764 #                          auto-converge detects that migration is not making
765 #                          progress. (Since 2.7)
767 # @tls-creds: ID of the 'tls-creds' object that provides credentials
768 #             for establishing a TLS connection over the migration data
769 #             channel. On the outgoing side of the migration, the credentials
770 #             must be for a 'client' endpoint, while for the incoming side the
771 #             credentials must be for a 'server' endpoint.
772 #             An empty string means that QEMU will use plain text mode for
773 #             migration, rather than TLS (Since 2.7)
774 #             Note: 2.8 reports this by omitting tls-creds instead.
776 # @tls-hostname: hostname of the target host for the migration. This
777 #                is required when using x509 based TLS credentials and the
778 #                migration URI does not already include a hostname. For
779 #                example if using fd: or exec: based migration, the
780 #                hostname must be provided so that the server's x509
781 #                certificate identity can be validated. (Since 2.7)
782 #                An empty string means that QEMU will use the hostname
783 #                associated with the migration URI, if any. (Since 2.9)
784 #                Note: 2.8 reports this by omitting tls-hostname instead.
786 # @tls-authz: ID of the 'authz' object subclass that provides access control
787 #             checking of the TLS x509 certificate distinguished name. (Since
788 #             4.0)
790 # @max-bandwidth: to set maximum speed for migration. maximum speed in
791 #                 bytes per second. (Since 2.8)
793 # @downtime-limit: set maximum tolerated downtime for migration. maximum
794 #                  downtime in milliseconds (Since 2.8)
796 # @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
798 # @block-incremental: Affects how much storage is migrated when the
799 #       block migration capability is enabled.  When false, the entire
800 #       storage backing chain is migrated into a flattened image at
801 #       the destination; when true, only the active qcow2 layer is
802 #       migrated and the destination must already have access to the
803 #       same backing chain as was used on the source.  (since 2.10)
805 # @multifd-channels: Number of channels used to migrate data in
806 #                    parallel. This is the same number that the
807 #                    number of sockets used for migration.
808 #                    The default value is 2 (since 4.0)
810 # @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
811 #                     needs to be a multiple of the target page size
812 #                     and a power of 2
813 #                     (Since 2.11)
815 # @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
816 #                     Defaults to 0 (unlimited).  In bytes per second.
817 #                     (Since 3.0)
819 # @max-cpu-throttle: maximum cpu throttle percentage.
820 #                    Defaults to 99.
821 #                     (Since 3.1)
823 # Since: 2.4
825 { 'struct': 'MigrationParameters',
826   'data': { '*announce-initial': 'size',
827             '*announce-max': 'size',
828             '*announce-rounds': 'size',
829             '*announce-step': 'size',
830             '*compress-level': 'uint8',
831             '*compress-threads': 'uint8',
832             '*compress-wait-thread': 'bool',
833             '*decompress-threads': 'uint8',
834             '*cpu-throttle-initial': 'uint8',
835             '*cpu-throttle-increment': 'uint8',
836             '*tls-creds': 'str',
837             '*tls-hostname': 'str',
838             '*tls-authz': 'str',
839             '*max-bandwidth': 'size',
840             '*downtime-limit': 'uint64',
841             '*x-checkpoint-delay': 'uint32',
842             '*block-incremental': 'bool' ,
843             '*multifd-channels': 'uint8',
844             '*xbzrle-cache-size': 'size',
845             '*max-postcopy-bandwidth': 'size',
846             '*max-cpu-throttle':'uint8'} }
849 # @query-migrate-parameters:
851 # Returns information about the current migration parameters
853 # Returns: @MigrationParameters
855 # Since: 2.4
857 # Example:
859 # -> { "execute": "query-migrate-parameters" }
860 # <- { "return": {
861 #          "decompress-threads": 2,
862 #          "cpu-throttle-increment": 10,
863 #          "compress-threads": 8,
864 #          "compress-level": 1,
865 #          "cpu-throttle-initial": 20,
866 #          "max-bandwidth": 33554432,
867 #          "downtime-limit": 300
868 #       }
869 #    }
872 { 'command': 'query-migrate-parameters',
873   'returns': 'MigrationParameters' }
876 # @client_migrate_info:
878 # Set migration information for remote display.  This makes the server
879 # ask the client to automatically reconnect using the new parameters
880 # once migration finished successfully.  Only implemented for SPICE.
882 # @protocol:     must be "spice"
883 # @hostname:     migration target hostname
884 # @port:         spice tcp port for plaintext channels
885 # @tls-port:     spice tcp port for tls-secured channels
886 # @cert-subject: server certificate subject
888 # Since: 0.14.0
890 # Example:
892 # -> { "execute": "client_migrate_info",
893 #      "arguments": { "protocol": "spice",
894 #                     "hostname": "virt42.lab.kraxel.org",
895 #                     "port": 1234 } }
896 # <- { "return": {} }
899 { 'command': 'client_migrate_info',
900   'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
901             '*tls-port': 'int', '*cert-subject': 'str' } }
904 # @migrate-start-postcopy:
906 # Followup to a migration command to switch the migration to postcopy mode.
907 # The postcopy-ram capability must be set on both source and destination
908 # before the original migration command.
910 # Since: 2.5
912 # Example:
914 # -> { "execute": "migrate-start-postcopy" }
915 # <- { "return": {} }
918 { 'command': 'migrate-start-postcopy' }
921 # @MIGRATION:
923 # Emitted when a migration event happens
925 # @status: @MigrationStatus describing the current migration status.
927 # Since: 2.4
929 # Example:
931 # <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
932 #     "event": "MIGRATION",
933 #     "data": {"status": "completed"} }
936 { 'event': 'MIGRATION',
937   'data': {'status': 'MigrationStatus'}}
940 # @MIGRATION_PASS:
942 # Emitted from the source side of a migration at the start of each pass
943 # (when it syncs the dirty bitmap)
945 # @pass: An incrementing count (starting at 1 on the first pass)
947 # Since: 2.6
949 # Example:
951 # { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
952 #   "event": "MIGRATION_PASS", "data": {"pass": 2} }
955 { 'event': 'MIGRATION_PASS',
956   'data': { 'pass': 'int' } }
959 # @COLOMessage:
961 # The message transmission between Primary side and Secondary side.
963 # @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
965 # @checkpoint-request: Primary VM (PVM) tells SVM to prepare for checkpointing
967 # @checkpoint-reply: SVM gets PVM's checkpoint request
969 # @vmstate-send: VM's state will be sent by PVM.
971 # @vmstate-size: The total size of VMstate.
973 # @vmstate-received: VM's state has been received by SVM.
975 # @vmstate-loaded: VM's state has been loaded by SVM.
977 # Since: 2.8
979 { 'enum': 'COLOMessage',
980   'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
981             'vmstate-send', 'vmstate-size', 'vmstate-received',
982             'vmstate-loaded' ] }
985 # @COLOMode:
987 # The COLO current mode.
989 # @none: COLO is disabled.
991 # @primary: COLO node in primary side.
993 # @secondary: COLO node in slave side.
995 # Since: 2.8
997 { 'enum': 'COLOMode',
998   'data': [ 'none', 'primary', 'secondary'] }
1001 # @FailoverStatus:
1003 # An enumeration of COLO failover status
1005 # @none: no failover has ever happened
1007 # @require: got failover requirement but not handled
1009 # @active: in the process of doing failover
1011 # @completed: finish the process of failover
1013 # @relaunch: restart the failover process, from 'none' -> 'completed' (Since 2.9)
1015 # Since: 2.8
1017 { 'enum': 'FailoverStatus',
1018   'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }
1021 # @COLO_EXIT:
1023 # Emitted when VM finishes COLO mode due to some errors happening or
1024 # at the request of users.
1026 # @mode: report COLO mode when COLO exited.
1028 # @reason: describes the reason for the COLO exit.
1030 # Since: 3.1
1032 # Example:
1034 # <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
1035 #      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
1038 { 'event': 'COLO_EXIT',
1039   'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }
1042 # @COLOExitReason:
1044 # The reason for a COLO exit.
1046 # @none: failover has never happened. This state does not occur
1047 # in the COLO_EXIT event, and is only visible in the result of
1048 # query-colo-status.
1050 # @request: COLO exit is due to an external request.
1052 # @error: COLO exit is due to an internal error.
1054 # @processing: COLO is currently handling a failover (since 4.0).
1056 # Since: 3.1
1058 { 'enum': 'COLOExitReason',
1059   'data': [ 'none', 'request', 'error' , 'processing' ] }
1062 # @x-colo-lost-heartbeat:
1064 # Tell qemu that heartbeat is lost, request it to do takeover procedures.
1065 # If this command is sent to the PVM, the Primary side will exit COLO mode.
1066 # If sent to the Secondary, the Secondary side will run failover work,
1067 # then takes over server operation to become the service VM.
1069 # Since: 2.8
1071 # Example:
1073 # -> { "execute": "x-colo-lost-heartbeat" }
1074 # <- { "return": {} }
1077 { 'command': 'x-colo-lost-heartbeat' }
1080 # @migrate_cancel:
1082 # Cancel the current executing migration process.
1084 # Returns: nothing on success
1086 # Notes: This command succeeds even if there is no migration process running.
1088 # Since: 0.14.0
1090 # Example:
1092 # -> { "execute": "migrate_cancel" }
1093 # <- { "return": {} }
1096 { 'command': 'migrate_cancel' }
1099 # @migrate-continue:
1101 # Continue migration when it's in a paused state.
1103 # @state: The state the migration is currently expected to be in
1105 # Returns: nothing on success
1106 # Since: 2.11
1107 # Example:
1109 # -> { "execute": "migrate-continue" , "arguments":
1110 #      { "state": "pre-switchover" } }
1111 # <- { "return": {} }
1113 { 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }
1116 # @migrate_set_downtime:
1118 # Set maximum tolerated downtime for migration.
1120 # @value: maximum downtime in seconds
1122 # Returns: nothing on success
1124 # Notes: This command is deprecated in favor of 'migrate-set-parameters'
1126 # Since: 0.14.0
1128 # Example:
1130 # -> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
1131 # <- { "return": {} }
1134 { 'command': 'migrate_set_downtime', 'data': {'value': 'number'} }
1137 # @migrate_set_speed:
1139 # Set maximum speed for migration.
1141 # @value: maximum speed in bytes per second.
1143 # Returns: nothing on success
1145 # Notes: This command is deprecated in favor of 'migrate-set-parameters'
1147 # Since: 0.14.0
1149 # Example:
1151 # -> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
1152 # <- { "return": {} }
1155 { 'command': 'migrate_set_speed', 'data': {'value': 'int'} }
1158 # @migrate-set-cache-size:
1160 # Set cache size to be used by XBZRLE migration
1162 # @value: cache size in bytes
1164 # The size will be rounded down to the nearest power of 2.
1165 # The cache size can be modified before and during ongoing migration
1167 # Returns: nothing on success
1169 # Notes: This command is deprecated in favor of 'migrate-set-parameters'
1171 # Since: 1.2
1173 # Example:
1175 # -> { "execute": "migrate-set-cache-size",
1176 #      "arguments": { "value": 536870912 } }
1177 # <- { "return": {} }
1180 { 'command': 'migrate-set-cache-size', 'data': {'value': 'int'} }
1183 # @query-migrate-cache-size:
1185 # Query migration XBZRLE cache size
1187 # Returns: XBZRLE cache size in bytes
1189 # Notes: This command is deprecated in favor of 'query-migrate-parameters'
1191 # Since: 1.2
1193 # Example:
1195 # -> { "execute": "query-migrate-cache-size" }
1196 # <- { "return": 67108864 }
1199 { 'command': 'query-migrate-cache-size', 'returns': 'int' }
1202 # @migrate:
1204 # Migrates the current running guest to another Virtual Machine.
1206 # @uri: the Uniform Resource Identifier of the destination VM
1208 # @blk: do block migration (full disk copy)
1210 # @inc: incremental disk copy migration
1212 # @detach: this argument exists only for compatibility reasons and
1213 #          is ignored by QEMU
1215 # @resume: resume one paused migration, default "off". (since 3.0)
1217 # Returns: nothing on success
1219 # Since: 0.14.0
1221 # Notes:
1223 # 1. The 'query-migrate' command should be used to check migration's progress
1224 #    and final result (this information is provided by the 'status' member)
1226 # 2. All boolean arguments default to false
1228 # 3. The user Monitor's "detach" argument is invalid in QMP and should not
1229 #    be used
1231 # Example:
1233 # -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
1234 # <- { "return": {} }
1237 { 'command': 'migrate',
1238   'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
1239            '*detach': 'bool', '*resume': 'bool' } }
1242 # @migrate-incoming:
1244 # Start an incoming migration, the qemu must have been started
1245 # with -incoming defer
1247 # @uri: The Uniform Resource Identifier identifying the source or
1248 #       address to listen on
1250 # Returns: nothing on success
1252 # Since: 2.3
1254 # Notes:
1256 # 1. It's a bad idea to use a string for the uri, but it needs to stay
1257 #    compatible with -incoming and the format of the uri is already exposed
1258 #    above libvirt.
1260 # 2. QEMU must be started with -incoming defer to allow migrate-incoming to
1261 #    be used.
1263 # 3. The uri format is the same as for -incoming
1265 # Example:
1267 # -> { "execute": "migrate-incoming",
1268 #      "arguments": { "uri": "tcp::4446" } }
1269 # <- { "return": {} }
1272 { 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
1275 # @xen-save-devices-state:
1277 # Save the state of all devices to file. The RAM and the block devices
1278 # of the VM are not saved by this command.
1280 # @filename: the file to save the state of the devices to as binary
1281 # data. See xen-save-devices-state.txt for a description of the binary
1282 # format.
1284 # @live: Optional argument to ask QEMU to treat this command as part of a live
1285 # migration. Default to true. (since 2.11)
1287 # Returns: Nothing on success
1289 # Since: 1.1
1291 # Example:
1293 # -> { "execute": "xen-save-devices-state",
1294 #      "arguments": { "filename": "/tmp/save" } }
1295 # <- { "return": {} }
1298 { 'command': 'xen-save-devices-state',
1299   'data': {'filename': 'str', '*live':'bool' } }
1302 # @xen-set-replication:
1304 # Enable or disable replication.
1306 # @enable: true to enable, false to disable.
1308 # @primary: true for primary or false for secondary.
1310 # @failover: true to do failover, false to stop. but cannot be
1311 #            specified if 'enable' is true. default value is false.
1313 # Returns: nothing.
1315 # Example:
1317 # -> { "execute": "xen-set-replication",
1318 #      "arguments": {"enable": true, "primary": false} }
1319 # <- { "return": {} }
1321 # Since: 2.9
1323 { 'command': 'xen-set-replication',
1324   'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
1325   'if': 'defined(CONFIG_REPLICATION)' }
1328 # @ReplicationStatus:
1330 # The result format for 'query-xen-replication-status'.
1332 # @error: true if an error happened, false if replication is normal.
1334 # @desc: the human readable error description string, when
1335 #        @error is 'true'.
1337 # Since: 2.9
1339 { 'struct': 'ReplicationStatus',
1340   'data': { 'error': 'bool', '*desc': 'str' },
1341   'if': 'defined(CONFIG_REPLICATION)' }
1344 # @query-xen-replication-status:
1346 # Query replication status while the vm is running.
1348 # Returns: A @ReplicationResult object showing the status.
1350 # Example:
1352 # -> { "execute": "query-xen-replication-status" }
1353 # <- { "return": { "error": false } }
1355 # Since: 2.9
1357 { 'command': 'query-xen-replication-status',
1358   'returns': 'ReplicationStatus',
1359   'if': 'defined(CONFIG_REPLICATION)' }
1362 # @xen-colo-do-checkpoint:
1364 # Xen uses this command to notify replication to trigger a checkpoint.
1366 # Returns: nothing.
1368 # Example:
1370 # -> { "execute": "xen-colo-do-checkpoint" }
1371 # <- { "return": {} }
1373 # Since: 2.9
1375 { 'command': 'xen-colo-do-checkpoint',
1376   'if': 'defined(CONFIG_REPLICATION)' }
1379 # @COLOStatus:
1381 # The result format for 'query-colo-status'.
1383 # @mode: COLO running mode. If COLO is running, this field will return
1384 #        'primary' or 'secondary'.
1386 # @last-mode: COLO last running mode. If COLO is running, this field
1387 #             will return same like mode field, after failover we can
1388 #             use this field to get last colo mode. (since 4.0)
1390 # @reason: describes the reason for the COLO exit.
1392 # Since: 3.1
1394 { 'struct': 'COLOStatus',
1395   'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
1396             'reason': 'COLOExitReason' } }
1399 # @query-colo-status:
1401 # Query COLO status while the vm is running.
1403 # Returns: A @COLOStatus object showing the status.
1405 # Example:
1407 # -> { "execute": "query-colo-status" }
1408 # <- { "return": { "mode": "primary", "reason": "request" } }
1410 # Since: 3.1
1412 { 'command': 'query-colo-status',
1413   'returns': 'COLOStatus' }
1416 # @migrate-recover:
1418 # Provide a recovery migration stream URI.
1420 # @uri: the URI to be used for the recovery of migration stream.
1422 # Returns: nothing.
1424 # Example:
1426 # -> { "execute": "migrate-recover",
1427 #      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
1428 # <- { "return": {} }
1430 # Since: 3.0
1432 { 'command': 'migrate-recover',
1433   'data': { 'uri': 'str' },
1434   'allow-oob': true }
1437 # @migrate-pause:
1439 # Pause a migration.  Currently it only supports postcopy.
1441 # Returns: nothing.
1443 # Example:
1445 # -> { "execute": "migrate-pause" }
1446 # <- { "return": {} }
1448 # Since: 3.0
1450 { 'command': 'migrate-pause', 'allow-oob': true }