Statistics
| Branch: | Revision:

root / qmp-commands.hx @ 6d3962bf

History | View | Annotate | Download (51.2 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
        .params     = "[-f] device",
88
        .help       = "eject a removable medium (use -f to force it)",
89
        .user_print = monitor_user_noop,
90
        .mhandler.cmd_new = do_eject,
91
    },
92

    
93
SQMP
94
eject
95
-----
96

    
97
Eject a removable medium.
98

    
99
Arguments: 
100

    
101
- force: force ejection (json-bool, optional)
102
- device: device name (json-string)
103

    
104
Example:
105

    
106
-> { "execute": "eject", "arguments": { "device": "ide1-cd0" } }
107
<- { "return": {} }
108

    
109
Note: The "force" argument defaults to false.
110

    
111
EQMP
112

    
113
    {
114
        .name       = "change",
115
        .args_type  = "device:B,target:F,arg:s?",
116
        .params     = "device filename [format]",
117
        .help       = "change a removable medium, optional format",
118
        .user_print = monitor_user_noop,
119
        .mhandler.cmd_new = do_change,
120
    },
121

    
122
SQMP
123
change
124
------
125

    
126
Change a removable medium or VNC configuration.
127

    
128
Arguments:
129

    
130
- "device": device name (json-string)
131
- "target": filename or item (json-string)
132
- "arg": additional argument (json-string, optional)
133

    
134
Examples:
135

    
136
1. Change a removable medium
137

    
138
-> { "execute": "change",
139
             "arguments": { "device": "ide1-cd0",
140
                            "target": "/srv/images/Fedora-12-x86_64-DVD.iso" } }
141
<- { "return": {} }
142

    
143
2. Change VNC password
144

    
145
-> { "execute": "change",
146
             "arguments": { "device": "vnc", "target": "password",
147
                            "arg": "foobar1" } }
148
<- { "return": {} }
149

    
150
EQMP
151

    
152
    {
153
        .name       = "screendump",
154
        .args_type  = "filename:F",
155
        .params     = "filename",
156
        .help       = "save screen into PPM image 'filename'",
157
        .user_print = monitor_user_noop,
158
        .mhandler.cmd_new = do_screen_dump,
159
    },
160

    
161
SQMP
162
screendump
163
----------
164

    
165
Save screen into PPM image.
166

    
167
Arguments:
168

    
169
- "filename": file path (json-string)
170

    
171
Example:
172

    
173
-> { "execute": "screendump", "arguments": { "filename": "/tmp/image" } }
174
<- { "return": {} }
175

    
176
EQMP
177

    
178
    {
179
        .name       = "stop",
180
        .args_type  = "",
181
        .mhandler.cmd_new = qmp_marshal_input_stop,
182
    },
183

    
184
SQMP
185
stop
186
----
187

    
188
Stop the emulator.
189

    
190
Arguments: None.
191

    
192
Example:
193

    
194
-> { "execute": "stop" }
195
<- { "return": {} }
196

    
197
EQMP
198

    
199
    {
200
        .name       = "cont",
201
        .args_type  = "",
202
        .params     = "",
203
        .help       = "resume emulation",
204
        .user_print = monitor_user_noop,
205
        .mhandler.cmd_new = do_cont,
206
    },
207

    
208
SQMP
209
cont
210
----
211

    
212
Resume emulation.
213

    
214
Arguments: None.
215

    
216
Example:
217

    
218
-> { "execute": "cont" }
219
<- { "return": {} }
220

    
221
EQMP
222

    
223
    {
224
        .name       = "system_reset",
225
        .args_type  = "",
226
        .mhandler.cmd_new = qmp_marshal_input_system_reset,
227
    },
228

    
229
SQMP
230
system_reset
231
------------
232

    
233
Reset the system.
234

    
235
Arguments: None.
236

    
237
Example:
238

    
239
-> { "execute": "system_reset" }
240
<- { "return": {} }
241

    
242
EQMP
243

    
244
    {
245
        .name       = "system_powerdown",
246
        .args_type  = "",
247
        .mhandler.cmd_new = qmp_marshal_input_system_powerdown,
248
    },
249

    
250
SQMP
251
system_powerdown
252
----------------
253

    
254
Send system power down event.
255

    
256
Arguments: None.
257

    
258
Example:
259

    
260
-> { "execute": "system_powerdown" }
261
<- { "return": {} }
262

    
263
EQMP
264

    
265
    {
266
        .name       = "device_add",
267
        .args_type  = "device:O",
268
        .params     = "driver[,prop=value][,...]",
269
        .help       = "add device, like -device on the command line",
270
        .user_print = monitor_user_noop,
271
        .mhandler.cmd_new = do_device_add,
272
    },
273

    
274
SQMP
275
device_add
276
----------
277

    
278
Add a device.
279

    
280
Arguments:
281

    
282
- "driver": the name of the new device's driver (json-string)
283
- "bus": the device's parent bus (device tree path, json-string, optional)
284
- "id": the device's ID, must be unique (json-string)
285
- device properties
286

    
287
Example:
288

    
289
-> { "execute": "device_add", "arguments": { "driver": "e1000", "id": "net1" } }
290
<- { "return": {} }
291

    
292
Notes:
293

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

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

    
300
EQMP
301

    
302
    {
303
        .name       = "device_del",
304
        .args_type  = "id:s",
305
        .params     = "device",
306
        .help       = "remove device",
307
        .user_print = monitor_user_noop,
308
        .mhandler.cmd_new = do_device_del,
309
    },
310

    
311
SQMP
312
device_del
313
----------
314

    
315
Remove a device.
316

    
317
Arguments:
318

    
319
- "id": the device's ID (json-string)
320

    
321
Example:
322

    
323
-> { "execute": "device_del", "arguments": { "id": "net1" } }
324
<- { "return": {} }
325

    
326
EQMP
327

    
328
    {
329
        .name       = "cpu",
330
        .args_type  = "index:i",
331
        .mhandler.cmd_new = qmp_marshal_input_cpu,
332
    },
333

    
334
SQMP
335
cpu
336
---
337

    
338
Set the default CPU.
339

    
340
Arguments:
341

    
342
- "index": the CPU's index (json-int)
343

    
344
Example:
345

    
346
-> { "execute": "cpu", "arguments": { "index": 0 } }
347
<- { "return": {} }
348

    
349
Note: CPUs' indexes are obtained with the 'query-cpus' command.
350

    
351
EQMP
352

    
353
    {
354
        .name       = "memsave",
355
        .args_type  = "val:l,size:i,filename:s,cpu:i?",
356
        .mhandler.cmd_new = qmp_marshal_input_memsave,
357
    },
358

    
359
SQMP
360
memsave
361
-------
362

    
363
Save to disk virtual memory dump starting at 'val' of size 'size'.
364

    
365
Arguments:
366

    
367
- "val": the starting address (json-int)
368
- "size": the memory size, in bytes (json-int)
369
- "filename": file path (json-string)
370
- "cpu": virtual CPU index (json-int, optional)
371

    
372
Example:
373

    
374
-> { "execute": "memsave",
375
             "arguments": { "val": 10,
376
                            "size": 100,
377
                            "filename": "/tmp/virtual-mem-dump" } }
