Statistics
| Branch: | Revision:

root / qmp-commands.hx @ f487b677

History | View | Annotate | Download (77.8 kB)

1
HXCOMM QMP dispatch table and documentation
2
HXCOMM Text between SQMP and EQMP is copied to the QMP documention 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_input_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_input_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_input_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_input_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_input_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_input_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_input_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_input_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_input_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
        .user_print = monitor_user_noop,
280
        .mhandler.cmd_new = do_device_add,
281
    },
282

    
283
SQMP
284
device_add
285
----------
286

    
287
Add a device.
288

    
289
Arguments:
290

    
291
- "driver": the name of the new device's driver (json-string)
292
- "bus": the device's parent bus (device tree path, json-string, optional)
293
- "id": the device's ID, must be unique (json-string)
294
- device properties
295

    
296
Example:
297

    
298
-> { "execute": "device_add", "arguments": { "driver": "e1000", "id": "net1" } }
299
<- { "return": {} }
300

    
301
Notes:
302

    
303
(1) For detailed information about this command, please refer to the
304
    'docs/qdev-device-use.txt' file.
305

    
306
(2) It's possible to list device properties by running QEMU with the
307
    "-device DEVICE,\?" command-line argument, where DEVICE is the device's name
308

    
309
EQMP
310

    
311
    {
312
        .name       = "device_del",
313
        .args_type  = "id:s",
314
        .mhandler.cmd_new = qmp_marshal_input_device_del,
315
    },
316

    
317
SQMP
318
device_del
319
----------
320

    
321
Remove a device.
322

    
323
Arguments:
324

    
325
- "id": the device's ID (json-string)
326

    
327
Example:
328

    
329
-> { "execute": "device_del", "arguments": { "id": "net1" } }
330
<- { "return": {} }
331

    
332
EQMP
333

    
334
    {
335
        .name       = "send-key",
336
        .args_type  = "keys:O,hold-time:i?",
337
        .mhandler.cmd_new = qmp_marshal_input_send_key,
338
    },
339

    
340
SQMP
341
send-key
342
----------
343

    
344
Send keys to VM.
345

    
346
Arguments:
347

    
348
keys array:
349
    - "key": key sequence (a json-array of key enum values)
350

    
351
- hold-time: time to delay key up events, milliseconds. Defaults to 100
352
             (json-int, optional)
353

    
354
Example:
355

    
356
-> { "execute": "send-key",
357
     "arguments": { 'keys': [ 'ctrl', 'alt', 'delete' ] } }
358
<- { "return": {} }
359

    
360
EQMP
361

    
362
    {
363
        .name       = "cpu",
364
        .args_type  = "index:i",
365
        .mhandler.cmd_new = qmp_marshal_input_cpu,
366
    },
367

    
368
SQMP
369
cpu
370
---
371

    
372
Set the default CPU.
373

    
374
Arguments:
375

    
376
- "index": the CPU's index (json-int)
377

    
378
Example:
379

    
380
-> { "execute": "cpu", "arguments": { "index": 0 } }
381
<- { "return": {} }
382

    
383
Note: CPUs' indexes are obtained with the 'query-cpus' command.
384

    
385
EQMP
386

    
387
    {
388
        .name       = "cpu-add",
389
        .args_type  = "id:i",
390
        .mhandler.cmd_new = qmp_marshal_input_cpu_add,
391
    },
392

    
393
SQMP
394
cpu-add
395
-------
396

    
397
Adds virtual cpu
398

    
399
Arguments:
400

    
401
- "id": cpu id (json-int)
402

    
403
Example:
404

    
405
-> { "execute": "cpu-add", "arguments": { "id": 2 } }
406
<- { "return": {} }
407

    
408
EQMP
409

    
410
    {
411
        .name       = "memsave",
412
        .args_type  = "val:l,size:i,filename:s,cpu:i?",
413
        .mhandler.cmd_new = qmp_marshal_input_memsave,
414
    },
415

    
416
SQMP
417
memsave
418
-------
419

    
420
Save to disk virtual memory dump starting at 'val' of size 'size'.
421

    
422
Arguments:
423

    
424
- "val": the starting address (json-int)
425
- "size": the memory size, in bytes (json-int)
426
- "filename": file path (json-string)
427
- "cpu": virtual CPU index (json-int, optional)
428

    
429
Example:
430

    
431
-> { "execute": "memsave",
432
             "arguments": { "val": 10,
433
                            "size": 100,
434
                            "filename": "/tmp/virtual-mem-dump" } }
435
<- { "return": {} }
436

    
437
EQMP
438

    
439
    {
440
        .name       = "pmemsave",
441
        .args_type  = "val:l,size:i,filename:s",
442
        .mhandler.cmd_new = qmp_marshal_input_pmemsave,
443
    },
444

    
445
SQMP
446
pmemsave
447
--------
448

    
449
Save to disk physical memory dump starting at 'val' of size 'size'.
450

    
451
Arguments:
452

    
453
- "val": the starting address (json-int)
454
- "size": the memory size, in bytes (json-int)
455
- "filename": file path (json-string)
456

    
457
Example:
458

    
459
-> { "execute": "pmemsave",
460
             "arguments": { "val": 10,
461
                            "size": 100,
462
                            "filename": "/tmp/physical-mem-dump" } }
463
<- { "return": {} }
464

    
465
EQMP
466

    
467
    {
468
        .name       = "inject-nmi",
469
        .args_type  = "",
470
        .mhandler.cmd_new = qmp_marshal_input_inject_nmi,
471
    },
472

    
473
SQMP
474
inject-nmi
475
----------
476

    
477
Inject an NMI on guest's CPUs.
478

    
479
Arguments: None.
480

    
481
Example:
482

    
483
-> { "execute": "inject-nmi" }
484
<- { "return": {} }
485

    
486
Note: inject-nmi fails when the guest doesn't support injecting.
487
      Currently, only x86 guests do.
488

    
489
EQMP
490

    
491
    {
492
        .name       = "ringbuf-write",
493
        .args_type  = "device:s,data:s,format:s?",
494
        .mhandler.cmd_new = qmp_marshal_input_ringbuf_write,
495
    },
496

    
497
SQMP
498
ringbuf-write
499
-------------
500

    
501
Write to a ring buffer character device.
502

    
503
Arguments:
504

    
505
- "device": ring buffer character device name (json-string)
506
- "data": data to write (json-string)
507
- "format": data format (json-string, optional)
508
          - Possible values: "utf8" (default), "base64"
509
            Bug: invalid base64 is currently not rejected.
510
            Whitespace *is* invalid.
511

    
512
Example:
513

    
514
-> { "execute": "ringbuf-write",
515
                "arguments": { "device": "foo",
516
                               "data": "abcdefgh",
517
                               "format": "utf8" } }
518
<- { "return": {} }
519

    
520
EQMP
521

    
522
    {
523
        .name       = "ringbuf-read",
524
        .args_type  = "device:s,size:i,format:s?",
525
        .mhandler.cmd_new = qmp_marshal_input_ringbuf_read,
526
    },
527

    
528
SQMP
529
ringbuf-read
530
-------------
531

    
532
Read from a ring buffer character device.
533

    
534
Arguments:
535

    
536
- "device": ring buffer character device name (json-string)
537
- "size": how many bytes to read at most (json-int)
538
          - Number of data bytes, not number of characters in encoded data
539
- "format": data format (json-string, optional)
540
          - Possible values: "utf8" (default), "base64"
541
          - Naturally, format "utf8" works only when the ring buffer
542
            contains valid UTF-8 text.  Invalid UTF-8 sequences get
543
            replaced.  Bug: replacement doesn't work.  Bug: can screw
544
            up on encountering NUL characters, after the ring buffer
545
            lost data, and when reading stops because the size limit
546
            is reached.
547

    
548
Example:
549

    
550
-> { "execute": "ringbuf-read",
551
                "arguments": { "device": "foo",
552
                               "size": 1000,
553
                               "format": "utf8" } }
554
<- {"return": "abcdefgh"}
555

    
556
EQMP
557

    
558
    {
559
        .name       = "xen-save-devices-state",
560
        .args_type  = "filename:F",
561
    .mhandler.cmd_new = qmp_marshal_input_xen_save_devices_state,
562
    },
563

    
564
SQMP
565
xen-save-devices-state
566
-------
567

    
568
Save the state of all devices to file. The RAM and the block devices
569
of the VM are not saved by this command.
570

    
571
Arguments:
572

    
573
- "filename": the file to save the state of the devices to as binary
574
data. See xen-save-devices-state.txt for a description of the binary
575
format.
576

    
577
Example:
578

    
579
-> { "execute": "xen-save-devices-state",
580
     "arguments": { "filename": "/tmp/save" } }
581
<- { "return": {} }
582

    
583
EQMP
584

    
585
    {
586
        .name       = "xen-set-global-dirty-log",
587
        .args_type  = "enable:b",
588
        .mhandler.cmd_new = qmp_marshal_input_xen_set_global_dirty_log,
589
    },
590

    
591
SQMP
592
xen-set-global-dirty-log
593
-------
594

    
595
Enable or disable the global dirty log mode.
596

    
597
Arguments:
598

    
599
- "enable": Enable it or disable it.
600

    
601
Example:
602

    
603
-> { "execute": "xen-set-global-dirty-log",
604
     "arguments": { "enable": true } }
605
<- { "return": {} }
606

    
607
EQMP
608

    
609
    {
610
        .name       = "migrate",
611
        .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
612
        .mhandler.cmd_new = qmp_marshal_input_migrate,
613
    },
614

    
615
SQMP
616
migrate
617
-------
618

    
619
Migrate to URI.
620

    
621
Arguments:
622

    
623
- "blk": block migration, full disk copy (json-bool, optional)
624
- "inc": incremental disk copy (json-bool, optional)
625
- "uri": Destination URI (json-string)
626

    
627
Example:
628

    
629
-> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
630
<- { "return": {} }
631

    
632
Notes:
633

    
634
(1) The 'query-migrate' command should be used to check migration's progress
635
    and final result (this information is provided by the 'status' member)
636
(2) All boolean arguments default to false
637
(3) The user Monitor's "detach" argument is invalid in QMP and should not
638
    be used
639

    
640
EQMP
641

    
642
    {
643
        .name       = "migrate_cancel",
644
        .args_type  = "",
645
        .mhandler.cmd_new = qmp_marshal_input_migrate_cancel,
646
    },
647

    
648
SQMP
649
migrate_cancel
650
--------------
651

    
652
Cancel the current migration.
653

    
654
Arguments: None.
655

    
656
Example:
657

    
658
-> { "execute": "migrate_cancel" }
659
<- { "return": {} }
660

    
661
EQMP
662
{
663
        .name       = "migrate-set-cache-size",
664
        .args_type  = "value:o",
665
        .mhandler.cmd_new = qmp_marshal_input_migrate_set_cache_size,
666
    },
