dump-guest-memory: add "detach" flag for QMP/HMP interfaces.
[sdk/emulator/qemu.git] / qmp-commands.hx
1 HXCOMM QMP dispatch table and documentation
2 HXCOMM Text between SQMP and EQMP is copied to the QMP documentation file and
3 HXCOMM does not show up in the other formats.
4
5 SQMP
6                         QMP Supported Commands
7                         ----------------------
8
9 This document describes all commands currently supported by QMP.
10
11 Most of the time their usage is exactly the same as in the user Monitor, this
12 means that any other document which also describe commands (the manpage,
13 QEMU's manual, etc) can and should be consulted.
14
15 QMP has two types of commands: regular and query commands. Regular commands
16 usually change the Virtual Machine's state someway, while query commands just
17 return information. The sections below are divided accordingly.
18
19 It's important to observe that all communication examples are formatted in
20 a reader-friendly way, so that they're easier to understand. However, in real
21 protocol usage, they're emitted as a single line.
22
23 Also, the following notation is used to denote data flow:
24
25 -> data issued by the Client
26 <- Server data response
27
28 Please, refer to the QMP specification (QMP/qmp-spec.txt) for detailed
29 information on the Server command and response formats.
30
31 NOTE: This document is temporary and will be replaced soon.
32
33 1. Stability Considerations
34 ===========================
35
36 The current QMP command set (described in this file) may be useful for a
37 number of use cases, however it's limited and several commands have bad
38 defined semantics, specially with regard to command completion.
39
40 These problems are going to be solved incrementally in the next QEMU releases
41 and we're going to establish a deprecation policy for badly defined commands.
42
43 If you're planning to adopt QMP, please observe the following:
44
45     1. The deprecation policy will take effect and be documented soon, please
46        check the documentation of each used command as soon as a new release of
47        QEMU is available
48
49     2. DO NOT rely on anything which is not explicit documented
50
51     3. Errors, in special, are not documented. Applications should NOT check
52        for specific errors classes or data (it's strongly recommended to only
53        check for the "error" key)
54
55 2. Regular Commands
56 ===================
57
58 Server's responses in the examples below are always a success response, please
59 refer to the QMP specification for more details on error responses.
60
61 EQMP
62
63     {
64         .name       = "quit",
65         .args_type  = "",
66         .mhandler.cmd_new = qmp_marshal_quit,
67     },
68
69 SQMP
70 quit
71 ----
72
73 Quit the emulator.
74
75 Arguments: None.
76
77 Example:
78
79 -> { "execute": "quit" }
80 <- { "return": {} }
81
82 EQMP
83
84     {
85         .name       = "eject",
86         .args_type  = "force:-f,device:B",
87         .mhandler.cmd_new = qmp_marshal_eject,
88     },
89
90 SQMP
91 eject
92 -----
93
94 Eject a removable medium.
95
96 Arguments: 
97
98 - force: force ejection (json-bool, optional)
99 - device: device name (json-string)
100
101 Example:
102
103 -> { "execute": "eject", "arguments": { "device": "ide1-cd0" } }
104 <- { "return": {} }
105
106 Note: The "force" argument defaults to false.
107
108 EQMP
109
110     {
111         .name       = "change",
112         .args_type  = "device:B,target:F,arg:s?",
113         .mhandler.cmd_new = qmp_marshal_change,
114     },
115
116 SQMP
117 change
118 ------
119
120 Change a removable medium or VNC configuration.
121
122 Arguments:
123
124 - "device": device name (json-string)
125 - "target": filename or item (json-string)
126 - "arg": additional argument (json-string, optional)
127
128 Examples:
129
130 1. Change a removable medium
131
132 -> { "execute": "change",
133              "arguments": { "device": "ide1-cd0",
134                             "target": "/srv/images/Fedora-12-x86_64-DVD.iso" } }
135 <- { "return": {} }
136
137 2. Change VNC password
138
139 -> { "execute": "change",
140              "arguments": { "device": "vnc", "target": "password",
141                             "arg": "foobar1" } }
142 <- { "return": {} }
143
144 EQMP
145
146     {
147         .name       = "screendump",
148         .args_type  = "filename:F",
149         .mhandler.cmd_new = qmp_marshal_screendump,
150     },
151
152 SQMP
153 screendump
154 ----------
155
156 Save screen into PPM image.
157
158 Arguments:
159
160 - "filename": file path (json-string)
161
162 Example:
163
164 -> { "execute": "screendump", "arguments": { "filename": "/tmp/image" } }
165 <- { "return": {} }
166
167 EQMP
168
169     {
170         .name       = "stop",
171         .args_type  = "",
172         .mhandler.cmd_new = qmp_marshal_stop,
173     },
174
175 SQMP
176 stop
177 ----
178
179 Stop the emulator.
180
181 Arguments: None.
182
183 Example:
184
185 -> { "execute": "stop" }
186 <- { "return": {} }
187
188 EQMP
189
190     {
191         .name       = "cont",
192         .args_type  = "",
193         .mhandler.cmd_new = qmp_marshal_cont,
194     },
195
196 SQMP
197 cont
198 ----
199
200 Resume emulation.
201
202 Arguments: None.
203
204 Example:
205
206 -> { "execute": "cont" }
207 <- { "return": {} }
208
209 EQMP
210
211     {
212         .name       = "system_wakeup",
213         .args_type  = "",
214         .mhandler.cmd_new = qmp_marshal_system_wakeup,
215     },
216
217 SQMP
218 system_wakeup
219 -------------
220
221 Wakeup guest from suspend.
222
223 Arguments: None.
224
225 Example:
226
227 -> { "execute": "system_wakeup" }
228 <- { "return": {} }
229
230 EQMP
231
232     {
233         .name       = "system_reset",
234         .args_type  = "",
235         .mhandler.cmd_new = qmp_marshal_system_reset,
236     },
237
238 SQMP
239 system_reset
240 ------------
241
242 Reset the system.
243
244 Arguments: None.
245
246 Example:
247
248 -> { "execute": "system_reset" }
249 <- { "return": {} }
250
251 EQMP
252
253     {
254         .name       = "system_powerdown",
255         .args_type  = "",
256         .mhandler.cmd_new = qmp_marshal_system_powerdown,
257     },
258
259 SQMP
260 system_powerdown
261 ----------------
262
263 Send system power down event.
264
265 Arguments: None.
266
267 Example:
268
269 -> { "execute": "system_powerdown" }
270 <- { "return": {} }
271
272 EQMP
273
274     {
275         .name       = "device_add",
276         .args_type  = "device:O",
277         .params     = "driver[,prop=value][,...]",
278         .help       = "add device, like -device on the command line",
279         .mhandler.cmd_new = qmp_device_add,
280     },
281
282 SQMP
283 device_add
284 ----------
285
286 Add a device.
287
288 Arguments:
289
290 - "driver": the name of the new device's driver (json-string)
291 - "bus": the device's parent bus (device tree path, json-string, optional)
292 - "id": the device's ID, must be unique (json-string)
293 - device properties
294
295 Example:
296
297 -> { "execute": "device_add", "arguments": { "driver": "e1000", "id": "net1" } }
298 <- { "return": {} }
299
300 Notes:
301
302 (1) For detailed information about this command, please refer to the
303     'docs/qdev-device-use.txt' file.
304
305 (2) It's possible to list device properties by running QEMU with the
306     "-device DEVICE,\?" command-line argument, where DEVICE is the device's name
307
308 EQMP
309
310     {
311         .name       = "device_del",
312         .args_type  = "id:s",
313         .mhandler.cmd_new = qmp_marshal_device_del,
314     },
315
316 SQMP
317 device_del
318 ----------
319
320 Remove a device.
321
322 Arguments:
323
324 - "id": the device's ID or QOM path (json-string)
325
326 Example:
327
328 -> { "execute": "device_del", "arguments": { "id": "net1" } }
329 <- { "return": {} }
330
331 Example:
332
333 -> { "execute": "device_del", "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
334 <- { "return": {} }
335
336 EQMP
337
338     {
339         .name       = "send-key",
340         .args_type  = "keys:q,hold-time:i?",
341         .mhandler.cmd_new = qmp_marshal_send_key,
342     },
343
344 SQMP
345 send-key
346 ----------
347
348 Send keys to VM.
349
350 Arguments:
351
352 keys array:
353     - "key": key sequence (a json-array of key union values,
354              union can be number or qcode enum)
355
356 - hold-time: time to delay key up events, milliseconds. Defaults to 100
357              (json-int, optional)
358
359 Example:
360
361 -> { "execute": "send-key",
362      "arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
363                               { "type": "qcode", "data": "alt" },
364                               { "type": "qcode", "data": "delete" } ] } }
365 <- { "return": {} }
366
367 EQMP
368
369     {
370         .name       = "cpu",
371         .args_type  = "index:i",
372         .mhandler.cmd_new = qmp_marshal_cpu,
373     },
374
375 SQMP
376 cpu
377 ---
378
379 Set the default CPU.
380
381 Arguments:
382
383 - "index": the CPU's index (json-int)
384
385 Example:
386
387 -> { "execute": "cpu", "arguments": { "index": 0 } }
388 <- { "return": {} }
389
390 Note: CPUs' indexes are obtained with the 'query-cpus' command.
391
392 EQMP
393
394     {
395         .name       = "cpu-add",
396         .args_type  = "id:i",
397         .mhandler.cmd_new = qmp_marshal_cpu_add,
398     },
399
400 SQMP
401 cpu-add
402 -------
403
404 Adds virtual cpu
405
406 Arguments:
407
408 - "id": cpu id (json-int)
409
410 Example:
411
412 -> { "execute": "cpu-add", "arguments": { "id": 2 } }
413 <- { "return": {} }
414
415 EQMP
416
417     {
418         .name       = "memsave",
419         .args_type  = "val:l,size:i,filename:s,cpu:i?",
420         .mhandler.cmd_new = qmp_marshal_memsave,
421     },
422
423 SQMP
424 memsave
425 -------
426
427 Save to disk virtual memory dump starting at 'val' of size 'size'.
428
429 Arguments:
430
431 - "val": the starting address (json-int)
432 - "size": the memory size, in bytes (json-int)
433 - "filename": file path (json-string)
434 - "cpu": virtual CPU index (json-int, optional)
435
436 Example:
437
438 -> { "execute": "memsave",
439              "arguments": { "val": 10,
440                             "size": 100,
441                             "filename": "/tmp/virtual-mem-dump" } }
442 <- { "return": {} }
443
444 EQMP
445
446     {
447         .name       = "pmemsave",
448         .args_type  = "val:l,size:i,filename:s",
449         .mhandler.cmd_new = qmp_marshal_pmemsave,
450     },
451
452 SQMP
453 pmemsave
454 --------
455
456 Save to disk physical memory dump starting at 'val' of size 'size'.
457
458 Arguments:
459
460 - "val": the starting address (json-int)
461 - "size": the memory size, in bytes (json-int)
462 - "filename": file path (json-string)
463
464 Example:
465
466 -> { "execute": "pmemsave",
467              "arguments": { "val": 10,
468                             "size": 100,
469                             "filename": "/tmp/physical-mem-dump" } }
470 <- { "return": {} }
471
472 EQMP
473
474     {
475         .name       = "inject-nmi",
476         .args_type  = "",
477         .mhandler.cmd_new = qmp_marshal_inject_nmi,
478     },
479
480 SQMP
481 inject-nmi
482 ----------
483
484 Inject an NMI on the default CPU (x86/s390) or all CPUs (ppc64).
485
486 Arguments: None.
487
488 Example:
489
490 -> { "execute": "inject-nmi" }
491 <- { "return": {} }
492
493 Note: inject-nmi fails when the guest doesn't support injecting.
494
495 EQMP
496
497     {
498         .name       = "ringbuf-write",
499         .args_type  = "device:s,data:s,format:s?",
500         .mhandler.cmd_new = qmp_marshal_ringbuf_write,
501     },
502
503 SQMP
504 ringbuf-write
505 -------------
506
507 Write to a ring buffer character device.
508
509 Arguments:
510
511 - "device": ring buffer character device name (json-string)
512 - "data": data to write (json-string)
513 - "format": data format (json-string, optional)
514           - Possible values: "utf8" (default), "base64"
515
516 Example:
517
518 -> { "execute": "ringbuf-write",
519                 "arguments": { "device": "foo",
520                                "data": "abcdefgh",
521                                "format": "utf8" } }
522 <- { "return": {} }
523
524 EQMP
525
526     {
527         .name       = "ringbuf-read",
528         .args_type  = "device:s,size:i,format:s?",
529         .mhandler.cmd_new = qmp_marshal_ringbuf_read,
530     },
531
532 SQMP
533 ringbuf-read
534 -------------
535
536 Read from a ring buffer character device.
537
538 Arguments:
539
540 - "device": ring buffer character device name (json-string)
541 - "size": how many bytes to read at most (json-int)
542           - Number of data bytes, not number of characters in encoded data
543 - "format": data format (json-string, optional)
544           - Possible values: "utf8" (default), "base64"
545           - Naturally, format "utf8" works only when the ring buffer
546             contains valid UTF-8 text.  Invalid UTF-8 sequences get
547             replaced.  Bug: replacement doesn't work.  Bug: can screw
548             up on encountering NUL characters, after the ring buffer
549             lost data, and when reading stops because the size limit
550             is reached.
551
552 Example:
553
554 -> { "execute": "ringbuf-read",
555                 "arguments": { "device": "foo",
556                                "size": 1000,
557                                "format": "utf8" } }
558 <- {"return": "abcdefgh"}
559
560 EQMP
561
562     {
563         .name       = "xen-save-devices-state",
564         .args_type  = "filename:F",
565     .mhandler.cmd_new = qmp_marshal_xen_save_devices_state,
566     },
567
568 SQMP
569 xen-save-devices-state
570 -------
571
572 Save the state of all devices to file. The RAM and the block devices
573 of the VM are not saved by this command.
574
575 Arguments:
576
577 - "filename": the file to save the state of the devices to as binary
578 data. See xen-save-devices-state.txt for a description of the binary
579 format.
580
581 Example:
582
583 -> { "execute": "xen-save-devices-state",
584      "arguments": { "filename": "/tmp/save" } }
585 <- { "return": {} }
586
587 EQMP
588
589     {
590         .name       = "xen-set-global-dirty-log",
591         .args_type  = "enable:b",
592         .mhandler.cmd_new = qmp_marshal_xen_set_global_dirty_log,
593     },
594
595 SQMP
596 xen-set-global-dirty-log
597 -------
598
599 Enable or disable the global dirty log mode.
600
601 Arguments:
602
603 - "enable": Enable it or disable it.
604
605 Example:
606
607 -> { "execute": "xen-set-global-dirty-log",
608      "arguments": { "enable": true } }
609 <- { "return": {} }
610
611 EQMP
612
613     {
614         .name       = "migrate",
615         .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
616         .mhandler.cmd_new = qmp_marshal_migrate,
617     },
618
619 SQMP
620 migrate
621 -------
622
623 Migrate to URI.
624
625 Arguments:
626
627 - "blk": block migration, full disk copy (json-bool, optional)
628 - "inc": incremental disk copy (json-bool, optional)
629 - "uri": Destination URI (json-string)
630
631 Example:
632
633 -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
634 <- { "return": {} }
635
636 Notes:
637
638 (1) The 'query-migrate' command should be used to check migration's progress
639     and final result (this information is provided by the 'status' member)
640 (2) All boolean arguments default to false
641 (3) The user Monitor's "detach" argument is invalid in QMP and should not
642     be used
643
644 EQMP
645
646     {
647         .name       = "migrate_cancel",
648         .args_type  = "",
649         .mhandler.cmd_new = qmp_marshal_migrate_cancel,
650     },
651
652 SQMP
653 migrate_cancel
654 --------------
655
656 Cancel the current migration.
657
658 Arguments: None.
659
660 Example:
661
662 -> { "execute": "migrate_cancel" }
663 <- { "return": {} }
664
665 EQMP
666
667     {
668         .name       = "migrate-incoming",
669         .args_type  = "uri:s",
670         .mhandler.cmd_new = qmp_marshal_migrate_incoming,
671     },
672
673 SQMP
674 migrate-incoming
675 ----------------
676
677 Continue an incoming migration
678
679 Arguments:
680
681 - "uri": Source/listening URI (json-string)
682
683 Example:
684
685 -> { "execute": "migrate-incoming", "arguments": { "uri": "tcp::4446" } }
686 <- { "return": {} }
687
688 Notes:
689
690 (1) QEMU must be started with -incoming defer to allow migrate-incoming to
691     be used
692 (2) The uri format is the same as for -incoming
693
694 EQMP
695     {
696         .name       = "migrate-set-cache-size",
697         .args_type  = "value:o",
698         .mhandler.cmd_new = qmp_marshal_migrate_set_cache_size,
699     },
700
701 SQMP
702 migrate-set-cache-size
703 ----------------------
704
705 Set cache size to be used by XBZRLE migration, the cache size will be rounded
706 down to the nearest power of 2
707
708 Arguments:
709
710 - "value": cache size in bytes (json-int)
711
712 Example:
713
714 -> { "execute": "migrate-set-cache-size", "arguments": { "value": 536870912 } }
715 <- { "return": {} }
716
717 EQMP
718     {
719         .name       = "migrate-start-postcopy",
720         .args_type  = "",
721         .mhandler.cmd_new = qmp_marshal_migrate_start_postcopy,
722     },
723
724 SQMP
725 migrate-start-postcopy
726 ----------------------
727
728 Switch an in-progress migration to postcopy mode. Ignored after the end of
729 migration (or once already in postcopy).
730
731 Example:
732 -> { "execute": "migrate-start-postcopy" }
733 <- { "return": {} }
734
735 EQMP
736
737     {
738         .name       = "query-migrate-cache-size",
739         .args_type  = "",
740         .mhandler.cmd_new = qmp_marshal_query_migrate_cache_size,
741     },
742
743 SQMP
744 query-migrate-cache-size
745 ------------------------
746
747 Show cache size to be used by XBZRLE migration
748
749 returns a json-object with the following information:
750 - "size" : json-int
751
752 Example:
753
754 -> { "execute": "query-migrate-cache-size" }
755 <- { "return": 67108864 }
756
757 EQMP
758
759     {
760         .name       = "migrate_set_speed",
761         .args_type  = "value:o",
762         .mhandler.cmd_new = qmp_marshal_migrate_set_speed,
763     },
764
765 SQMP
766 migrate_set_speed
767 -----------------
768
769 Set maximum speed for migrations.
770
771 Arguments:
772
773 - "value": maximum speed, in bytes per second (json-int)
774
775 Example:
776
777 -> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
778 <- { "return": {} }
779
780 EQMP
781
782     {
783         .name       = "migrate_set_downtime",
784         .args_type  = "value:T",
785         .mhandler.cmd_new = qmp_marshal_migrate_set_downtime,
786     },
787
788 SQMP
789 migrate_set_downtime
790 --------------------
791
792 Set maximum tolerated downtime (in seconds) for migrations.
793
794 Arguments:
795
796 - "value": maximum downtime (json-number)
797
798 Example:
799
800 -> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
801 <- { "return": {} }
802
803 EQMP
804
805     {
806         .name       = "client_migrate_info",
807         .args_type  = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
808         .params     = "protocol hostname port tls-port cert-subject",
809         .help       = "set migration information for remote display",
810         .mhandler.cmd_new = qmp_marshal_client_migrate_info,
811     },
812
813 SQMP
814 client_migrate_info
815 -------------------
816
817 Set migration information for remote display.  This makes the server
818 ask the client to automatically reconnect using the new parameters
819 once migration finished successfully.  Only implemented for SPICE.
820
821 Arguments:
822
823 - "protocol":     must be "spice" (json-string)
824 - "hostname":     migration target hostname (json-string)
825 - "port":         spice tcp port for plaintext channels (json-int, optional)
826 - "tls-port":     spice tcp port for tls-secured channels (json-int, optional)
827 - "cert-subject": server certificate subject (json-string, optional)
828
829 Example:
830
831 -> { "execute": "client_migrate_info",
832      "arguments": { "protocol": "spice",
833                     "hostname": "virt42.lab.kraxel.org",
834                     "port": 1234 } }
835 <- { "return": {} }
836
837 EQMP
838
839     {
840         .name       = "dump-guest-memory",
841         .args_type  = "paging:b,protocol:s,detach:b?,begin:i?,end:i?,format:s?",
842         .params     = "-p protocol [-d] [begin] [length] [format]",
843         .help       = "dump guest memory to file",
844         .mhandler.cmd_new = qmp_marshal_dump_guest_memory,
845     },
846
847 SQMP
848 dump
849
850
851 Dump guest memory to file. The file can be processed with crash or gdb.
852
853 Arguments:
854
855 - "paging": do paging to get guest's memory mapping (json-bool)
856 - "protocol": destination file(started with "file:") or destination file
857               descriptor (started with "fd:") (json-string)
858 - "detach": if specified, command will return immediately, without waiting
859             for the dump to finish (json-bool)
860 - "begin": the starting physical address. It's optional, and should be specified
861            with length together (json-int)
862 - "length": the memory size, in bytes. It's optional, and should be specified
863             with begin together (json-int)
864 - "format": the format of guest memory dump. It's optional, and can be
865             elf|kdump-zlib|kdump-lzo|kdump-snappy, but non-elf formats will
866             conflict with paging and filter, ie. begin and length (json-string)
867
868 Example:
869
870 -> { "execute": "dump-guest-memory", "arguments": { "protocol": "fd:dump" } }
871 <- { "return": {} }
872
873 Notes:
874
875 (1) All boolean arguments default to false
876
877 EQMP
878
879     {
880         .name       = "query-dump-guest-memory-capability",
881         .args_type  = "",
882     .mhandler.cmd_new = qmp_marshal_query_dump_guest_memory_capability,
883     },
884
885 SQMP
886 query-dump-guest-memory-capability
887 ----------
888
889 Show available formats for 'dump-guest-memory'
890
891 Example:
892
893 -> { "execute": "query-dump-guest-memory-capability" }
894 <- { "return": { "formats":
895                     ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
896
897 EQMP
898
899 #if defined TARGET_S390X
900     {
901         .name       = "dump-skeys",
902         .args_type  = "filename:F",
903         .mhandler.cmd_new = qmp_marshal_dump_skeys,
904     },
905 #endif
906
907 SQMP
908 dump-skeys
909 ----------
910
911 Save guest storage keys to file.
912
913 Arguments:
914
915 - "filename": file path (json-string)
916
917 Example:
918
919 -> { "execute": "dump-skeys", "arguments": { "filename": "/tmp/skeys" } }
920 <- { "return": {} }
921
922 EQMP
923
924     {
925         .name       = "netdev_add",
926         .args_type  = "netdev:O",
927         .mhandler.cmd_new = qmp_netdev_add,
928     },
929
930 SQMP
931 netdev_add
932 ----------
933
934 Add host network device.
935
936 Arguments:
937
938 - "type": the device type, "tap", "user", ... (json-string)
939 - "id": the device's ID, must be unique (json-string)
940 - device options
941
942 Example:
943
944 -> { "execute": "netdev_add",
945      "arguments": { "type": "user", "id": "netdev1",
946                     "dnssearch": "example.org" } }
947 <- { "return": {} }
948
949 Note: The supported device options are the same ones supported by the '-netdev'
950       command-line argument, which are listed in the '-help' output or QEMU's
951       manual
952
953 EQMP
954
955     {
956         .name       = "netdev_del",
957         .args_type  = "id:s",
958         .mhandler.cmd_new = qmp_marshal_netdev_del,
959     },
960
961 SQMP
962 netdev_del
963 ----------
964
965 Remove host network device.
966
967 Arguments:
968
969 - "id": the device's ID, must be unique (json-string)
970
971 Example:
972
973 -> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
974 <- { "return": {} }
975
976
977 EQMP
978
979     {
980         .name       = "object-add",
981         .args_type  = "qom-type:s,id:s,props:q?",
982         .mhandler.cmd_new = qmp_marshal_object_add,
983     },
984
985 SQMP
986 object-add
987 ----------
988
989 Create QOM object.
990
991 Arguments:
992
993 - "qom-type": the object's QOM type, i.e. the class name (json-string)
994 - "id": the object's ID, must be unique (json-string)
995 - "props": a dictionary of object property values (optional, json-dict)
996
997 Example:
998
999 -> { "execute": "object-add", "arguments": { "qom-type": "rng-random", "id": "rng1",
1000      "props": { "filename": "/dev/hwrng" } } }
1001 <- { "return": {} }
1002
1003 EQMP
1004
1005     {
1006         .name       = "object-del",
1007         .args_type  = "id:s",
1008         .mhandler.cmd_new = qmp_marshal_object_del,
1009     },
1010
1011 SQMP
1012 object-del
1013 ----------
1014
1015 Remove QOM object.
1016
1017 Arguments:
1018
1019 - "id": the object's ID (json-string)
1020
1021 Example:
1022
1023 -> { "execute": "object-del", "arguments": { "id": "rng1" } }
1024 <- { "return": {} }
1025
1026
1027 EQMP
1028
1029
1030     {
1031         .name       = "block_resize",
1032         .args_type  = "device:s?,node-name:s?,size:o",
1033         .mhandler.cmd_new = qmp_marshal_block_resize,
1034     },
1035
1036 SQMP
1037 block_resize
1038 ------------
1039
1040 Resize a block image while a guest is running.
1041
1042 Arguments:
1043
1044 - "device": the device's ID, must be unique (json-string)
1045 - "node-name": the node name in the block driver state graph (json-string)
1046 - "size": new size
1047
1048 Example:
1049
1050 -> { "execute": "block_resize", "arguments": { "device": "scratch", "size": 1073741824 } }
1051 <- { "return": {} }
1052
1053 EQMP
1054
1055     {
1056         .name       = "block-stream",
1057         .args_type  = "device:B,base:s?,speed:o?,backing-file:s?,on-error:s?",
1058         .mhandler.cmd_new = qmp_marshal_block_stream,
1059     },
1060
1061 SQMP
1062 block-stream
1063 ------------
1064
1065 Copy data from a backing file into a block device.
1066
1067 Arguments:
1068
1069 - "device": The device's ID, must be unique (json-string)
1070 - "base": The file name of the backing image above which copying starts
1071           (json-string, optional)
1072 - "backing-file": The backing file string to write into the active layer. This
1073                   filename is not validated.
1074
1075                   If a pathname string is such that it cannot be resolved by
1076                   QEMU, that means that subsequent QMP or HMP commands must use
1077                   node-names for the image in question, as filename lookup
1078                   methods will fail.
1079
1080                   If not specified, QEMU will automatically determine the
1081                   backing file string to use, or error out if there is no
1082                   obvious choice.  Care should be taken when specifying the
1083                   string, to specify a valid filename or protocol.
1084                   (json-string, optional) (Since 2.1)
1085 - "speed":  the maximum speed, in bytes per second (json-int, optional)
1086 - "on-error": the action to take on an error (default 'report').  'stop' and
1087               'enospc' can only be used if the block device supports io-status.
1088               (json-string, optional) (Since 2.1)
1089
1090 Example:
1091
1092 -> { "execute": "block-stream", "arguments": { "device": "virtio0",
1093                                                "base": "/tmp/master.qcow2" } }
1094 <- { "return": {} }
1095
1096 EQMP
1097
1098     {
1099         .name       = "block-commit",
1100         .args_type  = "device:B,base:s?,top:s?,backing-file:s?,speed:o?",
1101         .mhandler.cmd_new = qmp_marshal_block_commit,
1102     },
1103
1104 SQMP
1105 block-commit
1106 ------------
1107
1108 Live commit of data from overlay image nodes into backing nodes - i.e., writes
1109 data between 'top' and 'base' into 'base'.
1110
1111 Arguments:
1112
1113 - "device": The device's ID, must be unique (json-string)
1114 - "base": The file name of the backing image to write data into.
1115           If not specified, this is the deepest backing image
1116           (json-string, optional)
1117 - "top":  The file name of the backing image within the image chain,
1118           which contains the topmost data to be committed down. If
1119           not specified, this is the active layer. (json-string, optional)
1120
1121 - backing-file:     The backing file string to write into the overlay
1122                     image of 'top'.  If 'top' is the active layer,
1123                     specifying a backing file string is an error. This
1124                     filename is not validated.
1125
1126                     If a pathname string is such that it cannot be
1127                     resolved by QEMU, that means that subsequent QMP or
1128                     HMP commands must use node-names for the image in
1129                     question, as filename lookup methods will fail.
1130
1131                     If not specified, QEMU will automatically determine
1132                     the backing file string to use, or error out if
1133                     there is no obvious choice. Care should be taken
1134                     when specifying the string, to specify a valid
1135                     filename or protocol.
1136                     (json-string, optional) (Since 2.1)
1137
1138           If top == base, that is an error.
1139           If top == active, the job will not be completed by itself,
1140           user needs to complete the job with the block-job-complete
1141           command after getting the ready event. (Since 2.0)
1142
1143           If the base image is smaller than top, then the base image
1144           will be resized to be the same size as top.  If top is
1145           smaller than the base image, the base will not be
1146           truncated.  If you want the base image size to match the
1147           size of the smaller top, you can safely truncate it
1148           yourself once the commit operation successfully completes.
1149           (json-string)
1150 - "speed":  the maximum speed, in bytes per second (json-int, optional)
1151
1152
1153 Example:
1154
1155 -> { "execute": "block-commit", "arguments": { "device": "virtio0",
1156                                               "top": "/tmp/snap1.qcow2" } }
1157 <- { "return": {} }
1158
1159 EQMP
1160
1161     {
1162         .name       = "drive-backup",
1163         .args_type  = "sync:s,device:B,target:s,speed:i?,mode:s?,format:s?,"
1164                       "bitmap:s?,on-source-error:s?,on-target-error:s?",
1165         .mhandler.cmd_new = qmp_marshal_drive_backup,
1166     },
1167
1168 SQMP
1169 drive-backup
1170 ------------
1171
1172 Start a point-in-time copy of a block device to a new destination.  The
1173 status of ongoing drive-backup operations can be checked with
1174 query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
1175 The operation can be stopped before it has completed using the
1176 block-job-cancel command.
1177
1178 Arguments:
1179
1180 - "device": the name of the device which should be copied.
1181             (json-string)
1182 - "target": the target of the new image. If the file exists, or if it is a
1183             device, the existing file/device will be used as the new
1184             destination.  If it does not exist, a new file will be created.
1185             (json-string)
1186 - "format": the format of the new destination, default is to probe if 'mode' is
1187             'existing', else the format of the source
1188             (json-string, optional)
1189 - "sync": what parts of the disk image should be copied to the destination;
1190   possibilities include "full" for all the disk, "top" for only the sectors
1191   allocated in the topmost image, "incremental" for only the dirty sectors in
1192   the bitmap, or "none" to only replicate new I/O (MirrorSyncMode).
1193 - "bitmap": dirty bitmap name for sync==incremental. Must be present if sync
1194             is "incremental", must NOT be present otherwise.
1195 - "mode": whether and how QEMU should create a new image
1196           (NewImageMode, optional, default 'absolute-paths')
1197 - "speed": the maximum speed, in bytes per second (json-int, optional)
1198 - "on-source-error": the action to take on an error on the source, default
1199                      'report'.  'stop' and 'enospc' can only be used
1200                      if the block device supports io-status.
1201                      (BlockdevOnError, optional)
1202 - "on-target-error": the action to take on an error on the target, default
1203                      'report' (no limitations, since this applies to
1204                      a different block device than device).
1205                      (BlockdevOnError, optional)
1206
1207 Example:
1208 -> { "execute": "drive-backup", "arguments": { "device": "drive0",
1209                                                "sync": "full",
1210                                                "target": "backup.img" } }
1211 <- { "return": {} }
1212
1213 EQMP
1214
1215     {
1216         .name       = "blockdev-backup",
1217         .args_type  = "sync:s,device:B,target:B,speed:i?,"
1218                       "on-source-error:s?,on-target-error:s?",
1219         .mhandler.cmd_new = qmp_marshal_blockdev_backup,
1220     },
1221
1222 SQMP
1223 blockdev-backup
1224 ---------------
1225
1226 The device version of drive-backup: this command takes an existing named device
1227 as backup target.
1228
1229 Arguments:
1230
1231 - "device": the name of the device which should be copied.
1232             (json-string)
1233 - "target": the name of the backup target device. (json-string)
1234 - "sync": what parts of the disk image should be copied to the destination;
1235           possibilities include "full" for all the disk, "top" for only the
1236           sectors allocated in the topmost image, or "none" to only replicate
1237           new I/O (MirrorSyncMode).
1238 - "speed": the maximum speed, in bytes per second (json-int, optional)
1239 - "on-source-error": the action to take on an error on the source, default
1240                      'report'.  'stop' and 'enospc' can only be used
1241                      if the block device supports io-status.
1242                      (BlockdevOnError, optional)
1243 - "on-target-error": the action to take on an error on the target, default
1244                      'report' (no limitations, since this applies to
1245                      a different block device than device).
1246                      (BlockdevOnError, optional)
1247
1248 Example:
1249 -> { "execute": "blockdev-backup", "arguments": { "device": "src-id",
1250                                                   "sync": "full",
1251                                                   "target": "tgt-id" } }
1252 <- { "return": {} }
1253
1254 EQMP
1255
1256     {
1257         .name       = "block-job-set-speed",
1258         .args_type  = "device:B,speed:o",
1259         .mhandler.cmd_new = qmp_marshal_block_job_set_speed,
1260     },
1261
1262     {
1263         .name       = "block-job-cancel",
1264         .args_type  = "device:B,force:b?",
1265         .mhandler.cmd_new = qmp_marshal_block_job_cancel,
1266     },
1267     {
1268         .name       = "block-job-pause",
1269         .args_type  = "device:B",
1270         .mhandler.cmd_new = qmp_marshal_block_job_pause,
1271     },
1272     {
1273         .name       = "block-job-resume",
1274         .args_type  = "device:B",
1275         .mhandler.cmd_new = qmp_marshal_block_job_resume,
1276     },
1277     {
1278         .name       = "block-job-complete",
1279         .args_type  = "device:B",
1280         .mhandler.cmd_new = qmp_marshal_block_job_complete,
1281     },
1282     {
1283         .name       = "transaction",
1284         .args_type  = "actions:q,properties:q?",
1285         .mhandler.cmd_new = qmp_marshal_transaction,
1286     },
1287
1288 SQMP
1289 transaction
1290 -----------
1291
1292 Atomically operate on one or more block devices.  Operations that are
1293 currently supported:
1294
1295     - drive-backup
1296     - blockdev-backup
1297     - blockdev-snapshot-sync
1298     - blockdev-snapshot-internal-sync
1299     - abort
1300     - block-dirty-bitmap-add
1301     - block-dirty-bitmap-clear
1302
1303 Refer to the qemu/qapi-schema.json file for minimum required QEMU
1304 versions for these operations.  A list of dictionaries is accepted,
1305 that contains the actions to be performed.  If there is any failure
1306 performing any of the operations, all operations for the group are
1307 abandoned.
1308
1309 For external snapshots, the dictionary contains the device, the file to use for
1310 the new snapshot, and the format.  The default format, if not specified, is
1311 qcow2.
1312
1313 Each new snapshot defaults to being created by QEMU (wiping any
1314 contents if the file already exists), but it is also possible to reuse
1315 an externally-created file.  In the latter case, you should ensure that
1316 the new image file has the same contents as the current one; QEMU cannot
1317 perform any meaningful check.  Typically this is achieved by using the
1318 current image file as the backing file for the new image.
1319
1320 On failure, the original disks pre-snapshot attempt will be used.
1321
1322 For internal snapshots, the dictionary contains the device and the snapshot's
1323 name.  If an internal snapshot matching name already exists, the request will
1324 be rejected.  Only some image formats support it, for example, qcow2, rbd,
1325 and sheepdog.
1326
1327 On failure, qemu will try delete the newly created internal snapshot in the
1328 transaction.  When an I/O error occurs during deletion, the user needs to fix
1329 it later with qemu-img or other command.
1330
1331 Arguments:
1332
1333 actions array:
1334     - "type": the operation to perform (json-string).  Possible
1335               values: "drive-backup", "blockdev-backup",
1336                       "blockdev-snapshot-sync",
1337                       "blockdev-snapshot-internal-sync",
1338                       "abort", "block-dirty-bitmap-add",
1339                       "block-dirty-bitmap-clear"
1340     - "data": a dictionary.  The contents depend on the value
1341       of "type".  When "type" is "blockdev-snapshot-sync":
1342       - "device": device name to snapshot (json-string)
1343       - "node-name": graph node name to snapshot (json-string)
1344       - "snapshot-file": name of new image file (json-string)
1345       - "snapshot-node-name": graph node name of the new snapshot (json-string)
1346       - "format": format of new image (json-string, optional)
1347       - "mode": whether and how QEMU should create the snapshot file
1348         (NewImageMode, optional, default "absolute-paths")
1349       When "type" is "blockdev-snapshot-internal-sync":
1350       - "device": device name to snapshot (json-string)
1351       - "name": name of the new snapshot (json-string)
1352
1353 Example:
1354
1355 -> { "execute": "transaction",
1356      "arguments": { "actions": [
1357          { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd0",
1358                                          "snapshot-file": "/some/place/my-image",
1359                                          "format": "qcow2" } },
1360          { "type": "blockdev-snapshot-sync", "data" : { "node-name": "myfile",
1361                                          "snapshot-file": "/some/place/my-image2",
1362                                          "snapshot-node-name": "node3432",
1363                                          "mode": "existing",
1364                                          "format": "qcow2" } },
1365          { "type": "blockdev-snapshot-sync", "data" : { "device": "ide-hd1",
1366                                          "snapshot-file": "/some/place/my-image2",
1367                                          "mode": "existing",
1368                                          "format": "qcow2" } },
1369          { "type": "blockdev-snapshot-internal-sync", "data" : {
1370                                          "device": "ide-hd2",
1371                                          "name": "snapshot0" } } ] } }
1372 <- { "return": {} }
1373
1374 EQMP
1375
1376     {
1377         .name       = "block-dirty-bitmap-add",
1378         .args_type  = "node:B,name:s,granularity:i?",
1379         .mhandler.cmd_new = qmp_marshal_block_dirty_bitmap_add,
1380     },
1381
1382 SQMP
1383
1384 block-dirty-bitmap-add
1385 ----------------------
1386 Since 2.4
1387
1388 Create a dirty bitmap with a name on the device, and start tracking the writes.
1389
1390 Arguments:
1391
1392 - "node": device/node on which to create dirty bitmap (json-string)
1393 - "name": name of the new dirty bitmap (json-string)
1394 - "granularity": granularity to track writes with (int, optional)
1395
1396 Example:
1397
1398 -> { "execute": "block-dirty-bitmap-add", "arguments": { "node": "drive0",
1399                                                    "name": "bitmap0" } }
1400 <- { "return": {} }
1401
1402 EQMP
1403
1404     {
1405         .name       = "block-dirty-bitmap-remove",
1406         .args_type  = "node:B,name:s",
1407         .mhandler.cmd_new = qmp_marshal_block_dirty_bitmap_remove,
1408     },
1409
1410 SQMP
1411
1412 block-dirty-bitmap-remove
1413 -------------------------
1414 Since 2.4
1415
1416 Stop write tracking and remove the dirty bitmap that was created with
1417 block-dirty-bitmap-add.
1418
1419 Arguments:
1420
1421 - "node": device/node on which to remove dirty bitmap (json-string)
1422 - "name": name of the dirty bitmap to remove (json-string)
1423
1424 Example:
1425
1426 -> { "execute": "block-dirty-bitmap-remove", "arguments": { "node": "drive0",
1427                                                       "name": "bitmap0" } }
1428 <- { "return": {} }
1429
1430 EQMP
1431
1432     {
1433         .name       = "block-dirty-bitmap-clear",
1434         .args_type  = "node:B,name:s",
1435         .mhandler.cmd_new = qmp_marshal_block_dirty_bitmap_clear,
1436     },
1437
1438 SQMP
1439
1440 block-dirty-bitmap-clear
1441 ------------------------
1442 Since 2.4
1443
1444 Reset the dirty bitmap associated with a node so that an incremental backup
1445 from this point in time forward will only backup clusters modified after this
1446 clear operation.
1447
1448 Arguments:
1449
1450 - "node": device/node on which to remove dirty bitmap (json-string)
1451 - "name": name of the dirty bitmap to remove (json-string)
1452
1453 Example:
1454
1455 -> { "execute": "block-dirty-bitmap-clear", "arguments": { "node": "drive0",
1456                                                            "name": "bitmap0" } }
1457 <- { "return": {} }
1458
1459 EQMP
1460
1461     {
1462         .name       = "blockdev-snapshot-sync",
1463         .args_type  = "device:s?,node-name:s?,snapshot-file:s,snapshot-node-name:s?,format:s?,mode:s?",
1464         .mhandler.cmd_new = qmp_marshal_blockdev_snapshot_sync,
1465     },
1466
1467 SQMP
1468 blockdev-snapshot-sync
1469 ----------------------
1470
1471 Synchronous snapshot of a block device. snapshot-file specifies the
1472 target of the new image. If the file exists, or if it is a device, the
1473 snapshot will be created in the existing file/device. If does not
1474 exist, a new file will be created. format specifies the format of the
1475 snapshot image, default is qcow2.
1476
1477 Arguments:
1478
1479 - "device": device name to snapshot (json-string)
1480 - "node-name": graph node name to snapshot (json-string)
1481 - "snapshot-file": name of new image file (json-string)
1482 - "snapshot-node-name": graph node name of the new snapshot (json-string)
1483 - "mode": whether and how QEMU should create the snapshot file
1484   (NewImageMode, optional, default "absolute-paths")
1485 - "format": format of new image (json-string, optional)
1486
1487 Example:
1488
1489 -> { "execute": "blockdev-snapshot-sync", "arguments": { "device": "ide-hd0",
1490                                                          "snapshot-file":
1491                                                         "/some/place/my-image",
1492                                                         "format": "qcow2" } }
1493 <- { "return": {} }
1494
1495 EQMP
1496
1497     {
1498         .name       = "blockdev-snapshot",
1499         .args_type  = "node:s,overlay:s",
1500         .mhandler.cmd_new = qmp_marshal_blockdev_snapshot,
1501     },
1502
1503 SQMP
1504 blockdev-snapshot
1505 -----------------
1506 Since 2.5
1507
1508 Create a snapshot, by installing 'node' as the backing image of
1509 'overlay'. Additionally, if 'node' is associated with a block
1510 device, the block device changes to using 'overlay' as its new active
1511 image.
1512
1513 Arguments:
1514
1515 - "node": device that will have a snapshot created (json-string)
1516 - "overlay": device that will have 'node' as its backing image (json-string)
1517
1518 Example:
1519
1520 -> { "execute": "blockdev-add",
1521                 "arguments": { "options": { "driver": "qcow2",
1522                                             "node-name": "node1534",
1523                                             "file": { "driver": "file",
1524                                                       "filename": "hd1.qcow2" },
1525                                             "backing": "" } } }
1526
1527 <- { "return": {} }
1528
1529 -> { "execute": "blockdev-snapshot", "arguments": { "node": "ide-hd0",
1530                                                     "overlay": "node1534" } }
1531 <- { "return": {} }
1532
1533 EQMP
1534
1535     {
1536         .name       = "blockdev-snapshot-internal-sync",
1537         .args_type  = "device:B,name:s",
1538         .mhandler.cmd_new = qmp_marshal_blockdev_snapshot_internal_sync,
1539     },
1540
1541 SQMP
1542 blockdev-snapshot-internal-sync
1543 -------------------------------
1544
1545 Synchronously take an internal snapshot of a block device when the format of
1546 image used supports it.  If the name is an empty string, or a snapshot with
1547 name already exists, the operation will fail.
1548
1549 Arguments:
1550
1551 - "device": device name to snapshot (json-string)
1552 - "name": name of the new snapshot (json-string)
1553
1554 Example:
1555
1556 -> { "execute": "blockdev-snapshot-internal-sync",
1557                 "arguments": { "device": "ide-hd0",
1558                                "name": "snapshot0" }
1559    }
1560 <- { "return": {} }
1561
1562 EQMP
1563
1564     {
1565         .name       = "blockdev-snapshot-delete-internal-sync",
1566         .args_type  = "device:B,id:s?,name:s?",
1567         .mhandler.cmd_new =
1568                       qmp_marshal_blockdev_snapshot_delete_internal_sync,
1569     },
1570
1571 SQMP
1572 blockdev-snapshot-delete-internal-sync
1573 --------------------------------------
1574
1575 Synchronously delete an internal snapshot of a block device when the format of
1576 image used supports it.  The snapshot is identified by name or id or both.  One
1577 of name or id is required.  If the snapshot is not found, the operation will
1578 fail.
1579
1580 Arguments:
1581
1582 - "device": device name (json-string)
1583 - "id": ID of the snapshot (json-string, optional)
1584 - "name": name of the snapshot (json-string, optional)
1585
1586 Example:
1587
1588 -> { "execute": "blockdev-snapshot-delete-internal-sync",
1589                 "arguments": { "device": "ide-hd0",
1590                                "name": "snapshot0" }
1591    }
1592 <- { "return": {
1593                    "id": "1",
1594                    "name": "snapshot0",
1595                    "vm-state-size": 0,
1596                    "date-sec": 1000012,
1597                    "date-nsec": 10,
1598                    "vm-clock-sec": 100,
1599                    "vm-clock-nsec": 20
1600      }
1601    }
1602
1603 EQMP
1604
1605     {
1606         .name       = "drive-mirror",
1607         .args_type  = "sync:s,device:B,target:s,speed:i?,mode:s?,format:s?,"
1608                       "node-name:s?,replaces:s?,"
1609                       "on-source-error:s?,on-target-error:s?,"
1610                       "unmap:b?,"
1611                       "granularity:i?,buf-size:i?",
1612         .mhandler.cmd_new = qmp_marshal_drive_mirror,
1613     },
1614
1615 SQMP
1616 drive-mirror
1617 ------------
1618
1619 Start mirroring a block device's writes to a new destination. target
1620 specifies the target of the new image. If the file exists, or if it is
1621 a device, it will be used as the new destination for writes. If it does not
1622 exist, a new file will be created. format specifies the format of the
1623 mirror image, default is to probe if mode='existing', else the format
1624 of the source.
1625
1626 Arguments:
1627
1628 - "device": device name to operate on (json-string)
1629 - "target": name of new image file (json-string)
1630 - "format": format of new image (json-string, optional)
1631 - "node-name": the name of the new block driver state in the node graph
1632                (json-string, optional)
1633 - "replaces": the block driver node name to replace when finished
1634               (json-string, optional)
1635 - "mode": how an image file should be created into the target
1636   file/device (NewImageMode, optional, default 'absolute-paths')
1637 - "speed": maximum speed of the streaming job, in bytes per second
1638   (json-int)
1639 - "granularity": granularity of the dirty bitmap, in bytes (json-int, optional)
1640 - "buf-size": maximum amount of data in flight from source to target, in bytes
1641   (json-int, default 10M)
1642 - "sync": what parts of the disk image should be copied to the destination;
1643   possibilities include "full" for all the disk, "top" for only the sectors
1644   allocated in the topmost image, or "none" to only replicate new I/O
1645   (MirrorSyncMode).
1646 - "on-source-error": the action to take on an error on the source
1647   (BlockdevOnError, default 'report')
1648 - "on-target-error": the action to take on an error on the target
1649   (BlockdevOnError, default 'report')
1650 - "unmap": whether the target sectors should be discarded where source has only
1651   zeroes. (json-bool, optional, default true)
1652
1653 The default value of the granularity is the image cluster size clamped
1654 between 4096 and 65536, if the image format defines one.  If the format
1655 does not define a cluster size, the default value of the granularity
1656 is 65536.
1657
1658
1659 Example:
1660
1661 -> { "execute": "drive-mirror", "arguments": { "device": "ide-hd0",
1662                                                "target": "/some/place/my-image",
1663                                                "sync": "full",
1664                                                "format": "qcow2" } }
1665 <- { "return": {} }
1666
1667 EQMP
1668
1669     {
1670         .name       = "blockdev-mirror",
1671         .args_type  = "sync:s,device:B,target:B,replaces:s?,speed:i?,"
1672                       "on-source-error:s?,on-target-error:s?,"
1673                       "granularity:i?,buf-size:i?",
1674         .mhandler.cmd_new = qmp_marshal_blockdev_mirror,
1675     },
1676
1677 SQMP
1678 blockdev-mirror
1679 ------------
1680
1681 Start mirroring a block device's writes to another block device. target
1682 specifies the target of mirror operation.
1683
1684 Arguments:
1685
1686 - "device": device name to operate on (json-string)
1687 - "target": device name to mirror to (json-string)
1688 - "replaces": the block driver node name to replace when finished
1689               (json-string, optional)
1690 - "speed": maximum speed of the streaming job, in bytes per second
1691   (json-int)
1692 - "granularity": granularity of the dirty bitmap, in bytes (json-int, optional)
1693 - "buf_size": maximum amount of data in flight from source to target, in bytes
1694   (json-int, default 10M)
1695 - "sync": what parts of the disk image should be copied to the destination;
1696   possibilities include "full" for all the disk, "top" for only the sectors
1697   allocated in the topmost image, or "none" to only replicate new I/O
1698   (MirrorSyncMode).
1699 - "on-source-error": the action to take on an error on the source
1700   (BlockdevOnError, default 'report')
1701 - "on-target-error": the action to take on an error on the target
1702   (BlockdevOnError, default 'report')
1703
1704 The default value of the granularity is the image cluster size clamped
1705 between 4096 and 65536, if the image format defines one.  If the format
1706 does not define a cluster size, the default value of the granularity
1707 is 65536.
1708
1709 Example:
1710
1711 -> { "execute": "blockdev-mirror", "arguments": { "device": "ide-hd0",
1712                                                   "target": "target0",
1713                                                   "sync": "full" } }
1714 <- { "return": {} }
1715
1716 EQMP
1717     {
1718         .name       = "change-backing-file",
1719         .args_type  = "device:s,image-node-name:s,backing-file:s",
1720         .mhandler.cmd_new = qmp_marshal_change_backing_file,
1721     },
1722
1723 SQMP
1724 change-backing-file
1725 -------------------
1726 Since: 2.1
1727
1728 Change the backing file in the image file metadata.  This does not cause
1729 QEMU to reopen the image file to reparse the backing filename (it may,
1730 however, perform a reopen to change permissions from r/o -> r/w -> r/o,
1731 if needed). The new backing file string is written into the image file
1732 metadata, and the QEMU internal strings are updated.
1733
1734 Arguments:
1735
1736 - "image-node-name":    The name of the block driver state node of the
1737                         image to modify.  The "device" is argument is used to
1738                         verify "image-node-name" is in the chain described by
1739                         "device".
1740                         (json-string, optional)
1741
1742 - "device":             The name of the device.
1743                         (json-string)
1744
1745 - "backing-file":       The string to write as the backing file.  This string is
1746                         not validated, so care should be taken when specifying
1747                         the string or the image chain may not be able to be
1748                         reopened again.
1749                         (json-string)
1750
1751 Returns: Nothing on success
1752          If "device" does not exist or cannot be determined, DeviceNotFound
1753
1754 EQMP
1755
1756     {
1757         .name       = "balloon",
1758         .args_type  = "value:M",
1759         .mhandler.cmd_new = qmp_marshal_balloon,
1760     },
1761
1762 SQMP
1763 balloon
1764 -------
1765
1766 Request VM to change its memory allocation (in bytes).
1767
1768 Arguments:
1769
1770 - "value": New memory allocation (json-int)
1771
1772 Example:
1773
1774 -> { "execute": "balloon", "arguments": { "value": 536870912 } }
1775 <- { "return": {} }
1776
1777 EQMP
1778
1779     {
1780         .name       = "set_link",
1781         .args_type  = "name:s,up:b",
1782         .mhandler.cmd_new = qmp_marshal_set_link,
1783     },
1784
1785 SQMP
1786 set_link
1787 --------
1788
1789 Change the link status of a network adapter.
1790
1791 Arguments:
1792
1793 - "name": network device name (json-string)
1794 - "up": status is up (json-bool)
1795
1796 Example:
1797
1798 -> { "execute": "set_link", "arguments": { "name": "e1000.0", "up": false } }
1799 <- { "return": {} }
1800
1801 EQMP
1802
1803     {
1804         .name       = "getfd",
1805         .args_type  = "fdname:s",
1806         .params     = "getfd name",
1807         .help       = "receive a file descriptor via SCM rights and assign it a name",
1808         .mhandler.cmd_new = qmp_marshal_getfd,
1809     },
1810
1811 SQMP
1812 getfd
1813 -----
1814
1815 Receive a file descriptor via SCM rights and assign it a name.
1816
1817 Arguments:
1818
1819 - "fdname": file descriptor name (json-string)
1820
1821 Example:
1822
1823 -> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
1824 <- { "return": {} }
1825
1826 Notes:
1827
1828 (1) If the name specified by the "fdname" argument already exists,
1829     the file descriptor assigned to it will be closed and replaced
1830     by the received file descriptor.
1831 (2) The 'closefd' command can be used to explicitly close the file
1832     descriptor when it is no longer needed.
1833
1834 EQMP
1835
1836     {
1837         .name       = "closefd",
1838         .args_type  = "fdname:s",
1839         .params     = "closefd name",
1840         .help       = "close a file descriptor previously passed via SCM rights",
1841         .mhandler.cmd_new = qmp_marshal_closefd,
1842     },
1843
1844 SQMP
1845 closefd
1846 -------
1847
1848 Close a file descriptor previously passed via SCM rights.
1849
1850 Arguments:
1851
1852 - "fdname": file descriptor name (json-string)
1853
1854 Example:
1855
1856 -> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
1857 <- { "return": {} }
1858
1859 EQMP
1860
1861      {
1862         .name       = "add-fd",
1863         .args_type  = "fdset-id:i?,opaque:s?",
1864         .params     = "add-fd fdset-id opaque",
1865         .help       = "Add a file descriptor, that was passed via SCM rights, to an fd set",
1866         .mhandler.cmd_new = qmp_marshal_add_fd,
1867     },
1868
1869 SQMP
1870 add-fd
1871 -------
1872
1873 Add a file descriptor, that was passed via SCM rights, to an fd set.
1874
1875 Arguments:
1876
1877 - "fdset-id": The ID of the fd set to add the file descriptor to.
1878               (json-int, optional)
1879 - "opaque": A free-form string that can be used to describe the fd.
1880             (json-string, optional)
1881
1882 Return a json-object with the following information:
1883
1884 - "fdset-id": The ID of the fd set that the fd was added to. (json-int)
1885 - "fd": The file descriptor that was received via SCM rights and added to the
1886         fd set. (json-int)
1887
1888 Example:
1889
1890 -> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
1891 <- { "return": { "fdset-id": 1, "fd": 3 } }
1892
1893 Notes:
1894
1895 (1) The list of fd sets is shared by all monitor connections.
1896 (2) If "fdset-id" is not specified, a new fd set will be created.
1897
1898 EQMP
1899
1900      {
1901         .name       = "remove-fd",
1902         .args_type  = "fdset-id:i,fd:i?",
1903         .params     = "remove-fd fdset-id fd",
1904         .help       = "Remove a file descriptor from an fd set",
1905         .mhandler.cmd_new = qmp_marshal_remove_fd,
1906     },
1907
1908 SQMP
1909 remove-fd
1910 ---------
1911
1912 Remove a file descriptor from an fd set.
1913
1914 Arguments:
1915
1916 - "fdset-id": The ID of the fd set that the file descriptor belongs to.
1917               (json-int)
1918 - "fd": The file descriptor that is to be removed. (json-int, optional)
1919
1920 Example:
1921
1922 -> { "execute": "remove-fd", "arguments": { "fdset-id": 1, "fd": 3 } }
1923 <- { "return": {} }
1924
1925 Notes:
1926
1927 (1) The list of fd sets is shared by all monitor connections.
1928 (2) If "fd" is not specified, all file descriptors in "fdset-id" will be
1929     removed.
1930
1931 EQMP
1932
1933     {
1934         .name       = "query-fdsets",
1935         .args_type  = "",
1936         .help       = "Return information describing all fd sets",
1937         .mhandler.cmd_new = qmp_marshal_query_fdsets,
1938     },
1939
1940 SQMP
1941 query-fdsets
1942 -------------
1943
1944 Return information describing all fd sets.
1945
1946 Arguments: None
1947
1948 Example:
1949
1950 -> { "execute": "query-fdsets" }
1951 <- { "return": [
1952        {
1953          "fds": [
1954            {
1955              "fd": 30,
1956              "opaque": "rdonly:/path/to/file"
1957            },
1958            {
1959              "fd": 24,
1960              "opaque": "rdwr:/path/to/file"
1961            }
1962          ],
1963          "fdset-id": 1
1964        },
1965        {
1966          "fds": [
1967            {
1968              "fd": 28
1969            },
1970            {
1971              "fd": 29
1972            }
1973          ],
1974          "fdset-id": 0
1975        }
1976      ]
1977    }
1978
1979 Note: The list of fd sets is shared by all monitor connections.
1980
1981 EQMP
1982
1983     {
1984         .name       = "block_passwd",
1985         .args_type  = "device:s?,node-name:s?,password:s",
1986         .mhandler.cmd_new = qmp_marshal_block_passwd,
1987     },
1988
1989 SQMP
1990 block_passwd
1991 ------------
1992
1993 Set the password of encrypted block devices.
1994
1995 Arguments:
1996
1997 - "device": device name (json-string)
1998 - "node-name": name in the block driver state graph (json-string)
1999 - "password": password (json-string)
2000
2001 Example:
2002
2003 -> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
2004                                                "password": "12345" } }
2005 <- { "return": {} }
2006
2007 EQMP
2008
2009     {
2010         .name       = "block_set_io_throttle",
2011         .args_type  = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l,bps_max:l?,bps_rd_max:l?,bps_wr_max:l?,iops_max:l?,iops_rd_max:l?,iops_wr_max:l?,iops_size:l?,group:s?",
2012         .mhandler.cmd_new = qmp_marshal_block_set_io_throttle,
2013     },
2014
2015 SQMP
2016 block_set_io_throttle
2017 ------------
2018
2019 Change I/O throttle limits for a block drive.
2020
2021 Arguments:
2022
2023 - "device": device name (json-string)
2024 - "bps": total throughput limit in bytes per second (json-int)
2025 - "bps_rd": read throughput limit in bytes per second (json-int)
2026 - "bps_wr": write throughput limit in bytes per second (json-int)
2027 - "iops": total I/O operations per second (json-int)
2028 - "iops_rd": read I/O operations per second (json-int)
2029 - "iops_wr": write I/O operations per second (json-int)
2030 - "bps_max":  total max in bytes (json-int)
2031 - "bps_rd_max":  read max in bytes (json-int)
2032 - "bps_wr_max":  write max in bytes (json-int)
2033 - "iops_max":  total I/O operations max (json-int)
2034 - "iops_rd_max":  read I/O operations max (json-int)
2035 - "iops_wr_max":  write I/O operations max (json-int)
2036 - "iops_size":  I/O size in bytes when limiting (json-int)
2037 - "group": throttle group name (json-string)
2038
2039 Example:
2040
2041 -> { "execute": "block_set_io_throttle", "arguments": { "device": "virtio0",
2042                                                "bps": 1000000,
2043                                                "bps_rd": 0,
2044                                                "bps_wr": 0,
2045                                                "iops": 0,
2046                                                "iops_rd": 0,
2047                                                "iops_wr": 0,
2048                                                "bps_max": 8000000,
2049                                                "bps_rd_max": 0,
2050                                                "bps_wr_max": 0,
2051                                                "iops_max": 0,
2052                                                "iops_rd_max": 0,
2053                                                "iops_wr_max": 0,
2054                                                "iops_size": 0 } }
2055 <- { "return": {} }
2056
2057 EQMP
2058
2059     {
2060         .name       = "set_password",
2061         .args_type  = "protocol:s,password:s,connected:s?",
2062         .mhandler.cmd_new = qmp_marshal_set_password,
2063     },
2064
2065 SQMP
2066 set_password
2067 ------------
2068
2069 Set the password for vnc/spice protocols.
2070
2071 Arguments:
2072
2073 - "protocol": protocol name (json-string)
2074 - "password": password (json-string)
2075 - "connected": [ keep | disconnect | fail ] (json-string, optional)
2076
2077 Example:
2078
2079 -> { "execute": "set_password", "arguments": { "protocol": "vnc",
2080                                                "password": "secret" } }
2081 <- { "return": {} }
2082
2083 EQMP
2084
2085     {
2086         .name       = "expire_password",
2087         .args_type  = "protocol:s,time:s",
2088         .mhandler.cmd_new = qmp_marshal_expire_password,
2089     },
2090
2091 SQMP
2092 expire_password
2093 ---------------
2094
2095 Set the password expire time for vnc/spice protocols.
2096
2097 Arguments:
2098
2099 - "protocol": protocol name (json-string)
2100 - "time": [ now | never | +secs | secs ] (json-string)
2101
2102 Example:
2103
2104 -> { "execute": "expire_password", "arguments": { "protocol": "vnc",
2105                                                   "time": "+60" } }
2106 <- { "return": {} }
2107
2108 EQMP
2109
2110     {
2111         .name       = "add_client",
2112         .args_type  = "protocol:s,fdname:s,skipauth:b?,tls:b?",
2113         .mhandler.cmd_new = qmp_marshal_add_client,
2114     },
2115
2116 SQMP
2117 add_client
2118 ----------
2119
2120 Add a graphics client
2121
2122 Arguments:
2123
2124 - "protocol": protocol name (json-string)
2125 - "fdname": file descriptor name (json-string)
2126 - "skipauth": whether to skip authentication (json-bool, optional)
2127 - "tls": whether to perform TLS (json-bool, optional)
2128
2129 Example:
2130
2131 -> { "execute": "add_client", "arguments": { "protocol": "vnc",
2132                                              "fdname": "myclient" } }
2133 <- { "return": {} }
2134
2135 EQMP
2136     {
2137         .name       = "qmp_capabilities",
2138         .args_type  = "",
2139         .params     = "",
2140         .help       = "enable QMP capabilities",
2141         .mhandler.cmd_new = qmp_capabilities,
2142     },
2143
2144 SQMP
2145 qmp_capabilities
2146 ----------------
2147
2148 Enable QMP capabilities.
2149
2150 Arguments: None.
2151
2152 Example:
2153
2154 -> { "execute": "qmp_capabilities" }
2155 <- { "return": {} }
2156
2157 Note: This command must be issued before issuing any other command.
2158
2159 EQMP
2160
2161     {
2162         .name       = "human-monitor-command",
2163         .args_type  = "command-line:s,cpu-index:i?",
2164         .mhandler.cmd_new = qmp_marshal_human_monitor_command,
2165     },
2166
2167 SQMP
2168 human-monitor-command
2169 ---------------------
2170
2171 Execute a Human Monitor command.
2172
2173 Arguments: 
2174
2175 - command-line: the command name and its arguments, just like the
2176                 Human Monitor's shell (json-string)
2177 - cpu-index: select the CPU number to be used by commands which access CPU
2178              data, like 'info registers'. The Monitor selects CPU 0 if this
2179              argument is not provided (json-int, optional)
2180
2181 Example:
2182
2183 -> { "execute": "human-monitor-command", "arguments": { "command-line": "info kvm" } }
2184 <- { "return": "kvm support: enabled\r\n" }
2185
2186 Notes:
2187
2188 (1) The Human Monitor is NOT an stable interface, this means that command
2189     names, arguments and responses can change or be removed at ANY time.
2190     Applications that rely on long term stability guarantees should NOT
2191     use this command
2192
2193 (2) Limitations:
2194
2195     o This command is stateless, this means that commands that depend
2196       on state information (such as getfd) might not work
2197
2198     o Commands that prompt the user for data (eg. 'cont' when the block
2199       device is encrypted) don't currently work
2200
2201 3. Query Commands
2202 =================
2203
2204 HXCOMM Each query command below is inside a SQMP/EQMP section, do NOT change
2205 HXCOMM this! We will possibly move query commands definitions inside those
2206 HXCOMM sections, just like regular commands.
2207
2208 EQMP
2209
2210 SQMP
2211 query-version
2212 -------------
2213
2214 Show QEMU version.
2215
2216 Return a json-object with the following information:
2217
2218 - "qemu": A json-object containing three integer values:
2219     - "major": QEMU's major version (json-int)
2220     - "minor": QEMU's minor version (json-int)
2221     - "micro": QEMU's micro version (json-int)
2222 - "package": package's version (json-string)
2223
2224 Example:
2225
2226 -> { "execute": "query-version" }
2227 <- {
2228       "return":{
2229          "qemu":{
2230             "major":0,
2231             "minor":11,
2232             "micro":5
2233          },
2234          "package":""
2235       }
2236    }
2237
2238 EQMP
2239
2240     {
2241         .name       = "query-version",
2242         .args_type  = "",
2243         .mhandler.cmd_new = qmp_marshal_query_version,
2244     },
2245
2246 SQMP
2247 query-commands
2248 --------------
2249
2250 List QMP available commands.
2251
2252 Each command is represented by a json-object, the returned value is a json-array
2253 of all commands.
2254
2255 Each json-object contain:
2256
2257 - "name": command's name (json-string)
2258
2259 Example:
2260
2261 -> { "execute": "query-commands" }
2262 <- {
2263       "return":[
2264          {
2265             "name":"query-balloon"
2266          },
2267          {
2268             "name":"system_powerdown"
2269          }
2270       ]
2271    }
2272
2273 Note: This example has been shortened as the real response is too long.
2274
2275 EQMP
2276
2277     {
2278         .name       = "query-commands",
2279         .args_type  = "",
2280         .mhandler.cmd_new = qmp_marshal_query_commands,
2281     },
2282
2283 SQMP
2284 query-events
2285 --------------
2286
2287 List QMP available events.
2288
2289 Each event is represented by a json-object, the returned value is a json-array
2290 of all events.
2291
2292 Each json-object contains:
2293
2294 - "name": event's name (json-string)
2295
2296 Example:
2297
2298 -> { "execute": "query-events" }
2299 <- {
2300       "return":[
2301          {
2302             "name":"SHUTDOWN"
2303          },
2304          {
2305             "name":"RESET"
2306          }
2307       ]
2308    }
2309
2310 Note: This example has been shortened as the real response is too long.
2311
2312 EQMP
2313
2314     {
2315         .name       = "query-events",
2316         .args_type  = "",
2317         .mhandler.cmd_new = qmp_marshal_query_events,
2318     },
2319
2320 SQMP
2321 query-qmp-schema
2322 ----------------
2323
2324 Return the QMP wire schema.  The returned value is a json-array of
2325 named schema entities.  Entities are commands, events and various
2326 types.  See docs/qapi-code-gen.txt for information on their structure
2327 and intended use.
2328
2329 EQMP
2330
2331     {
2332         .name       = "query-qmp-schema",
2333         .args_type  = "",
2334         .mhandler.cmd_new = qmp_query_qmp_schema,
2335     },
2336
2337 SQMP
2338 query-chardev
2339 -------------
2340
2341 Each device is represented by a json-object. The returned value is a json-array
2342 of all devices.
2343
2344 Each json-object contain the following:
2345
2346 - "label": device's label (json-string)
2347 - "filename": device's file (json-string)
2348 - "frontend-open": open/closed state of the frontend device attached to this
2349                    backend (json-bool)
2350
2351 Example:
2352
2353 -> { "execute": "query-chardev" }
2354 <- {
2355       "return": [
2356          {
2357             "label": "charchannel0",
2358             "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.agent,server",
2359             "frontend-open": false
2360          },
2361          {
2362             "label": "charmonitor",
2363             "filename": "unix:/var/lib/libvirt/qemu/seabios.rhel6.monitor,server",
2364             "frontend-open": true
2365          },
2366          {
2367             "label": "charserial0",
2368             "filename": "pty:/dev/pts/2",
2369             "frontend-open": true
2370          }
2371       ]
2372    }
2373
2374 EQMP
2375
2376     {
2377         .name       = "query-chardev",
2378         .args_type  = "",
2379         .mhandler.cmd_new = qmp_marshal_query_chardev,
2380     },
2381
2382 SQMP
2383 query-chardev-backends
2384 -------------
2385
2386 List available character device backends.
2387
2388 Each backend is represented by a json-object, the returned value is a json-array
2389 of all backends.
2390
2391 Each json-object contains:
2392
2393 - "name": backend name (json-string)
2394
2395 Example:
2396
2397 -> { "execute": "query-chardev-backends" }
2398 <- {
2399       "return":[
2400          {
2401             "name":"udp"
2402          },
2403          {
2404             "name":"tcp"
2405          },
2406          {
2407             "name":"unix"
2408          },
2409          {
2410             "name":"spiceport"
2411          }
2412       ]
2413    }
2414
2415 EQMP
2416
2417     {
2418         .name       = "query-chardev-backends",
2419         .args_type  = "",
2420         .mhandler.cmd_new = qmp_marshal_query_chardev_backends,
2421     },
2422
2423 SQMP
2424 query-block
2425 -----------
2426
2427 Show the block devices.
2428
2429 Each block device information is stored in a json-object and the returned value
2430 is a json-array of all devices.
2431
2432 Each json-object contain the following:
2433
2434 - "device": device name (json-string)
2435 - "type": device type (json-string)
2436          - deprecated, retained for backward compatibility
2437          - Possible values: "unknown"
2438 - "removable": true if the device is removable, false otherwise (json-bool)
2439 - "locked": true if the device is locked, false otherwise (json-bool)
2440 - "tray_open": only present if removable, true if the device has a tray,
2441                and it is open (json-bool)
2442 - "inserted": only present if the device is inserted, it is a json-object
2443    containing the following:
2444          - "file": device file name (json-string)
2445          - "ro": true if read-only, false otherwise (json-bool)
2446          - "drv": driver format name (json-string)
2447              - Possible values: "blkdebug", "bochs", "cloop", "dmg",
2448                                 "file", "file", "ftp", "ftps", "host_cdrom",
2449                                 "host_device", "http", "https",
2450                                 "nbd", "parallels", "qcow", "qcow2", "raw",
2451                                 "tftp", "vdi", "vmdk", "vpc", "vvfat"
2452          - "backing_file": backing file name (json-string, optional)
2453          - "backing_file_depth": number of files in the backing file chain (json-int)
2454          - "encrypted": true if encrypted, false otherwise (json-bool)
2455          - "bps": limit total bytes per second (json-int)
2456          - "bps_rd": limit read bytes per second (json-int)
2457          - "bps_wr": limit write bytes per second (json-int)
2458          - "iops": limit total I/O operations per second (json-int)
2459          - "iops_rd": limit read operations per second (json-int)
2460          - "iops_wr": limit write operations per second (json-int)
2461          - "bps_max":  total max in bytes (json-int)
2462          - "bps_rd_max":  read max in bytes (json-int)
2463          - "bps_wr_max":  write max in bytes (json-int)
2464          - "iops_max":  total I/O operations max (json-int)
2465          - "iops_rd_max":  read I/O operations max (json-int)
2466          - "iops_wr_max":  write I/O operations max (json-int)
2467          - "iops_size": I/O size when limiting by iops (json-int)
2468          - "detect_zeroes": detect and optimize zero writing (json-string)
2469              - Possible values: "off", "on", "unmap"
2470          - "write_threshold": write offset threshold in bytes, a event will be
2471                               emitted if crossed. Zero if disabled (json-int)
2472          - "image": the detail of the image, it is a json-object containing
2473             the following:
2474              - "filename": image file name (json-string)
2475              - "format": image format (json-string)
2476              - "virtual-size": image capacity in bytes (json-int)
2477              - "dirty-flag": true if image is not cleanly closed, not present
2478                              means clean (json-bool, optional)
2479              - "actual-size": actual size on disk in bytes of the image, not
2480                               present when image does not support thin
2481                               provision (json-int, optional)
2482              - "cluster-size": size of a cluster in bytes, not present if image
2483                                format does not support it (json-int, optional)
2484              - "encrypted": true if the image is encrypted, not present means
2485                             false or the image format does not support
2486                             encryption (json-bool, optional)
2487              - "backing_file": backing file name, not present means no backing
2488                                file is used or the image format does not
2489                                support backing file chain
2490                                (json-string, optional)
2491              - "full-backing-filename": full path of the backing file, not
2492                                         present if it equals backing_file or no
2493                                         backing file is used
2494                                         (json-string, optional)
2495              - "backing-filename-format": the format of the backing file, not
2496                                           present means unknown or no backing
2497                                           file (json-string, optional)
2498              - "snapshots": the internal snapshot info, it is an optional list
2499                 of json-object containing the following:
2500                  - "id": unique snapshot id (json-string)
2501                  - "name": snapshot name (json-string)
2502                  - "vm-state-size": size of the VM state in bytes (json-int)
2503                  - "date-sec": UTC date of the snapshot in seconds (json-int)
2504                  - "date-nsec": fractional part in nanoseconds to be used with
2505                                 date-sec (json-int)
2506                  - "vm-clock-sec": VM clock relative to boot in seconds
2507                                    (json-int)
2508                  - "vm-clock-nsec": fractional part in nanoseconds to be used
2509                                     with vm-clock-sec (json-int)
2510              - "backing-image": the detail of the backing image, it is an
2511                                 optional json-object only present when a
2512                                 backing image present for this image
2513
2514 - "io-status": I/O operation status, only present if the device supports it
2515                and the VM is configured to stop on errors. It's always reset
2516                to "ok" when the "cont" command is issued (json_string, optional)
2517              - Possible values: "ok", "failed", "nospace"
2518
2519 Example:
2520
2521 -> { "execute": "query-block" }
2522 <- {
2523       "return":[
2524          {
2525             "io-status": "ok",
2526             "device":"ide0-hd0",
2527             "locked":false,
2528             "removable":false,
2529             "inserted":{
2530                "ro":false,
2531                "drv":"qcow2",
2532                "encrypted":false,
2533                "file":"disks/test.qcow2",
2534                "backing_file_depth":1,
2535                "bps":1000000,
2536                "bps_rd":0,
2537                "bps_wr":0,
2538                "iops":1000000,
2539                "iops_rd":0,
2540                "iops_wr":0,
2541                "bps_max": 8000000,
2542                "bps_rd_max": 0,
2543                "bps_wr_max": 0,
2544                "iops_max": 0,
2545                "iops_rd_max": 0,
2546                "iops_wr_max": 0,
2547                "iops_size": 0,
2548                "detect_zeroes": "on",
2549                "write_threshold": 0,
2550                "image":{
2551                   "filename":"disks/test.qcow2",
2552                   "format":"qcow2",
2553                   "virtual-size":2048000,
2554                   "backing_file":"base.qcow2",
2555                   "full-backing-filename":"disks/base.qcow2",
2556                   "backing-filename-format":"qcow2",
2557                   "snapshots":[
2558                      {
2559                         "id": "1",
2560                         "name": "snapshot1",
2561                         "vm-state-size": 0,
2562                         "date-sec": 10000200,
2563                         "date-nsec": 12,
2564                         "vm-clock-sec": 206,
2565                         "vm-clock-nsec": 30
2566                      }
2567                   ],
2568                   "backing-image":{
2569                       "filename":"disks/base.qcow2",
2570                       "format":"qcow2",
2571                       "virtual-size":2048000
2572                   }
2573                }
2574             },
2575             "type":"unknown"
2576          },
2577          {
2578             "io-status": "ok",
2579             "device":"ide1-cd0",
2580             "locked":false,
2581             "removable":true,
2582             "type":"unknown"
2583          },
2584          {
2585             "device":"floppy0",
2586             "locked":false,
2587             "removable":true,
2588             "type":"unknown"
2589          },
2590          {
2591             "device":"sd0",
2592             "locked":false,
2593             "removable":true,
2594             "type":"unknown"
2595          }
2596       ]
2597    }
2598
2599 EQMP
2600
2601     {
2602         .name       = "query-block",
2603         .args_type  = "",
2604         .mhandler.cmd_new = qmp_marshal_query_block,
2605     },
2606
2607 SQMP
2608 query-blockstats
2609 ----------------
2610
2611 Show block device statistics.
2612
2613 Each device statistic information is stored in a json-object and the returned
2614 value is a json-array of all devices.
2615
2616 Each json-object contain the following:
2617
2618 - "device": device name (json-string)
2619 - "stats": A json-object with the statistics information, it contains:
2620     - "rd_bytes": bytes read (json-int)
2621     - "wr_bytes": bytes written (json-int)
2622     - "rd_operations": read operations (json-int)
2623     - "wr_operations": write operations (json-int)
2624     - "flush_operations": cache flush operations (json-int)
2625     - "wr_total_time_ns": total time spend on writes in nano-seconds (json-int)
2626     - "rd_total_time_ns": total time spend on reads in nano-seconds (json-int)
2627     - "flush_total_time_ns": total time spend on cache flushes in nano-seconds (json-int)
2628     - "wr_highest_offset": The offset after the greatest byte written to the
2629                            BlockDriverState since it has been opened (json-int)
2630     - "rd_merged": number of read requests that have been merged into
2631                    another request (json-int)
2632     - "wr_merged": number of write requests that have been merged into
2633                    another request (json-int)
2634     - "idle_time_ns": time since the last I/O operation, in
2635                       nanoseconds. If the field is absent it means
2636                       that there haven't been any operations yet
2637                       (json-int, optional)
2638     - "failed_rd_operations": number of failed read operations
2639                               (json-int)
2640     - "failed_wr_operations": number of failed write operations
2641                               (json-int)
2642     - "failed_flush_operations": number of failed flush operations
2643                                (json-int)
2644     - "invalid_rd_operations": number of invalid read operations
2645                                (json-int)
2646     - "invalid_wr_operations": number of invalid write operations
2647                                (json-int)
2648     - "invalid_flush_operations": number of invalid flush operations
2649                                   (json-int)
2650     - "account_invalid": whether invalid operations are included in
2651                          the last access statistics (json-bool)
2652     - "account_failed": whether failed operations are included in the
2653                          latency and last access statistics
2654                          (json-bool)
2655     - "timed_stats": A json-array containing statistics collected in
2656                      specific intervals, with the following members:
2657         - "interval_length": interval used for calculating the
2658                              statistics, in seconds (json-int)
2659         - "min_rd_latency_ns": minimum latency of read operations in
2660                                the defined interval, in nanoseconds
2661                                (json-int)
2662         - "min_wr_latency_ns": minimum latency of write operations in
2663                                the defined interval, in nanoseconds
2664                                (json-int)
2665         - "min_flush_latency_ns": minimum latency of flush operations
2666                                   in the defined interval, in
2667                                   nanoseconds (json-int)
2668         - "max_rd_latency_ns": maximum latency of read operations in
2669                                the defined interval, in nanoseconds
2670                                (json-int)
2671         - "max_wr_latency_ns": maximum latency of write operations in
2672                                the defined interval, in nanoseconds
2673                                (json-int)
2674         - "max_flush_latency_ns": maximum latency of flush operations
2675                                   in the defined interval, in
2676                                   nanoseconds (json-int)
2677         - "avg_rd_latency_ns": average latency of read operations in
2678                                the defined interval, in nanoseconds
2679                                (json-int)
2680         - "avg_wr_latency_ns": average latency of write operations in
2681                                the defined interval, in nanoseconds
2682                                (json-int)
2683         - "avg_flush_latency_ns": average latency of flush operations
2684                                   in the defined interval, in
2685                                   nanoseconds (json-int)
2686         - "avg_rd_queue_depth": average number of pending read
2687                                 operations in the defined interval
2688                                 (json-number)
2689         - "avg_wr_queue_depth": average number of pending write
2690                                 operations in the defined interval
2691                                 (json-number).
2692 - "parent": Contains recursively the statistics of the underlying
2693             protocol (e.g. the host file for a qcow2 image). If there is
2694             no underlying protocol, this field is omitted
2695             (json-object, optional)
2696
2697 Example:
2698
2699 -> { "execute": "query-blockstats" }
2700 <- {
2701       "return":[
2702          {
2703             "device":"ide0-hd0",
2704             "parent":{
2705                "stats":{
2706                   "wr_highest_offset":3686448128,
2707                   "wr_bytes":9786368,
2708                   "wr_operations":751,
2709                   "rd_bytes":122567168,
2710                   "rd_operations":36772
2711                   "wr_total_times_ns":313253456
2712                   "rd_total_times_ns":3465673657
2713                   "flush_total_times_ns":49653
2714                   "flush_operations":61,
2715                   "rd_merged":0,
2716                   "wr_merged":0,
2717                   "idle_time_ns":2953431879,
2718                   "account_invalid":true,
2719                   "account_failed":false
2720                }
2721             },
2722             "stats":{
2723                "wr_highest_offset":2821110784,
2724                "wr_bytes":9786368,
2725                "wr_operations":692,
2726                "rd_bytes":122739200,
2727                "rd_operations":36604
2728                "flush_operations":51,
2729                "wr_total_times_ns":313253456
2730                "rd_total_times_ns":3465673657
2731                "flush_total_times_ns":49653,
2732                "rd_merged":0,
2733                "wr_merged":0,
2734                "idle_time_ns":2953431879,
2735                "account_invalid":true,
2736                "account_failed":false
2737             }
2738          },
2739          {
2740             "device":"ide1-cd0",
2741             "stats":{
2742                "wr_highest_offset":0,
2743                "wr_bytes":0,
2744                "wr_operations":0,
2745                "rd_bytes":0,
2746                "rd_operations":0
2747                "flush_operations":0,
2748                "wr_total_times_ns":0
2749                "rd_total_times_ns":0
2750                "flush_total_times_ns":0,
2751                "rd_merged":0,
2752                "wr_merged":0,
2753                "account_invalid":false,
2754                "account_failed":false
2755             }
2756          },
2757          {
2758             "device":"floppy0",
2759             "stats":{
2760                "wr_highest_offset":0,
2761                "wr_bytes":0,
2762                "wr_operations":0,
2763                "rd_bytes":0,
2764                "rd_operations":0
2765                "flush_operations":0,
2766                "wr_total_times_ns":0
2767                "rd_total_times_ns":0
2768                "flush_total_times_ns":0,
2769                "rd_merged":0,
2770                "wr_merged":0,
2771                "account_invalid":false,
2772                "account_failed":false
2773             }
2774          },
2775          {
2776             "device":"sd0",
2777             "stats":{
2778                "wr_highest_offset":0,
2779                "wr_bytes":0,
2780                "wr_operations":0,
2781                "rd_bytes":0,
2782                "rd_operations":0
2783                "flush_operations":0,
2784                "wr_total_times_ns":0
2785                "rd_total_times_ns":0
2786                "flush_total_times_ns":0,
2787                "rd_merged":0,
2788                "wr_merged":0,
2789                "account_invalid":false,
2790                "account_failed":false
2791             }
2792          }
2793       ]
2794    }
2795
2796 EQMP
2797
2798     {
2799         .name       = "query-blockstats",
2800         .args_type  = "query-nodes:b?",
2801         .mhandler.cmd_new = qmp_marshal_query_blockstats,
2802     },
2803
2804 SQMP
2805 query-cpus
2806 ----------
2807
2808 Show CPU information.
2809
2810 Return a json-array. Each CPU is represented by a json-object, which contains:
2811
2812 - "CPU": CPU index (json-int)
2813 - "current": true if this is the current CPU, false otherwise (json-bool)
2814 - "halted": true if the cpu is halted, false otherwise (json-bool)
2815 - "qom_path": path to the CPU object in the QOM tree (json-str)
2816 - "arch": architecture of the cpu, which determines what additional
2817           keys will be present (json-str)
2818 - Current program counter. The key's name depends on the architecture:
2819      "pc": i386/x86_64 (json-int)
2820      "nip": PPC (json-int)
2821      "pc" and "npc": sparc (json-int)
2822      "PC": mips (json-int)
2823 - "thread_id": ID of the underlying host thread (json-int)
2824
2825 Example:
2826
2827 -> { "execute": "query-cpus" }
2828 <- {
2829       "return":[
2830          {
2831             "CPU":0,
2832             "current":true,
2833             "halted":false,
2834             "qom_path":"/machine/unattached/device[0]",
2835             "arch":"x86",
2836             "pc":3227107138,
2837             "thread_id":3134
2838          },
2839          {
2840             "CPU":1,
2841             "current":false,
2842             "halted":true,
2843             "qom_path":"/machine/unattached/device[2]",
2844             "arch":"x86",
2845             "pc":7108165,
2846             "thread_id":3135
2847          }
2848       ]
2849    }
2850
2851 EQMP
2852
2853     {
2854         .name       = "query-cpus",
2855         .args_type  = "",
2856         .mhandler.cmd_new = qmp_marshal_query_cpus,
2857     },
2858
2859 SQMP
2860 query-iothreads
2861 ---------------
2862
2863 Returns a list of information about each iothread.
2864
2865 Note this list excludes the QEMU main loop thread, which is not declared
2866 using the -object iothread command-line option.  It is always the main thread
2867 of the process.
2868
2869 Return a json-array. Each iothread is represented by a json-object, which contains:
2870
2871 - "id": name of iothread (json-str)
2872 - "thread-id": ID of the underlying host thread (json-int)
2873
2874 Example:
2875
2876 -> { "execute": "query-iothreads" }
2877 <- {
2878       "return":[
2879          {
2880             "id":"iothread0",
2881             "thread-id":3134
2882          },
2883          {
2884             "id":"iothread1",
2885             "thread-id":3135
2886          }
2887       ]
2888    }
2889
2890 EQMP
2891
2892     {
2893         .name       = "query-iothreads",
2894         .args_type  = "",
2895         .mhandler.cmd_new = qmp_marshal_query_iothreads,
2896     },
2897
2898 SQMP
2899 query-pci
2900 ---------
2901
2902 PCI buses and devices information.
2903
2904 The returned value is a json-array of all buses. Each bus is represented by
2905 a json-object, which has a key with a json-array of all PCI devices attached
2906 to it. Each device is represented by a json-object.
2907
2908 The bus json-object contains the following:
2909
2910 - "bus": bus number (json-int)
2911 - "devices": a json-array of json-objects, each json-object represents a
2912              PCI device
2913
2914 The PCI device json-object contains the following:
2915
2916 - "bus": identical to the parent's bus number (json-int)
2917 - "slot": slot number (json-int)
2918 - "function": function number (json-int)
2919 - "class_info": a json-object containing:
2920      - "desc": device class description (json-string, optional)
2921      - "class": device class number (json-int)
2922 - "id": a json-object containing:
2923      - "device": device ID (json-int)
2924      - "vendor": vendor ID (json-int)
2925 - "irq": device's IRQ if assigned (json-int, optional)
2926 - "qdev_id": qdev id string (json-string)
2927 - "pci_bridge": It's a json-object, only present if this device is a
2928                 PCI bridge, contains:
2929      - "bus": bus number (json-int)
2930      - "secondary": secondary bus number (json-int)
2931      - "subordinate": subordinate bus number (json-int)
2932      - "io_range": I/O memory range information, a json-object with the
2933                    following members:
2934                  - "base": base address, in bytes (json-int)
2935                  - "limit": limit address, in bytes (json-int)
2936      - "memory_range": memory range information, a json-object with the
2937                        following members:
2938                  - "base": base address, in bytes (json-int)
2939                  - "limit": limit address, in bytes (json-int)
2940      - "prefetchable_range": Prefetchable memory range information, a
2941                              json-object with the following members:
2942                  - "base": base address, in bytes (json-int)
2943                  - "limit": limit address, in bytes (json-int)
2944      - "devices": a json-array of PCI devices if there's any attached, each
2945                   each element is represented by a json-object, which contains
2946                   the same members of the 'PCI device json-object' described
2947                   above (optional)
2948 - "regions": a json-array of json-objects, each json-object represents a
2949              memory region of this device
2950
2951 The memory range json-object contains the following:
2952
2953 - "base": base memory address (json-int)
2954 - "limit": limit value (json-int)
2955
2956 The region json-object can be an I/O region or a memory region, an I/O region
2957 json-object contains the following:
2958
2959 - "type": "io" (json-string, fixed)
2960 - "bar": BAR number (json-int)
2961 - "address": memory address (json-int)
2962 - "size": memory size (json-int)
2963
2964 A memory region json-object contains the following:
2965
2966 - "type": "memory" (json-string, fixed)
2967 - "bar": BAR number (json-int)
2968 - "address": memory address (json-int)
2969 - "size": memory size (json-int)
2970 - "mem_type_64": true or false (json-bool)
2971 - "prefetch": true or false (json-bool)
2972
2973 Example:
2974
2975 -> { "execute": "query-pci" }
2976 <- {
2977       "return":[
2978          {
2979             "bus":0,
2980             "devices":[
2981                {
2982                   "bus":0,
2983                   "qdev_id":"",
2984                   "slot":0,
2985                   "class_info":{
2986                      "class":1536,
2987                      "desc":"Host bridge"
2988                   },
2989                   "id":{
2990                      "device":32902,
2991                      "vendor":4663
2992                   },
2993                   "function":0,
2994                   "regions":[
2995    
2996                   ]
2997                },
2998                {
2999                   "bus":0,
3000                   "qdev_id":"",
3001                   "slot":1,
3002                   "class_info":{
3003                      "class":1537,
3004                      "desc":"ISA bridge"
3005                   },
3006                   "id":{
3007                      "device":32902,
3008                      "vendor":28672
3009                   },
3010                   "function":0,
3011                   "regions":[
3012    
3013                   ]
3014                },
3015                {
3016                   "bus":0,
3017                   "qdev_id":"",
3018                   "slot":1,
3019                   "class_info":{
3020                      "class":257,
3021                      "desc":"IDE controller"
3022                   },
3023                   "id":{
3024                      "device":32902,
3025                      "vendor":28688
3026                   },
3027                   "function":1,
3028                   "regions":[
3029                      {
3030                         "bar":4,
3031                         "size":16,
3032                         "address":49152,
3033                         "type":"io"
3034                      }
3035                   ]
3036                },
3037                {
3038                   "bus":0,
3039                   "qdev_id":"",
3040                   "slot":2,
3041                   "class_info":{
3042                      "class":768,
3043                      "desc":"VGA controller"
3044                   },
3045                   "id":{
3046                      "device":4115,
3047                      "vendor":184
3048                   },
3049                   "function":0,
3050                   "regions":[
3051                      {
3052                         "prefetch":true,
3053                         "mem_type_64":false,
3054                         "bar":0,
3055                         "size":33554432,
3056                         "address":4026531840,
3057                         "type":"memory"
3058                      },
3059                      {
3060                         "prefetch":false,
3061                         "mem_type_64":false,
3062                         "bar":1,
3063                         "size":4096,
3064                         "address":4060086272,
3065                         "type":"memory"
3066                      },
3067                      {
3068                         "prefetch":false,
3069                         "mem_type_64":false,
3070                         "bar":6,
3071                         "size":65536,
3072                         "address":-1,
3073                         "type":"memory"
3074                      }
3075                   ]
3076                },
3077                {
3078                   "bus":0,
3079                   "qdev_id":"",
3080                   "irq":11,
3081                   "slot":4,
3082                   "class_info":{
3083                      "class":1280,
3084                      "desc":"RAM controller"
3085                   },
3086                   "id":{
3087                      "device":6900,
3088                      "vendor":4098
3089                   },
3090                   "function":0,
3091                   "regions":[
3092                      {
3093                         "bar":0,
3094                         "size":32,
3095                         "address":49280,
3096                         "type":"io"
3097                      }
3098                   ]
3099                }
3100             ]
3101          }
3102       ]
3103    }
3104
3105 Note: This example has been shortened as the real response is too long.
3106
3107 EQMP
3108
3109     {
3110         .name       = "query-pci",
3111         .args_type  = "",
3112         .mhandler.cmd_new = qmp_marshal_query_pci,
3113     },
3114
3115 SQMP
3116 query-kvm
3117 ---------
3118
3119 Show KVM information.
3120
3121 Return a json-object with the following information:
3122
3123 - "enabled": true if KVM support is enabled, false otherwise (json-bool)
3124 - "present": true if QEMU has KVM support, false otherwise (json-bool)
3125
3126 Example:
3127
3128 -> { "execute": "query-kvm" }
3129 <- { "return": { "enabled": true, "present": true } }
3130
3131 EQMP
3132
3133     {
3134         .name       = "query-kvm",
3135         .args_type  = "",
3136         .mhandler.cmd_new = qmp_marshal_query_kvm,
3137     },
3138
3139 SQMP
3140 query-status
3141 ------------
3142
3143 Return a json-object with the following information:
3144
3145 - "running": true if the VM is running, or false if it is paused (json-bool)
3146 - "singlestep": true if the VM is in single step mode,
3147                 false otherwise (json-bool)
3148 - "status": one of the following values (json-string)
3149     "debug" - QEMU is running on a debugger
3150     "inmigrate" - guest is paused waiting for an incoming migration
3151     "internal-error" - An internal error that prevents further guest
3152     execution has occurred
3153     "io-error" - the last IOP has failed and the device is configured
3154     to pause on I/O errors
3155     "paused" - guest has been paused via the 'stop' command
3156     "postmigrate" - guest is paused following a successful 'migrate'
3157     "prelaunch" - QEMU was started with -S and guest has not started
3158     "finish-migrate" - guest is paused to finish the migration process
3159     "restore-vm" - guest is paused to restore VM state
3160     "running" - guest is actively running
3161     "save-vm" - guest is paused to save the VM state
3162     "shutdown" - guest is shut down (and -no-shutdown is in use)
3163     "watchdog" - the watchdog action is configured to pause and
3164      has been triggered
3165
3166 Example:
3167
3168 -> { "execute": "query-status" }
3169 <- { "return": { "running": true, "singlestep": false, "status": "running" } }
3170
3171 EQMP
3172     
3173     {
3174         .name       = "query-status",
3175         .args_type  = "",
3176         .mhandler.cmd_new = qmp_marshal_query_status,
3177     },
3178
3179 SQMP
3180 query-mice
3181 ----------
3182
3183 Show VM mice information.
3184
3185 Each mouse is represented by a json-object, the returned value is a json-array
3186 of all mice.
3187
3188 The mouse json-object contains the following:
3189
3190 - "name": mouse's name (json-string)
3191 - "index": mouse's index (json-int)
3192 - "current": true if this mouse is receiving events, false otherwise (json-bool)
3193 - "absolute": true if the mouse generates absolute input events (json-bool)
3194
3195 Example:
3196
3197 -> { "execute": "query-mice" }
3198 <- {
3199       "return":[
3200          {
3201             "name":"QEMU Microsoft Mouse",
3202             "index":0,
3203             "current":false,
3204             "absolute":false
3205          },
3206          {
3207             "name":"QEMU PS/2 Mouse",
3208             "index":1,
3209             "current":true,
3210             "absolute":true
3211          }
3212       ]
3213    }
3214
3215 EQMP
3216
3217     {
3218         .name       = "query-mice",
3219         .args_type  = "",
3220         .mhandler.cmd_new = qmp_marshal_query_mice,
3221     },
3222
3223 SQMP
3224 query-vnc
3225 ---------
3226
3227 Show VNC server information.
3228
3229 Return a json-object with server information. Connected clients are returned
3230 as a json-array of json-objects.
3231
3232 The main json-object contains the following:
3233
3234 - "enabled": true or false (json-bool)
3235 - "host": server's IP address (json-string)
3236 - "family": address family (json-string)
3237          - Possible values: "ipv4", "ipv6", "unix", "unknown"
3238 - "service": server's port number (json-string)
3239 - "auth": authentication method (json-string)
3240          - Possible values: "invalid", "none", "ra2", "ra2ne", "sasl", "tight",
3241                             "tls", "ultra", "unknown", "vencrypt", "vencrypt",
3242                             "vencrypt+plain", "vencrypt+tls+none",
3243                             "vencrypt+tls+plain", "vencrypt+tls+sasl",
3244                             "vencrypt+tls+vnc", "vencrypt+x509+none",
3245                             "vencrypt+x509+plain", "vencrypt+x509+sasl",
3246                             "vencrypt+x509+vnc", "vnc"
3247 - "clients": a json-array of all connected clients
3248
3249 Clients are described by a json-object, each one contain the following:
3250
3251 - "host": client's IP address (json-string)
3252 - "family": address family (json-string)
3253          - Possible values: "ipv4", "ipv6", "unix", "unknown"
3254 - "service": client's port number (json-string)
3255 - "x509_dname": TLS dname (json-string, optional)
3256 - "sasl_username": SASL username (json-string, optional)
3257
3258 Example:
3259
3260 -> { "execute": "query-vnc" }
3261 <- {
3262       "return":{
3263          "enabled":true,
3264          "host":"0.0.0.0",
3265          "service":"50402",
3266          "auth":"vnc",
3267          "family":"ipv4",
3268          "clients":[
3269             {
3270                "host":"127.0.0.1",
3271                "service":"50401",
3272                "family":"ipv4"
3273             }
3274          ]
3275       }
3276    }
3277
3278 EQMP
3279
3280     {
3281         .name       = "query-vnc",
3282         .args_type  = "",
3283         .mhandler.cmd_new = qmp_marshal_query_vnc,
3284     },
3285     {
3286         .name       = "query-vnc-servers",
3287         .args_type  = "",
3288         .mhandler.cmd_new = qmp_marshal_query_vnc_servers,
3289     },
3290
3291 SQMP
3292 query-spice
3293 -----------
3294
3295 Show SPICE server information.
3296
3297 Return a json-object with server information. Connected clients are returned
3298 as a json-array of json-objects.
3299
3300 The main json-object contains the following:
3301
3302 - "enabled": true or false (json-bool)
3303 - "host": server's IP address (json-string)
3304 - "port": server's port number (json-int, optional)
3305 - "tls-port": server's port number (json-int, optional)
3306 - "auth": authentication method (json-string)
3307          - Possible values: "none", "spice"
3308 - "channels": a json-array of all active channels clients
3309
3310 Channels are described by a json-object, each one contain the following:
3311
3312 - "host": client's IP address (json-string)
3313 - "family": address family (json-string)
3314          - Possible values: "ipv4", "ipv6", "unix", "unknown"
3315 - "port": client's port number (json-string)
3316 - "connection-id": spice connection id.  All channels with the same id
3317                    belong to the same spice session (json-int)
3318 - "channel-type": channel type.  "1" is the main control channel, filter for
3319                   this one if you want track spice sessions only (json-int)
3320 - "channel-id": channel id.  Usually "0", might be different needed when
3321                 multiple channels of the same type exist, such as multiple
3322                 display channels in a multihead setup (json-int)
3323 - "tls": whether the channel is encrypted (json-bool)
3324
3325 Example:
3326
3327 -> { "execute": "query-spice" }
3328 <- {
3329       "return": {
3330          "enabled": true,
3331          "auth": "spice",
3332          "port": 5920,
3333          "tls-port": 5921,
3334          "host": "0.0.0.0",
3335          "channels": [
3336             {
3337                "port": "54924",
3338                "family": "ipv4",
3339                "channel-type": 1,
3340                "connection-id": 1804289383,
3341                "host": "127.0.0.1",
3342                "channel-id": 0,
3343                "tls": true
3344             },
3345             {
3346                "port": "36710",
3347                "family": "ipv4",
3348                "channel-type": 4,
3349                "connection-id": 1804289383,
3350                "host": "127.0.0.1",
3351                "channel-id": 0,
3352                "tls": false
3353             },
3354             [ ... more channels follow ... ]
3355          ]
3356       }
3357    }
3358
3359 EQMP
3360
3361 #if defined(CONFIG_SPICE)
3362     {
3363         .name       = "query-spice",
3364         .args_type  = "",
3365         .mhandler.cmd_new = qmp_marshal_query_spice,
3366     },
3367 #endif
3368
3369 SQMP
3370 query-name
3371 ----------
3372
3373 Show VM name.
3374
3375 Return a json-object with the following information:
3376
3377 - "name": VM's name (json-string, optional)
3378
3379 Example:
3380
3381 -> { "execute": "query-name" }
3382 <- { "return": { "name": "qemu-name" } }
3383
3384 EQMP
3385
3386     {
3387         .name       = "query-name",
3388         .args_type  = "",
3389         .mhandler.cmd_new = qmp_marshal_query_name,
3390     },
3391
3392 SQMP
3393 query-uuid
3394 ----------
3395
3396 Show VM UUID.
3397
3398 Return a json-object with the following information:
3399
3400 - "UUID": Universally Unique Identifier (json-string)
3401
3402 Example:
3403
3404 -> { "execute": "query-uuid" }
3405 <- { "return": { "UUID": "550e8400-e29b-41d4-a716-446655440000" } }
3406
3407 EQMP
3408
3409     {
3410         .name       = "query-uuid",
3411         .args_type  = "",
3412         .mhandler.cmd_new = qmp_marshal_query_uuid,
3413     },
3414
3415 SQMP
3416 query-command-line-options
3417 --------------------------
3418
3419 Show command line option schema.
3420
3421 Return a json-array of command line option schema for all options (or for
3422 the given option), returning an error if the given option doesn't exist.
3423
3424 Each array entry contains the following:
3425
3426 - "option": option name (json-string)
3427 - "parameters": a json-array describes all parameters of the option:
3428     - "name": parameter name (json-string)
3429     - "type": parameter type (one of 'string', 'boolean', 'number',
3430               or 'size')
3431     - "help": human readable description of the parameter
3432               (json-string, optional)
3433     - "default": default value string for the parameter
3434                  (json-string, optional)
3435
3436 Example:
3437
3438 -> { "execute": "query-command-line-options", "arguments": { "option": "option-rom" } }
3439 <- { "return": [
3440         {
3441             "parameters": [
3442                 {
3443                     "name": "romfile",
3444                     "type": "string"
3445                 },
3446                 {
3447                     "name": "bootindex",
3448                     "type": "number"
3449                 }
3450             ],
3451             "option": "option-rom"
3452         }
3453      ]
3454    }
3455
3456 EQMP
3457
3458     {
3459         .name       = "query-command-line-options",
3460         .args_type  = "option:s?",
3461         .mhandler.cmd_new = qmp_marshal_query_command_line_options,
3462     },
3463
3464 SQMP
3465 query-migrate
3466 -------------
3467
3468 Migration status.
3469
3470 Return a json-object. If migration is active there will be another json-object
3471 with RAM migration status and if block migration is active another one with
3472 block migration status.
3473
3474 The main json-object contains the following:
3475
3476 - "status": migration status (json-string)
3477      - Possible values: "setup", "active", "completed", "failed", "cancelled"
3478 - "total-time": total amount of ms since migration started.  If
3479                 migration has ended, it returns the total migration
3480                 time (json-int)
3481 - "setup-time" amount of setup time in milliseconds _before_ the
3482                iterations begin but _after_ the QMP command is issued.
3483                This is designed to provide an accounting of any activities
3484                (such as RDMA pinning) which may be expensive, but do not 
3485                actually occur during the iterative migration rounds 
3486                themselves. (json-int)
3487 - "downtime": only present when migration has finished correctly
3488               total amount in ms for downtime that happened (json-int)
3489 - "expected-downtime": only present while migration is active
3490                 total amount in ms for downtime that was calculated on
3491                 the last bitmap round (json-int)
3492 - "ram": only present if "status" is "active", it is a json-object with the
3493   following RAM information:
3494          - "transferred": amount transferred in bytes (json-int)
3495          - "remaining": amount remaining to transfer in bytes (json-int)
3496          - "total": total amount of memory in bytes (json-int)
3497          - "duplicate": number of pages filled entirely with the same
3498             byte (json-int)
3499             These are sent over the wire much more efficiently.
3500          - "skipped": number of skipped zero pages (json-int)
3501          - "normal" : number of whole pages transferred.  I.e. they
3502             were not sent as duplicate or xbzrle pages (json-int)
3503          - "normal-bytes" : number of bytes transferred in whole
3504             pages. This is just normal pages times size of one page,
3505             but this way upper levels don't need to care about page
3506             size (json-int)
3507          - "dirty-sync-count": times that dirty ram was synchronized (json-int)
3508 - "disk": only present if "status" is "active" and it is a block migration,
3509   it is a json-object with the following disk information:
3510          - "transferred": amount transferred in bytes (json-int)
3511          - "remaining": amount remaining to transfer in bytes json-int)
3512          - "total": total disk size in bytes (json-int)
3513 - "xbzrle-cache": only present if XBZRLE is active.
3514   It is a json-object with the following XBZRLE information:
3515          - "cache-size": XBZRLE cache size in bytes
3516          - "bytes": number of bytes transferred for XBZRLE compressed pages
3517          - "pages": number of XBZRLE compressed pages
3518          - "cache-miss": number of XBRZRLE page cache misses
3519          - "cache-miss-rate": rate of XBRZRLE page cache misses
3520          - "overflow": number of times XBZRLE overflows.  This means
3521            that the XBZRLE encoding was bigger than just sent the
3522            whole page, and then we sent the whole page instead (as as
3523            normal page).
3524
3525 Examples:
3526
3527 1. Before the first migration
3528
3529 -> { "execute": "query-migrate" }
3530 <- { "return": {} }
3531
3532 2. Migration is done and has succeeded
3533
3534 -> { "execute": "query-migrate" }
3535 <- { "return": {
3536         "status": "completed",
3537         "ram":{
3538           "transferred":123,
3539           "remaining":123,
3540           "total":246,
3541           "total-time":12345,
3542           "setup-time":12345,
3543           "downtime":12345,
3544           "duplicate":123,
3545           "normal":123,
3546           "normal-bytes":123456,
3547           "dirty-sync-count":15
3548         }
3549      }
3550    }
3551
3552 3. Migration is done and has failed
3553
3554 -> { "execute": "query-migrate" }
3555 <- { "return": { "status": "failed" } }
3556
3557 4. Migration is being performed and is not a block migration:
3558
3559 -> { "execute": "query-migrate" }
3560 <- {
3561       "return":{
3562          "status":"active",
3563          "ram":{
3564             "transferred":123,
3565             "remaining":123,
3566             "total":246,
3567             "total-time":12345,
3568             "setup-time":12345,
3569             "expected-downtime":12345,
3570             "duplicate":123,
3571             "normal":123,
3572             "normal-bytes":123456,
3573             "dirty-sync-count":15
3574          }
3575       }
3576    }
3577
3578 5. Migration is being performed and is a block migration:
3579
3580 -> { "execute": "query-migrate" }
3581 <- {
3582       "return":{
3583          "status":"active",
3584          "ram":{
3585             "total":1057024,
3586             "remaining":1053304,
3587             "transferred":3720,
3588             "total-time":12345,
3589             "setup-time":12345,
3590             "expected-downtime":12345,
3591             "duplicate":123,
3592             "normal":123,
3593             "normal-bytes":123456,
3594             "dirty-sync-count":15
3595          },
3596          "disk":{
3597             "total":20971520,
3598             "remaining":20880384,
3599             "transferred":91136
3600          }
3601       }
3602    }
3603
3604 6. Migration is being performed and XBZRLE is active:
3605
3606 -> { "execute": "query-migrate" }
3607 <- {
3608       "return":{
3609          "status":"active",
3610          "capabilities" : [ { "capability": "xbzrle", "state" : true } ],
3611          "ram":{
3612             "total":1057024,
3613             "remaining":1053304,
3614             "transferred":3720,
3615             "total-time":12345,
3616             "setup-time":12345,
3617             "expected-downtime":12345,
3618             "duplicate":10,
3619             "normal":3333,
3620             "normal-bytes":3412992,
3621             "dirty-sync-count":15
3622          },
3623          "xbzrle-cache":{
3624             "cache-size":67108864,
3625             "bytes":20971520,
3626             "pages":2444343,
3627             "cache-miss":2244,
3628             "cache-miss-rate":0.123,
3629             "overflow":34434
3630          }
3631       }
3632    }
3633
3634 EQMP
3635
3636     {
3637         .name       = "query-migrate",
3638         .args_type  = "",
3639         .mhandler.cmd_new = qmp_marshal_query_migrate,
3640     },
3641
3642 SQMP
3643 migrate-set-capabilities
3644 ------------------------
3645
3646 Enable/Disable migration capabilities
3647
3648 - "xbzrle": XBZRLE support
3649 - "rdma-pin-all": pin all pages when using RDMA during migration
3650 - "auto-converge": throttle down guest to help convergence of migration
3651 - "zero-blocks": compress zero blocks during block migration
3652 - "compress": use multiple compression threads to accelerate live migration
3653 - "events": generate events for each migration state change
3654 - "x-postcopy-ram": postcopy mode for live migration
3655
3656 Arguments:
3657
3658 Example:
3659
3660 -> { "execute": "migrate-set-capabilities" , "arguments":
3661      { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
3662
3663 EQMP
3664
3665     {
3666         .name       = "migrate-set-capabilities",
3667         .args_type  = "capabilities:q",
3668         .params     = "capability:s,state:b",
3669         .mhandler.cmd_new = qmp_marshal_migrate_set_capabilities,
3670     },
3671 SQMP
3672 query-migrate-capabilities
3673 --------------------------
3674
3675 Query current migration capabilities
3676
3677 - "capabilities": migration capabilities state
3678          - "xbzrle" : XBZRLE state (json-bool)
3679          - "rdma-pin-all" : RDMA Pin Page state (json-bool)
3680          - "auto-converge" : Auto Converge state (json-bool)
3681          - "zero-blocks" : Zero Blocks state (json-bool)
3682          - "compress": Multiple compression threads state (json-bool)
3683          - "events": Migration state change event state (json-bool)
3684          - "x-postcopy-ram": postcopy ram state (json-bool)
3685
3686 Arguments:
3687
3688 Example:
3689
3690 -> { "execute": "query-migrate-capabilities" }
3691 <- {"return": [
3692      {"state": false, "capability": "xbzrle"},
3693      {"state": false, "capability": "rdma-pin-all"},
3694      {"state": false, "capability": "auto-converge"},
3695      {"state": false, "capability": "zero-blocks"},
3696      {"state": false, "capability": "compress"},
3697      {"state": true, "capability": "events"},
3698      {"state": false, "capability": "x-postcopy-ram"}
3699    ]}
3700
3701 EQMP
3702
3703     {
3704         .name       = "query-migrate-capabilities",
3705         .args_type  = "",
3706         .mhandler.cmd_new = qmp_marshal_query_migrate_capabilities,
3707     },
3708
3709 SQMP
3710 migrate-set-parameters
3711 ----------------------
3712
3713 Set migration parameters
3714
3715 - "compress-level": set compression level during migration (json-int)
3716 - "compress-threads": set compression thread count for migration (json-int)
3717 - "decompress-threads": set decompression thread count for migration (json-int)
3718 - "x-cpu-throttle-initial": set initial percentage of time guest cpus are
3719                            throttled for auto-converge (json-int)
3720 - "x-cpu-throttle-increment": set throttle increasing percentage for
3721                              auto-converge (json-int)
3722
3723 Arguments:
3724
3725 Example:
3726
3727 -> { "execute": "migrate-set-parameters" , "arguments":
3728       { "compress-level": 1 } }
3729
3730 EQMP
3731
3732     {
3733         .name       = "migrate-set-parameters",
3734         .args_type  =
3735             "compress-level:i?,compress-threads:i?,decompress-threads:i?,x-cpu-throttle-initial:i?,x-cpu-throttle-increment:i?",
3736         .mhandler.cmd_new = qmp_marshal_migrate_set_parameters,
3737     },
3738 SQMP
3739 query-migrate-parameters
3740 ------------------------
3741
3742 Query current migration parameters
3743
3744 - "parameters": migration parameters value
3745          - "compress-level" : compression level value (json-int)
3746          - "compress-threads" : compression thread count value (json-int)
3747          - "decompress-threads" : decompression thread count value (json-int)
3748          - "x-cpu-throttle-initial" : initial percentage of time guest cpus are
3749                                       throttled (json-int)
3750          - "x-cpu-throttle-increment" : throttle increasing percentage for
3751                                         auto-converge (json-int)
3752
3753 Arguments:
3754
3755 Example:
3756
3757 -> { "execute": "query-migrate-parameters" }
3758 <- {
3759       "return": {
3760          "decompress-threads": 2,
3761          "x-cpu-throttle-increment": 10,
3762          "compress-threads": 8,
3763          "compress-level": 1,
3764          "x-cpu-throttle-initial": 20
3765       }
3766    }
3767
3768 EQMP
3769
3770     {
3771         .name       = "query-migrate-parameters",
3772         .args_type  = "",
3773         .mhandler.cmd_new = qmp_marshal_query_migrate_parameters,
3774     },
3775
3776 SQMP
3777 query-balloon
3778 -------------
3779
3780 Show balloon information.
3781
3782 Make an asynchronous request for balloon info. When the request completes a
3783 json-object will be returned containing the following data:
3784
3785 - "actual": current balloon value in bytes (json-int)
3786
3787 Example:
3788
3789 -> { "execute": "query-balloon" }
3790 <- {
3791       "return":{
3792          "actual":1073741824,
3793       }
3794    }
3795
3796 EQMP
3797
3798     {
3799         .name       = "query-balloon",
3800         .args_type  = "",
3801         .mhandler.cmd_new = qmp_marshal_query_balloon,
3802     },
3803
3804     {
3805         .name       = "query-block-jobs",
3806         .args_type  = "",
3807         .mhandler.cmd_new = qmp_marshal_query_block_jobs,
3808     },
3809
3810     {
3811         .name       = "qom-list",
3812         .args_type  = "path:s",
3813         .mhandler.cmd_new = qmp_marshal_qom_list,
3814     },
3815
3816     {
3817         .name       = "qom-set",
3818         .args_type  = "path:s,property:s,value:q",
3819         .mhandler.cmd_new = qmp_marshal_qom_set,
3820     },
3821
3822     {
3823         .name       = "qom-get",
3824         .args_type  = "path:s,property:s",
3825         .mhandler.cmd_new = qmp_marshal_qom_get,
3826     },
3827
3828     {
3829         .name       = "nbd-server-start",
3830         .args_type  = "addr:q,tls-creds:s?",
3831         .mhandler.cmd_new = qmp_marshal_nbd_server_start,
3832     },
3833     {
3834         .name       = "nbd-server-add",
3835         .args_type  = "device:B,writable:b?",
3836         .mhandler.cmd_new = qmp_marshal_nbd_server_add,
3837     },
3838     {
3839         .name       = "nbd-server-stop",
3840         .args_type  = "",
3841         .mhandler.cmd_new = qmp_marshal_nbd_server_stop,
3842     },
3843
3844     {
3845         .name       = "change-vnc-password",
3846         .args_type  = "password:s",
3847         .mhandler.cmd_new = qmp_marshal_change_vnc_password,
3848     },
3849     {
3850         .name       = "qom-list-types",
3851         .args_type  = "implements:s?,abstract:b?",
3852         .mhandler.cmd_new = qmp_marshal_qom_list_types,
3853     },
3854
3855     {
3856         .name       = "device-list-properties",
3857         .args_type  = "typename:s",
3858         .mhandler.cmd_new = qmp_marshal_device_list_properties,
3859     },
3860
3861     {
3862         .name       = "query-machines",
3863         .args_type  = "",
3864         .mhandler.cmd_new = qmp_marshal_query_machines,
3865     },
3866
3867     {
3868         .name       = "query-cpu-definitions",
3869         .args_type  = "",
3870         .mhandler.cmd_new = qmp_marshal_query_cpu_definitions,
3871     },
3872
3873     {
3874         .name       = "query-target",
3875         .args_type  = "",
3876         .mhandler.cmd_new = qmp_marshal_query_target,
3877     },
3878
3879     {
3880         .name       = "query-tpm",
3881         .args_type  = "",
3882         .mhandler.cmd_new = qmp_marshal_query_tpm,
3883     },
3884
3885 SQMP
3886 query-tpm
3887 ---------
3888
3889 Return information about the TPM device.
3890
3891 Arguments: None
3892
3893 Example:
3894
3895 -> { "execute": "query-tpm" }
3896 <- { "return":
3897      [
3898        { "model": "tpm-tis",
3899          "options":
3900            { "type": "passthrough",
3901              "data":
3902                { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
3903                  "path": "/dev/tpm0"
3904                }
3905            },
3906          "id": "tpm0"
3907        }
3908      ]
3909    }
3910
3911 EQMP
3912
3913     {
3914         .name       = "query-tpm-models",
3915         .args_type  = "",
3916         .mhandler.cmd_new = qmp_marshal_query_tpm_models,
3917     },
3918
3919 SQMP
3920 query-tpm-models
3921 ----------------
3922
3923 Return a list of supported TPM models.
3924
3925 Arguments: None
3926
3927 Example:
3928
3929 -> { "execute": "query-tpm-models" }
3930 <- { "return": [ "tpm-tis" ] }
3931
3932 EQMP
3933
3934     {
3935         .name       = "query-tpm-types",
3936         .args_type  = "",
3937         .mhandler.cmd_new = qmp_marshal_query_tpm_types,
3938     },
3939
3940 SQMP
3941 query-tpm-types
3942 ---------------
3943
3944 Return a list of supported TPM types.
3945
3946 Arguments: None
3947
3948 Example:
3949
3950 -> { "execute": "query-tpm-types" }
3951 <- { "return": [ "passthrough" ] }
3952
3953 EQMP
3954
3955     {
3956         .name       = "chardev-add",
3957         .args_type  = "id:s,backend:q",
3958         .mhandler.cmd_new = qmp_marshal_chardev_add,
3959     },
3960
3961 SQMP
3962 chardev-add
3963 ----------------
3964
3965 Add a chardev.
3966
3967 Arguments:
3968
3969 - "id": the chardev's ID, must be unique (json-string)
3970 - "backend": chardev backend type + parameters
3971
3972 Examples:
3973
3974 -> { "execute" : "chardev-add",
3975      "arguments" : { "id" : "foo",
3976                      "backend" : { "type" : "null", "data" : {} } } }
3977 <- { "return": {} }
3978
3979 -> { "execute" : "chardev-add",
3980      "arguments" : { "id" : "bar",
3981                      "backend" : { "type" : "file",
3982                                    "data" : { "out" : "/tmp/bar.log" } } } }
3983 <- { "return": {} }
3984
3985 -> { "execute" : "chardev-add",
3986      "arguments" : { "id" : "baz",
3987                      "backend" : { "type" : "pty", "data" : {} } } }
3988 <- { "return": { "pty" : "/dev/pty/42" } }
3989
3990 EQMP
3991
3992     {
3993         .name       = "chardev-remove",
3994         .args_type  = "id:s",
3995         .mhandler.cmd_new = qmp_marshal_chardev_remove,
3996     },
3997
3998
3999 SQMP
4000 chardev-remove
4001 --------------
4002
4003 Remove a chardev.
4004
4005 Arguments:
4006
4007 - "id": the chardev's ID, must exist and not be in use (json-string)
4008
4009 Example:
4010
4011 -> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
4012 <- { "return": {} }
4013
4014 EQMP
4015     {
4016         .name       = "query-rx-filter",
4017         .args_type  = "name:s?",
4018         .mhandler.cmd_new = qmp_marshal_query_rx_filter,
4019     },
4020
4021 SQMP
4022 query-rx-filter
4023 ---------------
4024
4025 Show rx-filter information.
4026
4027 Returns a json-array of rx-filter information for all NICs (or for the
4028 given NIC), returning an error if the given NIC doesn't exist, or
4029 given NIC doesn't support rx-filter querying, or given net client
4030 isn't a NIC.
4031
4032 The query will clear the event notification flag of each NIC, then qemu
4033 will start to emit event to QMP monitor.
4034
4035 Each array entry contains the following:
4036
4037 - "name": net client name (json-string)
4038 - "promiscuous": promiscuous mode is enabled (json-bool)
4039 - "multicast": multicast receive state (one of 'normal', 'none', 'all')
4040 - "unicast": unicast receive state  (one of 'normal', 'none', 'all')
4041 - "vlan": vlan receive state (one of 'normal', 'none', 'all') (Since 2.0)
4042 - "broadcast-allowed": allow to receive broadcast (json-bool)
4043 - "multicast-overflow": multicast table is overflowed (json-bool)
4044 - "unicast-overflow": unicast table is overflowed (json-bool)
4045 - "main-mac": main macaddr string (json-string)
4046 - "vlan-table": a json-array of active vlan id
4047 - "unicast-table": a json-array of unicast macaddr string
4048 - "multicast-table": a json-array of multicast macaddr string
4049
4050 Example:
4051
4052 -> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } }
4053 <- { "return": [
4054         {
4055             "promiscuous": true,
4056             "name": "vnet0",
4057             "main-mac": "52:54:00:12:34:56",
4058             "unicast": "normal",
4059             "vlan": "normal",
4060             "vlan-table": [
4061                 4,
4062                 0
4063             ],
4064             "unicast-table": [
4065             ],
4066             "multicast": "normal",
4067             "multicast-overflow": false,
4068             "unicast-overflow": false,
4069             "multicast-table": [
4070                 "01:00:5e:00:00:01",
4071                 "33:33:00:00:00:01",
4072                 "33:33:ff:12:34:56"
4073             ],
4074             "broadcast-allowed": false
4075         }
4076       ]
4077    }
4078
4079 EQMP
4080
4081     {
4082         .name       = "blockdev-add",
4083         .args_type  = "options:q",
4084         .mhandler.cmd_new = qmp_marshal_blockdev_add,
4085     },
4086
4087 SQMP
4088 blockdev-add
4089 ------------
4090
4091 Add a block device.
4092
4093 This command is still a work in progress.  It doesn't support all
4094 block drivers among other things.  Stay away from it unless you want
4095 to help with its development.
4096
4097 Arguments:
4098
4099 - "options": block driver options
4100
4101 Example (1):
4102
4103 -> { "execute": "blockdev-add",
4104     "arguments": { "options" : { "driver": "qcow2",
4105                                  "file": { "driver": "file",
4106                                            "filename": "test.qcow2" } } } }
4107 <- { "return": {} }
4108
4109 Example (2):
4110
4111 -> { "execute": "blockdev-add",
4112      "arguments": {
4113          "options": {
4114            "driver": "qcow2",
4115            "id": "my_disk",
4116            "discard": "unmap",
4117            "cache": {
4118                "direct": true,
4119                "writeback": true
4120            },
4121            "file": {
4122                "driver": "file",
4123                "filename": "/tmp/test.qcow2"
4124            },
4125            "backing": {
4126                "driver": "raw",
4127                "file": {
4128                    "driver": "file",
4129                    "filename": "/dev/fdset/4"
4130                }
4131            }
4132          }
4133        }
4134      }
4135
4136 <- { "return": {} }
4137
4138 EQMP
4139
4140     {
4141         .name       = "x-blockdev-del",
4142         .args_type  = "id:s?,node-name:s?",
4143         .mhandler.cmd_new = qmp_marshal_x_blockdev_del,
4144     },
4145
4146 SQMP
4147 x-blockdev-del
4148 ------------
4149 Since 2.5
4150
4151 Deletes a block device thas has been added using blockdev-add.
4152 The selected device can be either a block backend or a graph node.
4153
4154 In the former case the backend will be destroyed, along with its
4155 inserted medium if there's any. The command will fail if the backend
4156 or its medium are in use.
4157
4158 In the latter case the node will be destroyed. The command will fail
4159 if the node is attached to a block backend or is otherwise being
4160 used.
4161
4162 One of "id" or "node-name" must be specified, but not both.
4163
4164 This command is still a work in progress and is considered
4165 experimental. Stay away from it unless you want to help with its
4166 development.
4167
4168 Arguments:
4169
4170 - "id": Name of the block backend device to delete (json-string, optional)
4171 - "node-name": Name of the graph node to delete (json-string, optional)
4172
4173 Example:
4174
4175 -> { "execute": "blockdev-add",
4176      "arguments": {
4177          "options": {
4178              "driver": "qcow2",
4179              "id": "drive0",
4180              "file": {
4181                  "driver": "file",
4182                  "filename": "test.qcow2"
4183              }
4184          }
4185      }
4186    }
4187
4188 <- { "return": {} }
4189
4190 -> { "execute": "x-blockdev-del",
4191      "arguments": { "id": "drive0" }
4192    }
4193 <- { "return": {} }
4194
4195 EQMP
4196
4197     {
4198         .name       = "blockdev-open-tray",
4199         .args_type  = "device:s,force:b?",
4200         .mhandler.cmd_new = qmp_marshal_blockdev_open_tray,
4201     },
4202
4203 SQMP
4204 blockdev-open-tray
4205 ------------------
4206
4207 Opens a block device's tray. If there is a block driver state tree inserted as a
4208 medium, it will become inaccessible to the guest (but it will remain associated
4209 to the block device, so closing the tray will make it accessible again).
4210
4211 If the tray was already open before, this will be a no-op.
4212
4213 Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in
4214 which no such event will be generated, these include:
4215 - if the guest has locked the tray, @force is false and the guest does not
4216   respond to the eject request
4217 - if the BlockBackend denoted by @device does not have a guest device attached
4218   to it
4219 - if the guest device does not have an actual tray and is empty, for instance
4220   for floppy disk drives
4221
4222 Arguments:
4223
4224 - "device": block device name (json-string)
4225 - "force": if false (the default), an eject request will be sent to the guest if
4226            it has locked the tray (and the tray will not be opened immediately);
4227            if true, the tray will be opened regardless of whether it is locked
4228            (json-bool, optional)
4229
4230 Example:
4231
4232 -> { "execute": "blockdev-open-tray",
4233      "arguments": { "device": "ide1-cd0" } }
4234
4235 <- { "timestamp": { "seconds": 1418751016,
4236                     "microseconds": 716996 },
4237      "event": "DEVICE_TRAY_MOVED",
4238      "data": { "device": "ide1-cd0",
4239                "tray-open": true } }
4240
4241 <- { "return": {} }
4242
4243 EQMP
4244
4245     {
4246         .name       = "blockdev-close-tray",
4247         .args_type  = "device:s",
4248         .mhandler.cmd_new = qmp_marshal_blockdev_close_tray,
4249     },
4250
4251 SQMP
4252 blockdev-close-tray
4253 -------------------
4254
4255 Closes a block device's tray. If there is a block driver state tree associated
4256 with the block device (which is currently ejected), that tree will be loaded as
4257 the medium.
4258
4259 If the tray was already closed before, this will be a no-op.
4260
4261 Arguments:
4262
4263 - "device": block device name (json-string)
4264
4265 Example:
4266
4267 -> { "execute": "blockdev-close-tray",
4268      "arguments": { "device": "ide1-cd0" } }
4269
4270 <- { "timestamp": { "seconds": 1418751345,
4271                     "microseconds": 272147 },
4272      "event": "DEVICE_TRAY_MOVED",
4273      "data": { "device": "ide1-cd0",
4274                "tray-open": false } }
4275
4276 <- { "return": {} }
4277
4278 EQMP
4279
4280     {
4281         .name       = "x-blockdev-remove-medium",
4282         .args_type  = "device:s",
4283         .mhandler.cmd_new = qmp_marshal_x_blockdev_remove_medium,
4284     },
4285
4286 SQMP
4287 x-blockdev-remove-medium
4288 ------------------------
4289
4290 Removes a medium (a block driver state tree) from a block device. That block
4291 device's tray must currently be open (unless there is no attached guest device).
4292
4293 If the tray is open and there is no medium inserted, this will be a no-op.
4294
4295 This command is still a work in progress and is considered experimental.
4296 Stay away from it unless you want to help with its development.
4297
4298 Arguments:
4299
4300 - "device": block device name (json-string)
4301
4302 Example:
4303
4304 -> { "execute": "x-blockdev-remove-medium",
4305      "arguments": { "device": "ide1-cd0" } }
4306
4307 <- { "error": { "class": "GenericError",
4308                 "desc": "Tray of device 'ide1-cd0' is not open" } }
4309
4310 -> { "execute": "blockdev-open-tray",
4311      "arguments": { "device": "ide1-cd0" } }
4312
4313 <- { "timestamp": { "seconds": 1418751627,
4314                     "microseconds": 549958 },
4315      "event": "DEVICE_TRAY_MOVED",
4316      "data": { "device": "ide1-cd0",
4317                "tray-open": true } }
4318
4319 <- { "return": {} }
4320
4321 -> { "execute": "x-blockdev-remove-medium",
4322      "arguments": { "device": "ide1-cd0" } }
4323
4324 <- { "return": {} }
4325
4326 EQMP
4327
4328     {
4329         .name       = "x-blockdev-insert-medium",
4330         .args_type  = "device:s,node-name:s",
4331         .mhandler.cmd_new = qmp_marshal_x_blockdev_insert_medium,
4332     },
4333
4334 SQMP
4335 x-blockdev-insert-medium
4336 ------------------------
4337
4338 Inserts a medium (a block driver state tree) into a block device. That block
4339 device's tray must currently be open (unless there is no attached guest device)
4340 and there must be no medium inserted already.
4341
4342 This command is still a work in progress and is considered experimental.
4343 Stay away from it unless you want to help with its development.
4344
4345 Arguments:
4346
4347 - "device": block device name (json-string)
4348 - "node-name": root node of the BDS tree to insert into the block device
4349
4350 Example:
4351
4352 -> { "execute": "blockdev-add",
4353      "arguments": { "options": { "node-name": "node0",
4354                                  "driver": "raw",
4355                                  "file": { "driver": "file",
4356                                            "filename": "fedora.iso" } } } }
4357
4358 <- { "return": {} }
4359
4360 -> { "execute": "x-blockdev-insert-medium",
4361      "arguments": { "device": "ide1-cd0",
4362                     "node-name": "node0" } }
4363
4364 <- { "return": {} }
4365
4366 EQMP
4367
4368     {
4369         .name       = "query-named-block-nodes",
4370         .args_type  = "",
4371         .mhandler.cmd_new = qmp_marshal_query_named_block_nodes,
4372     },
4373
4374 SQMP
4375 @query-named-block-nodes
4376 ------------------------
4377
4378 Return a list of BlockDeviceInfo for all the named block driver nodes
4379
4380 Example:
4381
4382 -> { "execute": "query-named-block-nodes" }
4383 <- { "return": [ { "ro":false,
4384                    "drv":"qcow2",
4385                    "encrypted":false,
4386                    "file":"disks/test.qcow2",
4387                    "node-name": "my-node",
4388                    "backing_file_depth":1,
4389                    "bps":1000000,
4390                    "bps_rd":0,
4391                    "bps_wr":0,
4392                    "iops":1000000,
4393                    "iops_rd":0,
4394                    "iops_wr":0,
4395                    "bps_max": 8000000,
4396                    "bps_rd_max": 0,
4397                    "bps_wr_max": 0,
4398                    "iops_max": 0,
4399                    "iops_rd_max": 0,
4400                    "iops_wr_max": 0,
4401                    "iops_size": 0,
4402                    "write_threshold": 0,
4403                    "image":{
4404                       "filename":"disks/test.qcow2",
4405                       "format":"qcow2",
4406                       "virtual-size":2048000,
4407                       "backing_file":"base.qcow2",
4408                       "full-backing-filename":"disks/base.qcow2",
4409                       "backing-filename-format":"qcow2",
4410                       "snapshots":[
4411                          {
4412                             "id": "1",
4413                             "name": "snapshot1",
4414                             "vm-state-size": 0,
4415                             "date-sec": 10000200,
4416                             "date-nsec": 12,
4417                             "vm-clock-sec": 206,
4418                             "vm-clock-nsec": 30
4419                          }
4420                       ],
4421                       "backing-image":{
4422                           "filename":"disks/base.qcow2",
4423                           "format":"qcow2",
4424                           "virtual-size":2048000
4425                       }
4426                    } } ] }
4427
4428 EQMP
4429
4430     {
4431         .name       = "blockdev-change-medium",
4432         .args_type  = "device:B,filename:F,format:s?,read-only-mode:s?",
4433         .mhandler.cmd_new = qmp_marshal_blockdev_change_medium,
4434     },
4435
4436 SQMP
4437 blockdev-change-medium
4438 ----------------------
4439
4440 Changes the medium inserted into a block device by ejecting the current medium
4441 and loading a new image file which is inserted as the new medium.
4442
4443 Arguments:
4444
4445 - "device": device name (json-string)
4446 - "filename": filename of the new image (json-string)
4447 - "format": format of the new image (json-string, optional)
4448 - "read-only-mode": new read-only mode (json-string, optional)
4449           - Possible values: "retain" (default), "read-only", "read-write"
4450
4451 Examples:
4452
4453 1. Change a removable medium
4454
4455 -> { "execute": "blockdev-change-medium",
4456              "arguments": { "device": "ide1-cd0",
4457                             "filename": "/srv/images/Fedora-12-x86_64-DVD.iso",
4458                             "format": "raw" } }
4459 <- { "return": {} }
4460
4461 2. Load a read-only medium into a writable drive
4462
4463 -> { "execute": "blockdev-change-medium",
4464              "arguments": { "device": "isa-fd0",
4465                             "filename": "/srv/images/ro.img",
4466                             "format": "raw",
4467                             "read-only-mode": "retain" } }
4468
4469 <- { "error":
4470      { "class": "GenericError",
4471        "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
4472
4473 -> { "execute": "blockdev-change-medium",
4474              "arguments": { "device": "isa-fd0",
4475                             "filename": "/srv/images/ro.img",
4476                             "format": "raw",
4477                             "read-only-mode": "read-only" } }
4478
4479 <- { "return": {} }
4480
4481 EQMP
4482
4483     {
4484         .name       = "query-memdev",
4485         .args_type  = "",
4486         .mhandler.cmd_new = qmp_marshal_query_memdev,
4487     },
4488
4489 SQMP
4490 query-memdev
4491 ------------
4492
4493 Show memory devices information.
4494
4495
4496 Example (1):
4497
4498 -> { "execute": "query-memdev" }
4499 <- { "return": [
4500        {
4501          "size": 536870912,
4502          "merge": false,
4503          "dump": true,
4504          "prealloc": false,
4505          "host-nodes": [0, 1],
4506          "policy": "bind"
4507        },
4508        {
4509          "size": 536870912,
4510          "merge": false,
4511          "dump": true,
4512          "prealloc": true,
4513          "host-nodes": [2, 3],
4514          "policy": "preferred"
4515        }
4516      ]
4517    }
4518
4519 EQMP
4520
4521     {
4522         .name       = "query-memory-devices",
4523         .args_type  = "",
4524         .mhandler.cmd_new = qmp_marshal_query_memory_devices,
4525     },
4526
4527 SQMP
4528 @query-memory-devices
4529 --------------------
4530
4531 Return a list of memory devices.
4532
4533 Example:
4534 -> { "execute": "query-memory-devices" }
4535 <- { "return": [ { "data":
4536                       { "addr": 5368709120,
4537                         "hotpluggable": true,
4538                         "hotplugged": true,
4539                         "id": "d1",
4540                         "memdev": "/objects/memX",
4541                         "node": 0,
4542                         "size": 1073741824,
4543                         "slot": 0},
4544                    "type": "dimm"
4545                  } ] }
4546 EQMP
4547
4548     {
4549         .name       = "query-acpi-ospm-status",
4550         .args_type  = "",
4551         .mhandler.cmd_new = qmp_marshal_query_acpi_ospm_status,
4552     },
4553
4554 SQMP
4555 @query-acpi-ospm-status
4556 --------------------
4557
4558 Return list of ACPIOSTInfo for devices that support status reporting
4559 via ACPI _OST method.
4560
4561 Example:
4562 -> { "execute": "query-acpi-ospm-status" }
4563 <- { "return": [ { "device": "d1", "slot": "0", "slot-type": "DIMM", "source": 1, "status": 0},
4564                  { "slot": "1", "slot-type": "DIMM", "source": 0, "status": 0},
4565                  { "slot": "2", "slot-type": "DIMM", "source": 0, "status": 0},
4566                  { "slot": "3", "slot-type": "DIMM", "source": 0, "status": 0}
4567    ]}
4568 EQMP
4569
4570 #if defined TARGET_I386
4571     {
4572         .name       = "rtc-reset-reinjection",
4573         .args_type  = "",
4574         .mhandler.cmd_new = qmp_marshal_rtc_reset_reinjection,
4575     },
4576 #endif
4577
4578 SQMP
4579 rtc-reset-reinjection
4580 ---------------------
4581
4582 Reset the RTC interrupt reinjection backlog.
4583
4584 Arguments: None.
4585
4586 Example:
4587
4588 -> { "execute": "rtc-reset-reinjection" }
4589 <- { "return": {} }
4590 EQMP
4591
4592     {
4593         .name       = "trace-event-get-state",
4594         .args_type  = "name:s",
4595         .mhandler.cmd_new = qmp_marshal_trace_event_get_state,
4596     },
4597
4598 SQMP
4599 trace-event-get-state
4600 ---------------------
4601
4602 Query the state of events.
4603
4604 Example:
4605
4606 -> { "execute": "trace-event-get-state", "arguments": { "name": "qemu_memalign" } }
4607 <- { "return": [ { "name": "qemu_memalign", "state": "disabled" } ] }
4608 EQMP
4609
4610     {
4611         .name       = "trace-event-set-state",
4612         .args_type  = "name:s,enable:b,ignore-unavailable:b?",
4613         .mhandler.cmd_new = qmp_marshal_trace_event_set_state,
4614     },
4615
4616 SQMP
4617 trace-event-set-state
4618 ---------------------
4619
4620 Set the state of events.
4621
4622 Example:
4623
4624 -> { "execute": "trace-event-set-state", "arguments": { "name": "qemu_memalign", "enable": "true" } }
4625 <- { "return": {} }
4626 EQMP
4627
4628     {
4629         .name       = "x-input-send-event",
4630         .args_type  = "console:i?,events:q",
4631         .mhandler.cmd_new = qmp_marshal_x_input_send_event,
4632     },
4633
4634 SQMP
4635 @x-input-send-event
4636 -----------------
4637
4638 Send input event to guest.
4639
4640 Arguments:
4641
4642 - "console": console index. (json-int, optional)
4643 - "events": list of input events.
4644
4645 The consoles are visible in the qom tree, under
4646 /backend/console[$index]. They have a device link and head property, so
4647 it is possible to map which console belongs to which device and display.
4648
4649 Note: this command is experimental, and not a stable API.
4650
4651 Example (1):
4652
4653 Press left mouse button.
4654
4655 -> { "execute": "x-input-send-event",
4656     "arguments": { "console": 0,
4657                    "events": [ { "type": "btn",
4658                     "data" : { "down": true, "button": "Left" } } ] } }
4659 <- { "return": {} }
4660
4661 -> { "execute": "x-input-send-event",
4662     "arguments": { "console": 0,
4663                    "events": [ { "type": "btn",
4664                     "data" : { "down": false, "button": "Left" } } ] } }
4665 <- { "return": {} }
4666
4667 Example (2):
4668
4669 Press ctrl-alt-del.
4670
4671 -> { "execute": "x-input-send-event",
4672      "arguments": { "console": 0, "events": [
4673         { "type": "key", "data" : { "down": true,
4674           "key": {"type": "qcode", "data": "ctrl" } } },
4675         { "type": "key", "data" : { "down": true,
4676           "key": {"type": "qcode", "data": "alt" } } },
4677         { "type": "key", "data" : { "down": true,
4678           "key": {"type": "qcode", "data": "delete" } } } ] } }
4679 <- { "return": {} }
4680
4681 Example (3):
4682
4683 Move mouse pointer to absolute coordinates (20000, 400).
4684
4685 -> { "execute": "x-input-send-event" ,
4686   "arguments": { "console": 0, "events": [
4687                { "type": "abs", "data" : { "axis": "X", "value" : 20000 } },
4688                { "type": "abs", "data" : { "axis": "Y", "value" : 400 } } ] } }
4689 <- { "return": {} }
4690
4691 EQMP
4692
4693     {
4694         .name       = "block-set-write-threshold",
4695         .args_type  = "node-name:s,write-threshold:l",
4696         .mhandler.cmd_new = qmp_marshal_block_set_write_threshold,
4697     },
4698
4699 SQMP
4700 block-set-write-threshold
4701 ------------
4702
4703 Change the write threshold for a block drive. The threshold is an offset,
4704 thus must be non-negative. Default is no write threshold.
4705 Setting the threshold to zero disables it.
4706
4707 Arguments:
4708
4709 - "node-name": the node name in the block driver state graph (json-string)
4710 - "write-threshold": the write threshold in bytes (json-int)
4711
4712 Example:
4713
4714 -> { "execute": "block-set-write-threshold",
4715   "arguments": { "node-name": "mydev",
4716                  "write-threshold": 17179869184 } }
4717 <- { "return": {} }
4718
4719 EQMP
4720
4721     {
4722         .name       = "query-rocker",
4723         .args_type  = "name:s",
4724         .mhandler.cmd_new = qmp_marshal_query_rocker,
4725     },
4726
4727 SQMP
4728 Show rocker switch
4729 ------------------
4730
4731 Arguments:
4732
4733 - "name": switch name
4734
4735 Example:
4736
4737 -> { "execute": "query-rocker", "arguments": { "name": "sw1" } }
4738 <- { "return": {"name": "sw1", "ports": 2, "id": 1327446905938}}
4739
4740 EQMP
4741
4742     {
4743         .name       = "query-rocker-ports",
4744         .args_type  = "name:s",
4745         .mhandler.cmd_new = qmp_marshal_query_rocker_ports,
4746     },
4747
4748 SQMP
4749 Show rocker switch ports
4750 ------------------------
4751
4752 Arguments:
4753
4754 - "name": switch name
4755
4756 Example:
4757
4758 -> { "execute": "query-rocker-ports", "arguments": { "name": "sw1" } }
4759 <- { "return": [ {"duplex": "full", "enabled": true, "name": "sw1.1",
4760                   "autoneg": "off", "link-up": true, "speed": 10000},
4761                  {"duplex": "full", "enabled": true, "name": "sw1.2",
4762                   "autoneg": "off", "link-up": true, "speed": 10000}
4763    ]}
4764
4765 EQMP
4766
4767     {
4768         .name       = "query-rocker-of-dpa-flows",
4769         .args_type  = "name:s,tbl-id:i?",
4770         .mhandler.cmd_new = qmp_marshal_query_rocker_of_dpa_flows,
4771     },
4772
4773 SQMP
4774 Show rocker switch OF-DPA flow tables
4775 -------------------------------------
4776
4777 Arguments:
4778
4779 - "name": switch name
4780 - "tbl-id": (optional) flow table ID
4781
4782 Example:
4783
4784 -> { "execute": "query-rocker-of-dpa-flows", "arguments": { "name": "sw1" } }
4785 <- { "return": [ {"key": {"in-pport": 0, "priority": 1, "tbl-id": 0},
4786                   "hits": 138,
4787                   "cookie": 0,
4788                   "action": {"goto-tbl": 10},
4789                   "mask": {"in-pport": 4294901760}
4790                  },
4791                  {...more...},
4792    ]}
4793
4794 EQMP
4795
4796     {
4797         .name       = "query-rocker-of-dpa-groups",
4798         .args_type  = "name:s,type:i?",
4799         .mhandler.cmd_new = qmp_marshal_query_rocker_of_dpa_groups,
4800     },
4801
4802 SQMP
4803 Show rocker OF-DPA group tables
4804 -------------------------------
4805
4806 Arguments:
4807
4808 - "name": switch name
4809 - "type": (optional) group type
4810
4811 Example:
4812
4813 -> { "execute": "query-rocker-of-dpa-groups", "arguments": { "name": "sw1" } }
4814 <- { "return": [ {"type": 0, "out-pport": 2, "pport": 2, "vlan-id": 3841,
4815                   "pop-vlan": 1, "id": 251723778},
4816                  {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3841,
4817                   "pop-vlan": 1, "id": 251723776},
4818                  {"type": 0, "out-pport": 1, "pport": 1, "vlan-id": 3840,
4819                   "pop-vlan": 1, "id": 251658241},
4820                  {"type": 0, "out-pport": 0, "pport": 0, "vlan-id": 3840,
4821                   "pop-vlan": 1, "id": 251658240}
4822    ]}