378
<- { "return": {} }
379

    
380
EQMP
381

    
382
    {
383
        .name       = "pmemsave",
384
        .args_type  = "val:l,size:i,filename:s",
385
        .mhandler.cmd_new = qmp_marshal_input_pmemsave,
386
    },
387

    
388
SQMP
389
pmemsave
390
--------
391

    
392
Save to disk physical memory dump starting at 'val' of size 'size'.
393

    
394
Arguments:
395

    
396
- "val": the starting address (json-int)
397
- "size": the memory size, in bytes (json-int)
398
- "filename": file path (json-string)
399

    
400
Example:
401

    
402
-> { "execute": "pmemsave",
403
             "arguments": { "val": 10,
404
                            "size": 100,
405
                            "filename": "/tmp/physical-mem-dump" } }
406
<- { "return": {} }
407

    
408
EQMP
409

    
410
    {
411
        .name       = "inject-nmi",
412
        .args_type  = "",
413
        .params     = "",
414
        .help       = "",
415
        .user_print = monitor_user_noop,
416
        .mhandler.cmd_new = do_inject_nmi,
417
    },
418

    
419
SQMP
420
inject-nmi
421
----------
422

    
423
Inject an NMI on guest's CPUs.
424

    
425
Arguments: None.
426

    
427
Example:
428

    
429
-> { "execute": "inject-nmi" }
430
<- { "return": {} }
431

    
432
Note: inject-nmi is only supported for x86 guest currently, it will
433
      returns "Unsupported" error for non-x86 guest.
434

    
435
EQMP
436

    
437
    {
438
        .name       = "migrate",
439
        .args_type  = "detach:-d,blk:-b,inc:-i,uri:s",
440
        .params     = "[-d] [-b] [-i] uri",
441
        .help       = "migrate to URI (using -d to not wait for completion)"
442
		      "\n\t\t\t -b for migration without shared storage with"
443
		      " full copy of disk\n\t\t\t -i for migration without "
444
		      "shared storage with incremental copy of disk "
445
		      "(base image shared between src and destination)",
446
        .user_print = monitor_user_noop,	
447
	.mhandler.cmd_new = do_migrate,
448
    },
449

    
450
SQMP
451
migrate
452
-------
453

    
454
Migrate to URI.
455

    
456
Arguments:
457

    
458
- "blk": block migration, full disk copy (json-bool, optional)
459
- "inc": incremental disk copy (json-bool, optional)
460
- "uri": Destination URI (json-string)
461

    
462
Example:
463

    
464
-> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
465
<- { "return": {} }
466

    
467
Notes:
468

    
469
(1) The 'query-migrate' command should be used to check migration's progress
470
    and final result (this information is provided by the 'status' member)
471
(2) All boolean arguments default to false
472
(3) The user Monitor's "detach" argument is invalid in QMP and should not
473
    be used
474

    
475
EQMP
476

    
477
    {
478
        .name       = "migrate_cancel",
479
        .args_type  = "",
480
        .params     = "",
481
        .help       = "cancel the current VM migration",
482
        .user_print = monitor_user_noop,
483
        .mhandler.cmd_new = do_migrate_cancel,
484
    },
485

    
486
SQMP
487
migrate_cancel
488
--------------
489

    
490
Cancel the current migration.
491

    
492
Arguments: None.
493

    
494
Example:
495

    
496
-> { "execute": "migrate_cancel" }
497
<- { "return": {} }
498

    
499
EQMP
500

    
501
    {
502
        .name       = "migrate_set_speed",
503
        .args_type  = "value:o",
504
        .params     = "value",
505
        .help       = "set maximum speed (in bytes) for migrations",
506
        .user_print = monitor_user_noop,
507
        .mhandler.cmd_new = do_migrate_set_speed,
508
    },
509

    
510
SQMP
511
migrate_set_speed
512
-----------------
513

    
514
Set maximum speed for migrations.
515

    
516
Arguments:
517

    
518
- "value": maximum speed, in bytes per second (json-int)
519

    
520
Example:
521

    
522
-> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
523
<- { "return": {} }
524

    
525
EQMP
526

    
527
    {
528
        .name       = "migrate_set_downtime",
529
        .args_type  = "value:T",
530
        .params     = "value",
531
        .help       = "set maximum tolerated downtime (in seconds) for migrations",
532
        .user_print = monitor_user_noop,
533
        .mhandler.cmd_new = do_migrate_set_downtime,
534
    },
535

    
536
SQMP
537
migrate_set_downtime
538
--------------------
539

    
540
Set maximum tolerated downtime (in seconds) for migrations.
541

    
542
Arguments:
543

    
544
- "value": maximum downtime (json-number)
545

    
546
Example:
547

    
548
-> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
549
<- { "return": {} }
550

    
551
EQMP
552

    
553
    {
554
        .name       = "client_migrate_info",
555
        .args_type  = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?",
556
        .params     = "protocol hostname port tls-port cert-subject",
557
        .help       = "send migration info to spice/vnc client",
558
        .user_print = monitor_user_noop,
559
        .mhandler.cmd_async = client_migrate_info,
560
        .flags      = MONITOR_CMD_ASYNC,
561
    },
562

    
563
SQMP
564
client_migrate_info
565
------------------
566

    
567
Set the spice/vnc connection info for the migration target.  The spice/vnc
568
server will ask the spice/vnc client to automatically reconnect using the
569
new parameters (if specified) once the vm migration finished successfully.
570

    
571
Arguments:
572

    
573
- "protocol":     protocol: "spice" or "vnc" (json-string)
574
- "hostname":     migration target hostname (json-string)
575
- "port":         spice/vnc tcp port for plaintext channels (json-int, optional)
576
- "tls-port":     spice tcp port for tls-secured channels (json-int, optional)
577
- "cert-subject": server certificate subject (json-string, optional)
578

    
579
Example:
580

    
581
-> { "execute": "client_migrate_info",
582
     "arguments": { "protocol": "spice",
583
                    "hostname": "virt42.lab.kraxel.org",
584
                    "port": 1234 } }
585
<- { "return": {} }
586

    
587
EQMP
588

    
589
    {
590
        .name       = "netdev_add",
591
        .args_type  = "netdev:O",
592
        .params     = "[user|tap|socket],id=str[,prop=value][,...]",
593
        .help       = "add host network device",
594
        .user_print = monitor_user_noop,
595
        .mhandler.cmd_new = do_netdev_add,
596
    },
597

    
598
SQMP
599
netdev_add
600
----------
601

    
602
Add host network device.
603

    
604
Arguments:
605

    
606
- "type": the device type, "tap", "user", ... (json-string)
607
- "id": the device's ID, must be unique (json-string)
608
- device options
609

    
610
Example:
611

    
612
-> { "execute": "netdev_add", "arguments": { "type": "user", "id": "netdev1" } }
613
<- { "return": {} }
614

    
615
Note: The supported device options are the same ones supported by the '-net'
616
      command-line argument, which are listed in the '-help' output or QEMU's
617
      manual
618

    
619
EQMP
620

    
621
    {
622
        .name       = "netdev_del",
623
        .args_type  = "id:s",
624
        .params     = "id",
625
        .help       = "remove host network device",
626
        .user_print = monitor_user_noop,
627
        .mhandler.cmd_new = do_netdev_del,
628
    },