667

    
668
SQMP
669
migrate-set-cache-size
670
----------------------
671

    
672
Set cache size to be used by XBZRLE migration, the cache size will be rounded
673
down to the nearest power of 2
674

    
675
Arguments:
676

    
677
- "value": cache size in bytes (json-int)
678

    
679
Example:
680

    
681
-> { "execute": "migrate-set-cache-size", "arguments": { "value": 536870912 } }
682
<- { "return": {} }
683

    
684
EQMP
685
    {
686
        .name       = "query-migrate-cache-size",
687
        .args_type  = "",
688
        .mhandler.cmd_new = qmp_marshal_input_query_migrate_cache_size,
689
    },
690

    
691
SQMP
692
query-migrate-cache-size
693
------------------------
694

    
695
Show cache size to be used by XBZRLE migration
696

    
697
returns a json-object with the following information:
698
- "size" : json-int
699

    
700
Example:
701

    
702
-> { "execute": "query-migrate-cache-size" }
703
<- { "return": 67108864 }
704

    
705
EQMP
706

    
707
    {
708
        .name       = "migrate_set_speed",
709
        .args_type  = "value:o",
710
        .mhandler.cmd_new = qmp_marshal_input_migrate_set_speed,
711
    },
712

    
713
SQMP
714
migrate_set_speed
715
-----------------
716

    
717
Set maximum speed for migrations.
718

    
719
Arguments:
720

    
721
- "value": maximum speed, in bytes per second (json-int)
722

    
723
Example:
724

    
725
-> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
726
<- { "return": {} }
727

    
728
EQMP
729

    
730
    {
731
        .name       = "migrate_set_downtime",
732
        .args_type  = "value:T",
733
        .mhandler.cmd_new = qmp_marshal_input_migrate_set_downtime,
734
    },
735

    
736
SQMP
737
migrate_set_downtime
738
--------------------
739

    
740
Set maximum tolerated downtime (in seconds) for migrations.
741

    
742
Arguments:
743

    
744
- "value": maximum downtime (json-number)
745

    
746
Example:
747

    
748
-> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
749
<- { "return": {} }
750

    
751
EQMP
752

    
753
    {
754
        .name       = "client_migrate_info",
755
        .args_type  = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
756
        .params     = "protocol hostname port tls-port cert-subject",
757
        .help       = "send migration info to spice/vnc client",
758
        .user_print = monitor_user_noop,
759
        .mhandler.cmd_async = client_migrate_info,
760
        .flags      = MONITOR_CMD_ASYNC,
761
    },
762

    
763
SQMP
764
client_migrate_info
765
------------------
766

    
767
Set the spice/vnc connection info for the migration target.  The spice/vnc
768
server will ask the spice/vnc client to automatically reconnect using the
769
new parameters (if specified) once the vm migration finished successfully.
770

    
771
Arguments:
772

    
773
- "protocol":     protocol: "spice" or "vnc" (json-string)
774
- "hostname":     migration target hostname (json-string)
775
- "port":         spice/vnc tcp port for plaintext channels (json-int, optional)
776
- "tls-port":     spice tcp port for tls-secured channels (json-int, optional)
777
- "cert-subject": server certificate subject (json-string, optional)
778

    
779
Example:
780

    
781
-> { "execute": "client_migrate_info",
782
     "arguments": { "protocol": "spice",
783
                    "hostname": "virt42.lab.kraxel.org",
784
                    "port": 1234 } }
785
<- { "return": {} }
786

    
787
EQMP
788

    
789
    {
790
        .name       = "dump-guest-memory",
791
        .args_type  = "paging:b,protocol:s,begin:i?,end:i?",
792
        .params     = "-p protocol [begin] [length]",
793
        .help       = "dump guest memory to file",
794
        .user_print = monitor_user_noop,
795
        .mhandler.cmd_new = qmp_marshal_input_dump_guest_memory,
796
    },
797

    
798
SQMP
799
dump
800

    
801

    
802
Dump guest memory to file. The file can be processed with crash or gdb.
803

    
804
Arguments:
805

    
806
- "paging": do paging to get guest's memory mapping (json-bool)
807
- "protocol": destination file(started with "file:") or destination file
808
              descriptor (started with "fd:") (json-string)
809
- "begin": the starting physical address. It's optional, and should be specified
810
           with length together (json-int)
811
- "length": the memory size, in bytes. It's optional, and should be specified
812
            with begin together (json-int)
813

    
814
Example:
815

    
816
-> { "execute": "dump-guest-memory", "arguments": { "protocol": "fd:dump" } }
817
<- { "return": {} }
818

    
819
Notes:
820

    
821
(1) All boolean arguments default to false
822

    
823
EQMP
824

    
825
    {
826
        .name       = "netdev_add",
827
        .args_type  = "netdev:O",
828
        .mhandler.cmd_new = qmp_netdev_add,
829
    },
830

    
831
SQMP
832
netdev_add
833
----------
834

    
835
Add host network device.
836

    
837
Arguments:
838

    
839
- "type": the device type, "tap", "user", ... (json-string)
840
- "id": the device's ID, must be unique (json-string)
841
- device options
842

    
843
Example:
844

    
845
-> { "execute": "netdev_add", "arguments": { "type": "user", "id": "netdev1" } }
846
<- { "return": {} }
847

    
848
Note: The supported device options are the same ones supported by the '-netdev'
849
      command-line argument, which are listed in the '-help' output or QEMU's
850
      manual
851

    
852
EQMP
853

    
854
    {
855
        .name       = "netdev_del",
856
        .args_type  = "id:s",
857
        .mhandler.cmd_new = qmp_marshal_input_netdev_del,
858
    },
859

    
860
SQMP
861
netdev_del
862
----------
863

    
864
Remove host network device.
865

    
866
Arguments:
867

    
868
- "id": the device's ID, must be unique (json-string)
869

    
870
Example:
871

    
872
-> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
873
<- { "return": {} }
874

    
875

    
876
EQMP
877

    
878
    {
879
        .name       = "block_resize",
880
        .args_type  = "device:B,size:o",
881
        .mhandler.cmd_new = qmp_marshal_input_block_resize,
882
    },
883

    
884
SQMP
885
block_resize
886
------------
887

    
888
Resize a block image while a guest is running.
889

    
890
Arguments:
891

    
892
- "device": the device's ID, must be unique (json-string)
893
- "size": new size
894

    
895
Example:
896

    
897
-> { "execute": "block_resize", "arguments": { "device": "scratch", "size": 1073741824 } }
898
<- { "return": {} }
899

    
900
EQMP
901

    
902
    {
903
        .name       = "block-stream",
904
        .args_type  = "device:B,base:s?,speed:o?,on-error:s?",
905
        .mhandler.cmd_new = qmp_marshal_input_block_stream,
906
    },
907

    
908
    {
909
        .name       = "block-commit",
910
        .args_type  = "device:B,base:s?,top:s,speed:o?",
911
        .mhandler.cmd_new = qmp_marshal_input_block_commit,
912
    },
913

    
914
    {
915
        .name       = "drive-backup",
916
        .args_type  = "device:B,target:s,speed:i?,mode:s?,format:s?,"
917
                      "on-source-error:s?,on-target-error:s?",
918
        .mhandler.cmd_new = qmp_marshal_input_drive_backup,
919
    },
920

    
921
SQMP
922
drive-backup
923
------------
924

    
925
Start a point-in-time copy of a block device to a new destination.  The
926
status of ongoing drive-backup operations can be checked with
927
query-block-jobs where the BlockJobInfo.type field has the value 'backup'.
928
The operation can be stopped before it has completed using the
929
block-job-cancel command.
930

    
931
Arguments:
932

    
933
- "device": the name of the device which should be copied.
934
            (json-string)
935
- "target": the target of the new image. If the file exists, or if it is a
936
            device, the existing file/device will be used as the new
937
            destination.  If it does not exist, a new file will be created.
938
            (json-string)
939
- "format": the format of the new destination, default is to probe if 'mode' is
940
            'existing', else the format of the source
941
            (json-string, optional)
942
- "mode": whether and how QEMU should create a new image
943
          (NewImageMode, optional, default 'absolute-paths')
944
- "speed": the maximum speed, in bytes per second (json-int, optional)
945
- "on-source-error": the action to take on an error on the source, default
946
                     'report'.  'stop' and 'enospc' can only be used
947
                     if the block device supports io-status.
948
                     (BlockdevOnError, optional)
949
- "on-target-error": the action to take on an error on the target, default
950
                     'report' (no limitations, since this applies to
951
                     a different block device than device).
952
                     (BlockdevOnError, optional)
953

    
954
Example:
955
-> { "execute": "drive-backup", "arguments": { "device": "drive0",
956
                                               "target": "backup.img" } }
957
<- { "return": {} }
958
EQMP
959

    
960
    {
961
        .name       = "block-job-set-speed",
962
        .args_type  = "device:B,speed:o",
963
        .mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
964
    },
965

    
966
    {
967
        .name       = "block-job-cancel",
968
        .args_type  = "device:B,force:b?",
969
        .mhandler.cmd_new = qmp_marshal_input_block_job_cancel,
970
    },
971
    {
972
        .name       = "block-job-pause",
973
        .args_type  = "device:B",
974
        .mhandler.cmd_new = qmp_marshal_input_block_job_pause,
975
    },
976
    {
977
        .name       = "block-job-resume",
978
        .args_type  = "device:B",
979
        .mhandler.cmd_new = qmp_marshal_input_block_job_resume,
980
    },
981
    {
982
        .name       = "block-job-complete",
983
        .args_type  = "device:B",
984
        .mhandler.cmd_new = qmp_marshal_input_block_job_complete,
985
    },
986
    {
987
        .name       = "transaction",
988
        .args_type  = "actions:q",
989
        .mhandler.cmd_new = qmp_marshal_input_transaction,
990
    },
991

    
992
SQMP
993
transaction
994
-----------
995

    
996
Atomically operate on one or more block devices.  The only supported
997
operation for now is snapshotting.  If there is any failure performing
998
any of the operations, all snapshots for the group are abandoned, and
999
the original disks pre-snapshot attempt are used.
1000

    
1001
A list of dictionaries is accepted, that contains the actions to be performed.
1002
For snapshots this is the device, the file to use for the new snapshot,
1003
and the format.  The default format, if not specified, is qcow2.
1004

    
1005
Each new snapshot defaults to being created by QEMU (wiping any
1006
contents if the file already exists), but it is also possible to reuse
1007
an externally-created file.  In the latter case, you should ensure that
1008
the new image file has the same contents as the current one; QEMU cannot
1009
perform any meaningful check.  Typically this is achieved by using the
1010
current image file as the backing file for the new image.
1011

    
1012
Arguments:
1013

    
1014
actions array:
1015
    - "type": the operation to perform.  The only supported
1016
      value is "blockdev-snapshot-sync". (json-string)
1017
    - "data": a dictionary.  The contents depend on the value
1018
      of "type".  When "type" is "blockdev-snapshot-sync":
