4 This document describes all commands currently supported by QMP.
6 Most of the time their usage is exactly the same as in the user Monitor, this
7 means that any other document which also describe commands (the manpage,
8 QEMU's manual, etc) can and should be consulted.
10 QMP has two types of commands: regular and query commands. Regular commands
11 usually change the Virtual Machine's state someway, while query commands just
12 return information. The sections below are divided accordingly.
14 It's important to observe that all communication examples are formatted in
15 a reader-friendly way, so that they're easier to understand. However, in real
16 protocol usage, they're emitted as a single line.
18 Also, the following notation is used to denote data flow:
20 -> data issued by the Client
21 <- Server data response
23 Please, refer to the QMP specification (docs/qmp-spec.txt) for detailed
24 information on the Server command and response formats.
26 NOTE: This document is temporary and will be replaced soon.
28 1. Stability Considerations
29 ===========================
31 The current QMP command set (described in this file) may be useful for a
32 number of use cases, however it's limited and several commands have bad
33 defined semantics, specially with regard to command completion.
35 These problems are going to be solved incrementally in the next QEMU releases
36 and we're going to establish a deprecation policy for badly defined commands.
38 If you're planning to adopt QMP, please observe the following:
40 1. The deprecation policy will take effect and be documented soon, please
41 check the documentation of each used command as soon as a new release of
44 2. DO NOT rely on anything which is not explicit documented
46 3. Errors, in special, are not documented. Applications should NOT check
47 for specific errors classes or data (it's strongly recommended to only
48 check for the "error" key)
53 Server's responses in the examples below are always a success response, please
54 refer to the QMP specification for more details on error responses.
59 Eject a removable medium.
63 - "force": force ejection (json-bool, optional)
64 - "device": block device name (deprecated, use @id instead)
65 (json-string, optional)
66 - "id": the name or QOM path of the guest device (json-string, optional)
70 -> { "execute": "eject", "arguments": { "id": "ide0-1-0" } }
73 Note: The "force" argument defaults to false.
82 - "driver": the name of the new device's driver (json-string)
83 - "bus": the device's parent bus (device tree path, json-string, optional)
84 - "id": the device's ID, must be unique (json-string)
89 -> { "execute": "device_add", "arguments": { "driver": "e1000", "id": "net1" } }
94 (1) For detailed information about this command, please refer to the
95 'docs/qdev-device-use.txt' file.
97 (2) It's possible to list device properties by running QEMU with the
98 "-device DEVICE,\?" command-line argument, where DEVICE is the device's name
107 - "index": the CPU's index (json-int)
111 -> { "execute": "cpu", "arguments": { "index": 0 } }
114 Note: CPUs' indexes are obtained with the 'query-cpus' command.
116 xen-load-devices-state
117 ----------------------
119 Load the state of all devices from file. The RAM and the block devices
120 of the VM are not loaded by this command.
124 - "filename": the file to load the state of the devices from as binary
125 data. See xen-save-devices-state.txt for a description of the binary
130 -> { "execute": "xen-load-devices-state",
131 "arguments": { "filename": "/tmp/resume" } }
134 migrate-set-cache-size
135 ----------------------
137 Set cache size to be used by XBZRLE migration, the cache size will be rounded
138 down to the nearest power of 2
142 - "value": cache size in bytes (json-int)
146 -> { "execute": "migrate-set-cache-size", "arguments": { "value": 536870912 } }
149 x-colo-lost-heartbeat
152 Tell COLO that heartbeat is lost, a failover or takeover is needed.
156 -> { "execute": "x-colo-lost-heartbeat" }
162 Query background dump status.
168 -> { "execute": "query-dump" }
169 <- { "return": { "status": "active", "completed": 1024000,
172 blockdev-snapshot-internal-sync
173 -------------------------------
175 Synchronously take an internal snapshot of a block device when the format of
176 image used supports it. If the name is an empty string, or a snapshot with
177 name already exists, the operation will fail.
181 - "device": the device name or node-name of a root node to snapshot
183 - "name": name of the new snapshot (json-string)
187 -> { "execute": "blockdev-snapshot-internal-sync",
188 "arguments": { "device": "ide-hd0",
189 "name": "snapshot0" }
193 blockdev-snapshot-delete-internal-sync
194 --------------------------------------
196 Synchronously delete an internal snapshot of a block device when the format of
197 image used supports it. The snapshot is identified by name or id or both. One
198 of name or id is required. If the snapshot is not found, the operation will
203 - "device": the device name or node-name of a root node (json-string)
204 - "id": ID of the snapshot (json-string, optional)
205 - "name": name of the snapshot (json-string, optional)
209 -> { "execute": "blockdev-snapshot-delete-internal-sync",
210 "arguments": { "device": "ide-hd0",
211 "name": "snapshot0" }
227 Start mirroring a block device's writes to another block device. target
228 specifies the target of mirror operation.
232 - "job-id": Identifier for the newly-created block job. If omitted,
233 the device name will be used. (json-string, optional)
234 - "device": The device name or node-name of a root node whose writes should be
235 mirrored (json-string)
236 - "target": device name to mirror to (json-string)
237 - "replaces": the block driver node name to replace when finished
238 (json-string, optional)
239 - "speed": maximum speed of the streaming job, in bytes per second
241 - "granularity": granularity of the dirty bitmap, in bytes (json-int, optional)
242 - "buf_size": maximum amount of data in flight from source to target, in bytes
243 (json-int, default 10M)
244 - "sync": what parts of the disk image should be copied to the destination;
245 possibilities include "full" for all the disk, "top" for only the sectors
246 allocated in the topmost image, or "none" to only replicate new I/O
248 - "on-source-error": the action to take on an error on the source
249 (BlockdevOnError, default 'report')
250 - "on-target-error": the action to take on an error on the target
251 (BlockdevOnError, default 'report')
253 The default value of the granularity is the image cluster size clamped
254 between 4096 and 65536, if the image format defines one. If the format
255 does not define a cluster size, the default value of the granularity
260 -> { "execute": "blockdev-mirror", "arguments": { "device": "ide-hd0",
268 Enable QMP capabilities.
274 -> { "execute": "qmp_capabilities" }
277 Note: This command must be issued before issuing any other command.
288 Return a json-object with the following information:
290 - "qemu": A json-object containing three integer values:
291 - "major": QEMU's major version (json-int)
292 - "minor": QEMU's minor version (json-int)
293 - "micro": QEMU's micro version (json-int)
294 - "package": package's version (json-string)
298 -> { "execute": "query-version" }
313 List QMP available commands.
315 Each command is represented by a json-object, the returned value is a json-array
318 Each json-object contain:
320 - "name": command's name (json-string)
324 -> { "execute": "query-commands" }
328 "name":"query-balloon"
331 "name":"system_powerdown"
336 Note: This example has been shortened as the real response is too long.
341 Return the QMP wire schema. The returned value is a json-array of
342 named schema entities. Entities are commands, events and various
343 types. See docs/qapi-code-gen.txt for information on their structure
349 Opens a block device's tray. If there is a block driver state tree inserted as a
350 medium, it will become inaccessible to the guest (but it will remain associated
351 to the block device, so closing the tray will make it accessible again).
353 If the tray was already open before, this will be a no-op.
355 Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
356 which no such event will be generated, these include:
357 - if the guest has locked the tray, @force is false and the guest does not
358 respond to the eject request
359 - if the BlockBackend denoted by @device does not have a guest device attached
361 - if the guest device does not have an actual tray and is empty, for instance
362 for floppy disk drives
366 - "device": block device name (deprecated, use @id instead)
367 (json-string, optional)
368 - "id": the name or QOM path of the guest device (json-string, optional)
369 - "force": if false (the default), an eject request will be sent to the guest if
370 it has locked the tray (and the tray will not be opened immediately);
371 if true, the tray will be opened regardless of whether it is locked
372 (json-bool, optional)
376 -> { "execute": "blockdev-open-tray",
377 "arguments": { "id": "ide0-1-0" } }
379 <- { "timestamp": { "seconds": 1418751016,
380 "microseconds": 716996 },
381 "event": "DEVICE_TRAY_MOVED",
382 "data": { "device": "ide1-cd0",
384 "tray-open": true } }
391 Closes a block device's tray. If there is a block driver state tree associated
392 with the block device (which is currently ejected), that tree will be loaded as
395 If the tray was already closed before, this will be a no-op.
399 - "device": block device name (deprecated, use @id instead)
400 (json-string, optional)
401 - "id": the name or QOM path of the guest device (json-string, optional)
405 -> { "execute": "blockdev-close-tray",
406 "arguments": { "id": "ide0-1-0" } }
408 <- { "timestamp": { "seconds": 1418751345,
409 "microseconds": 272147 },
410 "event": "DEVICE_TRAY_MOVED",
411 "data": { "device": "ide1-cd0",
413 "tray-open": false } }
417 x-blockdev-remove-medium
418 ------------------------
420 Removes a medium (a block driver state tree) from a block device. That block
421 device's tray must currently be open (unless there is no attached guest device).
423 If the tray is open and there is no medium inserted, this will be a no-op.
425 This command is still a work in progress and is considered experimental.
426 Stay away from it unless you want to help with its development.
430 - "device": block device name (deprecated, use @id instead)
431 (json-string, optional)
432 - "id": the name or QOM path of the guest device (json-string, optional)
436 -> { "execute": "x-blockdev-remove-medium",
437 "arguments": { "id": "ide0-1-0" } }
439 <- { "error": { "class": "GenericError",
440 "desc": "Tray of device 'ide0-1-0' is not open" } }
442 -> { "execute": "blockdev-open-tray",
443 "arguments": { "id": "ide0-1-0" } }
445 <- { "timestamp": { "seconds": 1418751627,
446 "microseconds": 549958 },
447 "event": "DEVICE_TRAY_MOVED",
448 "data": { "device": "ide1-cd0",
450 "tray-open": true } }
454 -> { "execute": "x-blockdev-remove-medium",
455 "arguments": { "device": "ide0-1-0" } }
459 x-blockdev-insert-medium
460 ------------------------
462 Inserts a medium (a block driver state tree) into a block device. That block
463 device's tray must currently be open (unless there is no attached guest device)
464 and there must be no medium inserted already.
466 This command is still a work in progress and is considered experimental.
467 Stay away from it unless you want to help with its development.
471 - "device": block device name (deprecated, use @id instead)
472 (json-string, optional)
473 - "id": the name or QOM path of the guest device (json-string, optional)
474 - "node-name": root node of the BDS tree to insert into the block device
478 -> { "execute": "blockdev-add",
479 "arguments": { { "node-name": "node0",
481 "file": { "driver": "file",
482 "filename": "fedora.iso" } } }
486 -> { "execute": "x-blockdev-insert-medium",
487 "arguments": { "id": "ide0-1-0",
488 "node-name": "node0" } }
495 Dynamically reconfigure the block driver state graph. It can be used
496 to add, remove, insert or replace a graph node. Currently only the
497 Quorum driver implements this feature to add or remove its child. This
498 is useful to fix a broken quorum child.
500 If @node is specified, it will be inserted under @parent. @child
501 may not be specified in this case. If both @parent and @child are
502 specified but @node is not, @child will be detached from @parent.
505 - "parent": the id or name of the parent node (json-string)
506 - "child": the name of a child under the given parent node (json-string, optional)
507 - "node": the name of the node that will be added (json-string, optional)
509 Note: this command is experimental, and not a stable API. It doesn't
510 support all kinds of operations, all kinds of children, nor all block
513 Warning: The data in a new quorum child MUST be consistent with that of
514 the rest of the array.
518 Add a new node to a quorum
519 -> { "execute": "blockdev-add",
520 "arguments": { "driver": "raw",
521 "node-name": "new_node",
522 "file": { "driver": "file",
523 "filename": "test.raw" } } }
525 -> { "execute": "x-blockdev-change",
526 "arguments": { "parent": "disk1",
527 "node": "new_node" } }
530 Delete a quorum's node
531 -> { "execute": "x-blockdev-change",
532 "arguments": { "parent": "disk1",
533 "child": "children.1" } }
536 blockdev-change-medium
537 ----------------------
539 Changes the medium inserted into a block device by ejecting the current medium
540 and loading a new image file which is inserted as the new medium.
544 - "device": block device name (deprecated, use @id instead)
545 (json-string, optional)
546 - "id": the name or QOM path of the guest device (json-string, optional)
547 - "filename": filename of the new image (json-string)
548 - "format": format of the new image (json-string, optional)
549 - "read-only-mode": new read-only mode (json-string, optional)
550 - Possible values: "retain" (default), "read-only", "read-write"
554 1. Change a removable medium
556 -> { "execute": "blockdev-change-medium",
557 "arguments": { "id": "ide0-1-0",
558 "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
562 2. Load a read-only medium into a writable drive
564 -> { "execute": "blockdev-change-medium",
565 "arguments": { "id": "floppyA",
566 "filename": "/srv/images/ro.img",
568 "read-only-mode": "retain" } }
571 { "class": "GenericError",
572 "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
574 -> { "execute": "blockdev-change-medium",
575 "arguments": { "id": "floppyA",
576 "filename": "/srv/images/ro.img",
578 "read-only-mode": "read-only" } }
582 trace-event-get-state
583 ---------------------
585 Query the state of events.
589 - "name": Event name pattern (json-string).
590 - "vcpu": The vCPU to query, any vCPU by default (json-int, optional).
592 An event is returned if:
593 - its name matches the "name" pattern, and
594 - if "vcpu" is given, the event has the "vcpu" property.
596 Therefore, if "vcpu" is given, the operation will only match per-vCPU events,
597 returning their state on the specified vCPU. Special case: if "name" is an exact
598 match, "vcpu" is given and the event does not have the "vcpu" property, an error
603 -> { "execute": "trace-event-get-state", "arguments": { "name": "qemu_memalign" } }
604 <- { "return": [ { "name": "qemu_memalign", "state": "disabled" } ] }
606 trace-event-set-state
607 ---------------------
609 Set the state of events.
613 - "name": Event name pattern (json-string).
614 - "enable": Whether to enable or disable the event (json-bool).
615 - "ignore-unavailable": Whether to ignore errors for events that cannot be
616 changed (json-bool, optional).
617 - "vcpu": The vCPU to act upon, all vCPUs by default (json-int, optional).
619 An event's state is modified if:
620 - its name matches the "name" pattern, and
621 - if "vcpu" is given, the event has the "vcpu" property.
623 Therefore, if "vcpu" is given, the operation will only match per-vCPU events,
624 setting their state on the specified vCPU. Special case: if "name" is an exact
625 match, "vcpu" is given and the event does not have the "vcpu" property, an error
630 -> { "execute": "trace-event-set-state", "arguments": { "name": "qemu_memalign", "enable": "true" } }
633 block-set-write-threshold
636 Change the write threshold for a block drive. The threshold is an offset,
637 thus must be non-negative. Default is no write threshold.
638 Setting the threshold to zero disables it.
642 - "node-name": the node name in the block driver state graph (json-string)
643 - "write-threshold": the write threshold in bytes (json-int)
647 -> { "execute": "block-set-write-threshold",
648 "arguments": { "node-name": "mydev",
649 "write-threshold": 17179869184 } }
657 - "name": switch name
661 -> { "execute": "query-rocker", "arguments": { "name": "sw1" } }
662 <- { "return": {"name": "sw1", "ports": 2, "id": 1327446905938}}
664 Show rocker switch ports
665 ------------------------
669 - "name": switch name
673 -> { "execute": "query-rocker-ports", "arguments": { "name": "sw1" } }
674 <- { "return": [ {"duplex": "full", "enabled": true, "name": "sw1.1",
675 "autoneg": "off", "link-up": true, "speed": 10000},
676 {"duplex": "full", "enabled": true, "name": "sw1.2",
677 "autoneg": "off", "link-up": true, "speed": 10000}
680 Show rocker switch OF-DPA flow tables
681 -------------------------------------
685 - "name": switch name
686 - "tbl-id": (optional) flow table ID
690 -> { "execute": "query-rocker-of-dpa-flows", "arguments": { "name": "sw1" } }
691 <- { "return": [ {"key": {"in-pport": 0, "priority": 1, "tbl-id": 0},
694 "action": {"goto-tbl": 10},
695 "mask": {"in-pport": 4294901760}
700 Show rocker OF-DPA group tables
701 -------------------------------
705 - "name": switch name
706 - "type": (optional) group type
710 -> { "execute": "query-rocker-of-dpa-groups", "arguments": { "name": "sw1" } }
711 <- { "return": [ {"type": 0, "out-pport": 2, "pport": 2, "vlan-id": 3841,
712 "pop-vlan": 1, "id": 251723778},
713 {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3841,
714 "pop-vlan": 1, "id": 251723776},
715 {"type": 0, "out-pport": 1, "pport": 1, "vlan-id": 3840,
716 "pop-vlan": 1, "id": 251658241},
717 {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3840,
718 "pop-vlan": 1, "id": 251658240}
721 query-gic-capabilities
724 Return a list of GICCapability objects, describing supported GIC
725 (Generic Interrupt Controller) versions.
731 -> { "execute": "query-gic-capabilities" }
732 <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
733 { "version": 3, "emulated": false, "kernel": true } ] }
735 Show existing/possible CPUs
736 ---------------------------
740 Example for pseries machine type started with
741 -smp 2,cores=2,maxcpus=4 -cpu POWER8:
743 -> { "execute": "query-hotpluggable-cpus" }
745 { "props": { "core-id": 8 }, "type": "POWER8-spapr-cpu-core",
747 { "props": { "core-id": 0 }, "type": "POWER8-spapr-cpu-core",
748 "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
751 Example for pc machine type started with
753 -> { "execute": "query-hotpluggable-cpus" }
756 "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
757 "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
760 "qom-path": "/machine/unattached/device[0]",
761 "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
762 "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}