629

    
630
SQMP
631
netdev_del
632
----------
633

    
634
Remove host network device.
635

    
636
Arguments:
637

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

    
640
Example:
641

    
642
-> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
643
<- { "return": {} }
644

    
645

    
646
EQMP
647

    
648
    {
649
        .name       = "block_resize",
650
        .args_type  = "device:B,size:o",
651
        .params     = "device size",
652
        .help       = "resize a block image",
653
        .user_print = monitor_user_noop,
654
        .mhandler.cmd_new = do_block_resize,
655
    },
656

    
657
SQMP
658
block_resize
659
------------
660

    
661
Resize a block image while a guest is running.
662

    
663
Arguments:
664

    
665
- "device": the device's ID, must be unique (json-string)
666
- "size": new size
667

    
668
Example:
669

    
670
-> { "execute": "block_resize", "arguments": { "device": "scratch", "size": 1073741824 } }
671
<- { "return": {} }
672

    
673
EQMP
674

    
675
    {
676
        .name       = "blockdev-snapshot-sync",
677
        .args_type  = "device:B,snapshot-file:s?,format:s?",
678
        .params     = "device [new-image-file] [format]",
679
        .user_print = monitor_user_noop,
680
        .mhandler.cmd_new = do_snapshot_blkdev,
681
    },
682

    
683
SQMP
684
blockdev-snapshot-sync
685
----------------------
686

    
687
Synchronous snapshot of a block device. snapshot-file specifies the
688
target of the new image. If the file exists, or if it is a device, the
689
snapshot will be created in the existing file/device. If does not
690
exist, a new file will be created. format specifies the format of the
691
snapshot image, default is qcow2.
692

    
693
Arguments:
694

    
695
- "device": device name to snapshot (json-string)
696
- "snapshot-file": name of new image file (json-string)
697
- "format": format of new image (json-string, optional)
698

    
699
Example:
700

    
701
-> { "execute": "blockdev-snapshot-sync", "arguments": { "device": "ide-hd0",
702
                                                         "snapshot-file":
703
                                                        "/some/place/my-image",
704
                                                        "format": "qcow2" } }
705
<- { "return": {} }
706

    
707
EQMP
708

    
709
    {
710
        .name       = "balloon",
711
        .args_type  = "value:M",
712
        .params     = "target",
713
        .help       = "request VM to change its memory allocation (in MB)",
714
        .user_print = monitor_user_noop,
715
        .mhandler.cmd_async = do_balloon,
716
        .flags      = MONITOR_CMD_ASYNC,
717
    },
718

    
719
SQMP
720
balloon
721
-------
722

    
723
Request VM to change its memory allocation (in bytes).
724

    
725
Arguments:
726

    
727
- "value": New memory allocation (json-int)
728

    
729
Example:
730

    
731
-> { "execute": "balloon", "arguments": { "value": 536870912 } }
732
<- { "return": {} }
733

    
734
EQMP
735

    
736
    {
737
        .name       = "set_link",
738
        .args_type  = "name:s,up:b",
739
        .params     = "name on|off",
740
        .help       = "change the link status of a network adapter",
741
        .user_print = monitor_user_noop,
742
        .mhandler.cmd_new = do_set_link,
743
    },
744

    
745
SQMP
746
set_link
747
--------
748

    
749
Change the link status of a network adapter.
750

    
751
Arguments:
752

    
753
- "name": network device name (json-string)
754
- "up": status is up (json-bool)
755

    
756
Example:
757

    
758
-> { "execute": "set_link", "arguments": { "name": "e1000.0", "up": false } }
759
<- { "return": {} }
760

    
761
EQMP
762

    
763
    {
764
        .name       = "getfd",
765
        .args_type  = "fdname:s",
766
        .params     = "getfd name",
767
        .help       = "receive a file descriptor via SCM rights and assign it a name",
768
        .user_print = monitor_user_noop,
769
        .mhandler.cmd_new = do_getfd,
770
    },
771

    
772
SQMP
773
getfd
774
-----
775

    
776
Receive a file descriptor via SCM rights and assign it a name.
777

    
778
Arguments:
779

    
780
- "fdname": file descriptor name (json-string)
781

    
782
Example:
783

    
784
-> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
785
<- { "return": {} }
786

    
787
EQMP
788

    
789
    {
790
        .name       = "closefd",
791
        .args_type  = "fdname:s",
792
        .params     = "closefd name",
793
        .help       = "close a file descriptor previously passed via SCM rights",
794
        .user_print = monitor_user_noop,
795
        .mhandler.cmd_new = do_closefd,
796
    },
797

    
798
SQMP
799
closefd
800
-------
801

    
802
Close a file descriptor previously passed via SCM rights.
803

    
804
Arguments:
805

    
806
- "fdname": file descriptor name (json-string)
807

    
808
Example:
809

    
810
-> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
811
<- { "return": {} }
812

    
813
EQMP
814

    
815
    {
816
        .name       = "block_passwd",
817
        .args_type  = "device:B,password:s",
818
        .params     = "block_passwd device password",
819
        .help       = "set the password of encrypted block devices",
820
        .user_print = monitor_user_noop,
821
        .mhandler.cmd_new = do_block_set_passwd,
822
    },
823

    
824
SQMP
825
block_passwd
826
------------
827

    
828
Set the password of encrypted block devices.
829

    
830
Arguments:
831

    
832
- "device": device name (json-string)
833
- "password": password (json-string)
834

    
835
Example:
836

    
837
-> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0",
838
                                               "password": "12345" } }
839
<- { "return": {} }
840

    
841
EQMP
842

    
843
    {
844
        .name       = "block_set_io_throttle",
845
        .args_type  = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l",
846
        .params     = "device bps bps_rd bps_wr iops iops_rd iops_wr",
847
        .help       = "change I/O throttle limits for a block drive",
848
        .user_print = monitor_user_noop,
849
        .mhandler.cmd_new = do_block_set_io_throttle,
850
    },
851

    
852
SQMP
853
block_set_io_throttle
854
------------
855

    
856
Change I/O throttle limits for a block drive.
857

    
858
Arguments:
859

    
860
- "device": device name (json-string)
861
- "bps":  total throughput limit in bytes per second(json-int)
862
- "bps_rd":  read throughput limit in bytes per second(json-int)
863
- "bps_wr":  read throughput limit in bytes per second(json-int)
864
- "iops":  total I/O operations per second(json-int)
865
- "iops_rd":  read I/O operations per second(json-int)
866
- "iops_wr":  write I/O operations per second(json-int)
867

    
868
Example:
869

    
870
-> { "execute": "block_set_io_throttle", "arguments": { "device": "virtio0",
871
                                               "bps": "1000000",
872
                                               "bps_rd": "0",
873
                                               "bps_wr": "0",
874
                                               "iops": "0",
875
                                               "iops_rd": "0",
876
                                               "iops_wr": "0" } }
877
<- { "return": {} }
878

    
879
EQMP
880

    
881
    {
882
        .name       = "set_password",
883
        .args_type  = "protocol:s,password:s,connected:s?",
884
        .params     = "protocol password action-if-connected",
885
        .help       = "set spice/vnc password",
886
        .user_print = monitor_user_noop,
887
        .mhandler.cmd_new = set_password,
888
    },