1019
      - "device": device name to snapshot (json-string)
1020
      - "snapshot-file": name of new image file (json-string)
1021
      - "format": format of new image (json-string, optional)
1022
      - "mode": whether and how QEMU should create the snapshot file
1023
        (NewImageMode, optional, default "absolute-paths")
1024

    
1025
Example:
1026

    
1027
-> { "execute": "transaction",
1028
     "arguments": { "actions": [
1029
         { 'type': 'blockdev-snapshot-sync', 'data' : { "device": "ide-hd0",
1030
                                         "snapshot-file": "/some/place/my-image",
1031
                                         "format": "qcow2" } },
1032
         { 'type': 'blockdev-snapshot-sync', 'data' : { "device": "ide-hd1",
1033
                                         "snapshot-file": "/some/place/my-image2",
1034
                                         "mode": "existing",
1035
                                         "format": "qcow2" } } ] } }
1036
<- { "return": {} }
1037

    
1038
EQMP
1039

    
1040
    {
1041
        .name       = "blockdev-snapshot-sync",
1042
        .args_type  = "device:B,snapshot-file:s,format:s?,mode:s?",
1043
        .mhandler.cmd_new = qmp_marshal_input_blockdev_snapshot_sync,
1044
    },
1045

    
1046
SQMP
1047
blockdev-snapshot-sync
1048
----------------------
1049

    
1050
Synchronous snapshot of a block device. snapshot-file specifies the
1051
target of the new image. If the file exists, or if it is a device, the
1052
snapshot will be created in the existing file/device. If does not
1053
exist, a new file will be created. format specifies the format of the
1054
snapshot image, default is qcow2.
1055

    
1056
Arguments:
1057

    
1058
- "device": device name to snapshot (json-string)
1059
- "snapshot-file": name of new image file (json-string)
1060
- "mode": whether and how QEMU should create the snapshot file
1061
  (NewImageMode, optional, default "absolute-paths")
1062
- "format": format of new image (json-string, optional)
1063

    
1064
Example:
1065

    
1066
-> { "execute": "blockdev-snapshot-sync", "arguments": { "device": "ide-hd0",
1067
                                                         "snapshot-file":
1068
                                                        "/some/place/my-image",
1069
                                                        "format": "qcow2" } }
1070
<- { "return": {} }
1071

    
1072
EQMP
1073

    
1074
    {
1075
        .name       = "drive-mirror",
1076
        .args_type  = "sync:s,device:B,target:s,speed:i?,mode:s?,format:s?,"
1077
                      "on-source-error:s?,on-target-error:s?,"
1078
                      "granularity:i?,buf-size:i?",
1079
        .mhandler.cmd_new = qmp_marshal_input_drive_mirror,
1080
    },
1081

    
1082
SQMP
1083
drive-mirror
1084
------------
1085

    
1086
Start mirroring a block device's writes to a new destination. target
1087
specifies the target of the new image. If the file exists, or if it is
1088
a device, it will be used as the new destination for writes. If it does not
1089
exist, a new file will be created. format specifies the format of the
1090
mirror image, default is to probe if mode='existing', else the format
1091
of the source.
1092

    
1093
Arguments:
1094

    
1095
- "device": device name to operate on (json-string)
1096
- "target": name of new image file (json-string)
1097
- "format": format of new image (json-string, optional)
1098
- "mode": how an image file should be created into the target
1099
  file/device (NewImageMode, optional, default 'absolute-paths')
1100
- "speed": maximum speed of the streaming job, in bytes per second
1101
  (json-int)
1102
- "granularity": granularity of the dirty bitmap, in bytes (json-int, optional)
1103
- "buf_size": maximum amount of data in flight from source to target, in bytes
1104
  (json-int, default 10M)
1105
- "sync": what parts of the disk image should be copied to the destination;
1106
  possibilities include "full" for all the disk, "top" for only the sectors
1107
  allocated in the topmost image, or "none" to only replicate new I/O
1108
  (MirrorSyncMode).
1109
- "on-source-error": the action to take on an error on the source
1110
  (BlockdevOnError, default 'report')
1111
- "on-target-error": the action to take on an error on the target
1112
  (BlockdevOnError, default 'report')
1113

    
1114
The default value of the granularity is the image cluster size clamped
1115
between 4096 and 65536, if the image format defines one.  If the format
1116
does not define a cluster size, the default value of the granularity
1117
is 65536.
1118

    
1119

    
1120
Example:
1121

    
1122
-> { "execute": "drive-mirror", "arguments": { "device": "ide-hd0",
1123
                                               "target": "/some/place/my-image",
1124
                                               "sync": "full",
1125
                                               "format": "qcow2" } }
1126
<- { "return": {} }
1127

    
1128
EQMP
1129

    
1130
    {
1131
        .name       = "balloon",
1132
        .args_type  = "value:M",
1133
        .mhandler.cmd_new = qmp_marshal_input_balloon,
1134
    },
1135

    
1136
SQMP
1137
balloon
1138
-------
1139

    
1140
Request VM to change its memory allocation (in bytes).
1141

    
1142
Arguments:
1143

    
1144
- "value": New memory allocation (json-int)
1145

    
1146
Example:
1147

    
1148
-> { "execute": "balloon", "arguments": { "value": 536870912 } }
1149
<- { "return": {} }
1150

    
1151
EQMP
1152

    
1153
    {
1154
        .name       = "set_link",
1155
        .args_type  = "name:s,up:b",
1156
        .mhandler.cmd_new = qmp_marshal_input_set_link,
1157
    },
1158

    
1159
SQMP
1160
set_link
1161
--------
1162

    
1163
Change the link status of a network adapter.
1164

    
1165
Arguments:
1166

    
1167
- "name": network device name (json-string)
1168
- "up": status is up (json-bool)
1169

    
1170
Example:
1171

    
1172
-> { "execute": "set_link", "arguments": { "name": "e1000.0", "up": false } }
1173
<- { "return": {} }
1174

    
1175
EQMP
1176

    
1177
    {
1178
        .name       = "getfd",
1179
        .args_type  = "fdname:s",
1180
        .params     = "getfd name",
1181
        .help       = "receive a file descriptor via SCM rights and assign it a name",
1182
        .mhandler.cmd_new = qmp_marshal_input_getfd,
1183
    },
1184

    
1185
SQMP
1186
getfd
1187
-----
1188

    
1189
Receive a file descriptor via SCM rights and assign it a name.
1190

    
1191
Arguments:
1192

    
1193
- "fdname": file descriptor name (json-string)
1194

    
1195
Example:
1196

    
1197
-> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
1198
<- { "return": {} }
1199

    
1200
Notes:
1201

    
1202
(1) If the name specified by the "fdname" argument already exists,
1203
    the file descriptor assigned to it will be closed and replaced
1204
    by the received file descriptor.
1205
(2) The 'closefd' command can be used to explicitly close the file
1206
    descriptor when it is no longer needed.
1207

    
1208
EQMP
1209

    
1210
    {
1211
        .name       = "closefd",
1212
        .args_type  = "fdname:s",
1213
        .params     = "closefd name",
1214
        .help       = "close a file descriptor previously passed via SCM rights",
1215
        .mhandler.cmd_new = qmp_marshal_input_closefd,
1216
    },
1217

    
1218
SQMP
1219
closefd
1220
-------
1221

    
1222
Close a file descriptor previously passed via SCM rights.
1223

    
1224
Arguments:
1225

    
1226
- "fdname": file descriptor name (json-string)
1227

    
1228
Example:
1229

    
1230
-> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
1231
<- { "return": {} }
1232

    
1233
EQMP
1234

    
1235
     {
1236
        .name       = "add-fd",
1237
        .args_type  = "fdset-id:i?,opaque:s?",
1238
        .params     = "add-fd fdset-id opaque",
1239
        .help       = "Add a file descriptor, that was passed via SCM rights, to an fd set",
1240
        .mhandler.cmd_new = qmp_marshal_input_add_fd,
1241
    },
1242

    
1243
SQMP
1244
add-fd
1245
-------
1246

    
1247
Add a file descriptor, that was passed via SCM rights, to an fd set.
1248

    
1249
Arguments:
1250

    
1251
- "fdset-id": The ID of the fd set to add the file descriptor to.
1252
              (json-int, optional)
1253
- "opaque": A free-form string that can be used to describe the fd.
1254
            (json-string, optional)
1255

    
1256
Return a json-object with the following information:
1257

    
1258
- "fdset-id": The ID of the fd set that the fd was added to. (json-int)
1259
- "fd": The file descriptor that was received via SCM rights and added to the
1260
        fd set. (json-int)
1261

    
1262
Example:
1263

    
1264
-> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
1265
<- { "return": { "fdset-id": 1, "fd": 3 } }
1266

    
1267
Notes:
1268

    
1269
(1) The list of fd sets is shared by all monitor connections.
1270
(2) If "fdset-id" is not specified, a new fd set will be created.
1271

    
1272
EQMP
1273

    
1274
     {
1275
        .name       = "remove-fd",
1276
        .args_type  = "fdset-id:i,fd:i?",
1277
        .params     = "remove-fd fdset-id fd",
1278
        .help       = "Remove a file descriptor from an fd set",
1279
        .mhandler.cmd_new = qmp_marshal_input_remove_fd,
1280
    },
1281

    
1282
SQMP
1283
remove-fd
1284
---------
1285

    
1286
Remove a file descriptor from an fd set.
1287

    
1288
Arguments:
1289

    
1290
- "fdset-id": The ID of the fd set that the file descriptor belongs to.
1291
              (json-int)
1292
- "fd": The file descriptor that is to be removed. (json-int, optional)
1293

    
1294
Example:
1295

    
1296
-> { "execute": "remove-fd", "arguments": { "fdset-id": 1, "fd": 3 } }
1297
<- { "return": {} }
1298

    
1299
Notes:
1300

    
1301
(1) The list of fd sets is shared by all monitor connections.
1302
(2) If "fd" is not specified, all file descriptors in "fdset-id" will be
1303
    removed.
1304

    
1305
EQMP
1306

    
1307
    {
1308
        .name       = "query-fdsets",
1309
        .args_type  = "",
1310
        .help       = "Return information describing all fd sets",
1311
        .mhandler.cmd_new = qmp_marshal_input_query_fdsets,
1312
    },
1313

    
1314
SQMP
1315
query-fdsets
1316
-------------
1317

    
1318
Return information describing all fd sets.
1319

    
1320
Arguments: None
1321

    
1322
Example:
1323

    
1324
-> { "execute": "query-fdsets" }
1325
<- { "return": [
1326
       {
1327
         "fds": [
1328
           {
1329
             "fd": 30,
1330
             "opaque": "rdonly:/path/to/file"
1331
           },
1332
           {
1333
             "fd": 24,
1334
             "opaque": "rdwr:/path/to/file"
1335
           }
1336
         ],
1337
         "fdset-id": 1
1338
       },
1339
       {
1340
         "fds": [
1341
           {
1342
             "fd": 28
1343
           },
1344
           {
1345
             "fd": 29
1346
           }
1347
         ],
1348
         "fdset-id": 0
1349
       }
1350
     ]
1351
   }
