]> Git Repo - qemu.git/blame - docs/qmp-commands.txt
qmp-commands: move 'xen-save-devices-state' doc to schema
[qemu.git] / docs / qmp-commands.txt
CommitLineData
82a56f0d
LC
1 QMP Supported Commands
2 ----------------------
3
4This document describes all commands currently supported by QMP.
5
6Most of the time their usage is exactly the same as in the user Monitor, this
7means that any other document which also describe commands (the manpage,
8QEMU's manual, etc) can and should be consulted.
9
10QMP has two types of commands: regular and query commands. Regular commands
11usually change the Virtual Machine's state someway, while query commands just
12return information. The sections below are divided accordingly.
13
14It's important to observe that all communication examples are formatted in
15a reader-friendly way, so that they're easier to understand. However, in real
16protocol usage, they're emitted as a single line.
17
18Also, the following notation is used to denote data flow:
19
20-> data issued by the Client
21<- Server data response
22
77a6da26 23Please, refer to the QMP specification (docs/qmp-spec.txt) for detailed
82a56f0d
LC
24information on the Server command and response formats.
25
26NOTE: This document is temporary and will be replaced soon.
27
281. Stability Considerations
29===========================
30
31The current QMP command set (described in this file) may be useful for a
32number of use cases, however it's limited and several commands have bad
33defined semantics, specially with regard to command completion.
34
35These problems are going to be solved incrementally in the next QEMU releases
36and we're going to establish a deprecation policy for badly defined commands.
37
38If you're planning to adopt QMP, please observe the following:
39
c20cdf8b 40 1. The deprecation policy will take effect and be documented soon, please
82a56f0d
LC
41 check the documentation of each used command as soon as a new release of
42 QEMU is available
43
44 2. DO NOT rely on anything which is not explicit documented
45
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)
49
502. Regular Commands
51===================
52
53Server's responses in the examples below are always a success response, please
54refer to the QMP specification for more details on error responses.
55
82a56f0d
LC
56eject
57-----
58
59Eject a removable medium.
60
bdf05133 61Arguments:
82a56f0d 62
fbe2d816
KW
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)
82a56f0d
LC
67
68Example:
69
fbe2d816 70-> { "execute": "eject", "arguments": { "id": "ide0-1-0" } }
82a56f0d
LC
71<- { "return": {} }
72
73Note: The "force" argument defaults to false.
74
82a56f0d
LC
75screendump
76----------
77
78Save screen into PPM image.
79
80Arguments:
81
82- "filename": file path (json-string)
83
84Example:
85
86-> { "execute": "screendump", "arguments": { "filename": "/tmp/image" } }
87<- { "return": {} }
88
82a56f0d
LC
89device_add
90----------
91
92Add a device.
93
94Arguments:
95
96- "driver": the name of the new device's driver (json-string)
97- "bus": the device's parent bus (device tree path, json-string, optional)
98- "id": the device's ID, must be unique (json-string)
99- device properties
100
101Example:
102
103-> { "execute": "device_add", "arguments": { "driver": "e1000", "id": "net1" } }
104<- { "return": {} }
105
106Notes:
107
108(1) For detailed information about this command, please refer to the
109 'docs/qdev-device-use.txt' file.
110
111(2) It's possible to list device properties by running QEMU with the
112 "-device DEVICE,\?" command-line argument, where DEVICE is the device's name
113
82a56f0d
LC
114device_del
115----------
116
117Remove a device.
118
119Arguments:
120
6287d827 121- "id": the device's ID or QOM path (json-string)
82a56f0d
LC
122
123Example:
124
125-> { "execute": "device_del", "arguments": { "id": "net1" } }
126<- { "return": {} }
127
6287d827
DB
128Example:
129
130-> { "execute": "device_del", "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
131<- { "return": {} }
132
e4c8f004
AK
133send-key
134----------
135
136Send keys to VM.
137
138Arguments:
139
140keys array:
f9b1d9b2
AK
141 - "key": key sequence (a json-array of key union values,
142 union can be number or qcode enum)
e4c8f004
AK
143
144- hold-time: time to delay key up events, milliseconds. Defaults to 100
145 (json-int, optional)
146
147Example:
148
149-> { "execute": "send-key",
f9b1d9b2
AK
150 "arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
151 { "type": "qcode", "data": "alt" },
152 { "type": "qcode", "data": "delete" } ] } }
e4c8f004
AK
153<- { "return": {} }
154
82a56f0d
LC
155cpu
156---
157
158Set the default CPU.
159
160Arguments:
161
162- "index": the CPU's index (json-int)
163
164Example:
165
166-> { "execute": "cpu", "arguments": { "index": 0 } }
167<- { "return": {} }
168
169Note: CPUs' indexes are obtained with the 'query-cpus' command.
170
88c16567
WC
171xen-load-devices-state
172----------------------
173
174Load the state of all devices from file. The RAM and the block devices
175of the VM are not loaded by this command.
176
177Arguments:
178
179- "filename": the file to load the state of the devices from as binary
180data. See xen-save-devices-state.txt for a description of the binary
181format.
182
183Example:
184
185-> { "execute": "xen-load-devices-state",
186 "arguments": { "filename": "/tmp/resume" } }
187<- { "return": {} }
188
39f42439
AP
189xen-set-global-dirty-log
190-------
191
192Enable or disable the global dirty log mode.
193
194Arguments:
195
196- "enable": Enable it or disable it.
197
198Example:
199
200-> { "execute": "xen-set-global-dirty-log",
201 "arguments": { "enable": true } }
202<- { "return": {} }
203
9e1ba4cc 204migrate-set-cache-size
817c6045 205----------------------
9e1ba4cc
OW
206
207Set cache size to be used by XBZRLE migration, the cache size will be rounded
208down to the nearest power of 2
209
210Arguments:
211
212- "value": cache size in bytes (json-int)
213
214Example:
215
216-> { "execute": "migrate-set-cache-size", "arguments": { "value": 536870912 } }
217<- { "return": {} }
218
d89e666e
HZ
219x-colo-lost-heartbeat
220--------------------
221
222Tell COLO that heartbeat is lost, a failover or takeover is needed.
223
224Example:
225
226-> { "execute": "x-colo-lost-heartbeat" }
227<- { "return": {} }
228
783e9b48
WC
229dump
230
231
232Dump guest memory to file. The file can be processed with crash or gdb.
233
234Arguments:
235
236- "paging": do paging to get guest's memory mapping (json-bool)
237- "protocol": destination file(started with "file:") or destination file
238 descriptor (started with "fd:") (json-string)
228de9cf 239- "detach": if specified, command will return immediately, without waiting
39ba2ea6
PX
240 for the dump to finish. The user can track progress using
241 "query-dump". (json-bool)
783e9b48
WC
242- "begin": the starting physical address. It's optional, and should be specified
243 with length together (json-int)
244- "length": the memory size, in bytes. It's optional, and should be specified
245 with begin together (json-int)
b53ccc30
QN
246- "format": the format of guest memory dump. It's optional, and can be
247 elf|kdump-zlib|kdump-lzo|kdump-snappy, but non-elf formats will
248 conflict with paging and filter, ie. begin and length (json-string)
783e9b48
WC
249
250Example:
251
252-> { "execute": "dump-guest-memory", "arguments": { "protocol": "fd:dump" } }
253<- { "return": {} }
254
255Notes:
256
257(1) All boolean arguments default to false
258
7d6dc7f3
QN
259query-dump-guest-memory-capability
260----------
261
262Show available formats for 'dump-guest-memory'
263
264Example:
265
266-> { "execute": "query-dump-guest-memory-capability" }
267<- { "return": { "formats":
268 ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
269
39ba2ea6
PX
270query-dump
271----------
272
273Query background dump status.
274
275Arguments: None.
276
277Example:
278
279-> { "execute": "query-dump" }
280<- { "return": { "status": "active", "completed": 1024000,
281 "total": 2048000 } }
282
7ee0c3e3
JH
283dump-skeys
284----------
285
286Save guest storage keys to file.
287
288Arguments:
289
290- "filename": file path (json-string)
291
292Example:
293
294-> { "execute": "dump-skeys", "arguments": { "filename": "/tmp/skeys" } }
295<- { "return": {} }
296
82a56f0d
LC
297netdev_add
298----------
299
300Add host network device.
301
302Arguments:
303
304- "type": the device type, "tap", "user", ... (json-string)
305- "id": the device's ID, must be unique (json-string)
306- device options
307
308Example:
309
b8a98326
MA
310-> { "execute": "netdev_add",
311 "arguments": { "type": "user", "id": "netdev1",
312 "dnssearch": "example.org" } }
82a56f0d
LC
313<- { "return": {} }
314
af347aa5 315Note: The supported device options are the same ones supported by the '-netdev'
82a56f0d
LC
316 command-line argument, which are listed in the '-help' output or QEMU's
317 manual
318
82a56f0d
LC
319netdev_del
320----------
321
322Remove host network device.
323
324Arguments:
325
326- "id": the device's ID, must be unique (json-string)
327
328Example:
329
330-> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
331<- { "return": {} }
332
6d4a2b3a 333
cff8b2c6
PB
334object-add
335----------
336
337Create QOM object.
338
339Arguments:
340
341- "qom-type": the object's QOM type, i.e. the class name (json-string)
342- "id": the object's ID, must be unique (json-string)
343- "props": a dictionary of object property values (optional, json-dict)
344
345Example:
346
347-> { "execute": "object-add", "arguments": { "qom-type": "rng-random", "id": "rng1",
348 "props": { "filename": "/dev/hwrng" } } }
349<- { "return": {} }
350
ab2d0531
PB
351object-del
352----------
353
354Remove QOM object.
355
356Arguments:
357
358- "id": the object's ID (json-string)
359
360Example:
361
362-> { "execute": "object-del", "arguments": { "id": "rng1" } }
363<- { "return": {} }
364
365
6d4a2b3a
CH
366block_resize
367------------
368
369Resize a block image while a guest is running.
370
371Arguments:
372
373- "device": the device's ID, must be unique (json-string)
3b1dbd11 374- "node-name": the node name in the block driver state graph (json-string)
6d4a2b3a
CH
375- "size": new size
376
377Example:
378
379-> { "execute": "block_resize", "arguments": { "device": "scratch", "size": 1073741824 } }
380<- { "return": {} }
381
ec683d60
SH
382block-stream
383------------
384
385Copy data from a backing file into a block device.
386
387Arguments:
388
2323322e
AG
389- "job-id": Identifier for the newly-created block job. If omitted,
390 the device name will be used. (json-string, optional)
b6c1bae5 391- "device": The device name or node-name of a root node (json-string)
312fe09c
AG
392- "base": The file name of the backing image above which copying starts.
393 It cannot be set if 'base-node' is also set (json-string, optional)
394- "base-node": the node name of the backing image above which copying starts.
395 It cannot be set if 'base' is also set.
396 (json-string, optional) (Since 2.8)
ec683d60
SH
397- "backing-file": The backing file string to write into the active layer. This
398 filename is not validated.
399
400 If a pathname string is such that it cannot be resolved by
401 QEMU, that means that subsequent QMP or HMP commands must use
402 node-names for the image in question, as filename lookup
403 methods will fail.
404
405 If not specified, QEMU will automatically determine the
406 backing file string to use, or error out if there is no
407 obvious choice. Care should be taken when specifying the
408 string, to specify a valid filename or protocol.
409 (json-string, optional) (Since 2.1)
410- "speed": the maximum speed, in bytes per second (json-int, optional)
411- "on-error": the action to take on an error (default 'report'). 'stop' and
412 'enospc' can only be used if the block device supports io-status.
413 (json-string, optional) (Since 2.1)
414
415Example:
416
417-> { "execute": "block-stream", "arguments": { "device": "virtio0",
418 "base": "/tmp/master.qcow2" } }
419<- { "return": {} }
420
37222900
JC
421block-commit
422------------
423
424Live commit of data from overlay image nodes into backing nodes - i.e., writes
425data between 'top' and 'base' into 'base'.
426
427Arguments:
428
fd62c609
AG
429- "job-id": Identifier for the newly-created block job. If omitted,
430 the device name will be used. (json-string, optional)
1d13b167 431- "device": The device name or node-name of a root node (json-string)
37222900
JC
432- "base": The file name of the backing image to write data into.
433 If not specified, this is the deepest backing image
434 (json-string, optional)
435- "top": The file name of the backing image within the image chain,
7676e2c5
JC
436 which contains the topmost data to be committed down. If
437 not specified, this is the active layer. (json-string, optional)
37222900 438
54e26900
JC
439- backing-file: The backing file string to write into the overlay
440 image of 'top'. If 'top' is the active layer,
441 specifying a backing file string is an error. This
442 filename is not validated.
443
444 If a pathname string is such that it cannot be
445 resolved by QEMU, that means that subsequent QMP or
446 HMP commands must use node-names for the image in
447 question, as filename lookup methods will fail.
448
449 If not specified, QEMU will automatically determine
450 the backing file string to use, or error out if
451 there is no obvious choice. Care should be taken
452 when specifying the string, to specify a valid
453 filename or protocol.
454 (json-string, optional) (Since 2.1)
455
37222900
JC
456 If top == base, that is an error.
457 If top == active, the job will not be completed by itself,
458 user needs to complete the job with the block-job-complete
459 command after getting the ready event. (Since 2.0)
460
461 If the base image is smaller than top, then the base image
462 will be resized to be the same size as top. If top is
463 smaller than the base image, the base will not be
464 truncated. If you want the base image size to match the
465 size of the smaller top, you can safely truncate it
466 yourself once the commit operation successfully completes.
467 (json-string)
468- "speed": the maximum speed, in bytes per second (json-int, optional)
469
470
471Example:
472
473-> { "execute": "block-commit", "arguments": { "device": "virtio0",
474 "top": "/tmp/snap1.qcow2" } }
475<- { "return": {} }
476
99a9addf
SH
477drive-backup
478------------
479
480Start a point-in-time copy of a block device to a new destination. The
481status of ongoing drive-backup operations can be checked with
482query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
483The operation can be stopped before it has completed using the
484block-job-cancel command.
485
486Arguments:
487
70559d49
AG
488- "job-id": Identifier for the newly-created block job. If omitted,
489 the device name will be used. (json-string, optional)
b7e4fa22 490- "device": the device name or node-name of a root node which should be copied.
99a9addf
SH
491 (json-string)
492- "target": the target of the new image. If the file exists, or if it is a
493 device, the existing file/device will be used as the new
494 destination. If it does not exist, a new file will be created.
495 (json-string)
496- "format": the format of the new destination, default is to probe if 'mode' is
497 'existing', else the format of the source
498 (json-string, optional)
b53169ea
SH
499- "sync": what parts of the disk image should be copied to the destination;
500 possibilities include "full" for all the disk, "top" for only the sectors
4b80ab2b 501 allocated in the topmost image, "incremental" for only the dirty sectors in
d58d8453 502 the bitmap, or "none" to only replicate new I/O (MirrorSyncMode).
4b80ab2b
JS
503- "bitmap": dirty bitmap name for sync==incremental. Must be present if sync
504 is "incremental", must NOT be present otherwise.
99a9addf
SH
505- "mode": whether and how QEMU should create a new image
506 (NewImageMode, optional, default 'absolute-paths')
507- "speed": the maximum speed, in bytes per second (json-int, optional)
13b9414b
PB
508- "compress": true to compress data, if the target format supports it.
509 (json-bool, optional, default false)
99a9addf
SH
510- "on-source-error": the action to take on an error on the source, default
511 'report'. 'stop' and 'enospc' can only be used
512 if the block device supports io-status.
513 (BlockdevOnError, optional)
514- "on-target-error": the action to take on an error on the target, default
515 'report' (no limitations, since this applies to
516 a different block device than device).
517 (BlockdevOnError, optional)
518
519Example:
520-> { "execute": "drive-backup", "arguments": { "device": "drive0",
fc5d3f84 521 "sync": "full",
99a9addf
SH
522 "target": "backup.img" } }
523<- { "return": {} }
c29c1dd3 524
c29c1dd3
FZ
525blockdev-backup
526---------------
527
528The device version of drive-backup: this command takes an existing named device
529as backup target.
530
531Arguments:
532
70559d49
AG
533- "job-id": Identifier for the newly-created block job. If omitted,
534 the device name will be used. (json-string, optional)
cef34eeb 535- "device": the device name or node-name of a root node which should be copied.
c29c1dd3
FZ
536 (json-string)
537- "target": the name of the backup target device. (json-string)
538- "sync": what parts of the disk image should be copied to the destination;
539 possibilities include "full" for all the disk, "top" for only the
540 sectors allocated in the topmost image, or "none" to only replicate
541 new I/O (MirrorSyncMode).
542- "speed": the maximum speed, in bytes per second (json-int, optional)
3b7b1236
PB
543- "compress": true to compress data, if the target format supports it.
544 (json-bool, optional, default false)
c29c1dd3
FZ
545- "on-source-error": the action to take on an error on the source, default
546 'report'. 'stop' and 'enospc' can only be used
547 if the block device supports io-status.
548 (BlockdevOnError, optional)
549- "on-target-error": the action to take on an error on the target, default
550 'report' (no limitations, since this applies to
551 a different block device than device).
552 (BlockdevOnError, optional)
553
554Example:
555-> { "execute": "blockdev-backup", "arguments": { "device": "src-id",
556 "sync": "full",
557 "target": "tgt-id" } }
558<- { "return": {} }
559
341ebc2f
JS
560block-dirty-bitmap-add
561----------------------
562Since 2.4
563
564Create a dirty bitmap with a name on the device, and start tracking the writes.
565
566Arguments:
567
568- "node": device/node on which to create dirty bitmap (json-string)
569- "name": name of the new dirty bitmap (json-string)
570- "granularity": granularity to track writes with (int, optional)
571
572Example:
573
574-> { "execute": "block-dirty-bitmap-add", "arguments": { "node": "drive0",
575 "name": "bitmap0" } }
576<- { "return": {} }
577
341ebc2f
JS
578block-dirty-bitmap-remove
579-------------------------
580Since 2.4
581
582Stop write tracking and remove the dirty bitmap that was created with
583block-dirty-bitmap-add.
584
585Arguments:
586
587- "node": device/node on which to remove dirty bitmap (json-string)
588- "name": name of the dirty bitmap to remove (json-string)
589
590Example:
591
592-> { "execute": "block-dirty-bitmap-remove", "arguments": { "node": "drive0",
593 "name": "bitmap0" } }
594<- { "return": {} }
595
e74e6b78
JS
596block-dirty-bitmap-clear
597------------------------
598Since 2.4
599
600Reset the dirty bitmap associated with a node so that an incremental backup
601from this point in time forward will only backup clusters modified after this
602clear operation.
603
604Arguments:
605
606- "node": device/node on which to remove dirty bitmap (json-string)
607- "name": name of the dirty bitmap to remove (json-string)
608
609Example:
610
611-> { "execute": "block-dirty-bitmap-clear", "arguments": { "node": "drive0",
612 "name": "bitmap0" } }
613<- { "return": {} }
614
d967b2f1
JS
615blockdev-snapshot-sync
616----------------------
617
618Synchronous snapshot of a block device. snapshot-file specifies the
619target of the new image. If the file exists, or if it is a device, the
620snapshot will be created in the existing file/device. If does not
621exist, a new file will be created. format specifies the format of the
622snapshot image, default is qcow2.
623
624Arguments:
625
626- "device": device name to snapshot (json-string)
0901f67e 627- "node-name": graph node name to snapshot (json-string)
d967b2f1 628- "snapshot-file": name of new image file (json-string)
0901f67e 629- "snapshot-node-name": graph node name of the new snapshot (json-string)
6cc2a415
PB
630- "mode": whether and how QEMU should create the snapshot file
631 (NewImageMode, optional, default "absolute-paths")
d967b2f1
JS
632- "format": format of new image (json-string, optional)
633
634Example:
635
7f3850c2
LC
636-> { "execute": "blockdev-snapshot-sync", "arguments": { "device": "ide-hd0",
637 "snapshot-file":
638 "/some/place/my-image",
639 "format": "qcow2" } }
d967b2f1
JS
640<- { "return": {} }
641
43de7e2d
AG
642blockdev-snapshot
643-----------------
644Since 2.5
645
646Create a snapshot, by installing 'node' as the backing image of
647'overlay'. Additionally, if 'node' is associated with a block
648device, the block device changes to using 'overlay' as its new active
649image.
650
651Arguments:
652
653- "node": device that will have a snapshot created (json-string)
654- "overlay": device that will have 'node' as its backing image (json-string)
655
656Example:
657
658-> { "execute": "blockdev-add",
0153d2f5
KW
659 "arguments": { "driver": "qcow2",
660 "node-name": "node1534",
661 "file": { "driver": "file",
662 "filename": "hd1.qcow2" },
663 "backing": "" } }
43de7e2d
AG
664
665<- { "return": {} }
666
667-> { "execute": "blockdev-snapshot", "arguments": { "node": "ide-hd0",
668 "overlay": "node1534" } }
669<- { "return": {} }
670
f323bc9e
WX
671blockdev-snapshot-internal-sync
672-------------------------------
673
674Synchronously take an internal snapshot of a block device when the format of
675image used supports it. If the name is an empty string, or a snapshot with
676name already exists, the operation will fail.
677
678Arguments:
679
75dfd402
KW
680- "device": the device name or node-name of a root node to snapshot
681 (json-string)
f323bc9e
WX
682- "name": name of the new snapshot (json-string)
683
684Example:
685
686-> { "execute": "blockdev-snapshot-internal-sync",
687 "arguments": { "device": "ide-hd0",
688 "name": "snapshot0" }
689 }
690<- { "return": {} }
691
44e3e053
WX
692blockdev-snapshot-delete-internal-sync
693--------------------------------------
694
695Synchronously delete an internal snapshot of a block device when the format of
696image used supports it. The snapshot is identified by name or id or both. One
697of name or id is required. If the snapshot is not found, the operation will
698fail.
699
700Arguments:
701
2dfb4c03 702- "device": the device name or node-name of a root node (json-string)
44e3e053
WX
703- "id": ID of the snapshot (json-string, optional)
704- "name": name of the snapshot (json-string, optional)
705
706Example:
707
708-> { "execute": "blockdev-snapshot-delete-internal-sync",
709 "arguments": { "device": "ide-hd0",
710 "name": "snapshot0" }
711 }
712<- { "return": {
713 "id": "1",
714 "name": "snapshot0",
715 "vm-state-size": 0,
716 "date-sec": 1000012,
717 "date-nsec": 10,
718 "vm-clock-sec": 100,
719 "vm-clock-nsec": 20
720 }
721 }
722
d9b902db
PB
723drive-mirror
724------------
725
726Start mirroring a block device's writes to a new destination. target
727specifies the target of the new image. If the file exists, or if it is
728a device, it will be used as the new destination for writes. If it does not
729exist, a new file will be created. format specifies the format of the
730mirror image, default is to probe if mode='existing', else the format
731of the source.
732
733Arguments:
734
71aa9867
AG
735- "job-id": Identifier for the newly-created block job. If omitted,
736 the device name will be used. (json-string, optional)
0524e93a
KW
737- "device": the device name or node-name of a root node whose writes should be
738 mirrored. (json-string)
d9b902db
PB
739- "target": name of new image file (json-string)
740- "format": format of new image (json-string, optional)
4c828dc6
BC
741- "node-name": the name of the new block driver state in the node graph
742 (json-string, optional)
09158f00
BC
743- "replaces": the block driver node name to replace when finished
744 (json-string, optional)
d9b902db
PB
745- "mode": how an image file should be created into the target
746 file/device (NewImageMode, optional, default 'absolute-paths')
747- "speed": maximum speed of the streaming job, in bytes per second
748 (json-int)
eee13dfe 749- "granularity": granularity of the dirty bitmap, in bytes (json-int, optional)
df92562e 750- "buf-size": maximum amount of data in flight from source to target, in bytes
08e4ed6c 751 (json-int, default 10M)
d9b902db
PB
752- "sync": what parts of the disk image should be copied to the destination;
753 possibilities include "full" for all the disk, "top" for only the sectors
754 allocated in the topmost image, or "none" to only replicate new I/O
755 (MirrorSyncMode).
b952b558
PB
756- "on-source-error": the action to take on an error on the source
757 (BlockdevOnError, default 'report')
758- "on-target-error": the action to take on an error on the target
759 (BlockdevOnError, default 'report')
0fc9f8ea
FZ
760- "unmap": whether the target sectors should be discarded where source has only
761 zeroes. (json-bool, optional, default true)
b952b558 762
eee13dfe
PB
763The default value of the granularity is the image cluster size clamped
764between 4096 and 65536, if the image format defines one. If the format
765does not define a cluster size, the default value of the granularity
766is 65536.
d9b902db
PB
767
768
769Example:
770
771-> { "execute": "drive-mirror", "arguments": { "device": "ide-hd0",
772 "target": "/some/place/my-image",
773 "sync": "full",
774 "format": "qcow2" } }
775<- { "return": {} }
776
df92562e
FZ
777blockdev-mirror
778------------
779
780Start mirroring a block device's writes to another block device. target
781specifies the target of mirror operation.
782
783Arguments:
784
71aa9867
AG
785- "job-id": Identifier for the newly-created block job. If omitted,
786 the device name will be used. (json-string, optional)
07eec652
KW
787- "device": The device name or node-name of a root node whose writes should be
788 mirrored (json-string)
df92562e
FZ
789- "target": device name to mirror to (json-string)
790- "replaces": the block driver node name to replace when finished
791 (json-string, optional)
792- "speed": maximum speed of the streaming job, in bytes per second
793 (json-int)
794- "granularity": granularity of the dirty bitmap, in bytes (json-int, optional)
795- "buf_size": maximum amount of data in flight from source to target, in bytes
796 (json-int, default 10M)
797- "sync": what parts of the disk image should be copied to the destination;
798 possibilities include "full" for all the disk, "top" for only the sectors
799 allocated in the topmost image, or "none" to only replicate new I/O
800 (MirrorSyncMode).
801- "on-source-error": the action to take on an error on the source
802 (BlockdevOnError, default 'report')
803- "on-target-error": the action to take on an error on the target
804 (BlockdevOnError, default 'report')
805
806The default value of the granularity is the image cluster size clamped
807between 4096 and 65536, if the image format defines one. If the format
808does not define a cluster size, the default value of the granularity
809is 65536.
810
811Example:
812
813-> { "execute": "blockdev-mirror", "arguments": { "device": "ide-hd0",
814 "target": "target0",
815 "sync": "full" } }
816<- { "return": {} }
817
fa40e656
JC
818change-backing-file
819-------------------
820Since: 2.1
821
822Change the backing file in the image file metadata. This does not cause
823QEMU to reopen the image file to reparse the backing filename (it may,
824however, perform a reopen to change permissions from r/o -> r/w -> r/o,
825if needed). The new backing file string is written into the image file
826metadata, and the QEMU internal strings are updated.
827
828Arguments:
829
830- "image-node-name": The name of the block driver state node of the
831 image to modify. The "device" is argument is used to
832 verify "image-node-name" is in the chain described by
833 "device".
834 (json-string, optional)
835
7b5dca3f
KW
836- "device": The device name or node-name of the root node that owns
837 image-node-name.
fa40e656
JC
838 (json-string)
839
840- "backing-file": The string to write as the backing file. This string is
841 not validated, so care should be taken when specifying
842 the string or the image chain may not be able to be
843 reopened again.
844 (json-string)
845
846Returns: Nothing on success
847 If "device" does not exist or cannot be determined, DeviceNotFound
848
82a56f0d
LC
849getfd
850-----
851
852Receive a file descriptor via SCM rights and assign it a name.
853
854Arguments:
855
856- "fdname": file descriptor name (json-string)
857
858Example:
859
860-> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
861<- { "return": {} }
862
208c9d1b
CB
863Notes:
864
865(1) If the name specified by the "fdname" argument already exists,
866 the file descriptor assigned to it will be closed and replaced
867 by the received file descriptor.
868(2) The 'closefd' command can be used to explicitly close the file
869 descriptor when it is no longer needed.
870
82a56f0d
LC
871closefd
872-------
873
874Close a file descriptor previously passed via SCM rights.
875
876Arguments:
877
878- "fdname": file descriptor name (json-string)
879
880Example:
881
882-> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
883<- { "return": {} }
884
ba1c048a
CB
885add-fd
886-------
887
888Add a file descriptor, that was passed via SCM rights, to an fd set.
889
890Arguments:
891
892- "fdset-id": The ID of the fd set to add the file descriptor to.
893 (json-int, optional)
894- "opaque": A free-form string that can be used to describe the fd.
895 (json-string, optional)
896
897Return a json-object with the following information:
898
899- "fdset-id": The ID of the fd set that the fd was added to. (json-int)
900- "fd": The file descriptor that was received via SCM rights and added to the
901 fd set. (json-int)
902
903Example:
904
905-> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
906<- { "return": { "fdset-id": 1, "fd": 3 } }
907
908Notes:
909
910(1) The list of fd sets is shared by all monitor connections.
911(2) If "fdset-id" is not specified, a new fd set will be created.
912
ba1c048a
CB
913remove-fd
914---------
915
916Remove a file descriptor from an fd set.
917
918Arguments:
919
920- "fdset-id": The ID of the fd set that the file descriptor belongs to.
921 (json-int)
922- "fd": The file descriptor that is to be removed. (json-int, optional)
923
924Example:
925
926-> { "execute": "remove-fd", "arguments": { "fdset-id": 1, "fd": 3 } }
927<- { "return": {} }
928
929Notes:
930
931(1) The list of fd sets is shared by all monitor connections.
932(2) If "fd" is not specified, all file descriptors in "fdset-id" will be
933 removed.
934
ba1c048a
CB
935query-fdsets
936-------------
937
938Return information describing all fd sets.
939
940Arguments: None
941
942Example:
943
944-> { "execute": "query-fdsets" }
945<- { "return": [
946 {
947 "fds": [
948 {
949 "fd": 30,
950 "opaque": "rdonly:/path/to/file"
951 },
952 {
953 "fd": 24,
954 "opaque": "rdwr:/path/to/file"
955 }
956 ],
957 "fdset-id": 1
958 },
959 {
960 "fds": [
961 {
962 "fd": 28
963 },
964 {
965 "fd": 29
966 }
967 ],
968 "fdset-id": 0
969 }
970 ]
971 }
972
973Note: The list of fd sets is shared by all monitor connections.
974
82a56f0d
LC
975block_passwd
976------------
977
978Set the password of encrypted block devices.
979
980Arguments:
981
982- "device": device name (json-string)
12d3ba82 983- "node-name": name in the block driver state graph (json-string)
82a56f0d
LC
984- "password": password (json-string)
985
986Example:
987
988-> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
989 "password": "12345" } }
990<- { "return": {} }
991
727f005e
ZYW
992block_set_io_throttle
993------------
994
995Change I/O throttle limits for a block drive.
996
997Arguments:
998
7a9877a0
KW
999- "device": block device name (deprecated, use @id instead)
1000 (json-string, optional)
1001- "id": the name or QOM path of the guest device (json-string, optional)
586b5466
EB
1002- "bps": total throughput limit in bytes per second (json-int)
1003- "bps_rd": read throughput limit in bytes per second (json-int)
1004- "bps_wr": write throughput limit in bytes per second (json-int)
1005- "iops": total I/O operations per second (json-int)
1006- "iops_rd": read I/O operations per second (json-int)
1007- "iops_wr": write I/O operations per second (json-int)
dce13204
AG
1008- "bps_max": total throughput limit during bursts, in bytes (json-int, optional)
1009- "bps_rd_max": read throughput limit during bursts, in bytes (json-int, optional)
1010- "bps_wr_max": write throughput limit during bursts, in bytes (json-int, optional)
1011- "iops_max": total I/O operations per second during bursts (json-int, optional)
1012- "iops_rd_max": read I/O operations per second during bursts (json-int, optional)
1013- "iops_wr_max": write I/O operations per second during bursts (json-int, optional)
1014- "bps_max_length": maximum length of the @bps_max burst period, in seconds (json-int, optional)
1015- "bps_rd_max_length": maximum length of the @bps_rd_max burst period, in seconds (json-int, optional)
1016- "bps_wr_max_length": maximum length of the @bps_wr_max burst period, in seconds (json-int, optional)
1017- "iops_max_length": maximum length of the @iops_max burst period, in seconds (json-int, optional)
1018- "iops_rd_max_length": maximum length of the @iops_rd_max burst period, in seconds (json-int, optional)
1019- "iops_wr_max_length": maximum length of the @iops_wr_max burst period, in seconds (json-int, optional)
1020- "iops_size": I/O size in bytes when limiting (json-int, optional)
1021- "group": throttle group name (json-string, optional)
727f005e
ZYW
1022
1023Example:
1024
7a9877a0 1025-> { "execute": "block_set_io_throttle", "arguments": { "id": "ide0-1-0",
586b5466
EB
1026 "bps": 1000000,
1027 "bps_rd": 0,
1028 "bps_wr": 0,
1029 "iops": 0,
1030 "iops_rd": 0,
3e9fab69
BC
1031 "iops_wr": 0,
1032 "bps_max": 8000000,
1033 "bps_rd_max": 0,
1034 "bps_wr_max": 0,
1035 "iops_max": 0,
1036 "iops_rd_max": 0,
2024c1df 1037 "iops_wr_max": 0,
dce13204 1038 "bps_max_length": 60,
2024c1df 1039 "iops_size": 0 } }
727f005e
ZYW
1040<- { "return": {} }
1041
82a56f0d
LC
1042qmp_capabilities
1043----------------
1044
1045Enable QMP capabilities.
1046
1047Arguments: None.
1048
1049Example:
1050
1051-> { "execute": "qmp_capabilities" }
1052<- { "return": {} }
1053
1054Note: This command must be issued before issuing any other command.
1055
10563. Query Commands
1057=================
1058
82a56f0d 1059
82a56f0d
LC
1060query-version
1061-------------
1062
1063Show QEMU version.
1064
1065Return a json-object with the following information:
1066
1067- "qemu": A json-object containing three integer values:
1068 - "major": QEMU's major version (json-int)
1069 - "minor": QEMU's minor version (json-int)
1070 - "micro": QEMU's micro version (json-int)
1071- "package": package's version (json-string)
1072
1073Example:
1074
1075-> { "execute": "query-version" }
1076<- {
1077 "return":{
1078 "qemu":{
1079 "major":0,
1080 "minor":11,
1081 "micro":5
1082 },
1083 "package":""
1084 }
1085 }
1086
82a56f0d
LC
1087query-commands
1088--------------
1089
1090List QMP available commands.
1091
1092Each command is represented by a json-object, the returned value is a json-array
1093of all commands.
1094
1095Each json-object contain:
1096
1097- "name": command's name (json-string)
1098
1099Example:
1100
1101-> { "execute": "query-commands" }
1102<- {
1103 "return":[
1104 {
1105 "name":"query-balloon"
1106 },
1107 {
1108 "name":"system_powerdown"
1109 }
1110 ]
1111 }
1112
1113Note: This example has been shortened as the real response is too long.
1114
39a18158
MA
1115query-qmp-schema
1116----------------
1117
1118Return the QMP wire schema. The returned value is a json-array of
1119named schema entities. Entities are commands, events and various
1120types. See docs/qapi-code-gen.txt for information on their structure
1121and intended use.
1122
82a56f0d
LC
1123query-block
1124-----------
1125
1126Show the block devices.
1127
1128Each block device information is stored in a json-object and the returned value
1129is a json-array of all devices.
1130
1131Each json-object contain the following:
1132
1133- "device": device name (json-string)
1134- "type": device type (json-string)
d8aeeb31
MA
1135 - deprecated, retained for backward compatibility
1136 - Possible values: "unknown"
82a56f0d
LC
1137- "removable": true if the device is removable, false otherwise (json-bool)
1138- "locked": true if the device is locked, false otherwise (json-bool)
99f42808 1139- "tray_open": only present if removable, true if the device has a tray,
e4def80b 1140 and it is open (json-bool)
82a56f0d
LC
1141- "inserted": only present if the device is inserted, it is a json-object
1142 containing the following:
1143 - "file": device file name (json-string)
1144 - "ro": true if read-only, false otherwise (json-bool)
1145 - "drv": driver format name (json-string)
550830f9 1146 - Possible values: "blkdebug", "bochs", "cloop", "dmg",
82a56f0d 1147 "file", "file", "ftp", "ftps", "host_cdrom",
92a539d2 1148 "host_device", "http", "https",
82a56f0d 1149 "nbd", "parallels", "qcow", "qcow2", "raw",
23dce387 1150 "vdi", "vmdk", "vpc", "vvfat"
82a56f0d 1151 - "backing_file": backing file name (json-string, optional)
2e3e3317 1152 - "backing_file_depth": number of files in the backing file chain (json-int)
82a56f0d 1153 - "encrypted": true if encrypted, false otherwise (json-bool)
727f005e
ZYW
1154 - "bps": limit total bytes per second (json-int)
1155 - "bps_rd": limit read bytes per second (json-int)
1156 - "bps_wr": limit write bytes per second (json-int)
1157 - "iops": limit total I/O operations per second (json-int)
1158 - "iops_rd": limit read operations per second (json-int)
1159 - "iops_wr": limit write operations per second (json-int)
3e9fab69
BC
1160 - "bps_max": total max in bytes (json-int)
1161 - "bps_rd_max": read max in bytes (json-int)
1162 - "bps_wr_max": write max in bytes (json-int)
1163 - "iops_max": total I/O operations max (json-int)
1164 - "iops_rd_max": read I/O operations max (json-int)
1165 - "iops_wr_max": write I/O operations max (json-int)
2024c1df 1166 - "iops_size": I/O size when limiting by iops (json-int)
465bee1d
PL
1167 - "detect_zeroes": detect and optimize zero writing (json-string)
1168 - Possible values: "off", "on", "unmap"
e2462113
FR
1169 - "write_threshold": write offset threshold in bytes, a event will be
1170 emitted if crossed. Zero if disabled (json-int)
553a7e87
WX
1171 - "image": the detail of the image, it is a json-object containing
1172 the following:
1173 - "filename": image file name (json-string)
1174 - "format": image format (json-string)
1175 - "virtual-size": image capacity in bytes (json-int)
1176 - "dirty-flag": true if image is not cleanly closed, not present
1177 means clean (json-bool, optional)
1178 - "actual-size": actual size on disk in bytes of the image, not
1179 present when image does not support thin
1180 provision (json-int, optional)
1181 - "cluster-size": size of a cluster in bytes, not present if image
1182 format does not support it (json-int, optional)
1183 - "encrypted": true if the image is encrypted, not present means
1184 false or the image format does not support
1185 encryption (json-bool, optional)
1186 - "backing_file": backing file name, not present means no backing
1187 file is used or the image format does not
1188 support backing file chain
1189 (json-string, optional)
1190 - "full-backing-filename": full path of the backing file, not
1191 present if it equals backing_file or no
1192 backing file is used
1193 (json-string, optional)
1194 - "backing-filename-format": the format of the backing file, not
1195 present means unknown or no backing
1196 file (json-string, optional)
1197 - "snapshots": the internal snapshot info, it is an optional list
1198 of json-object containing the following:
1199 - "id": unique snapshot id (json-string)
1200 - "name": snapshot name (json-string)
1201 - "vm-state-size": size of the VM state in bytes (json-int)
1202 - "date-sec": UTC date of the snapshot in seconds (json-int)
1203 - "date-nsec": fractional part in nanoseconds to be used with
586b5466 1204 date-sec (json-int)
553a7e87
WX
1205 - "vm-clock-sec": VM clock relative to boot in seconds
1206 (json-int)
1207 - "vm-clock-nsec": fractional part in nanoseconds to be used
1208 with vm-clock-sec (json-int)
1209 - "backing-image": the detail of the backing image, it is an
1210 optional json-object only present when a
1211 backing image present for this image
727f005e 1212
f04ef601
LC
1213- "io-status": I/O operation status, only present if the device supports it
1214 and the VM is configured to stop on errors. It's always reset
1215 to "ok" when the "cont" command is issued (json_string, optional)
1216 - Possible values: "ok", "failed", "nospace"
82a56f0d
LC
1217
1218Example:
1219
1220-> { "execute": "query-block" }
1221<- {
1222 "return":[
1223 {
f04ef601 1224 "io-status": "ok",
82a56f0d
LC
1225 "device":"ide0-hd0",
1226 "locked":false,
1227 "removable":false,
1228 "inserted":{
1229 "ro":false,
1230 "drv":"qcow2",
1231 "encrypted":false,
553a7e87
WX
1232 "file":"disks/test.qcow2",
1233 "backing_file_depth":1,
727f005e
ZYW
1234 "bps":1000000,
1235 "bps_rd":0,
1236 "bps_wr":0,
1237 "iops":1000000,
1238 "iops_rd":0,
1239 "iops_wr":0,
3e9fab69
BC
1240 "bps_max": 8000000,
1241 "bps_rd_max": 0,
1242 "bps_wr_max": 0,
1243 "iops_max": 0,
1244 "iops_rd_max": 0,
1245 "iops_wr_max": 0,
2024c1df 1246 "iops_size": 0,
465bee1d 1247 "detect_zeroes": "on",
e2462113 1248 "write_threshold": 0,
553a7e87
WX
1249 "image":{
1250 "filename":"disks/test.qcow2",
1251 "format":"qcow2",
1252 "virtual-size":2048000,
1253 "backing_file":"base.qcow2",
1254 "full-backing-filename":"disks/base.qcow2",
5403432f 1255 "backing-filename-format":"qcow2",
553a7e87
WX
1256 "snapshots":[
1257 {
1258 "id": "1",
1259 "name": "snapshot1",
1260 "vm-state-size": 0,
1261 "date-sec": 10000200,
1262 "date-nsec": 12,
1263 "vm-clock-sec": 206,
1264 "vm-clock-nsec": 30
1265 }
1266 ],
1267 "backing-image":{
1268 "filename":"disks/base.qcow2",
1269 "format":"qcow2",
1270 "virtual-size":2048000
1271 }
1272 }
82a56f0d 1273 },
d8aeeb31 1274 "type":"unknown"
82a56f0d
LC
1275 },
1276 {
f04ef601 1277 "io-status": "ok",
82a56f0d
LC
1278 "device":"ide1-cd0",
1279 "locked":false,
1280 "removable":true,
d8aeeb31 1281 "type":"unknown"
82a56f0d
LC
1282 },
1283 {
1284 "device":"floppy0",
1285 "locked":false,
1286 "removable":true,
d8aeeb31 1287 "type":"unknown"
82a56f0d
LC
1288 },
1289 {
1290 "device":"sd0",
1291 "locked":false,
1292 "removable":true,
d8aeeb31 1293 "type":"unknown"
82a56f0d
LC
1294 }
1295 ]
1296 }
1297
82a56f0d
LC
1298query-blockstats
1299----------------
1300
1301Show block device statistics.
1302
1303Each device statistic information is stored in a json-object and the returned
1304value is a json-array of all devices.
1305
1306Each json-object contain the following:
1307
1308- "device": device name (json-string)
1309- "stats": A json-object with the statistics information, it contains:
1310 - "rd_bytes": bytes read (json-int)
1311 - "wr_bytes": bytes written (json-int)
1312 - "rd_operations": read operations (json-int)
1313 - "wr_operations": write operations (json-int)
e8045d67 1314 - "flush_operations": cache flush operations (json-int)
c488c7f6
CH
1315 - "wr_total_time_ns": total time spend on writes in nano-seconds (json-int)
1316 - "rd_total_time_ns": total time spend on reads in nano-seconds (json-int)
1317 - "flush_total_time_ns": total time spend on cache flushes in nano-seconds (json-int)
53d8f9d8
HR
1318 - "wr_highest_offset": The offset after the greatest byte written to the
1319 BlockDriverState since it has been opened (json-int)
f4564d53
PL
1320 - "rd_merged": number of read requests that have been merged into
1321 another request (json-int)
1322 - "wr_merged": number of write requests that have been merged into
1323 another request (json-int)
cb38fffb
AG
1324 - "idle_time_ns": time since the last I/O operation, in
1325 nanoseconds. If the field is absent it means
1326 that there haven't been any operations yet
1327 (json-int, optional)
7ee12daf
AG
1328 - "failed_rd_operations": number of failed read operations
1329 (json-int)
1330 - "failed_wr_operations": number of failed write operations
1331 (json-int)
1332 - "failed_flush_operations": number of failed flush operations
1333 (json-int)
1334 - "invalid_rd_operations": number of invalid read operations
1335 (json-int)
1336 - "invalid_wr_operations": number of invalid write operations
1337 (json-int)
1338 - "invalid_flush_operations": number of invalid flush operations
1339 (json-int)
362e9299
AG
1340 - "account_invalid": whether invalid operations are included in
1341 the last access statistics (json-bool)
1342 - "account_failed": whether failed operations are included in the
1343 latency and last access statistics
1344 (json-bool)
979e9b03
AG
1345 - "timed_stats": A json-array containing statistics collected in
1346 specific intervals, with the following members:
1347 - "interval_length": interval used for calculating the
1348 statistics, in seconds (json-int)
1349 - "min_rd_latency_ns": minimum latency of read operations in
1350 the defined interval, in nanoseconds
1351 (json-int)
1352 - "min_wr_latency_ns": minimum latency of write operations in
1353 the defined interval, in nanoseconds
1354 (json-int)
1355 - "min_flush_latency_ns": minimum latency of flush operations
1356 in the defined interval, in
1357 nanoseconds (json-int)
1358 - "max_rd_latency_ns": maximum latency of read operations in
1359 the defined interval, in nanoseconds
1360 (json-int)
1361 - "max_wr_latency_ns": maximum latency of write operations in
1362 the defined interval, in nanoseconds
1363 (json-int)
1364 - "max_flush_latency_ns": maximum latency of flush operations
1365 in the defined interval, in
1366 nanoseconds (json-int)
1367 - "avg_rd_latency_ns": average latency of read operations in
1368 the defined interval, in nanoseconds
1369 (json-int)
1370 - "avg_wr_latency_ns": average latency of write operations in
1371 the defined interval, in nanoseconds
1372 (json-int)
1373 - "avg_flush_latency_ns": average latency of flush operations
1374 in the defined interval, in
1375 nanoseconds (json-int)
96e4deda
AG
1376 - "avg_rd_queue_depth": average number of pending read
1377 operations in the defined interval
1378 (json-number)
1379 - "avg_wr_queue_depth": average number of pending write
1380 operations in the defined interval
1381 (json-number).
82a56f0d
LC
1382- "parent": Contains recursively the statistics of the underlying
1383 protocol (e.g. the host file for a qcow2 image). If there is
1384 no underlying protocol, this field is omitted
1385 (json-object, optional)
1386
1387Example:
1388
1389-> { "execute": "query-blockstats" }
1390<- {
1391 "return":[
1392 {
1393 "device":"ide0-hd0",
1394 "parent":{
1395 "stats":{
1396 "wr_highest_offset":3686448128,
1397 "wr_bytes":9786368,
1398 "wr_operations":751,
1399 "rd_bytes":122567168,
1400 "rd_operations":36772
c488c7f6
CH
1401 "wr_total_times_ns":313253456
1402 "rd_total_times_ns":3465673657
1403 "flush_total_times_ns":49653
e8045d67 1404 "flush_operations":61,
f4564d53 1405 "rd_merged":0,
cb38fffb 1406 "wr_merged":0,
362e9299
AG
1407 "idle_time_ns":2953431879,
1408 "account_invalid":true,
1409 "account_failed":false
82a56f0d
LC
1410 }
1411 },
1412 "stats":{
1413 "wr_highest_offset":2821110784,
1414 "wr_bytes":9786368,
1415 "wr_operations":692,
1416 "rd_bytes":122739200,
1417 "rd_operations":36604
e8045d67 1418 "flush_operations":51,
c488c7f6
CH
1419 "wr_total_times_ns":313253456
1420 "rd_total_times_ns":3465673657
f4564d53
PL
1421 "flush_total_times_ns":49653,
1422 "rd_merged":0,
cb38fffb 1423 "wr_merged":0,
362e9299
AG
1424 "idle_time_ns":2953431879,
1425 "account_invalid":true,
1426 "account_failed":false
82a56f0d
LC
1427 }
1428 },
1429 {
1430 "device":"ide1-cd0",
1431 "stats":{
1432 "wr_highest_offset":0,
1433 "wr_bytes":0,
1434 "wr_operations":0,
1435 "rd_bytes":0,
1436 "rd_operations":0
e8045d67 1437 "flush_operations":0,
c488c7f6
CH
1438 "wr_total_times_ns":0
1439 "rd_total_times_ns":0
f4564d53
PL
1440 "flush_total_times_ns":0,
1441 "rd_merged":0,
362e9299
AG
1442 "wr_merged":0,
1443 "account_invalid":false,
1444 "account_failed":false
82a56f0d
LC
1445 }
1446 },
1447 {
1448 "device":"floppy0",
1449 "stats":{
1450 "wr_highest_offset":0,
1451 "wr_bytes":0,
1452 "wr_operations":0,
1453 "rd_bytes":0,
1454 "rd_operations":0
e8045d67 1455 "flush_operations":0,
c488c7f6
CH
1456 "wr_total_times_ns":0
1457 "rd_total_times_ns":0
f4564d53
PL
1458 "flush_total_times_ns":0,
1459 "rd_merged":0,
362e9299
AG
1460 "wr_merged":0,
1461 "account_invalid":false,
1462 "account_failed":false
82a56f0d
LC
1463 }
1464 },
1465 {
1466 "device":"sd0",
1467 "stats":{
1468 "wr_highest_offset":0,
1469 "wr_bytes":0,
1470 "wr_operations":0,
1471 "rd_bytes":0,
1472 "rd_operations":0
e8045d67 1473 "flush_operations":0,
c488c7f6
CH
1474 "wr_total_times_ns":0
1475 "rd_total_times_ns":0
f4564d53
PL
1476 "flush_total_times_ns":0,
1477 "rd_merged":0,
362e9299
AG
1478 "wr_merged":0,
1479 "account_invalid":false,
1480 "account_failed":false
82a56f0d
LC
1481 }
1482 }
1483 ]
1484 }
1485
1f8f987d
AK
1486query-command-line-options
1487--------------------------
1488
1489Show command line option schema.
1490
1491Return a json-array of command line option schema for all options (or for
1492the given option), returning an error if the given option doesn't exist.
1493
1494Each array entry contains the following:
1495
1496- "option": option name (json-string)
1497- "parameters": a json-array describes all parameters of the option:
1498 - "name": parameter name (json-string)
1499 - "type": parameter type (one of 'string', 'boolean', 'number',
1500 or 'size')
1501 - "help": human readable description of the parameter
1502 (json-string, optional)
e36af94f
CL
1503 - "default": default value string for the parameter
1504 (json-string, optional)
1f8f987d
AK
1505
1506Example:
1507
1508-> { "execute": "query-command-line-options", "arguments": { "option": "option-rom" } }
1509<- { "return": [
1510 {
1511 "parameters": [
1512 {
1513 "name": "romfile",
1514 "type": "string"
1515 },
1516 {
1517 "name": "bootindex",
1518 "type": "number"
1519 }
1520 ],
1521 "option": "option-rom"
1522 }
1523 ]
1524 }
1525
28c4fa32
CB
1526query-tpm
1527---------
1528
1529Return information about the TPM device.
1530
1531Arguments: None
1532
1533Example:
1534
1535-> { "execute": "query-tpm" }
1536<- { "return":
1537 [
1538 { "model": "tpm-tis",
1539 "options":
1540 { "type": "passthrough",
1541 "data":
1542 { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
1543 "path": "/dev/tpm0"
1544 }
1545 },
1546 "id": "tpm0"
1547 }
1548 ]
1549 }
1550
28c4fa32
CB
1551query-tpm-models
1552----------------
1553
1554Return a list of supported TPM models.
1555
1556Arguments: None
1557
1558Example:
1559
1560-> { "execute": "query-tpm-models" }
1561<- { "return": [ "tpm-tis" ] }
1562
28c4fa32
CB
1563query-tpm-types
1564---------------
1565
1566Return a list of supported TPM types.
1567
1568Arguments: None
1569
1570Example:
1571
1572-> { "execute": "query-tpm-types" }
1573<- { "return": [ "passthrough" ] }
1574
f1a1a356
GH
1575chardev-add
1576----------------
1577
1578Add a chardev.
1579
1580Arguments:
1581
1582- "id": the chardev's ID, must be unique (json-string)
1583- "backend": chardev backend type + parameters
1584
ffbdbe59 1585Examples:
f1a1a356
GH
1586
1587-> { "execute" : "chardev-add",
1588 "arguments" : { "id" : "foo",
1589 "backend" : { "type" : "null", "data" : {} } } }
1590<- { "return": {} }
1591
ffbdbe59
GH
1592-> { "execute" : "chardev-add",
1593 "arguments" : { "id" : "bar",
1594 "backend" : { "type" : "file",
1595 "data" : { "out" : "/tmp/bar.log" } } } }
1596<- { "return": {} }
1597
0a1a7fab
GH
1598-> { "execute" : "chardev-add",
1599 "arguments" : { "id" : "baz",
1600 "backend" : { "type" : "pty", "data" : {} } } }
1601<- { "return": { "pty" : "/dev/pty/42" } }
1602
f1a1a356
GH
1603chardev-remove
1604--------------
1605
1606Remove a chardev.
1607
1608Arguments:
1609
1610- "id": the chardev's ID, must exist and not be in use (json-string)
1611
1612Example:
1613
1614-> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
1615<- { "return": {} }
1616
b1be4280
AK
1617query-rx-filter
1618---------------
1619
1620Show rx-filter information.
1621
1622Returns a json-array of rx-filter information for all NICs (or for the
1623given NIC), returning an error if the given NIC doesn't exist, or
1624given NIC doesn't support rx-filter querying, or given net client
1625isn't a NIC.
1626
1627The query will clear the event notification flag of each NIC, then qemu
1628will start to emit event to QMP monitor.
1629
1630Each array entry contains the following:
1631
1632- "name": net client name (json-string)
1633- "promiscuous": promiscuous mode is enabled (json-bool)
1634- "multicast": multicast receive state (one of 'normal', 'none', 'all')
1635- "unicast": unicast receive state (one of 'normal', 'none', 'all')
f7bc8ef8 1636- "vlan": vlan receive state (one of 'normal', 'none', 'all') (Since 2.0)
b1be4280
AK
1637- "broadcast-allowed": allow to receive broadcast (json-bool)
1638- "multicast-overflow": multicast table is overflowed (json-bool)
1639- "unicast-overflow": unicast table is overflowed (json-bool)
1640- "main-mac": main macaddr string (json-string)
1641- "vlan-table": a json-array of active vlan id
1642- "unicast-table": a json-array of unicast macaddr string
1643- "multicast-table": a json-array of multicast macaddr string
1644
1645Example:
1646
1647-> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } }
1648<- { "return": [
1649 {
1650 "promiscuous": true,
1651 "name": "vnet0",
1652 "main-mac": "52:54:00:12:34:56",
1653 "unicast": "normal",
f7bc8ef8 1654 "vlan": "normal",
b1be4280
AK
1655 "vlan-table": [
1656 4,
1657 0
1658 ],
1659 "unicast-table": [
1660 ],
1661 "multicast": "normal",
1662 "multicast-overflow": false,
1663 "unicast-overflow": false,
1664 "multicast-table": [
1665 "01:00:5e:00:00:01",
1666 "33:33:00:00:00:01",
1667 "33:33:ff:12:34:56"
1668 ],
1669 "broadcast-allowed": false
1670 }
1671 ]
1672 }
1673
d26c9a15
KW
1674blockdev-add
1675------------
1676
1677Add a block device.
1678
da2cf4e8 1679This command is still a work in progress. It doesn't support all
81b936ae
AG
1680block drivers among other things. Stay away from it unless you want
1681to help with its development.
da2cf4e8 1682
0153d2f5 1683For the arguments, see the QAPI schema documentation of BlockdevOptions.
d26c9a15
KW
1684
1685Example (1):
1686
1687-> { "execute": "blockdev-add",
0153d2f5
KW
1688 "arguments": { "driver": "qcow2",
1689 "file": { "driver": "file",
1690 "filename": "test.qcow2" } } }
d26c9a15
KW
1691<- { "return": {} }
1692
1693Example (2):
1694
1695-> { "execute": "blockdev-add",
1696 "arguments": {
0153d2f5
KW
1697 "driver": "qcow2",
1698 "node-name": "my_disk",
1699 "discard": "unmap",
1700 "cache": {
1701 "direct": true,
1702 "writeback": true
1703 },
1704 "file": {
1705 "driver": "file",
1706 "filename": "/tmp/test.qcow2"
1707 },
1708 "backing": {
1709 "driver": "raw",
1710 "file": {
1711 "driver": "file",
1712 "filename": "/dev/fdset/4"
1713 }
d26c9a15
KW
1714 }
1715 }
1716 }
1717
1718<- { "return": {} }
1719
81b936ae
AG
1720x-blockdev-del
1721------------
1722Since 2.5
1723
9ec8873e
KW
1724Deletes a block device that has been added using blockdev-add.
1725The command will fail if the node is attached to a device or is
1726otherwise being used.
81b936ae
AG
1727
1728This command is still a work in progress and is considered
1729experimental. Stay away from it unless you want to help with its
1730development.
1731
1732Arguments:
1733
9ec8873e 1734- "node-name": Name of the graph node to delete (json-string)
81b936ae
AG
1735
1736Example:
1737
1738-> { "execute": "blockdev-add",
1739 "arguments": {
0153d2f5
KW
1740 "driver": "qcow2",
1741 "node-name": "node0",
1742 "file": {
1743 "driver": "file",
1744 "filename": "test.qcow2"
81b936ae
AG
1745 }
1746 }
1747 }
1748
1749<- { "return": {} }
1750
1751-> { "execute": "x-blockdev-del",
9ec8873e 1752 "arguments": { "node-name": "node0" }
81b936ae
AG
1753 }
1754<- { "return": {} }
1755
7d8a9f71
HR
1756blockdev-open-tray
1757------------------
1758
1759Opens a block device's tray. If there is a block driver state tree inserted as a
1760medium, it will become inaccessible to the guest (but it will remain associated
1761to the block device, so closing the tray will make it accessible again).
1762
1763If the tray was already open before, this will be a no-op.
1764
1765Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
1766which no such event will be generated, these include:
1767- if the guest has locked the tray, @force is false and the guest does not
1768 respond to the eject request
1769- if the BlockBackend denoted by @device does not have a guest device attached
1770 to it
1771- if the guest device does not have an actual tray and is empty, for instance
1772 for floppy disk drives
1773
1774Arguments:
1775
b33945cf
KW
1776- "device": block device name (deprecated, use @id instead)
1777 (json-string, optional)
1778- "id": the name or QOM path of the guest device (json-string, optional)
7d8a9f71
HR
1779- "force": if false (the default), an eject request will be sent to the guest if
1780 it has locked the tray (and the tray will not be opened immediately);
1781 if true, the tray will be opened regardless of whether it is locked
1782 (json-bool, optional)
1783
1784Example:
1785
1786-> { "execute": "blockdev-open-tray",
b33945cf 1787 "arguments": { "id": "ide0-1-0" } }
7d8a9f71
HR
1788
1789<- { "timestamp": { "seconds": 1418751016,
1790 "microseconds": 716996 },
1791 "event": "DEVICE_TRAY_MOVED",
1792 "data": { "device": "ide1-cd0",
2d76e724 1793 "id": "ide0-1-0",
7d8a9f71
HR
1794 "tray-open": true } }
1795
1796<- { "return": {} }
1797
abaaf59d
HR
1798blockdev-close-tray
1799-------------------
1800
1801Closes a block device's tray. If there is a block driver state tree associated
1802with the block device (which is currently ejected), that tree will be loaded as
1803the medium.
1804
1805If the tray was already closed before, this will be a no-op.
1806
1807Arguments:
1808
b33945cf
KW
1809- "device": block device name (deprecated, use @id instead)
1810 (json-string, optional)
1811- "id": the name or QOM path of the guest device (json-string, optional)
abaaf59d
HR
1812
1813Example:
1814
1815-> { "execute": "blockdev-close-tray",
b33945cf 1816 "arguments": { "id": "ide0-1-0" } }
abaaf59d
HR
1817
1818<- { "timestamp": { "seconds": 1418751345,
1819 "microseconds": 272147 },
1820 "event": "DEVICE_TRAY_MOVED",
1821 "data": { "device": "ide1-cd0",
2d76e724 1822 "id": "ide0-1-0",
abaaf59d
HR
1823 "tray-open": false } }
1824
1825<- { "return": {} }
1826
6e0abc25
HR
1827x-blockdev-remove-medium
1828------------------------
2814f672
HR
1829
1830Removes a medium (a block driver state tree) from a block device. That block
1831device's tray must currently be open (unless there is no attached guest device).
1832
1833If the tray is open and there is no medium inserted, this will be a no-op.
1834
6e0abc25
HR
1835This command is still a work in progress and is considered experimental.
1836Stay away from it unless you want to help with its development.
1837
2814f672
HR
1838Arguments:
1839
00949bab
KW
1840- "device": block device name (deprecated, use @id instead)
1841 (json-string, optional)
1842- "id": the name or QOM path of the guest device (json-string, optional)
2814f672
HR
1843
1844Example:
1845
6e0abc25 1846-> { "execute": "x-blockdev-remove-medium",
00949bab 1847 "arguments": { "id": "ide0-1-0" } }
2814f672
HR
1848
1849<- { "error": { "class": "GenericError",
00949bab 1850 "desc": "Tray of device 'ide0-1-0' is not open" } }
2814f672
HR
1851
1852-> { "execute": "blockdev-open-tray",
00949bab 1853 "arguments": { "id": "ide0-1-0" } }
2814f672
HR
1854
1855<- { "timestamp": { "seconds": 1418751627,
1856 "microseconds": 549958 },
1857 "event": "DEVICE_TRAY_MOVED",
1858 "data": { "device": "ide1-cd0",
2d76e724 1859 "id": "ide0-1-0",
2814f672
HR
1860 "tray-open": true } }
1861
1862<- { "return": {} }
1863
6e0abc25 1864-> { "execute": "x-blockdev-remove-medium",
00949bab 1865 "arguments": { "device": "ide0-1-0" } }
2814f672
HR
1866
1867<- { "return": {} }
1868
6e0abc25
HR
1869x-blockdev-insert-medium
1870------------------------
d1299882
HR
1871
1872Inserts a medium (a block driver state tree) into a block device. That block
1873device's tray must currently be open (unless there is no attached guest device)
1874and there must be no medium inserted already.
1875
6e0abc25
HR
1876This command is still a work in progress and is considered experimental.
1877Stay away from it unless you want to help with its development.
1878
d1299882
HR
1879Arguments:
1880
716df217
KW
1881- "device": block device name (deprecated, use @id instead)
1882 (json-string, optional)
1883- "id": the name or QOM path of the guest device (json-string, optional)
d1299882
HR
1884- "node-name": root node of the BDS tree to insert into the block device
1885
1886Example:
1887
1888-> { "execute": "blockdev-add",
0153d2f5
KW
1889 "arguments": { { "node-name": "node0",
1890 "driver": "raw",
1891 "file": { "driver": "file",
1892 "filename": "fedora.iso" } } }
d1299882
HR
1893
1894<- { "return": {} }
1895
6e0abc25 1896-> { "execute": "x-blockdev-insert-medium",
716df217 1897 "arguments": { "id": "ide0-1-0",
d1299882
HR
1898 "node-name": "node0" } }
1899
1900<- { "return": {} }
1901
7f821597
WC
1902x-blockdev-change
1903-----------------
1904
1905Dynamically reconfigure the block driver state graph. It can be used
1906to add, remove, insert or replace a graph node. Currently only the
1907Quorum driver implements this feature to add or remove its child. This
1908is useful to fix a broken quorum child.
1909
1910If @node is specified, it will be inserted under @parent. @child
1911may not be specified in this case. If both @parent and @child are
1912specified but @node is not, @child will be detached from @parent.
1913
1914Arguments:
1915- "parent": the id or name of the parent node (json-string)
1916- "child": the name of a child under the given parent node (json-string, optional)
1917- "node": the name of the node that will be added (json-string, optional)
1918
1919Note: this command is experimental, and not a stable API. It doesn't
1920support all kinds of operations, all kinds of children, nor all block
1921drivers.
1922
1923Warning: The data in a new quorum child MUST be consistent with that of
1924the rest of the array.
1925
1926Example:
1927
1928Add a new node to a quorum
1929-> { "execute": "blockdev-add",
0153d2f5
KW
1930 "arguments": { "driver": "raw",
1931 "node-name": "new_node",
1932 "file": { "driver": "file",
1933 "filename": "test.raw" } } }
7f821597
WC
1934<- { "return": {} }
1935-> { "execute": "x-blockdev-change",
1936 "arguments": { "parent": "disk1",
1937 "node": "new_node" } }
1938<- { "return": {} }
1939
1940Delete a quorum's node
1941-> { "execute": "x-blockdev-change",
1942 "arguments": { "parent": "disk1",
1943 "child": "children.1" } }
1944<- { "return": {} }
1945
bdf05133
MAL
1946query-named-block-nodes
1947-----------------------
c13163fb
BC
1948
1949Return a list of BlockDeviceInfo for all the named block driver nodes
1950
1951Example:
1952
1953-> { "execute": "query-named-block-nodes" }
1954<- { "return": [ { "ro":false,
1955 "drv":"qcow2",
1956 "encrypted":false,
1957 "file":"disks/test.qcow2",
1958 "node-name": "my-node",
1959 "backing_file_depth":1,
1960 "bps":1000000,
1961 "bps_rd":0,
1962 "bps_wr":0,
1963 "iops":1000000,
1964 "iops_rd":0,
1965 "iops_wr":0,
1966 "bps_max": 8000000,
1967 "bps_rd_max": 0,
1968 "bps_wr_max": 0,
1969 "iops_max": 0,
1970 "iops_rd_max": 0,
1971 "iops_wr_max": 0,
1972 "iops_size": 0,
e2462113 1973 "write_threshold": 0,
c13163fb
BC
1974 "image":{
1975 "filename":"disks/test.qcow2",
1976 "format":"qcow2",
1977 "virtual-size":2048000,
1978 "backing_file":"base.qcow2",
1979 "full-backing-filename":"disks/base.qcow2",
5403432f 1980 "backing-filename-format":"qcow2",
c13163fb
BC
1981 "snapshots":[
1982 {
1983 "id": "1",
1984 "name": "snapshot1",
1985 "vm-state-size": 0,
1986 "date-sec": 10000200,
1987 "date-nsec": 12,
1988 "vm-clock-sec": 206,
1989 "vm-clock-nsec": 30
1990 }
1991 ],
1992 "backing-image":{
1993 "filename":"disks/base.qcow2",
1994 "format":"qcow2",
1995 "virtual-size":2048000
1996 }
c059451c 1997 } } ] }
c13163fb 1998
24fb4133
HR
1999blockdev-change-medium
2000----------------------
2001
2002Changes the medium inserted into a block device by ejecting the current medium
2003and loading a new image file which is inserted as the new medium.
2004
2005Arguments:
2006
70e2cb3b
KW
2007- "device": block device name (deprecated, use @id instead)
2008 (json-string, optional)
2009- "id": the name or QOM path of the guest device (json-string, optional)
24fb4133
HR
2010- "filename": filename of the new image (json-string)
2011- "format": format of the new image (json-string, optional)
39ff43d9
HR
2012- "read-only-mode": new read-only mode (json-string, optional)
2013 - Possible values: "retain" (default), "read-only", "read-write"
24fb4133
HR
2014
2015Examples:
2016
20171. Change a removable medium
2018
2019-> { "execute": "blockdev-change-medium",
70e2cb3b 2020 "arguments": { "id": "ide0-1-0",
24fb4133
HR
2021 "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
2022 "format": "raw" } }
2023<- { "return": {} }
2024
39ff43d9
HR
20252. Load a read-only medium into a writable drive
2026
2027-> { "execute": "blockdev-change-medium",
70e2cb3b 2028 "arguments": { "id": "floppyA",
39ff43d9
HR
2029 "filename": "/srv/images/ro.img",
2030 "format": "raw",
2031 "read-only-mode": "retain" } }
2032
2033<- { "error":
2034 { "class": "GenericError",
2035 "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
2036
2037-> { "execute": "blockdev-change-medium",
70e2cb3b 2038 "arguments": { "id": "floppyA",
39ff43d9
HR
2039 "filename": "/srv/images/ro.img",
2040 "format": "raw",
2041 "read-only-mode": "read-only" } }
2042
2043<- { "return": {} }
2044
76b5d850
HT
2045query-memdev
2046------------
2047
2048Show memory devices information.
2049
2050
2051Example (1):
2052
2053-> { "execute": "query-memdev" }
2054<- { "return": [
2055 {
2056 "size": 536870912,
2057 "merge": false,
2058 "dump": true,
2059 "prealloc": false,
2060 "host-nodes": [0, 1],
2061 "policy": "bind"
2062 },
2063 {
e1ff3c67 2064 "id": "mem1",
76b5d850
HT
2065 "size": 536870912,
2066 "merge": false,
2067 "dump": true,
2068 "prealloc": true,
2069 "host-nodes": [2, 3],
2070 "policy": "preferred"
2071 }
2072 ]
2073 }
2074
bdf05133 2075query-memory-devices
6f2e2730
IM
2076--------------------
2077
2078Return a list of memory devices.
2079
2080Example:
2081-> { "execute": "query-memory-devices" }
2082<- { "return": [ { "data":
2083 { "addr": 5368709120,
2084 "hotpluggable": true,
2085 "hotplugged": true,
2086 "id": "d1",
2087 "memdev": "/objects/memX",
2088 "node": 0,
2089 "size": 1073741824,
2090 "slot": 0},
2091 "type": "dimm"
2092 } ] }
bdf05133 2093
bdf05133
MAL
2094query-acpi-ospm-status
2095----------------------
02419bcb
IM
2096
2097Return list of ACPIOSTInfo for devices that support status reporting
2098via ACPI _OST method.
2099
2100Example:
2101-> { "execute": "query-acpi-ospm-status" }
2102<- { "return": [ { "device": "d1", "slot": "0", "slot-type": "DIMM", "source": 1, "status": 0},
2103 { "slot": "1", "slot-type": "DIMM", "source": 0, "status": 0},
2104 { "slot": "2", "slot-type": "DIMM", "source": 0, "status": 0},
2105 { "slot": "3", "slot-type": "DIMM", "source": 0, "status": 0}
2106 ]}
bdf05133 2107
f2ae8abf
MT
2108rtc-reset-reinjection
2109---------------------
2110
2111Reset the RTC interrupt reinjection backlog.
2112
2113Arguments: None.
2114
2115Example:
2116
2117-> { "execute": "rtc-reset-reinjection" }
2118<- { "return": {} }
bdf05133 2119
1dde0f48
LV
2120trace-event-get-state
2121---------------------
2122
2123Query the state of events.
2124
77e2b172
LV
2125Arguments:
2126
2127- "name": Event name pattern (json-string).
2128- "vcpu": The vCPU to query, any vCPU by default (json-int, optional).
2129
2130An event is returned if:
2131- its name matches the "name" pattern, and
2132- if "vcpu" is given, the event has the "vcpu" property.
2133
2134Therefore, if "vcpu" is given, the operation will only match per-vCPU events,
2135returning their state on the specified vCPU. Special case: if "name" is an exact
2136match, "vcpu" is given and the event does not have the "vcpu" property, an error
2137is returned.
2138
1dde0f48
LV
2139Example:
2140
2141-> { "execute": "trace-event-get-state", "arguments": { "name": "qemu_memalign" } }
2142<- { "return": [ { "name": "qemu_memalign", "state": "disabled" } ] }
bdf05133 2143
1dde0f48
LV
2144trace-event-set-state
2145---------------------
2146
2147Set the state of events.
2148
77e2b172
LV
2149Arguments:
2150
2151- "name": Event name pattern (json-string).
2152- "enable": Whether to enable or disable the event (json-bool).
2153- "ignore-unavailable": Whether to ignore errors for events that cannot be
2154 changed (json-bool, optional).
2155- "vcpu": The vCPU to act upon, all vCPUs by default (json-int, optional).
2156
2157An event's state is modified if:
2158- its name matches the "name" pattern, and
2159- if "vcpu" is given, the event has the "vcpu" property.
2160
2161Therefore, if "vcpu" is given, the operation will only match per-vCPU events,
2162setting their state on the specified vCPU. Special case: if "name" is an exact
2163match, "vcpu" is given and the event does not have the "vcpu" property, an error
2164is returned.
2165
1dde0f48
LV
2166Example:
2167
2168-> { "execute": "trace-event-set-state", "arguments": { "name": "qemu_memalign", "enable": "true" } }
2169<- { "return": {} }
bdf05133 2170
bdf05133
MAL
2171input-send-event
2172----------------
50c6617f
MT
2173
2174Send input event to guest.
2175
2176Arguments:
2177
b98d26e3
GH
2178- "device": display device (json-string, optional)
2179- "head": display head (json-int, optional)
2180- "events": list of input events
50c6617f
MT
2181
2182The consoles are visible in the qom tree, under
2183/backend/console[$index]. They have a device link and head property, so
2184it is possible to map which console belongs to which device and display.
2185
2186Example (1):
2187
2188Press left mouse button.
2189
6575ccdd 2190-> { "execute": "input-send-event",
b98d26e3 2191 "arguments": { "device": "video0",
50c6617f 2192 "events": [ { "type": "btn",
f22d0af0 2193 "data" : { "down": true, "button": "left" } } ] } }
50c6617f
MT
2194<- { "return": {} }
2195
6575ccdd 2196-> { "execute": "input-send-event",
b98d26e3 2197 "arguments": { "device": "video0",
50c6617f 2198 "events": [ { "type": "btn",
f22d0af0 2199 "data" : { "down": false, "button": "left" } } ] } }
50c6617f
MT
2200<- { "return": {} }
2201
2202Example (2):
2203
2204Press ctrl-alt-del.
2205
6575ccdd 2206-> { "execute": "input-send-event",
b98d26e3 2207 "arguments": { "events": [
50c6617f
MT
2208 { "type": "key", "data" : { "down": true,
2209 "key": {"type": "qcode", "data": "ctrl" } } },
2210 { "type": "key", "data" : { "down": true,
2211 "key": {"type": "qcode", "data": "alt" } } },
2212 { "type": "key", "data" : { "down": true,
2213 "key": {"type": "qcode", "data": "delete" } } } ] } }
2214<- { "return": {} }
2215
2216Example (3):
2217
2218Move mouse pointer to absolute coordinates (20000, 400).
2219
6575ccdd 2220-> { "execute": "input-send-event" ,
b98d26e3 2221 "arguments": { "events": [
01df5143
GH
2222 { "type": "abs", "data" : { "axis": "x", "value" : 20000 } },
2223 { "type": "abs", "data" : { "axis": "y", "value" : 400 } } ] } }
50c6617f
MT
2224<- { "return": {} }
2225
e2462113
FR
2226block-set-write-threshold
2227------------
2228
2229Change the write threshold for a block drive. The threshold is an offset,
2230thus must be non-negative. Default is no write threshold.
2231Setting the threshold to zero disables it.
2232
2233Arguments:
2234
2235- "node-name": the node name in the block driver state graph (json-string)
2236- "write-threshold": the write threshold in bytes (json-int)
2237
2238Example:
2239
2240-> { "execute": "block-set-write-threshold",
2241 "arguments": { "node-name": "mydev",
2242 "write-threshold": 17179869184 } }
2243<- { "return": {} }
2244
fafa4d50
SF
2245Show rocker switch
2246------------------
2247
2248Arguments:
2249
2250- "name": switch name
2251
2252Example:
2253
2254-> { "execute": "query-rocker", "arguments": { "name": "sw1" } }
2255<- { "return": {"name": "sw1", "ports": 2, "id": 1327446905938}}
2256
fafa4d50
SF
2257Show rocker switch ports
2258------------------------
2259
2260Arguments:
2261
2262- "name": switch name
2263
2264Example:
2265
2266-> { "execute": "query-rocker-ports", "arguments": { "name": "sw1" } }
2267<- { "return": [ {"duplex": "full", "enabled": true, "name": "sw1.1",
2268 "autoneg": "off", "link-up": true, "speed": 10000},
2269 {"duplex": "full", "enabled": true, "name": "sw1.2",
2270 "autoneg": "off", "link-up": true, "speed": 10000}
2271 ]}
2272
fafa4d50
SF
2273Show rocker switch OF-DPA flow tables
2274-------------------------------------
2275
2276Arguments:
2277
2278- "name": switch name
2279- "tbl-id": (optional) flow table ID
2280
2281Example:
2282
2283-> { "execute": "query-rocker-of-dpa-flows", "arguments": { "name": "sw1" } }
2284<- { "return": [ {"key": {"in-pport": 0, "priority": 1, "tbl-id": 0},
2285 "hits": 138,
2286 "cookie": 0,
2287 "action": {"goto-tbl": 10},
2288 "mask": {"in-pport": 4294901760}
2289 },
2290 {...more...},
2291 ]}
2292
fafa4d50
SF
2293Show rocker OF-DPA group tables
2294-------------------------------
2295
2296Arguments:
2297
2298- "name": switch name
2299- "type": (optional) group type
2300
2301Example:
2302
2303-> { "execute": "query-rocker-of-dpa-groups", "arguments": { "name": "sw1" } }
2304<- { "return": [ {"type": 0, "out-pport": 2, "pport": 2, "vlan-id": 3841,
2305 "pop-vlan": 1, "id": 251723778},
2306 {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3841,
2307 "pop-vlan": 1, "id": 251723776},
2308 {"type": 0, "out-pport": 1, "pport": 1, "vlan-id": 3840,
2309 "pop-vlan": 1, "id": 251658241},
2310 {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3840,
2311 "pop-vlan": 1, "id": 251658240}
2312 ]}
ae50a770 2313
ae50a770
PX
2314query-gic-capabilities
2315---------------
2316
2317Return a list of GICCapability objects, describing supported GIC
2318(Generic Interrupt Controller) versions.
2319
2320Arguments: None
2321
2322Example:
2323
2324-> { "execute": "query-gic-capabilities" }
2325<- { "return": [{ "version": 2, "emulated": true, "kernel": false },
2326 { "version": 3, "emulated": false, "kernel": true } ] }
2327
d4633541
IM
2328Show existing/possible CPUs
2329---------------------------
2330
2331Arguments: None.
2332
2333Example for pseries machine type started with
2334-smp 2,cores=2,maxcpus=4 -cpu POWER8:
2335
2336-> { "execute": "query-hotpluggable-cpus" }
2337<- {"return": [
13f5e800 2338 { "props": { "core-id": 8 }, "type": "POWER8-spapr-cpu-core",
d4633541 2339 "vcpus-count": 1 },
13f5e800 2340 { "props": { "core-id": 0 }, "type": "POWER8-spapr-cpu-core",
d4633541
IM
2341 "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
2342 ]}'
4d952914
IM
2343
2344Example for pc machine type started with
2345-smp 1,maxcpus=2:
2346 -> { "execute": "query-hotpluggable-cpus" }
2347 <- {"return": [
2348 {
2349 "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
2350 "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
2351 },
2352 {
2353 "qom-path": "/machine/unattached/device[0]",
2354 "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
2355 "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
2356 }
2357 ]}
This page took 0.931279 seconds and 4 git commands to generate.