889

    
890
SQMP
891
set_password
892
------------
893

    
894
Set the password for vnc/spice protocols.
895

    
896
Arguments:
897

    
898
- "protocol": protocol name (json-string)
899
- "password": password (json-string)
900
- "connected": [ keep | disconnect | fail ] (josn-string, optional)
901

    
902
Example:
903

    
904
-> { "execute": "set_password", "arguments": { "protocol": "vnc",
905
                                               "password": "secret" } }
906
<- { "return": {} }
907

    
908
EQMP
909

    
910
    {
911
        .name       = "expire_password",
912
        .args_type  = "protocol:s,time:s",
913
        .params     = "protocol time",
914
        .help       = "set spice/vnc password expire-time",
915
        .user_print = monitor_user_noop,
916
        .mhandler.cmd_new = expire_password,
917
    },
918

    
919
SQMP
920
expire_password
921
---------------
922

    
923
Set the password expire time for vnc/spice protocols.
924

    
925
Arguments:
926

    
927
- "protocol": protocol name (json-string)
928
- "time": [ now | never | +secs | secs ] (json-string)
929

    
930
Example:
931

    
932
-> { "execute": "expire_password", "arguments": { "protocol": "vnc",
933
                                                  "time": "+60" } }
934
<- { "return": {} }
935

    
936
EQMP
937

    
938
    {
939
        .name       = "add_client",
940
        .args_type  = "protocol:s,fdname:s,skipauth:b?",
941
        .params     = "protocol fdname skipauth",
942
        .help       = "add a graphics client",
943
        .user_print = monitor_user_noop,
944
        .mhandler.cmd_new = add_graphics_client,
945
    },
946

    
947
SQMP
948
add_client
949
----------
950

    
951
Add a graphics client
952

    
953
Arguments:
954

    
955
- "protocol": protocol name (json-string)
956
- "fdname": file descriptor name (json-string)
957

    
958
Example:
959

    
960
-> { "execute": "add_client", "arguments": { "protocol": "vnc",
961
                                             "fdname": "myclient" } }
962
<- { "return": {} }
963

    
964
EQMP
965
    {
966
        .name       = "qmp_capabilities",
967
        .args_type  = "",
968
        .params     = "",
969
        .help       = "enable QMP capabilities",
970
        .user_print = monitor_user_noop,
971
        .mhandler.cmd_new = do_qmp_capabilities,
972
    },
973

    
974
SQMP
975
qmp_capabilities
976
----------------
977

    
978
Enable QMP capabilities.
979

    
980
Arguments: None.
981

    
982
Example:
983

    
984
-> { "execute": "qmp_capabilities" }
985
<- { "return": {} }
986

    
987
Note: This command must be issued before issuing any other command.
988

    
989
EQMP
990

    
991
    {
992
        .name       = "human-monitor-command",
993
        .args_type  = "command-line:s,cpu-index:i?",
994
        .params     = "",
995
        .help       = "",
996
        .user_print = monitor_user_noop,
997
        .mhandler.cmd_new = do_hmp_passthrough,
998
    },
999

    
1000
SQMP
1001
human-monitor-command
1002
---------------------
1003

    
1004
Execute a Human Monitor command.
1005

    
1006
Arguments: 
1007

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

    
1014
Example:
1015

    
1016
-> { "execute": "human-monitor-command", "arguments": { "command-line": "info kvm" } }
1017
<- { "return": "kvm support: enabled\r\n" }
1018

    
1019
Notes:
1020

    
1021
(1) The Human Monitor is NOT an stable interface, this means that command
1022
    names, arguments and responses can change or be removed at ANY time.
1023
    Applications that rely on long term stability guarantees should NOT
1024
    use this command
1025

    
1026
(2) Limitations:
1027

    
1028
    o This command is stateless, this means that commands that depend
1029
      on state information (such as getfd) might not work
1030

    
1031
    o Commands that prompt the user for data (eg. 'cont' when the block
1032
      device is encrypted) don't currently work
1033

    
1034
3. Query Commands
1035
=================
1036

    
1037
HXCOMM Each query command below is inside a SQMP/EQMP section, do NOT change
1038
HXCOMM this! We will possibly move query commands definitions inside those
1039
HXCOMM sections, just like regular commands.
1040

    
1041
EQMP
1042

    
1043
SQMP
1044
query-version
1045
-------------
1046

    
1047
Show QEMU version.
1048

    
1049
Return a json-object with the following information:
1050

    
1051
- "qemu": A json-object containing three integer values:
1052
    - "major": QEMU's major version (json-int)
1053
    - "minor": QEMU's minor version (json-int)
1054
    - "micro": QEMU's micro version (json-int)
1055
- "package": package's version (json-string)
1056

    
1057
Example:
1058

    
1059
-> { "execute": "query-version" }
1060
<- {
1061
      "return":{
1062
         "qemu":{
1063
            "major":0,
1064
            "minor":11,
1065
            "micro":5
1066
         },
1067
         "package":""
1068
      }
1069
   }
1070

    
1071
EQMP
1072

    
1073
    {
1074
        .name       = "query-version",
1075
        .args_type  = "",
1076
        .mhandler.cmd_new = qmp_marshal_input_query_version,
1077
    },
1078

    
1079
SQMP
1080
query-commands
1081
--------------
1082

    
1083
List QMP available commands.
1084

    
1085
Each command is represented by a json-object, the returned value is a json-array
1086
of all commands.
1087

    
1088
Each json-object contain:
1089

    
1090
- "name": command's name (json-string)
1091

    
1092
Example:
1093

    
1094
-> { "execute": "query-commands" }
1095
<- {
1096
      "return":[
1097
         {
1098
            "name":"query-balloon"
1099
         },
1100
         {
1101
            "name":"system_powerdown"
1102
         }
1103
      ]
1104
   }
1105

    
1106
Note: This example has been shortened as the real response is too long.
1107

    
1108
EQMP
1109

    
1110
    {
1111
        .name       = "query-commands",
1112
        .args_type  = "",
1113
        .mhandler.cmd_new = qmp_marshal_input_query_commands,
1114
    },
1115

    
1116
SQMP
1117
query-chardev
1118
-------------
1119

    
1120
Each device is represented by a json-object. The returned value is a json-array
1121
of all devices.
1122

    
1123
Each json-object contain the following:
1124

    
1125
- "label": device's label (json-string)
1126
- "filename": device's file (json-string)
1127

    
1128
Example:
1129

    
1130
-> { "execute": "query-chardev" }
1131
<- {
1132
      "return":[
1133
         {
1134
            "label":"monitor",
1135
            "filename":"stdio"
1136
         },
1137
         {
1138
            "label":"serial0",
1139
            "filename":"vc"
1140
         }
1141
      ]
1142
   }
1143

    
1144
EQMP
1145

    
1146
    {
1147
        .name       = "query-chardev",
1148
        .args_type  = "",
1149
        .mhandler.cmd_new = qmp_marshal_input_query_chardev,
1150
    },
1151

    
1152
SQMP
1153
query-block
1154
-----------
1155

    
1156
Show the block devices.
1157

    
1158
Each block device information is stored in a json-object and the returned value
1159
is a json-array of all devices.
1160

    
1161
Each json-object contain the following:
1162

    
1163
- "device": device name (json-string)
1164
- "type": device type (json-string)
1165
         - deprecated, retained for backward compatibility