1352

    
1353
Note: The list of fd sets is shared by all monitor connections.
1354

    
1355
EQMP
1356

    
1357
    {
1358
        .name       = "block_passwd",
1359
        .args_type  = "device:B,password:s",
1360
        .mhandler.cmd_new = qmp_marshal_input_block_passwd,
1361
    },
1362

    
1363
SQMP
1364
block_passwd
1365
------------
1366

    
1367
Set the password of encrypted block devices.
1368

    
1369
Arguments:
1370

    
1371
- "device": device name (json-string)
1372
- "password": password (json-string)
1373

    
1374
Example:
1375

    
1376
-> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
1377
                                               "password": "12345" } }
1378
<- { "return": {} }
1379

    
1380
EQMP
1381

    
1382
    {
1383
        .name       = "block_set_io_throttle",
1384
        .args_type  = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l",
1385
        .mhandler.cmd_new = qmp_marshal_input_block_set_io_throttle,
1386
    },
1387

    
1388
SQMP
1389
block_set_io_throttle
1390
------------
1391

    
1392
Change I/O throttle limits for a block drive.
1393

    
1394
Arguments:
1395

    
1396
- "device": device name (json-string)
1397
- "bps":  total throughput limit in bytes per second(json-int)
1398
- "bps_rd":  read throughput limit in bytes per second(json-int)
1399
- "bps_wr":  read throughput limit in bytes per second(json-int)
1400
- "iops":  total I/O operations per second(json-int)
1401
- "iops_rd":  read I/O operations per second(json-int)
1402
- "iops_wr":  write I/O operations per second(json-int)
1403

    
1404
Example:
1405

    
1406
-> { "execute": "block_set_io_throttle", "arguments": { "device": "virtio0",
1407
                                               "bps": "1000000",
1408
                                               "bps_rd": "0",
1409
                                               "bps_wr": "0",
1410
                                               "iops": "0",
1411
                                               "iops_rd": "0",
1412
                                               "iops_wr": "0" } }
1413
<- { "return": {} }
1414

    
1415
EQMP
1416

    
1417
    {
1418
        .name       = "set_password",
1419
        .args_type  = "protocol:s,password:s,connected:s?",
1420
        .mhandler.cmd_new = qmp_marshal_input_set_password,
1421
    },
1422

    
1423
SQMP
1424
set_password
1425
------------
1426

    
1427
Set the password for vnc/spice protocols.
1428

    
1429
Arguments:
1430

    
1431
- "protocol": protocol name (json-string)
1432
- "password": password (json-string)
1433
- "connected": [ keep | disconnect | fail ] (josn-string, optional)
1434

    
1435
Example:
1436

    
1437
-> { "execute": "set_password", "arguments": { "protocol": "vnc",
1438
                                               "password": "secret" } }
1439
<- { "return": {} }
1440

    
1441
EQMP
1442

    
1443
    {
1444
        .name       = "expire_password",
1445
        .args_type  = "protocol:s,time:s",
1446
        .mhandler.cmd_new = qmp_marshal_input_expire_password,
1447
    },
1448

    
1449
SQMP
1450
expire_password
1451
---------------
1452

    
1453
Set the password expire time for vnc/spice protocols.
1454

    
1455
Arguments:
1456

    
1457
- "protocol": protocol name (json-string)
1458
- "time": [ now | never | +secs | secs ] (json-string)
1459

    
1460
Example:
1461

    
1462
-> { "execute": "expire_password", "arguments": { "protocol": "vnc",
1463
                                                  "time": "+60" } }
1464
<- { "return": {} }
1465

    
1466
EQMP
1467

    
1468
    {
1469
        .name       = "add_client",
1470
        .args_type  = "protocol:s,fdname:s,skipauth:b?,tls:b?",
1471
        .mhandler.cmd_new = qmp_marshal_input_add_client,
1472
    },
1473

    
1474
SQMP
1475
add_client
1476
----------
1477

    
1478
Add a graphics client
1479

    
1480
Arguments:
1481

    
1482
- "protocol": protocol name (json-string)
1483
- "fdname": file descriptor name (json-string)
1484
- "skipauth": whether to skip authentication (json-bool, optional)
1485
- "tls": whether to perform TLS (json-bool, optional)
1486

    
1487
Example:
1488

    
1489
-> { "execute": "add_client", "arguments": { "protocol": "vnc",
1490
                                             "fdname": "myclient" } }
1491
<- { "return": {} }
1492

    
1493
EQMP
1494
    {
1495
        .name       = "qmp_capabilities",
1496
        .args_type  = "",
1497
        .params     = "",
1498
        .help       = "enable QMP capabilities",
1499
        .user_print = monitor_user_noop,
1500
        .mhandler.cmd_new = do_qmp_capabilities,
1501
    },
1502

    
1503
SQMP
1504
qmp_capabilities
1505
----------------
1506

    
1507
Enable QMP capabilities.
1508

    
1509
Arguments: None.
1510

    
1511
Example:
1512

    
1513
-> { "execute": "qmp_capabilities" }
1514
<- { "return": {} }
1515

    
1516
Note: This command must be issued before issuing any other command.
1517

    
1518
EQMP
1519

    
1520
    {
1521
        .name       = "human-monitor-command",
1522
        .args_type  = "command-line:s,cpu-index:i?",
1523
        .mhandler.cmd_new = qmp_marshal_input_human_monitor_command,
1524
    },
1525

    
1526
SQMP
1527
human-monitor-command
1528
---------------------
1529

    
1530
Execute a Human Monitor command.
1531

    
1532
Arguments: 
1533

    
1534
- command-line: the command name and its arguments, just like the
1535
                Human Monitor's shell (json-string)
1536
- cpu-index: select the CPU number to be used by commands which access CPU
1537
             data, like 'info registers'. The Monitor selects CPU 0 if this
1538
             argument is not provided (json-int, optional)
1539

    
1540
Example:
1541

    
1542
-> { "execute": "human-monitor-command", "arguments": { "command-line": "info kvm" } }
1543
<- { "return": "kvm support: enabled\r\n" }
1544

    
1545
Notes:
1546

    
1547
(1) The Human Monitor is NOT an stable interface, this means that command
1548
    names, arguments and responses can change or be removed at ANY time.
1549
    Applications that rely on long term stability guarantees should NOT
1550
    use this command
1551

    
1552
(2) Limitations:
1553

    
1554
    o This command is stateless, this means that commands that depend
1555
      on state information (such as getfd) might not work
1556

    
1557
    o Commands that prompt the user for data (eg. 'cont' when the block
1558
      device is encrypted) don't currently work
1559

    
1560
3. Query Commands
1561
=================
1562

    
1563
HXCOMM Each query command below is inside a SQMP/EQMP section, do NOT change
1564
HXCOMM this! We will possibly move query commands definitions inside those
1565
HXCOMM sections, just like regular commands.
1566

    
1567
EQMP
1568

    
1569
SQMP
1570
query-version
1571
-------------
1572

    
1573
Show QEMU version.
1574

    
1575
Return a json-object with the following information:
1576

    
1577
- "qemu": A json-object containing three integer values:
1578
    - "major": QEMU's major version (json-int)
1579
    - "minor": QEMU's minor version (json-int)
1580
    - "micro": QEMU's micro version (json-int)
1581
- "package": package's version (json-string)
1582

    
1583
Example:
1584

    
1585
-> { "execute": "query-version" }
1586
<- {
1587
      "return":{
1588
         "qemu":{
1589
            "major":0,
1590
            "minor":11,
1591
            "micro":5
1592
         },
1593
         "package":""
1594
      }
1595
   }
1596

    
1597
EQMP
1598

    
1599
    {
1600
        .name       = "query-version",
1601
        .args_type  = "",
1602
        .mhandler.cmd_new = qmp_marshal_input_query_version,
1603
    },
1604

    
1605
SQMP
1606
query-commands
1607
--------------
1608

    
1609
List QMP available commands.
1610

    
1611
Each command is represented by a json-object, the returned value is a json-array
1612
of all commands.
1613

    
1614
Each json-object contain:
1615

    
1616
- "name": command's name (json-string)
1617

    
1618
Example:
1619

    
1620
-> { "execute": "query-commands" }
1621
<- {
1622
      "return":[
1623
         {
1624
            "name":"query-balloon"
1625
         },
1626
         {
1627
            "name":"system_powerdown"
1628
         }
1629
      ]
1630
   }
1631

    
1632
Note: This example has been shortened as the real response is too long.
1633

    
1634
EQMP
1635

    
1636
    {
1637
        .name       = "query-commands",
1638
        .args_type  = "",
1639
        .mhandler.cmd_new = qmp_marshal_input_query_commands,
1640
    },
1641

    
1642
SQMP
1643
query-events
1644
--------------
1645

    
1646
List QMP available events.
1647

    
1648
Each event is represented by a json-object, the returned value is a json-array
1649
of all events.
1650

    
1651
Each json-object contains:
1652

    
1653
- "name": event's name (json-string)
1654

    
1655
Example:
1656

    
1657
-> { "execute": "query-events" }
1658
<- {
1659
      "return":[
1660
         {
1661
            "name":"SHUTDOWN"
1662
         },
1663
         {
1664
            "name":"RESET"
1665
         }
1666
      ]
1667
   }
1668

    
1669
Note: This example has been shortened as the real response is too long.
1670

    
1671
EQMP
1672

    
1673
    {
1674
        .name       = "query-events",
1675
        .args_type  = "",
1676
        .mhandler.cmd_new = qmp_marshal_input_query_events,
1677
    },
1678

    
1679
SQMP
1680
query-chardev
1681
-------------
1682

    
1683
Each device is represented by a json-object. The returned value is a json-array
1684
of all devices.
1685

    
1686
Each json-object contain the following:
1687

    
1688
- "label": device's label (json-string)
1689
- "filename": device's file (json-string)
1690

    
1691
Example:
1692

    
1693
-> { "execute": "query-chardev" }
1694
<- {
1695
      "return":[
1696
         {
1697
            "label":"monitor",
1698
            "filename":"stdio"
1699
         },
1700
         {
1701
            "label":"serial0",
1702
            "filename":"vc"
1703
         }
1704
      ]
1705
   }
1706

    
1707
EQMP
1708

    
1709
    {
1710
        .name       = "query-chardev",
1711
        .args_type  = "",
1712
        .mhandler.cmd_new = qmp_marshal_input_query_chardev,
1713
    },
1714

    
1715
SQMP
1716
query-block
1717
-----------
1718

    
1719
Show the block devices.
1720

    
1721
Each block device information is stored in a json-object and the returned value
1722
is a json-array of all devices.
1723

    
1724
Each json-object contain the following:
1725

    
1726
- "device": device name (json-string)
1727
- "type": device type (json-string)
1728
         - deprecated, retained for backward compatibility