1166
         - Possible values: "unknown"
1167
- "removable": true if the device is removable, false otherwise (json-bool)
1168
- "locked": true if the device is locked, false otherwise (json-bool)
1169
- "tray-open": only present if removable, true if the device has a tray,
1170
               and it is open (json-bool)
1171
- "inserted": only present if the device is inserted, it is a json-object
1172
   containing the following:
1173
         - "file": device file name (json-string)
1174
         - "ro": true if read-only, false otherwise (json-bool)
1175
         - "drv": driver format name (json-string)
1176
             - Possible values: "blkdebug", "bochs", "cloop", "cow", "dmg",
1177
                                "file", "file", "ftp", "ftps", "host_cdrom",
1178
                                "host_device", "host_floppy", "http", "https",
1179
                                "nbd", "parallels", "qcow", "qcow2", "raw",
1180
                                "tftp", "vdi", "vmdk", "vpc", "vvfat"
1181
         - "backing_file": backing file name (json-string, optional)
1182
         - "encrypted": true if encrypted, false otherwise (json-bool)
1183
         - "bps": limit total bytes per second (json-int)
1184
         - "bps_rd": limit read bytes per second (json-int)
1185
         - "bps_wr": limit write bytes per second (json-int)
1186
         - "iops": limit total I/O operations per second (json-int)
1187
         - "iops_rd": limit read operations per second (json-int)
1188
         - "iops_wr": limit write operations per second (json-int)
1189

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

    
1195
Example:
1196

    
1197
-> { "execute": "query-block" }
1198
<- {
1199
      "return":[
1200
         {
1201
            "io-status": "ok",
1202
            "device":"ide0-hd0",
1203
            "locked":false,
1204
            "removable":false,
1205
            "inserted":{
1206
               "ro":false,
1207
               "drv":"qcow2",
1208
               "encrypted":false,
1209
               "file":"disks/test.img",
1210
               "bps":1000000,
1211
               "bps_rd":0,
1212
               "bps_wr":0,
1213
               "iops":1000000,
1214
               "iops_rd":0,
1215
               "iops_wr":0,
1216
            },
1217
            "type":"unknown"
1218
         },
1219
         {
1220
            "io-status": "ok",
1221
            "device":"ide1-cd0",
1222
            "locked":false,
1223
            "removable":true,
1224
            "type":"unknown"
1225
         },
1226
         {
1227
            "device":"floppy0",
1228
            "locked":false,
1229
            "removable":true,
1230
            "type":"unknown"
1231
         },
1232
         {
1233
            "device":"sd0",
1234
            "locked":false,
1235
            "removable":true,
1236
            "type":"unknown"
1237
         }
1238
      ]
1239
   }
1240

    
1241
EQMP
1242

    
1243
    {
1244
        .name       = "query-block",
1245
        .args_type  = "",
1246
        .mhandler.cmd_new = qmp_marshal_input_query_block,
1247
    },
1248

    
1249
SQMP
1250
query-blockstats
1251
----------------
1252

    
1253
Show block device statistics.
1254

    
1255
Each device statistic information is stored in a json-object and the returned
1256
value is a json-array of all devices.
1257

    
1258
Each json-object contain the following:
1259

    
1260
- "device": device name (json-string)
1261
- "stats": A json-object with the statistics information, it contains:
1262
    - "rd_bytes": bytes read (json-int)
1263
    - "wr_bytes": bytes written (json-int)
1264
    - "rd_operations": read operations (json-int)
1265
    - "wr_operations": write operations (json-int)
1266
    - "flush_operations": cache flush operations (json-int)
1267
    - "wr_total_time_ns": total time spend on writes in nano-seconds (json-int)
1268
    - "rd_total_time_ns": total time spend on reads in nano-seconds (json-int)
1269
    - "flush_total_time_ns": total time spend on cache flushes in nano-seconds (json-int)
1270
    - "wr_highest_offset": Highest offset of a sector written since the
1271
                           BlockDriverState has been opened (json-int)
1272
- "parent": Contains recursively the statistics of the underlying
1273
            protocol (e.g. the host file for a qcow2 image). If there is
1274
            no underlying protocol, this field is omitted
1275
            (json-object, optional)
1276

    
1277
Example:
1278

    
1279
-> { "execute": "query-blockstats" }
1280
<- {
1281
      "return":[
1282
         {
1283
            "device":"ide0-hd0",
1284
            "parent":{
1285
               "stats":{
1286
                  "wr_highest_offset":3686448128,
1287
                  "wr_bytes":9786368,
1288
                  "wr_operations":751,
1289
                  "rd_bytes":122567168,
1290
                  "rd_operations":36772
1291
                  "wr_total_times_ns":313253456
1292
                  "rd_total_times_ns":3465673657
1293
                  "flush_total_times_ns":49653
1294
                  "flush_operations":61,
1295
               }
1296
            },
1297
            "stats":{
1298
               "wr_highest_offset":2821110784,
1299
               "wr_bytes":9786368,
1300
               "wr_operations":692,
1301
               "rd_bytes":122739200,
1302
               "rd_operations":36604
1303
               "flush_operations":51,
1304
               "wr_total_times_ns":313253456
1305
               "rd_total_times_ns":3465673657
1306
               "flush_total_times_ns":49653
1307
            }
1308
         },
1309
         {
1310
            "device":"ide1-cd0",
1311
            "stats":{
1312
               "wr_highest_offset":0,
1313
               "wr_bytes":0,
1314
               "wr_operations":0,
1315
               "rd_bytes":0,
1316
               "rd_operations":0
1317
               "flush_operations":0,
1318
               "wr_total_times_ns":0
1319
               "rd_total_times_ns":0
1320
               "flush_total_times_ns":0
1321
            }
1322
         },
1323
         {
1324
            "device":"floppy0",
1325
            "stats":{
1326
               "wr_highest_offset":0,
1327
               "wr_bytes":0,
1328
               "wr_operations":0,
1329
               "rd_bytes":0,
1330
               "rd_operations":0
1331
               "flush_operations":0,
1332
               "wr_total_times_ns":0
1333
               "rd_total_times_ns":0
1334
               "flush_total_times_ns":0
1335
            }
1336
         },
1337
         {
1338
            "device":"sd0",
1339
            "stats":{
1340
               "wr_highest_offset":0,
1341
               "wr_bytes":0,
1342
               "wr_operations":0,
1343
               "rd_bytes":0,
1344
               "rd_operations":0
1345
               "flush_operations":0,
1346
               "wr_total_times_ns":0
1347
               "rd_total_times_ns":0
1348
               "flush_total_times_ns":0
1349
            }
1350
         }
1351
      ]
1352
   }
1353

    
1354
EQMP
1355

    
1356
    {
1357
        .name       = "query-blockstats",
1358
        .args_type  = "",
1359
        .mhandler.cmd_new = qmp_marshal_input_query_blockstats,
1360
    },