1729
         - Possible values: "unknown"
1730
- "removable": true if the device is removable, false otherwise (json-bool)
1731
- "locked": true if the device is locked, false otherwise (json-bool)
1732
- "tray_open": only present if removable, true if the device has a tray,
1733
               and it is open (json-bool)
1734
- "inserted": only present if the device is inserted, it is a json-object
1735
   containing the following:
1736
         - "file": device file name (json-string)
1737
         - "ro": true if read-only, false otherwise (json-bool)
1738
         - "drv": driver format name (json-string)
1739
             - Possible values: "blkdebug", "bochs", "cloop", "cow", "dmg",
1740
                                "file", "file", "ftp", "ftps", "host_cdrom",
1741
                                "host_device", "host_floppy", "http", "https",
1742
                                "nbd", "parallels", "qcow", "qcow2", "raw",
1743
                                "tftp", "vdi", "vmdk", "vpc", "vvfat"
1744
         - "backing_file": backing file name (json-string, optional)
1745
         - "backing_file_depth": number of files in the backing file chain (json-int)
1746
         - "encrypted": true if encrypted, false otherwise (json-bool)
1747
         - "bps": limit total bytes per second (json-int)
1748
         - "bps_rd": limit read bytes per second (json-int)
1749
         - "bps_wr": limit write bytes per second (json-int)
1750
         - "iops": limit total I/O operations per second (json-int)
1751
         - "iops_rd": limit read operations per second (json-int)
1752
         - "iops_wr": limit write operations per second (json-int)
1753
         - "image": the detail of the image, it is a json-object containing
1754
            the following:
1755
             - "filename": image file name (json-string)
1756
             - "format": image format (json-string)
1757
             - "virtual-size": image capacity in bytes (json-int)
1758
             - "dirty-flag": true if image is not cleanly closed, not present
1759
                             means clean (json-bool, optional)
1760
             - "actual-size": actual size on disk in bytes of the image, not
1761
                              present when image does not support thin
1762
                              provision (json-int, optional)
1763
             - "cluster-size": size of a cluster in bytes, not present if image
1764
                               format does not support it (json-int, optional)
1765
             - "encrypted": true if the image is encrypted, not present means
1766
                            false or the image format does not support
1767
                            encryption (json-bool, optional)
1768
             - "backing_file": backing file name, not present means no backing
1769
                               file is used or the image format does not
1770
                               support backing file chain
1771
                               (json-string, optional)
1772
             - "full-backing-filename": full path of the backing file, not
1773
                                        present if it equals backing_file or no
1774
                                        backing file is used
1775
                                        (json-string, optional)
1776
             - "backing-filename-format": the format of the backing file, not
1777
                                          present means unknown or no backing
1778
                                          file (json-string, optional)
1779
             - "snapshots": the internal snapshot info, it is an optional list
1780
                of json-object containing the following:
1781
                 - "id": unique snapshot id (json-string)
1782
                 - "name": snapshot name (json-string)
1783
                 - "vm-state-size": size of the VM state in bytes (json-int)
1784
                 - "date-sec": UTC date of the snapshot in seconds (json-int)
1785
                 - "date-nsec": fractional part in nanoseconds to be used with
1786
                                date-sec(json-int)
1787
                 - "vm-clock-sec": VM clock relative to boot in seconds
1788
                                   (json-int)
1789
                 - "vm-clock-nsec": fractional part in nanoseconds to be used
1790
                                    with vm-clock-sec (json-int)
1791
             - "backing-image": the detail of the backing image, it is an
1792
                                optional json-object only present when a
1793
                                backing image present for this image
1794

    
1795
- "io-status": I/O operation status, only present if the device supports it
1796
               and the VM is configured to stop on errors. It's always reset
1797
               to "ok" when the "cont" command is issued (json_string, optional)
1798
             - Possible values: "ok", "failed", "nospace"
1799

    
1800
Example:
1801

    
1802
-> { "execute": "query-block" }
1803
<- {
1804
      "return":[
1805
         {
1806
            "io-status": "ok",
1807
            "device":"ide0-hd0",
1808
            "locked":false,
1809
            "removable":false,
1810
            "inserted":{
1811
               "ro":false,
1812
               "drv":"qcow2",
1813
               "encrypted":false,
1814
               "file":"disks/test.qcow2",
1815
               "backing_file_depth":1,
1816
               "bps":1000000,
1817
               "bps_rd":0,
1818
               "bps_wr":0,
1819
               "iops":1000000,
1820
               "iops_rd":0,
1821
               "iops_wr":0,
1822
               "image":{
1823
                  "filename":"disks/test.qcow2",
1824
                  "format":"qcow2",
1825
                  "virtual-size":2048000,
1826
                  "backing_file":"base.qcow2",
1827
                  "full-backing-filename":"disks/base.qcow2",
1828
                  "backing-filename-format:"qcow2",
1829
                  "snapshots":[
1830
                     {
1831
                        "id": "1",
1832
                        "name": "snapshot1",
1833
                        "vm-state-size": 0,
1834
                        "date-sec": 10000200,
1835
                        "date-nsec": 12,
1836
                        "vm-clock-sec": 206,
1837
                        "vm-clock-nsec": 30
1838
                     }
1839
                  ],
1840
                  "backing-image":{
1841
                      "filename":"disks/base.qcow2",
1842
                      "format":"qcow2",
1843
                      "virtual-size":2048000
1844
                  }
1845
               }
1846
            },
1847
            "type":"unknown"
1848
         },
1849
         {
1850
            "io-status": "ok",
1851
            "device":"ide1-cd0",
1852
            "locked":false,
1853
            "removable":true,
1854
            "type":"unknown"
1855
         },
1856
         {
1857
            "device":"floppy0",
1858
            "locked":false,
1859
            "removable":true,
1860
            "type":"unknown"
1861
         },
1862
         {
1863
            "device":"sd0",
1864
            "locked":false,
1865
            "removable":true,
1866
            "type":"unknown"
1867
         }
1868
      ]
1869
   }
1870

    
1871
EQMP
1872

    
1873
    {
1874
        .name       = "query-block",
1875
        .args_type  = "",
1876
        .mhandler.cmd_new = qmp_marshal_input_query_block,
1877
    },
1878

    
1879
SQMP
1880
query-blockstats
1881
----------------
1882

    
1883
Show block device statistics.
1884

    
1885
Each device statistic information is stored in a json-object and the returned
1886
value is a json-array of all devices.
1887

    
1888
Each json-object contain the following:
1889

    
1890
- "device": device name (json-string)
1891
- "stats": A json-object with the statistics information, it contains:
1892
    - "rd_bytes": bytes read (json-int)
1893
    - "wr_bytes": bytes written (json-int)
1894
    - "rd_operations": read operations (json-int)
1895
    - "wr_operations": write operations (json-int)
1896
    - "flush_operations": cache flush operations (json-int)
1897
    - "wr_total_time_ns": total time spend on writes in nano-seconds (json-int)
1898
    - "rd_total_time_ns": total time spend on reads in nano-seconds (json-int)
1899
    - "flush_total_time_ns": total time spend on cache flushes in nano-seconds (json-int)
1900
    - "wr_highest_offset": Highest offset of a sector written since the
1901
                           BlockDriverState has been opened (json-int)
1902
- "parent": Contains recursively the statistics of the underlying
1903
            protocol (e.g. the host file for a qcow2 image). If there is
1904
            no underlying protocol, this field is omitted
1905
            (json-object, optional)
1906

    
1907
Example:
1908

    
1909
-> { "execute": "query-blockstats" }
1910
<- {
1911
      "return":[
1912
         {
1913
            "device":"ide0-hd0",
1914
            "parent":{
1915
               "stats":{
1916
                  "wr_highest_offset":3686448128,
1917
                  "wr_bytes":9786368,
1918
                  "wr_operations":751,
1919
                  "rd_bytes":122567168,
1920
                  "rd_operations":36772
1921
                  "wr_total_times_ns":313253456
1922
                  "rd_total_times_ns":3465673657
1923
                  "flush_total_times_ns":49653
1924
                  "flush_operations":61,
1925
               }
1926
            },
1927
            "stats":{
1928
               "wr_highest_offset":2821110784,
1929
               "wr_bytes":9786368,
1930
               "wr_operations":692,
1931
               "rd_bytes":122739200,
1932
               "rd_operations":36604
1933
               "flush_operations":51,
1934
               "wr_total_times_ns":313253456
1935
               "rd_total_times_ns":3465673657
1936
               "flush_total_times_ns":49653
1937
            }
1938
         },
1939
         {
1940
            "device":"ide1-cd0",
1941
            "stats":{
1942
               "wr_highest_offset":0,
1943
               "wr_bytes":0,
1944
               "wr_operations":0,
1945
               "rd_bytes":0,
1946
               "rd_operations":0
1947
               "flush_operations":0,
1948
               "wr_total_times_ns":0
1949
               "rd_total_times_ns":0
1950
               "flush_total_times_ns":0
1951
            }
1952
         },
1953
         {
1954
            "device":"floppy0",
1955
            "stats":{
1956
               "wr_highest_offset":0,
1957
               "wr_bytes":0,
1958
               "wr_operations":0,
1959
               "rd_bytes":0,
1960
               "rd_operations":0
1961
               "flush_operations":0,
1962
               "wr_total_times_ns":0
1963
               "rd_total_times_ns":0
1964
               "flush_total_times_ns":0
1965
            }
1966
         },
1967
         {
1968
            "device":"sd0",
1969
            "stats":{
1970
               "wr_highest_offset":0,
1971
               "wr_bytes":0,
1972
               "wr_operations":0,
1973
               "rd_bytes":0,
1974
               "rd_operations":0
1975
               "flush_operations":0,
1976
               "wr_total_times_ns":0
1977
               "rd_total_times_ns":0
1978
               "flush_total_times_ns":0
1979
            }
1980
         }
1981
      ]
1982
   }
1983

    
1984
EQMP
1985

    
1986
    {
1987
        .name       = "query-blockstats",
1988
        .args_type  = "",
1989
        .mhandler.cmd_new = qmp_marshal_input_query_blockstats,
1990
    },
1991

    
1992
SQMP
1993
query-cpus
1994
----------
1995

    
1996
Show CPU information.
1997

    
1998
Return a json-array. Each CPU is represented by a json-object, which contains:
1999

    
2000
- "CPU": CPU index (json-int)
2001
- "current": true if this is the current CPU, false otherwise (json-bool)
2002
- "halted": true if the cpu is halted, false otherwise (json-bool)
2003
- Current program counter. The key's name depends on the architecture:
2004
     "pc": i386/x86_64 (json-int)
2005
     "nip": PPC (json-int)
2006
     "pc" and "npc": sparc (json-int)
2007
     "PC": mips (json-int)
2008
- "thread_id": ID of the underlying host thread (json-int)
2009

    
2010
Example:
2011

    
2012
-> { "execute": "query-cpus" }
2013
<- {
2014
      "return":[
2015
         {
2016
            "CPU":0,
2017
            "current":true,
2018
            "halted":false,
2019
            "pc":3227107138
2020
            "thread_id":3134
2021
         },
2022
         {
2023
            "CPU":1,
2024
            "current":false,
2025
            "halted":true,
2026
            "pc":7108165
2027
            "thread_id":3135
2028
         }
2029
      ]
2030
   }
2031

    
2032
EQMP
2033

    
2034
    {
2035
        .name       = "query-cpus",
2036
        .args_type  = "",
2037
        .mhandler.cmd_new = qmp_marshal_input_query_cpus,
2038
    },
2039

    
2040
SQMP
2041
query-pci
2042
---------
2043

    
2044
PCI buses and devices information.
2045

    
2046
The returned value is a json-array of all buses. Each bus is represented by
2047
a json-object, which has a key with a json-array of all PCI devices attached
2048
to it. Each device is represented by a json-object.
2049

    
2050
The bus json-object contains the following:
2051

    
2052
- "bus": bus number (json-int)
2053
- "devices": a json-array of json-objects, each json-object represents a
2054
             PCI device
2055

    
2056
The PCI device json-object contains the following:
2057

    
2058
- "bus": identical to the parent's bus number (json-int)
2059
- "slot": slot number (json-int)
2060
- "function": function number (json-int)
2061
- "class_info": a json-object containing:
2062
     - "desc": device class description (json-string, optional)
2063
     - "class": device class number (json-int)
2064
- "id": a json-object containing:
2065
     - "device": device ID (json-int)
2066
     - "vendor": vendor ID (json-int)
2067
- "irq": device's IRQ if assigned (json-int, optional)
2068
- "qdev_id": qdev id string (json-string)
2069
- "pci_bridge": It's a json-object, only present if this device is a
2070
                PCI bridge, contains:
2071
     - "bus": bus number (json-int)
2072
     - "secondary": secondary bus number (json-int)
2073
     - "subordinate": subordinate bus number (json-int)
2074
     - "io_range": I/O memory range information, a json-object with the
2075
                   following members:
2076
                 - "base": base address, in bytes (json-int)
2077
                 - "limit": limit address, in bytes (json-int)
2078
     - "memory_range": memory range information, a json-object with the
2079
                       following members:
2080
                 - "base": base address, in bytes (json-int)
2081
                 - "limit": limit address, in bytes (json-int)
2082
     - "prefetchable_range": Prefetchable memory range information, a
2083
                             json-object with the following members:
2084
                 - "base": base address, in bytes (json-int)
2085
                 - "limit": limit address, in bytes (json-int)
2086
     - "devices": a json-array of PCI devices if there's any attached, each
2087
                  each element is represented by a json-object, which contains
2088
                  the same members of the 'PCI device json-object' described
2089
                  above (optional)
2090
- "regions": a json-array of json-objects, each json-object represents a
2091
             memory region of this device
2092

    
2093
The memory range json-object contains the following:
2094

    
2095
- "base": base memory address (json-int)
2096
- "limit": limit value (json-int)
2097

    
2098
The region json-object can be an I/O region or a memory region, an I/O region
2099
json-object contains the following:
2100

    
2101
- "type": "io" (json-string, fixed)
2102
- "bar": BAR number (json-int)
2103
- "address": memory address (json-int)
2104
- "size": memory size (json-int)
2105

    
2106
A memory region json-object contains the following:
2107

    
2108
- "type": "memory" (json-string, fixed)
2109
- "bar": BAR number (json-int)
2110
- "address": memory address (json-int)
2111
- "size": memory size (json-int)
2112
- "mem_type_64": true or false (json-bool)
2113
- "prefetch": true or false (json-bool)
2114

    
2115
Example:
2116

    
2117
-> { "execute": "query-pci" }
2118
<- {
2119
      "return":[
2120
         {
2121
            "bus":0,
2122
            "devices":[
2123
               {
2124
                  "bus":0,
2125
                  "qdev_id":"",
2126
                  "slot":0,
2127
                  "class_info":{
2128
                     "class":1536,
2129
                     "desc":"Host bridge"
2130
                  },
2131
                  "id":{
2132
                     "device":32902,
2133
                     "vendor":4663
2134
                  },
2135
                  "function":0,
2136
                  "regions":[
2137
   
2138
                  ]
2139
               },
2140
               {
2141
                  "bus":0,
2142
                  "qdev_id":"",
2143
                  "slot":1,
2144
                  "class_info":{
2145
                     "class":1537,
2146
                     "desc":"ISA bridge"
2147
                  },
2148
                  "id":{
2149
                     "device":32902,
2150
                     "vendor":28672
2151
                  },
2152
                  "function":0,
2153
                  "regions":[
2154
   
2155
                  ]
2156
               },
2157
               {
2158
                  "bus":0,
2159
                  "qdev_id":"",
2160
                  "slot":1,
2161
                  "class_info":{
2162
                     "class":257,
2163
                     "desc":"IDE controller"
2164
                  },
2165
                  "id":{
2166
                     "device":32902,
2167
                     "vendor":28688
2168
                  },
2169
                  "function":1,
2170
                  "regions":[
2171
                     {
2172
                        "bar":4,
2173
                        "size":16,
2174
                        "address":49152,
2175
                        "type":"io"
2176
                     }
2177
                  ]
2178
               },
2179
               {
2180
                  "bus":0,
2181
                  "qdev_id":"",
2182
                  "slot":2,
2183
                  "class_info":{
2184
                     "class":768,
2185
                     "desc":"VGA controller"
2186
                  },
2187
                  "id":{
2188
                     "device":4115,
2189
                     "vendor":184
2190
                  },
2191
                  "function":0,
2192
                  "regions":[
2193
                     {
2194
                        "prefetch":true,
2195
                        "mem_type_64":false,
2196
                        "bar":0,
2197
                        "size":33554432,
2198
                        "address":4026531840,
2199
                        "type":"memory"
2200
                     },
2201
                     {
2202
                        "prefetch":false,
2203
                        "mem_type_64":false,
2204
                        "bar":1,
2205
                        "size":4096,
2206
                        "address":4060086272,
2207
                        "type":"memory"
2208
                     },
2209
                     {
2210
                        "prefetch":false,
2211
                        "mem_type_64":false,
2212
                        "bar":6,
2213
                        "size":65536,
2214
                        "address":-1,
2215
                        "type":"memory"
2216
                     }
2217
                  ]
2218
               },
2219
               {
2220
                  "bus":0,
2221
                  "qdev_id":"",
2222
                  "irq":11,
2223
                  "slot":4,
2224
                  "class_info":{
2225
                     "class":1280,
2226
                     "desc":"RAM controller"
2227
                  },
2228
                  "id":{
2229
                     "device":6900,
2230
                     "vendor":4098
2231
                  },
2232
                  "function":0,
2233
                  "regions":[
2234
                     {
2235
                        "bar":0,
2236
                        "size":32,
2237
                        "address":49280,
2238
                        "type":"io"
2239
                     }
2240
                  ]
2241
               }
2242
            ]
2243
         }
2244
      ]
2245
   }
2246

    
2247
Note: This example has been shortened as the real response is too long.
2248

    
2249
EQMP
2250

    
2251
    {
2252
        .name       = "query-pci",
2253
        .args_type  = "",
2254
        .mhandler.cmd_new = qmp_marshal_input_query_pci,
2255
    },
2256

    
2257
SQMP
2258
query-kvm
2259
---------
2260

    
2261
Show KVM information.
2262

    
2263
Return a json-object with the following information:
2264

    
2265
- "enabled": true if KVM support is enabled, false otherwise (json-bool)
2266
- "present": true if QEMU has KVM support, false otherwise (json-bool)
2267

    
2268
Example:
2269

    
2270
-> { "execute": "query-kvm" }
2271
<- { "return": { "enabled": true, "present": true } }
2272

    
2273
EQMP
2274

    
2275
    {
2276
        .name       = "query-kvm",
2277
        .args_type  = "",
2278
        .mhandler.cmd_new = qmp_marshal_input_query_kvm,
2279
    },
2280

    
2281
SQMP
2282
query-status
2283
------------
2284

    
2285
Return a json-object with the following information:
2286

    
2287
- "running": true if the VM is running, or false if it is paused (json-bool)
2288
- "singlestep": true if the VM is in single step mode,
2289
                false otherwise (json-bool)
2290
- "status": one of the following values (json-string)
2291
    "debug" - QEMU is running on a debugger
2292
    "inmigrate" - guest is paused waiting for an incoming migration
2293
    "internal-error" - An internal error that prevents further guest
2294
    execution has occurred
2295
    "io-error" - the last IOP has failed and the device is configured
2296
    to pause on I/O errors
2297
    "paused" - guest has been paused via the 'stop' command
2298
    "postmigrate" - guest is paused following a successful 'migrate'
2299
    "prelaunch" - QEMU was started with -S and guest has not started
2300
    "finish-migrate" - guest is paused to finish the migration process
2301
    "restore-vm" - guest is paused to restore VM state
2302
    "running" - guest is actively running
2303
    "save-vm" - guest is paused to save the VM state
2304
    "shutdown" - guest is shut down (and -no-shutdown is in use)
2305
    "watchdog" - the watchdog action is configured to pause and
2306
     has been triggered
2307

    
2308
Example:
2309

    
2310
-> { "execute": "query-status" }
2311
<- { "return": { "running": true, "singlestep": false, "status": "running" } }
2312

    
2313
EQMP
2314
    
2315
    {
2316
        .name       = "query-status",
2317
        .args_type  = "",
2318
        .mhandler.cmd_new = qmp_marshal_input_query_status,
2319
    },
2320

    
2321
SQMP
2322
query-mice
2323
----------
2324

    
2325
Show VM mice information.
2326

    
2327
Each mouse is represented by a json-object, the returned value is a json-array
2328
of all mice.
2329

    
2330
The mouse json-object contains the following:
2331

    
2332
- "name": mouse's name (json-string)
2333
- "index": mouse's index (json-int)
2334
- "current": true if this mouse is receiving events, false otherwise (json-bool)
2335
- "absolute": true if the mouse generates absolute input events (json-bool)
2336

    
2337
Example:
2338

    
2339
-> { "execute": "query-mice" }
2340
<- {
2341
      "return":[
2342
         {
2343
            "name":"QEMU Microsoft Mouse",
2344
            "index":0,
2345
            "current":false,
2346
            "absolute":false
2347
         },
2348
         {
2349
            "name":"QEMU PS/2 Mouse",
2350
            "index":1,
2351
            "current":true,
2352
            "absolute":true
2353
         }
2354
      ]
2355
   }