1361

    
1362
SQMP
1363
query-cpus
1364
----------
1365

    
1366
Show CPU information.
1367

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

    
1370
- "CPU": CPU index (json-int)
1371
- "current": true if this is the current CPU, false otherwise (json-bool)
1372
- "halted": true if the cpu is halted, false otherwise (json-bool)
1373
- Current program counter. The key's name depends on the architecture:
1374
     "pc": i386/x86_64 (json-int)
1375
     "nip": PPC (json-int)
1376
     "pc" and "npc": sparc (json-int)
1377
     "PC": mips (json-int)
1378
- "thread_id": ID of the underlying host thread (json-int)
1379

    
1380
Example:
1381

    
1382
-> { "execute": "query-cpus" }
1383
<- {
1384
      "return":[
1385
         {
1386
            "CPU":0,
1387
            "current":true,
1388
            "halted":false,
1389
            "pc":3227107138
1390
            "thread_id":3134
1391
         },
1392
         {
1393
            "CPU":1,
1394
            "current":false,
1395
            "halted":true,
1396
            "pc":7108165
1397
            "thread_id":3135
1398
         }
1399
      ]
1400
   }
1401

    
1402
EQMP
1403

    
1404
    {
1405
        .name       = "query-cpus",
1406
        .args_type  = "",
1407
        .mhandler.cmd_new = qmp_marshal_input_query_cpus,
1408
    },
1409

    
1410
SQMP
1411
query-pci
1412
---------
1413

    
1414
PCI buses and devices information.
1415

    
1416
The returned value is a json-array of all buses. Each bus is represented by
1417
a json-object, which has a key with a json-array of all PCI devices attached
1418
to it. Each device is represented by a json-object.
1419

    
1420
The bus json-object contains the following:
1421

    
1422
- "bus": bus number (json-int)
1423
- "devices": a json-array of json-objects, each json-object represents a
1424
             PCI device
1425

    
1426
The PCI device json-object contains the following:
1427

    
1428
- "bus": identical to the parent's bus number (json-int)
1429
- "slot": slot number (json-int)
1430
- "function": function number (json-int)
1431
- "class_info": a json-object containing:
1432
     - "desc": device class description (json-string, optional)
1433
     - "class": device class number (json-int)
1434
- "id": a json-object containing:
1435
     - "device": device ID (json-int)
1436
     - "vendor": vendor ID (json-int)
1437
- "irq": device's IRQ if assigned (json-int, optional)
1438
- "qdev_id": qdev id string (json-string)
1439
- "pci_bridge": It's a json-object, only present if this device is a
1440
                PCI bridge, contains:
1441
     - "bus": bus number (json-int)
1442
     - "secondary": secondary bus number (json-int)
1443
     - "subordinate": subordinate bus number (json-int)
1444
     - "io_range": I/O memory range information, a json-object with the
1445
                   following members:
1446
                 - "base": base address, in bytes (json-int)
1447
                 - "limit": limit address, in bytes (json-int)
1448
     - "memory_range": memory range information, a json-object with the
1449
                       following members:
1450
                 - "base": base address, in bytes (json-int)
1451
                 - "limit": limit address, in bytes (json-int)
1452
     - "prefetchable_range": Prefetchable memory range information, a
1453
                             json-object with the following members:
1454
                 - "base": base address, in bytes (json-int)
1455
                 - "limit": limit address, in bytes (json-int)
1456
     - "devices": a json-array of PCI devices if there's any attached, each
1457
                  each element is represented by a json-object, which contains
1458
                  the same members of the 'PCI device json-object' described
1459
                  above (optional)
1460
- "regions": a json-array of json-objects, each json-object represents a
1461
             memory region of this device
1462

    
1463
The memory range json-object contains the following:
1464

    
1465
- "base": base memory address (json-int)
1466
- "limit": limit value (json-int)
1467

    
1468
The region json-object can be an I/O region or a memory region, an I/O region
1469
json-object contains the following:
1470

    
1471
- "type": "io" (json-string, fixed)
1472
- "bar": BAR number (json-int)
1473
- "address": memory address (json-int)
1474
- "size": memory size (json-int)
1475

    
1476
A memory region json-object contains the following:
1477

    
1478
- "type": "memory" (json-string, fixed)
1479
- "bar": BAR number (json-int)
1480
- "address": memory address (json-int)
1481
- "size": memory size (json-int)
1482
- "mem_type_64": true or false (json-bool)
1483
- "prefetch": true or false (json-bool)
1484

    
1485
Example:
1486

    
1487
-> { "execute": "query-pci" }
1488
<- {
1489
      "return":[
1490
         {
1491
            "bus":0,
1492
            "devices":[
1493
               {
1494
                  "bus":0,
1495
                  "qdev_id":"",
1496
                  "slot":0,
1497
                  "class_info":{
1498
                     "class":1536,
1499
                     "desc":"Host bridge"
1500
                  },
1501
                  "id":{
1502
                     "device":32902,
1503
                     "vendor":4663
1504
                  },
1505
                  "function":0,
1506
                  "regions":[
1507
   
1508
                  ]
1509
               },
1510
               {
1511
                  "bus":0,
1512
                  "qdev_id":"",
1513
                  "slot":1,
1514
                  "class_info":{
1515
                     "class":1537,
1516
                     "desc":"ISA bridge"
1517
                  },
1518
                  "id":{
1519
                     "device":32902,
1520
                     "vendor":28672
1521
                  },
1522
                  "function":0,
1523
                  "regions":[
1524
   
1525
                  ]
1526
               },
1527
               {
1528
                  "bus":0,
1529
                  "qdev_id":"",
1530
                  "slot":1,
1531
                  "class_info":{
1532
                     "class":257,
1533
                     "desc":"IDE controller"
1534
                  },
1535
                  "id":{
1536
                     "device":32902,
1537
                     "vendor":28688
1538
                  },
1539
                  "function":1,
1540
                  "regions":[
1541
                     {
1542
                        "bar":4,
1543
                        "size":16,
1544
                        "address":49152,
1545
                        "type":"io"
1546
                     }
1547
                  ]
1548
               },
1549
               {
1550
                  "bus":0,
1551
                  "qdev_id":"",
1552
                  "slot":2,
1553
                  "class_info":{
1554
                     "class":768,
1555
                     "desc":"VGA controller"
1556
                  },
1557
                  "id":{
1558
                     "device":4115,
1559
                     "vendor":184
1560
                  },
1561
                  "function":0,
1562
                  "regions":[
1563
                     {
1564
                        "prefetch":true,
1565
                        "mem_type_64":false,
1566
                        "bar":0,
1567
                        "size":33554432,
1568
                        "address":4026531840,
1569
                        "type":"memory"
1570
                     },
1571
                     {
1572
                        "prefetch":false,
1573
                        "mem_type_64":false,
1574
                        "bar":1,
1575
                        "size":4096,
1576
                        "address":4060086272,
1577
                        "type":"memory"
1578
                     },
1579
                     {
1580
                        "prefetch":false,
1581
                        "mem_type_64":false,
1582
                        "bar":6,
1583
                        "size":65536,
1584
                        "address":-1,
1585
                        "type":"memory"
1586
                     }
1587
                  ]
1588
               },
1589
               {
1590
                  "bus":0,
1591
                  "qdev_id":"",
1592
                  "irq":11,
1593
                  "slot":4,
1594
                  "class_info":{
1595
                     "class":1280,
1596
                     "desc":"RAM controller"
1597
                  },
1598
                  "id":{
1599
                     "device":6900,
1600
                     "vendor":4098
1601
                  },
1602
                  "function":0,
1603
                  "regions":[
1604
                     {
1605
                        "bar":0,
1606
                        "size":32,
1607
                        "address":49280,
1608
                        "type":"io"
1609
                     }
1610
                  ]
1611
               }
1612
            ]
1613
         }
1614
      ]
1615
   }
1616

    
1617
Note: This example has been shortened as the real response is too long.
1618

    
1619
EQMP
1620

    
1621
    {
1622
        .name       = "query-pci",
1623
        .args_type  = "",
1624
        .mhandler.cmd_new = qmp_marshal_input_query_pci,
1625
    },
1626

    
1627
SQMP
1628
query-kvm
1629
---------
1630

    
1631
Show KVM information.
1632

    
1633
Return a json-object with the following information:
1634

    
1635
- "enabled": true if KVM support is enabled, false otherwise (json-bool)
1636
- "present": true if QEMU has KVM support, false otherwise (json-bool)
1637

    
1638
Example:
1639

    
1640
-> { "execute": "query-kvm" }
1641
<- { "return": { "enabled": true, "present": true } }
1642

    
1643
EQMP
1644

    
1645
    {
1646
        .name       = "query-kvm",
1647
        .args_type  = "",
1648
        .mhandler.cmd_new = qmp_marshal_input_query_kvm,
1649
    },
1650

    
1651
SQMP
1652
query-status
1653
------------
1654

    
1655
Return a json-object with the following information:
1656

    
1657
- "running": true if the VM is running, or false if it is paused (json-bool)
1658
- "singlestep": true if the VM is in single step mode,
1659
                false otherwise (json-bool)
1660
- "status": one of the following values (json-string)
1661
    "debug" - QEMU is running on a debugger
1662
    "inmigrate" - guest is paused waiting for an incoming migration
1663
    "internal-error" - An internal error that prevents further guest
1664
    execution has occurred
1665
    "io-error" - the last IOP has failed and the device is configured
1666
    to pause on I/O errors
1667
    "paused" - guest has been paused via the 'stop' command
1668
    "postmigrate" - guest is paused following a successful 'migrate'
1669
    "prelaunch" - QEMU was started with -S and guest has not started
1670
    "finish-migrate" - guest is paused to finish the migration process
1671
    "restore-vm" - guest is paused to restore VM state
1672
    "running" - guest is actively running
1673
    "save-vm" - guest is paused to save the VM state
1674
    "shutdown" - guest is shut down (and -no-shutdown is in use)
1675
    "watchdog" - the watchdog action is configured to pause and
1676
     has been triggered
1677

    
1678
Example:
1679

    
1680
-> { "execute": "query-status" }
1681
<- { "return": { "running": true, "singlestep": false, "status": "running" } }
1682

    
1683
EQMP
1684
    
1685
    {
1686
        .name       = "query-status",
1687
        .args_type  = "",
1688
        .mhandler.cmd_new = qmp_marshal_input_query_status,
1689
    },
1690

    
1691
SQMP
1692
query-mice
1693
----------
1694

    
1695
Show VM mice information.
1696

    
1697
Each mouse is represented by a json-object, the returned value is a json-array
1698
of all mice.
1699

    
1700
The mouse json-object contains the following:
1701

    
1702
- "name": mouse's name (json-string)
1703
- "index": mouse's index (json-int)
1704
- "current": true if this mouse is receiving events, false otherwise (json-bool)
1705
- "absolute": true if the mouse generates absolute input events (json-bool)
1706

    
1707
Example:
1708

    
1709
-> { "execute": "query-mice" }
1710
<- {
1711
      "return":[
1712
         {
1713
            "name":"QEMU Microsoft Mouse",
1714
            "index":0,
1715
            "current":false,
1716
            "absolute":false
1717
         },
1718
         {
1719
            "name":"QEMU PS/2 Mouse",
1720
            "index":1,
1721
            "current":true,
1722
            "absolute":true
1723
         }
1724
      ]
1725
   }
1726

    
1727
EQMP
1728

    
1729
    {
1730
        .name       = "query-mice",
1731
        .args_type  = "",
1732
        .mhandler.cmd_new = qmp_marshal_input_query_mice,
1733
    },
1734

    
1735
SQMP
1736
query-vnc
1737
---------
1738

    
1739
Show VNC server information.
1740

    
1741
Return a json-object with server information. Connected clients are returned
1742
as a json-array of json-objects.
1743

    
1744
The main json-object contains the following:
1745

    
1746
- "enabled": true or false (json-bool)
1747
- "host": server's IP address (json-string)
1748
- "family": address family (json-string)
1749
         - Possible values: "ipv4", "ipv6", "unix", "unknown"
1750
- "service": server's port number (json-string)
1751
- "auth": authentication method (json-string)
1752
         - Possible values: "invalid", "none", "ra2", "ra2ne", "sasl", "tight",
1753
                            "tls", "ultra", "unknown", "vencrypt", "vencrypt",
1754
                            "vencrypt+plain", "vencrypt+tls+none",
1755
                            "vencrypt+tls+plain", "vencrypt+tls+sasl",
1756
                            "vencrypt+tls+vnc", "vencrypt+x509+none",
1757
                            "vencrypt+x509+plain", "vencrypt+x509+sasl",
1758
                            "vencrypt+x509+vnc", "vnc"
1759
- "clients": a json-array of all connected clients
1760

    
1761
Clients are described by a json-object, each one contain the following:
1762

    
1763
- "host": client's IP address (json-string)
1764
- "family": address family (json-string)
1765
         - Possible values: "ipv4", "ipv6", "unix", "unknown"
1766
- "service": client's port number (json-string)
1767
- "x509_dname": TLS dname (json-string, optional)
1768
- "sasl_username": SASL username (json-string, optional)
1769

    
1770
Example:
1771

    
1772
-> { "execute": "query-vnc" }
1773
<- {
1774
      "return":{
1775
         "enabled":true,
1776
         "host":"0.0.0.0",
1777
         "service":"50402",
1778
         "auth":"vnc",
1779
         "family":"ipv4",
1780
         "clients":[
1781
            {
1782
               "host":"127.0.0.1",
1783
               "service":"50401",
1784
               "family":"ipv4"
1785
            }
1786
         ]
1787
      }
1788
   }
1789

    
1790
EQMP
1791

    
1792
    {
1793
        .name       = "query-vnc",
1794
        .args_type  = "",
1795
        .mhandler.cmd_new = qmp_marshal_input_query_vnc,
1796
    },
1797

    
1798
SQMP
1799
query-spice
1800
-----------
1801

    
1802
Show SPICE server information.
1803

    
1804
Return a json-object with server information. Connected clients are returned
1805
as a json-array of json-objects.
1806

    
1807
The main json-object contains the following:
1808

    
1809
- "enabled": true or false (json-bool)
1810
- "host": server's IP address (json-string)
1811
- "port": server's port number (json-int, optional)
1812
- "tls-port": server's port number (json-int, optional)
1813
- "auth": authentication method (json-string)
1814
         - Possible values: "none", "spice"