2356

    
2357
EQMP
2358

    
2359
    {
2360
        .name       = "query-mice",
2361
        .args_type  = "",
2362
        .mhandler.cmd_new = qmp_marshal_input_query_mice,
2363
    },
2364

    
2365
SQMP
2366
query-vnc
2367
---------
2368

    
2369
Show VNC server information.
2370

    
2371
Return a json-object with server information. Connected clients are returned
2372
as a json-array of json-objects.
2373

    
2374
The main json-object contains the following:
2375

    
2376
- "enabled": true or false (json-bool)
2377
- "host": server's IP address (json-string)
2378
- "family": address family (json-string)
2379
         - Possible values: "ipv4", "ipv6", "unix", "unknown"
2380
- "service": server's port number (json-string)
2381
- "auth": authentication method (json-string)
2382
         - Possible values: "invalid", "none", "ra2", "ra2ne", "sasl", "tight",
2383
                            "tls", "ultra", "unknown", "vencrypt", "vencrypt",
2384
                            "vencrypt+plain", "vencrypt+tls+none",
2385
                            "vencrypt+tls+plain", "vencrypt+tls+sasl",
2386
                            "vencrypt+tls+vnc", "vencrypt+x509+none",
2387
                            "vencrypt+x509+plain", "vencrypt+x509+sasl",
2388
                            "vencrypt+x509+vnc", "vnc"
2389
- "clients": a json-array of all connected clients
2390

    
2391
Clients are described by a json-object, each one contain the following:
2392

    
2393
- "host": client's IP address (json-string)
2394
- "family": address family (json-string)
2395
         - Possible values: "ipv4", "ipv6", "unix", "unknown"
2396
- "service": client's port number (json-string)
2397
- "x509_dname": TLS dname (json-string, optional)
2398
- "sasl_username": SASL username (json-string, optional)
2399

    
2400
Example:
2401

    
2402
-> { "execute": "query-vnc" }
2403
<- {
2404
      "return":{
2405
         "enabled":true,
2406
         "host":"0.0.0.0",
2407
         "service":"50402",
2408
         "auth":"vnc",
2409
         "family":"ipv4",
2410
         "clients":[
2411
            {
2412
               "host":"127.0.0.1",
2413
               "service":"50401",
2414
               "family":"ipv4"
2415
            }
2416
         ]
2417
      }
2418
   }
2419

    
2420
EQMP
2421

    
2422
    {
2423
        .name       = "query-vnc",
2424
        .args_type  = "",
2425
        .mhandler.cmd_new = qmp_marshal_input_query_vnc,
2426
    },
2427

    
2428
SQMP
2429
query-spice
2430
-----------
2431

    
2432
Show SPICE server information.
2433

    
2434
Return a json-object with server information. Connected clients are returned
2435
as a json-array of json-objects.
2436

    
2437
The main json-object contains the following:
2438

    
2439
- "enabled": true or false (json-bool)
2440
- "host": server's IP address (json-string)
2441
- "port": server's port number (json-int, optional)
2442
- "tls-port": server's port number (json-int, optional)
2443
- "auth": authentication method (json-string)
2444
         - Possible values: "none", "spice"
2445
- "channels": a json-array of all active channels clients
2446

    
2447
Channels are described by a json-object, each one contain the following:
2448

    
2449
- "host": client's IP address (json-string)
2450
- "family": address family (json-string)
2451
         - Possible values: "ipv4", "ipv6", "unix", "unknown"
2452
- "port": client's port number (json-string)
2453
- "connection-id": spice connection id.  All channels with the same id
2454
                   belong to the same spice session (json-int)
2455
- "channel-type": channel type.  "1" is the main control channel, filter for
2456
                  this one if you want track spice sessions only (json-int)
2457
- "channel-id": channel id.  Usually "0", might be different needed when
2458
                multiple channels of the same type exist, such as multiple
2459
                display channels in a multihead setup (json-int)
2460
- "tls": whevener the channel is encrypted (json-bool)
2461

    
2462
Example:
2463

    
2464
-> { "execute": "query-spice" }
2465
<- {
2466
      "return": {
2467
         "enabled": true,
2468
         "auth": "spice",
2469
         "port": 5920,
2470
         "tls-port": 5921,
2471
         "host": "0.0.0.0",
2472
         "channels": [
2473
            {
2474
               "port": "54924",
2475
               "family": "ipv4",
2476
               "channel-type": 1,
2477
               "connection-id": 1804289383,
2478
               "host": "127.0.0.1",
2479
               "channel-id": 0,
2480
               "tls": true
2481
            },
2482
            {
2483
               "port": "36710",
2484
               "family": "ipv4",
2485
               "channel-type": 4,
2486
               "connection-id": 1804289383,
2487
               "host": "127.0.0.1",
2488
               "channel-id": 0,
2489
               "tls": false
2490
            },
2491
            [ ... more channels follow ... ]
2492
         ]
2493
      }
2494
   }
2495

    
2496
EQMP
2497

    
2498
#if defined(CONFIG_SPICE)
2499
    {
2500
        .name       = "query-spice",
2501
        .args_type  = "",
2502
        .mhandler.cmd_new = qmp_marshal_input_query_spice,
2503
    },
2504
#endif
2505

    
2506
SQMP
2507
query-name
2508
----------
2509

    
2510
Show VM name.
2511

    
2512
Return a json-object with the following information:
2513

    
2514
- "name": VM's name (json-string, optional)
2515

    
2516
Example:
2517

    
2518
-> { "execute": "query-name" }
2519
<- { "return": { "name": "qemu-name" } }
2520

    
2521
EQMP
2522

    
2523
    {
2524
        .name       = "query-name",
2525
        .args_type  = "",
2526
        .mhandler.cmd_new = qmp_marshal_input_query_name,
2527
    },
2528

    
2529
SQMP
2530
query-uuid
2531
----------
2532

    
2533
Show VM UUID.
2534

    
2535
Return a json-object with the following information:
2536

    
2537
- "UUID": Universally Unique Identifier (json-string)
2538

    
2539
Example:
2540

    
2541
-> { "execute": "query-uuid" }
2542
<- { "return": { "UUID": "550e8400-e29b-41d4-a716-446655440000" } }
2543

    
2544
EQMP
2545

    
2546
    {
2547
        .name       = "query-uuid",
2548
        .args_type  = "",
2549
        .mhandler.cmd_new = qmp_marshal_input_query_uuid,
2550
    },
2551

    
2552
SQMP
2553
query-command-line-options
2554
--------------------------
2555

    
2556
Show command line option schema.
2557

    
2558
Return a json-array of command line option schema for all options (or for
2559
the given option), returning an error if the given option doesn't exist.
2560

    
2561
Each array entry contains the following:
2562

    
2563
- "option": option name (json-string)
2564
- "parameters": a json-array describes all parameters of the option:
2565
    - "name": parameter name (json-string)
2566
    - "type": parameter type (one of 'string', 'boolean', 'number',
2567
              or 'size')
2568
    - "help": human readable description of the parameter
2569
              (json-string, optional)
2570

    
2571
Example:
2572

    
2573
-> { "execute": "query-command-line-options", "arguments": { "option": "option-rom" } }
2574
<- { "return": [
2575
        {
2576
            "parameters": [
2577
                {
2578
                    "name": "romfile",
2579
                    "type": "string"
2580
                },
2581
                {
2582
                    "name": "bootindex",
2583
                    "type": "number"
2584
                }
2585
            ],
2586
            "option": "option-rom"
2587
        }
2588
     ]
2589
   }
2590

    
2591
EQMP
2592

    
2593
    {
2594
        .name       = "query-command-line-options",
2595
        .args_type  = "option:s?",
2596
        .mhandler.cmd_new = qmp_marshal_input_query_command_line_options,
2597
    },
2598

    
2599
SQMP
2600
query-migrate
2601
-------------
2602

    
2603
Migration status.
2604

    
2605
Return a json-object. If migration is active there will be another json-object
2606
with RAM migration status and if block migration is active another one with
2607
block migration status.
2608

    
2609
The main json-object contains the following:
2610

    
2611
- "status": migration status (json-string)
2612
     - Possible values: "active", "completed", "failed", "cancelled"
2613
- "total-time": total amount of ms since migration started.  If
2614
                migration has ended, it returns the total migration
2615
                time (json-int)
2616
- "downtime": only present when migration has finished correctly
2617
              total amount in ms for downtime that happened (json-int)
2618
- "expected-downtime": only present while migration is active
2619
                total amount in ms for downtime that was calculated on
2620
                the last bitmap round (json-int)
2621
- "ram": only present if "status" is "active", it is a json-object with the
2622
  following RAM information:
2623
         - "transferred": amount transferred in bytes (json-int)
2624
         - "remaining": amount remaining to transfer in bytes (json-int)
2625
         - "total": total amount of memory in bytes (json-int)
2626
         - "duplicate": number of pages filled entirely with the same
2627
            byte (json-int)
2628
            These are sent over the wire much more efficiently.
2629
         - "skipped": number of skipped zero pages (json-int)
2630
         - "normal" : number of whole pages transferred.  I.e. they
2631
            were not sent as duplicate or xbzrle pages (json-int)
2632
         - "normal-bytes" : number of bytes transferred in whole
2633
            pages. This is just normal pages times size of one page,
2634
            but this way upper levels don't need to care about page
2635
            size (json-int)
2636
- "disk": only present if "status" is "active" and it is a block migration,
2637
  it is a json-object with the following disk information:
2638
         - "transferred": amount transferred in bytes (json-int)
2639
         - "remaining": amount remaining to transfer in bytes json-int)
2640
         - "total": total disk size in bytes (json-int)
2641
- "xbzrle-cache": only present if XBZRLE is active.
2642
  It is a json-object with the following XBZRLE information:
2643
         - "cache-size": XBZRLE cache size in bytes
2644
         - "bytes": number of bytes transferred for XBZRLE compressed pages
2645
         - "pages": number of XBZRLE compressed pages
2646
         - "cache-miss": number of XBRZRLE page cache misses
2647
         - "overflow": number of times XBZRLE overflows.  This means
2648
           that the XBZRLE encoding was bigger than just sent the
2649
           whole page, and then we sent the whole page instead (as as
2650
           normal page).
2651

    
2652
Examples:
2653

    
2654
1. Before the first migration
2655

    
2656
-> { "execute": "query-migrate" }
2657
<- { "return": {} }
2658

    
2659
2. Migration is done and has succeeded
2660

    
2661
-> { "execute": "query-migrate" }
2662
<- { "return": {
2663
        "status": "completed",
2664
        "ram":{
2665
          "transferred":123,
2666
          "remaining":123,
2667
          "total":246,
2668
          "total-time":12345,
2669
          "downtime":12345,
2670
          "duplicate":123,
2671
          "normal":123,
2672
          "normal-bytes":123456
2673
        }
2674
     }
2675
   }