1815
- "channels": a json-array of all active channels clients
1816

    
1817
Channels are described by a json-object, each one contain the following:
1818

    
1819
- "host": client's IP address (json-string)
1820
- "family": address family (json-string)
1821
         - Possible values: "ipv4", "ipv6", "unix", "unknown"
1822
- "port": client's port number (json-string)
1823
- "connection-id": spice connection id.  All channels with the same id
1824
                   belong to the same spice session (json-int)
1825
- "channel-type": channel type.  "1" is the main control channel, filter for
1826
                  this one if you want track spice sessions only (json-int)
1827
- "channel-id": channel id.  Usually "0", might be different needed when
1828
                multiple channels of the same type exist, such as multiple
1829
                display channels in a multihead setup (json-int)
1830
- "tls": whevener the channel is encrypted (json-bool)
1831

    
1832
Example:
1833

    
1834
-> { "execute": "query-spice" }
1835
<- {
1836
      "return": {
1837
         "enabled": true,
1838
         "auth": "spice",
1839
         "port": 5920,
1840
         "tls-port": 5921,
1841
         "host": "0.0.0.0",
1842
         "channels": [
1843
            {
1844
               "port": "54924",
1845
               "family": "ipv4",
1846
               "channel-type": 1,
1847
               "connection-id": 1804289383,
1848
               "host": "127.0.0.1",
1849
               "channel-id": 0,
1850
               "tls": true
1851
            },
1852
            {
1853
               "port": "36710",
1854
               "family": "ipv4",
1855
               "channel-type": 4,
1856
               "connection-id": 1804289383,
1857
               "host": "127.0.0.1",
1858
               "channel-id": 0,
1859
               "tls": false
1860
            },
1861
            [ ... more channels follow ... ]
1862
         ]
1863
      }
1864
   }
1865

    
1866
EQMP
1867

    
1868
#if defined(CONFIG_SPICE)
1869
    {
1870
        .name       = "query-spice",
1871
        .args_type  = "",
1872
        .mhandler.cmd_new = qmp_marshal_input_query_spice,
1873
    },
1874
#endif
1875

    
1876
SQMP
1877
query-name
1878
----------
1879

    
1880
Show VM name.
1881

    
1882
Return a json-object with the following information:
1883

    
1884
- "name": VM's name (json-string, optional)
1885

    
1886
Example:
1887

    
1888
-> { "execute": "query-name" }
1889
<- { "return": { "name": "qemu-name" } }
1890

    
1891
EQMP
1892

    
1893
    {
1894
        .name       = "query-name",
1895
        .args_type  = "",
1896
        .mhandler.cmd_new = qmp_marshal_input_query_name,
1897
    },
1898

    
1899
SQMP
1900
query-uuid
1901
----------
1902

    
1903
Show VM UUID.
1904

    
1905
Return a json-object with the following information:
1906

    
1907
- "UUID": Universally Unique Identifier (json-string)
1908

    
1909
Example:
1910

    
1911
-> { "execute": "query-uuid" }
1912
<- { "return": { "UUID": "550e8400-e29b-41d4-a716-446655440000" } }
1913

    
1914
EQMP
1915

    
1916
    {
1917
        .name       = "query-uuid",
1918
        .args_type  = "",
1919
        .mhandler.cmd_new = qmp_marshal_input_query_uuid,
1920
    },
1921

    
1922
SQMP
1923
query-migrate
1924
-------------
1925

    
1926
Migration status.
1927

    
1928
Return a json-object. If migration is active there will be another json-object
1929
with RAM migration status and if block migration is active another one with
1930
block migration status.
1931

    
1932
The main json-object contains the following:
1933

    
1934
- "status": migration status (json-string)
1935
     - Possible values: "active", "completed", "failed", "cancelled"
1936
- "ram": only present if "status" is "active", it is a json-object with the
1937
  following RAM information (in bytes):
1938
         - "transferred": amount transferred (json-int)
1939
         - "remaining": amount remaining (json-int)
1940
         - "total": total (json-int)
1941
- "disk": only present if "status" is "active" and it is a block migration,
1942
  it is a json-object with the following disk information (in bytes):
1943
         - "transferred": amount transferred (json-int)
1944
         - "remaining": amount remaining (json-int)
1945
         - "total": total (json-int)
1946

    
1947
Examples:
1948

    
1949
1. Before the first migration
1950

    
1951
-> { "execute": "query-migrate" }
1952
<- { "return": {} }
1953

    
1954
2. Migration is done and has succeeded
1955

    
1956
-> { "execute": "query-migrate" }
1957
<- { "return": { "status": "completed" } }
1958

    
1959
3. Migration is done and has failed
1960

    
1961
-> { "execute": "query-migrate" }
1962
<- { "return": { "status": "failed" } }
1963

    
1964
4. Migration is being performed and is not a block migration:
1965

    
1966
-> { "execute": "query-migrate" }
1967
<- {
1968
      "return":{
1969
         "status":"active",
1970
         "ram":{
1971
            "transferred":123,
1972
            "remaining":123,
1973
            "total":246
1974
         }
1975
      }
1976
   }
1977

    
1978
5. Migration is being performed and is a block migration:
1979

    
1980
-> { "execute": "query-migrate" }
1981
<- {
1982
      "return":{
1983
         "status":"active",
1984
         "ram":{
1985
            "total":1057024,
1986
            "remaining":1053304,
1987
            "transferred":3720
1988
         },
1989
         "disk":{
1990
            "total":20971520,
1991
            "remaining":20880384,
1992
            "transferred":91136
1993
         }
1994
      }
1995
   }
1996

    
1997
EQMP
1998

    
1999
    {
2000
        .name       = "query-migrate",
2001
        .args_type  = "",
2002
        .mhandler.cmd_new = qmp_marshal_input_query_migrate,
2003
    },
2004

    
2005
SQMP
2006
query-balloon
2007
-------------
2008

    
2009
Show balloon information.
2010

    
2011
Make an asynchronous request for balloon info. When the request completes a
2012
json-object will be returned containing the following data:
2013

    
2014
- "actual": current balloon value in bytes (json-int)
2015
- "mem_swapped_in": Amount of memory swapped in bytes (json-int, optional)
2016
- "mem_swapped_out": Amount of memory swapped out in bytes (json-int, optional)
2017
- "major_page_faults": Number of major faults (json-int, optional)
2018
- "minor_page_faults": Number of minor faults (json-int, optional)
2019
- "free_mem": Total amount of free and unused memory in
2020
              bytes (json-int, optional)
2021
- "total_mem": Total amount of available memory in bytes (json-int, optional)
2022

    
2023
Example:
2024

    
2025
-> { "execute": "query-balloon" }
2026
<- {
2027
      "return":{
2028
         "actual":1073741824,
2029
         "mem_swapped_in":0,
2030
         "mem_swapped_out":0,
2031
         "major_page_faults":142,
2032
         "minor_page_faults":239245,
2033
         "free_mem":1014185984,
2034
         "total_mem":1044668416
2035
      }
2036
   }
2037

    
2038
EQMP
2039

    
2040
    {
2041
        .name       = "query-balloon",
2042
        .args_type  = "",
2043
        .mhandler.cmd_new = qmp_marshal_input_query_balloon,
2044
    },