2676

    
2677
3. Migration is done and has failed
2678

    
2679
-> { "execute": "query-migrate" }
2680
<- { "return": { "status": "failed" } }
2681

    
2682
4. Migration is being performed and is not a block migration:
2683

    
2684
-> { "execute": "query-migrate" }
2685
<- {
2686
      "return":{
2687
         "status":"active",
2688
         "ram":{
2689
            "transferred":123,
2690
            "remaining":123,
2691
            "total":246,
2692
            "total-time":12345,
2693
            "expected-downtime":12345,
2694
            "duplicate":123,
2695
            "normal":123,
2696
            "normal-bytes":123456
2697
         }
2698
      }
2699
   }
2700

    
2701
5. Migration is being performed and is a block migration:
2702

    
2703
-> { "execute": "query-migrate" }
2704
<- {
2705
      "return":{
2706
         "status":"active",
2707
         "ram":{
2708
            "total":1057024,
2709
            "remaining":1053304,
2710
            "transferred":3720,
2711
            "total-time":12345,
2712
            "expected-downtime":12345,
2713
            "duplicate":123,
2714
            "normal":123,
2715
            "normal-bytes":123456
2716
         },
2717
         "disk":{
2718
            "total":20971520,
2719
            "remaining":20880384,
2720
            "transferred":91136
2721
         }
2722
      }
2723
   }
2724

    
2725
6. Migration is being performed and XBZRLE is active:
2726

    
2727
-> { "execute": "query-migrate" }
2728
<- {
2729
      "return":{
2730
         "status":"active",
2731
         "capabilities" : [ { "capability": "xbzrle", "state" : true } ],
2732
         "ram":{
2733
            "total":1057024,
2734
            "remaining":1053304,
2735
            "transferred":3720,
2736
            "total-time":12345,
2737
            "expected-downtime":12345,
2738
            "duplicate":10,
2739
            "normal":3333,
2740
            "normal-bytes":3412992
2741
         },
2742
         "xbzrle-cache":{
2743
            "cache-size":67108864,
2744
            "bytes":20971520,
2745
            "pages":2444343,
2746
            "cache-miss":2244,
2747
            "overflow":34434
2748
         }
2749
      }
2750
   }
2751

    
2752
EQMP
2753

    
2754
    {
2755
        .name       = "query-migrate",
2756
        .args_type  = "",
2757
        .mhandler.cmd_new = qmp_marshal_input_query_migrate,
2758
    },
2759

    
2760
SQMP
2761
migrate-set-capabilities
2762
------------------------
2763

    
2764
Enable/Disable migration capabilities
2765

    
2766
- "xbzrle": XBZRLE support
2767

    
2768
Arguments:
2769

    
2770
Example:
2771

    
2772
-> { "execute": "migrate-set-capabilities" , "arguments":
2773
     { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
2774

    
2775
EQMP
2776

    
2777
    {
2778
        .name       = "migrate-set-capabilities",
2779
        .args_type  = "capabilities:O",
2780
        .params     = "capability:s,state:b",
2781
	.mhandler.cmd_new = qmp_marshal_input_migrate_set_capabilities,
2782
    },
2783
SQMP
2784
query-migrate-capabilities
2785
--------------------------
2786

    
2787
Query current migration capabilities
2788

    
2789
- "capabilities": migration capabilities state
2790
         - "xbzrle" : XBZRLE state (json-bool)
2791

    
2792
Arguments:
2793

    
2794
Example:
2795

    
2796
-> { "execute": "query-migrate-capabilities" }
2797
<- { "return": [ { "state": false, "capability": "xbzrle" } ] }
2798

    
2799
EQMP
2800

    
2801
    {
2802
        .name       = "query-migrate-capabilities",
2803
        .args_type  = "",
2804
        .mhandler.cmd_new = qmp_marshal_input_query_migrate_capabilities,
2805
    },
2806

    
2807
SQMP
2808
query-balloon
2809
-------------
2810

    
2811
Show balloon information.
2812

    
2813
Make an asynchronous request for balloon info. When the request completes a
2814
json-object will be returned containing the following data:
2815

    
2816
- "actual": current balloon value in bytes (json-int)
2817

    
2818
Example:
2819

    
2820
-> { "execute": "query-balloon" }
2821
<- {
2822
      "return":{
2823
         "actual":1073741824,
2824
      }
2825
   }
2826

    
2827
EQMP
2828

    
2829
    {
2830
        .name       = "query-balloon",
2831
        .args_type  = "",
2832
        .mhandler.cmd_new = qmp_marshal_input_query_balloon,
2833
    },
2834

    
2835
    {
2836
        .name       = "query-block-jobs",
2837
        .args_type  = "",
2838
        .mhandler.cmd_new = qmp_marshal_input_query_block_jobs,
2839
    },
2840

    
2841
    {
2842
        .name       = "qom-list",
2843
        .args_type  = "path:s",
2844
        .mhandler.cmd_new = qmp_marshal_input_qom_list,
2845
    },
2846

    
2847
    {
2848
        .name       = "qom-set",
2849
	.args_type  = "path:s,property:s,value:q",
2850
	.mhandler.cmd_new = qmp_qom_set,
2851
    },
2852

    
2853
    {
2854
        .name       = "qom-get",
2855
	.args_type  = "path:s,property:s",
2856
	.mhandler.cmd_new = qmp_qom_get,
2857
    },
2858

    
2859
    {
2860
        .name       = "nbd-server-start",
2861
        .args_type  = "addr:q",
2862
        .mhandler.cmd_new = qmp_marshal_input_nbd_server_start,
2863
    },
2864
    {
2865
        .name       = "nbd-server-add",
2866
        .args_type  = "device:B,writable:b?",
2867
        .mhandler.cmd_new = qmp_marshal_input_nbd_server_add,
2868
    },
2869
    {
2870
        .name       = "nbd-server-stop",
2871
        .args_type  = "",
2872
        .mhandler.cmd_new = qmp_marshal_input_nbd_server_stop,
2873
    },
2874

    
2875
    {
2876
        .name       = "change-vnc-password",
2877
        .args_type  = "password:s",
2878
        .mhandler.cmd_new = qmp_marshal_input_change_vnc_password,
2879
    },
2880
    {
2881
        .name       = "qom-list-types",
2882
        .args_type  = "implements:s?,abstract:b?",
2883
        .mhandler.cmd_new = qmp_marshal_input_qom_list_types,
2884
    },
2885

    
2886
    {
2887
        .name       = "device-list-properties",
2888
        .args_type  = "typename:s",
2889
        .mhandler.cmd_new = qmp_marshal_input_device_list_properties,
2890
    },
2891

    
2892
    {
2893
        .name       = "query-machines",
2894
        .args_type  = "",
2895
        .mhandler.cmd_new = qmp_marshal_input_query_machines,
2896
    },
2897

    
2898
    {
2899
        .name       = "query-cpu-definitions",
2900
        .args_type  = "",
2901
        .mhandler.cmd_new = qmp_marshal_input_query_cpu_definitions,
2902
    },
2903

    
2904
    {
2905
        .name       = "query-target",
2906
        .args_type  = "",
2907
        .mhandler.cmd_new = qmp_marshal_input_query_target,
2908
    },
2909

    
2910
    {
2911
        .name       = "query-tpm",
2912
        .args_type  = "",
2913
        .mhandler.cmd_new = qmp_marshal_input_query_tpm,
2914
    },
2915

    
2916
SQMP
2917
query-tpm
2918
---------
2919

    
2920
Return information about the TPM device.
2921

    
2922
Arguments: None
2923

    
2924
Example:
2925

    
2926
-> { "execute": "query-tpm" }
2927
<- { "return":
2928
     [
2929
       { "model": "tpm-tis",
2930
         "options":
2931
           { "type": "passthrough",
2932
             "data":
2933
               { "cancel-path": "/sys/class/misc/tpm0/device/cancel",
2934
                 "path": "/dev/tpm0"
2935
               }
2936
           },
2937
         "id": "tpm0"
2938
       }
2939
     ]
2940
   }
2941

    
2942
EQMP
2943

    
2944
    {
2945
        .name       = "query-tpm-models",
2946
        .args_type  = "",
2947
        .mhandler.cmd_new = qmp_marshal_input_query_tpm_models,
2948
    },
2949

    
2950
SQMP
2951
query-tpm-models
2952
----------------
2953

    
2954
Return a list of supported TPM models.
2955

    
2956
Arguments: None
2957

    
2958
Example:
2959

    
2960
-> { "execute": "query-tpm-models" }
2961
<- { "return": [ "tpm-tis" ] }
2962

    
2963
EQMP
2964

    
2965
    {
2966
        .name       = "query-tpm-types",
2967
        .args_type  = "",
2968
        .mhandler.cmd_new = qmp_marshal_input_query_tpm_types,
2969
    },
2970

    
2971
SQMP
2972
query-tpm-types
2973
---------------
2974

    
2975
Return a list of supported TPM types.
2976

    
2977
Arguments: None
2978

    
2979
Example:
2980

    
2981
-> { "execute": "query-tpm-types" }
2982
<- { "return": [ "passthrough" ] }
2983

    
2984
EQMP
2985

    
2986
    {
2987
        .name       = "chardev-add",
2988
        .args_type  = "id:s,backend:q",
2989
        .mhandler.cmd_new = qmp_marshal_input_chardev_add,
2990
    },
2991

    
2992
SQMP
2993
chardev-add
2994
----------------
2995

    
2996
Add a chardev.
2997

    
2998
Arguments:
2999

    
3000
- "id": the chardev's ID, must be unique (json-string)
3001
- "backend": chardev backend type + parameters
3002

    
3003
Examples:
3004

    
3005
-> { "execute" : "chardev-add",
3006
     "arguments" : { "id" : "foo",
3007
                     "backend" : { "type" : "null", "data" : {} } } }
3008
<- { "return": {} }
3009

    
3010
-> { "execute" : "chardev-add",
3011
     "arguments" : { "id" : "bar",
3012
                     "backend" : { "type" : "file",
3013
                                   "data" : { "out" : "/tmp/bar.log" } } } }
3014
<- { "return": {} }
3015

    
3016
-> { "execute" : "chardev-add",
3017
     "arguments" : { "id" : "baz",
3018
                     "backend" : { "type" : "pty", "data" : {} } } }
3019
<- { "return": { "pty" : "/dev/pty/42" } }
3020

    
3021
EQMP
3022

    
3023
    {
3024
        .name       = "chardev-remove",
3025
        .args_type  = "id:s",
3026
        .mhandler.cmd_new = qmp_marshal_input_chardev_remove,
3027
    },
3028

    
3029

    
3030
SQMP
3031
chardev-remove
3032
--------------
3033

    
3034
Remove a chardev.
3035

    
3036
Arguments:
3037

    
3038
- "id": the chardev's ID, must exist and not be in use (json-string)
3039

    
3040
Example:
3041

    
3042
-> { "execute": "chardev-remove", "arguments": { "id" : "foo" } }
3043
<- { "return": {} }
3044

    
3045
EQMP