1QEMU-GA-REF(7) QEMU QEMU-GA-REF(7)
2
3
4
6 qemu-ga-ref - QEMU Guest Agent Protocol Reference
7
8 Contents
9 • QEMU Guest Agent Protocol Reference
10
11 • General note concerning the use of guest agent interfaces
12
13 • "unsupported" is a higher-level error than the errors that indi‐
14 vidual commands might document. The caller should always be pre‐
15 pared to receive QERR_UNSUPPORTED, even if the given command
16 doesn't specify it, or doesn't document any failure mode at all.
17
18 • QEMU guest agent protocol commands and structs
19
20 • guest-sync-delimited (Command)
21
22 • guest-sync (Command)
23
24 • guest-ping (Command)
25
26 • guest-get-time (Command)
27
28 • guest-set-time (Command)
29
30 • GuestAgentCommandInfo (Object)
31
32 • GuestAgentInfo (Object)
33
34 • guest-info (Command)
35
36 • guest-shutdown (Command)
37
38 • guest-file-open (Command)
39
40 • guest-file-close (Command)
41
42 • GuestFileRead (Object)
43
44 • guest-file-read (Command)
45
46 • GuestFileWrite (Object)
47
48 • guest-file-write (Command)
49
50 • GuestFileSeek (Object)
51
52 • QGASeek (Enum)
53
54 • GuestFileWhence (Alternate)
55
56 • guest-file-seek (Command)
57
58 • guest-file-flush (Command)
59
60 • GuestFsfreezeStatus (Enum)
61
62 • guest-fsfreeze-status (Command)
63
64 • guest-fsfreeze-freeze (Command)
65
66 • guest-fsfreeze-freeze-list (Command)
67
68 • guest-fsfreeze-thaw (Command)
69
70 • GuestFilesystemTrimResult (Object)
71
72 • GuestFilesystemTrimResponse (Object)
73
74 • guest-fstrim (Command)
75
76 • guest-suspend-disk (Command)
77
78 • guest-suspend-ram (Command)
79
80 • guest-suspend-hybrid (Command)
81
82 • GuestIpAddressType (Enum)
83
84 • GuestIpAddress (Object)
85
86 • GuestNetworkInterfaceStat (Object)
87
88 • GuestNetworkInterface (Object)
89
90 • guest-network-get-interfaces (Command)
91
92 • GuestLogicalProcessor (Object)
93
94 • guest-get-vcpus (Command)
95
96 • guest-set-vcpus (Command)
97
98 • GuestDiskBusType (Enum)
99
100 • GuestPCIAddress (Object)
101
102 • GuestCCWAddress (Object)
103
104 • GuestDiskAddress (Object)
105
106 • GuestNVMeSmart (Object)
107
108 • GuestDiskSmart (Object)
109
110 • GuestDiskInfo (Object)
111
112 • guest-get-disks (Command)
113
114 • GuestFilesystemInfo (Object)
115
116 • guest-get-fsinfo (Command)
117
118 • guest-set-user-password (Command)
119
120 • GuestMemoryBlock (Object)
121
122 • guest-get-memory-blocks (Command)
123
124 • GuestMemoryBlockResponseType (Enum)
125
126 • GuestMemoryBlockResponse (Object)
127
128 • guest-set-memory-blocks (Command)
129
130 • GuestMemoryBlockInfo (Object)
131
132 • guest-get-memory-block-info (Command)
133
134 • GuestExecStatus (Object)
135
136 • guest-exec-status (Command)
137
138 • GuestExec (Object)
139
140 • guest-exec (Command)
141
142 • GuestHostName (Object)
143
144 • guest-get-host-name (Command)
145
146 • GuestUser (Object)
147
148 • guest-get-users (Command)
149
150 • GuestTimezone (Object)
151
152 • guest-get-timezone (Command)
153
154 • GuestOSInfo (Object)
155
156 • guest-get-osinfo (Command)
157
158 • GuestDeviceType (Enum)
159
160 • GuestDeviceIdPCI (Object)
161
162 • GuestDeviceId (Object)
163
164 • GuestDeviceInfo (Object)
165
166 • guest-get-devices (Command)
167
168 • GuestAuthorizedKeys (Object)
169
170 • guest-ssh-get-authorized-keys (Command)
171
172 • guest-ssh-add-authorized-keys (Command)
173
174 • guest-ssh-remove-authorized-keys (Command)
175
176 • GuestDiskStats (Object)
177
178 • GuestDiskStatsInfo (Object)
179
180 • guest-get-diskstats (Command)
181
182 • GuestCpuStatsType (Enum)
183
184 • GuestLinuxCpuStats (Object)
185
186 • GuestCpuStats (Object)
187
188 • guest-get-cpustats (Command)
189
191 "unsupported" is a higher-level error than the errors that individual
192 commands might document. The caller should always be prepared to re‐
193 ceive QERR_UNSUPPORTED, even if the given command doesn't specify it,
194 or doesn't document any failure mode at all.
195
197 guest-sync-delimited (Command)
198 Echo back a unique integer value, and prepend to response a leading
199 sentinel byte (0xFF) the client can check scan for.
200
201 This is used by clients talking to the guest agent over the wire to en‐
202 sure the stream is in sync and doesn't contain stale data from previous
203 client. It must be issued upon initial connection, and after any
204 client-side timeouts (including timeouts on receiving a response to
205 this command).
206
207 After issuing this request, all guest agent responses should be ignored
208 until the response containing the unique integer value the client
209 passed in is returned. Receival of the 0xFF sentinel byte must be han‐
210 dled as an indication that the client's lexer/tokenizer/parser state
211 should be flushed/reset in preparation for reliably receiving the sub‐
212 sequent response. As an optimization, clients may opt to ignore all
213 data until a sentinel value is receiving to avoid unnecessary process‐
214 ing of stale data.
215
216 Similarly, clients should also precede this request with a 0xFF byte to
217 make sure the guest agent flushes any partially read JSON data from a
218 previous client connection.
219
220 Arguments
221 id: int
222 randomly generated 64-bit integer
223
224 Returns
225 The unique integer id passed in by the client
226
227 Since
228 1.1
229
230 guest-sync (Command)
231 Echo back a unique integer value
232
233 This is used by clients talking to the guest agent over the wire to en‐
234 sure the stream is in sync and doesn't contain stale data from previous
235 client. All guest agent responses should be ignored until the provided
236 unique integer value is returned, and it is up to the client to handle
237 stale whole or partially-delivered JSON text in such a way that this
238 response can be obtained.
239
240 In cases where a partial stale response was previously received by the
241 client, this cannot always be done reliably. One particular scenario
242 being if qemu-ga responses are fed character-by-character into a JSON
243 parser. In these situations, using guest-sync-delimited may be optimal.
244
245 For clients that fetch responses line by line and convert them to JSON
246 objects, guest-sync should be sufficient, but note that in cases where
247 the channel is dirty some attempts at parsing the response may result
248 in a parser error.
249
250 Such clients should also precede this command with a 0xFF byte to make
251 sure the guest agent flushes any partially read JSON data from a previ‐
252 ous session.
253
254 Arguments
255 id: int
256 randomly generated 64-bit integer
257
258 Returns
259 The unique integer id passed in by the client
260
261 Since
262 0.15.0
263
264 guest-ping (Command)
265 Ping the guest agent, a non-error return implies success
266
267 Since
268 0.15.0
269
270 guest-get-time (Command)
271 Get the information about guest's System Time relative to the Epoch of
272 1970-01-01 in UTC.
273
274 Returns
275 Time in nanoseconds.
276
277 Since
278 1.5
279
280 guest-set-time (Command)
281 Set guest time.
282
283 When a guest is paused or migrated to a file then loaded from that
284 file, the guest OS has no idea that there was a big gap in the time.
285 Depending on how long the gap was, NTP might not be able to resynchro‐
286 nize the guest.
287
288 This command tries to set guest's System Time to the given value, then
289 sets the Hardware Clock (RTC) to the current System Time. This will
290 make it easier for a guest to resynchronize without waiting for NTP. If
291 no time is specified, then the time to set is read from RTC. However,
292 this may not be supported on all platforms (i.e. Windows). If that's
293 the case users are advised to always pass a value.
294
295 Arguments
296 time: int (optional)
297 time of nanoseconds, relative to the Epoch of 1970-01-01 in UTC.
298
299 Returns
300 Nothing on success.
301
302 Since
303 1.5
304
305 GuestAgentCommandInfo (Object)
306 Information about guest agent commands.
307
308 Members
309 name: string
310 name of the command
311
312 enabled: boolean
313 whether command is currently enabled by guest admin
314
315 success-response: boolean
316 whether command returns a response on success (since 1.7)
317
318 Since
319 1.1.0
320
321 GuestAgentInfo (Object)
322 Information about guest agent.
323
324 Members
325 version: string
326 guest agent version
327
328 supported_commands: array of GuestAgentCommandInfo
329 Information about guest agent commands
330
331 Since
332 0.15.0
333
334 guest-info (Command)
335 Get some information about the guest agent.
336
337 Returns
338 GuestAgentInfo
339
340 Since
341 0.15.0
342
343 guest-shutdown (Command)
344 Initiate guest-activated shutdown. Note: this is an asynchronous shut‐
345 down request, with no guarantee of successful shutdown.
346
347 Arguments
348 mode: string (optional)
349 "halt", "powerdown" (default), or "reboot"
350 This command does NOT return a response on success. Success condition
351 is indicated by the VM exiting with a zero exit status or, when running
352 with --no-shutdown, by issuing the query-status QMP command to confirm
353 the VM status is "shutdown".
354
355 Since
356 0.15.0
357
358 guest-file-open (Command)
359 Open a file in the guest and retrieve a file handle for it
360
361 Arguments
362 path: string
363 Full path to the file in the guest to open.
364
365 mode: string (optional)
366 open mode, as per fopen(), "r" is the default.
367
368 Returns
369 Guest file handle on success.
370
371 Since
372 0.15.0
373
374 guest-file-close (Command)
375 Close an open file in the guest
376
377 Arguments
378 handle: int
379 filehandle returned by guest-file-open
380
381 Returns
382 Nothing on success.
383
384 Since
385 0.15.0
386
387 GuestFileRead (Object)
388 Result of guest agent file-read operation
389
390 Members
391 count: int
392 number of bytes read (note: count is before base64-encoding is
393 applied)
394
395 buf-b64: string
396 base64-encoded bytes read
397
398 eof: boolean
399 whether EOF was encountered during read operation.
400
401 Since
402 0.15.0
403
404 guest-file-read (Command)
405 Read from an open file in the guest. Data will be base64-encoded. As
406 this command is just for limited, ad-hoc debugging, such as log file
407 access, the number of bytes to read is limited to 48 MB.
408
409 Arguments
410 handle: int
411 filehandle returned by guest-file-open
412
413 count: int (optional)
414 maximum number of bytes to read (default is 4KB, maximum is
415 48MB)
416
417 Returns
418 GuestFileRead on success.
419
420 Since
421 0.15.0
422
423 GuestFileWrite (Object)
424 Result of guest agent file-write operation
425
426 Members
427 count: int
428 number of bytes written (note: count is actual bytes written,
429 after base64-decoding of provided buffer)
430
431 eof: boolean
432 whether EOF was encountered during write operation.
433
434 Since
435 0.15.0
436
437 guest-file-write (Command)
438 Write to an open file in the guest.
439
440 Arguments
441 handle: int
442 filehandle returned by guest-file-open
443
444 buf-b64: string
445 base64-encoded string representing data to be written
446
447 count: int (optional)
448 bytes to write (actual bytes, after base64-decode), default is
449 all content in buf-b64 buffer after base64 decoding
450
451 Returns
452 GuestFileWrite on success.
453
454 Since
455 0.15.0
456
457 GuestFileSeek (Object)
458 Result of guest agent file-seek operation
459
460 Members
461 position: int
462 current file position
463
464 eof: boolean
465 whether EOF was encountered during file seek
466
467 Since
468 0.15.0
469
470 QGASeek (Enum)
471 Symbolic names for use in guest-file-seek
472
473 Values
474 set Set to the specified offset (same effect as 'whence':0)
475
476 cur Add offset to the current location (same effect as 'whence':1)
477
478 end Add offset to the end of the file (same effect as 'whence':2)
479
480 Since
481 2.6
482
483 GuestFileWhence (Alternate)
484 Controls the meaning of offset to guest-file-seek.
485
486 Members
487 value: int
488 Integral value (0 for set, 1 for cur, 2 for end), available for
489 historical reasons, and might differ from the host's or guest's
490 SEEK_* values (since: 0.15)
491
492 name: QGASeek
493 Symbolic name, and preferred interface
494
495 Since
496 2.6
497
498 guest-file-seek (Command)
499 Seek to a position in the file, as with fseek(), and return the current
500 file position afterward. Also encapsulates ftell()'s functionality,
501 with offset=0 and whence=1.
502
503 Arguments
504 handle: int
505 filehandle returned by guest-file-open
506
507 offset: int
508 bytes to skip over in the file stream
509
510 whence: GuestFileWhence
511 Symbolic or numeric code for interpreting offset
512
513 Returns
514 GuestFileSeek on success.
515
516 Since
517 0.15.0
518
519 guest-file-flush (Command)
520 Write file changes buffered in userspace to disk/kernel buffers
521
522 Arguments
523 handle: int
524 filehandle returned by guest-file-open
525
526 Returns
527 Nothing on success.
528
529 Since
530 0.15.0
531
532 GuestFsfreezeStatus (Enum)
533 An enumeration of filesystem freeze states
534
535 Values
536 thawed filesystems thawed/unfrozen
537
538 frozen all non-network guest filesystems frozen
539
540 Since
541 0.15.0
542
543 guest-fsfreeze-status (Command)
544 Get guest fsfreeze state. error state indicates
545
546 Returns
547 GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
548
549 Note
550 This may fail to properly report the current state as a result of some
551 other guest processes having issued an fs freeze/thaw.
552
553 Since
554 0.15.0
555
556 guest-fsfreeze-freeze (Command)
557 Sync and freeze all freezable, local guest filesystems. If this command
558 succeeded, you may call guest-fsfreeze-thaw later to unfreeze.
559
560 Note
561 On Windows, the command is implemented with the help of a Volume
562 Shadow-copy Service DLL helper. The frozen state is limited for up to
563 10 seconds by VSS.
564
565 Returns
566 Number of file systems currently frozen. On error, all filesystems will
567 be thawed. If no filesystems are frozen as a result of this call, then
568 guest-fsfreeze-status will remain "thawed" and calling guest-fs‐
569 freeze-thaw is not necessary.
570
571 Since
572 0.15.0
573
574 guest-fsfreeze-freeze-list (Command)
575 Sync and freeze specified guest filesystems. See also guest-fs‐
576 freeze-freeze.
577
578 Arguments
579 mountpoints: array of string (optional)
580 an array of mountpoints of filesystems to be frozen. If omit‐
581 ted, every mounted filesystem is frozen. Invalid mount points
582 are ignored.
583
584 Returns
585 Number of file systems currently frozen. On error, all filesystems will
586 be thawed.
587
588 Since
589 2.2
590
591 guest-fsfreeze-thaw (Command)
592 Unfreeze all frozen guest filesystems
593
594 Returns
595 Number of file systems thawed by this call
596
597 Note
598 if return value does not match the previous call to guest-fs‐
599 freeze-freeze, this likely means some freezable filesystems were un‐
600 frozen before this call, and that the filesystem state may have changed
601 before issuing this command.
602
603 Since
604 0.15.0
605
606 GuestFilesystemTrimResult (Object)
607 Members
608 path: string
609 path that was trimmed
610
611 error: string (optional)
612 an error message when trim failed
613
614 trimmed: int (optional)
615 bytes trimmed for this path
616
617 minimum: int (optional)
618 reported effective minimum for this path
619
620 Since
621 2.4
622
623 GuestFilesystemTrimResponse (Object)
624 Members
625 paths: array of GuestFilesystemTrimResult
626 list of GuestFilesystemTrimResult per path that was trimmed
627
628 Since
629 2.4
630
631 guest-fstrim (Command)
632 Discard (or "trim") blocks which are not in use by the filesystem.
633
634 Arguments
635 minimum: int (optional)
636 Minimum contiguous free range to discard, in bytes. Free ranges
637 smaller than this may be ignored (this is a hint and the guest
638 may not respect it). By increasing this value, the fstrim oper‐
639 ation will complete more quickly for filesystems with badly
640 fragmented free space, although not all blocks will be dis‐
641 carded. The default value is zero, meaning "discard every free
642 block".
643
644 Returns
645 A GuestFilesystemTrimResponse which contains the status of all trimmed
646 paths. (since 2.4)
647
648 Since
649 1.2
650
651 guest-suspend-disk (Command)
652 Suspend guest to disk.
653
654 This command attempts to suspend the guest using three strategies, in
655 this order:
656
657 • systemd hibernate
658
659 • pm-utils (via pm-hibernate)
660
661 • manual write into sysfs
662
663 This command does NOT return a response on success. There is a high
664 chance the command succeeded if the VM exits with a zero exit status
665 or, when running with --no-shutdown, by issuing the query-status QMP
666 command to to confirm the VM status is "shutdown". However, the VM
667 could also exit (or set its status to "shutdown") due to other reasons.
668
669 The following errors may be returned:
670
671 • If suspend to disk is not supported, Unsupported
672
673 Notes
674 It's strongly recommended to issue the guest-sync command before send‐
675 ing commands when the guest resumes
676
677 Since
678 1.1
679
680 guest-suspend-ram (Command)
681 Suspend guest to ram.
682
683 This command attempts to suspend the guest using three strategies, in
684 this order:
685
686 • systemd suspend
687
688 • pm-utils (via pm-suspend)
689
690 • manual write into sysfs
691
692 IMPORTANT: guest-suspend-ram requires working wakeup support in QEMU.
693 You should check QMP command query-current-machine returns wakeup-sus‐
694 pend-support: true before issuing this command. Failure in doing so can
695 result in a suspended guest that QEMU will not be able to awaken, forc‐
696 ing the user to power cycle the guest to bring it back.
697
698 This command does NOT return a response on success. There are two op‐
699 tions to check for success:
700
701 1. Wait for the SUSPEND QMP event from QEMU
702
703 2. Issue the query-status QMP command to confirm the VM status is "sus‐
704 pended"
705
706 The following errors may be returned:
707
708 • If suspend to ram is not supported, Unsupported
709
710 Notes
711 It's strongly recommended to issue the guest-sync command before send‐
712 ing commands when the guest resumes
713
714 Since
715 1.1
716
717 guest-suspend-hybrid (Command)
718 Save guest state to disk and suspend to ram.
719
720 This command attempts to suspend the guest by executing, in this order:
721
722 • systemd hybrid-sleep
723
724 • pm-utils (via pm-suspend-hybrid)
725
726 IMPORTANT: guest-suspend-hybrid requires working wakeup support in
727 QEMU. You should check QMP command query-current-machine returns
728 wakeup-suspend-support: true before issuing this command. Failure in
729 doing so can result in a suspended guest that QEMU will not be able to
730 awaken, forcing the user to power cycle the guest to bring it back.
731
732 This command does NOT return a response on success. There are two op‐
733 tions to check for success:
734
735 1. Wait for the SUSPEND QMP event from QEMU
736
737 2. Issue the query-status QMP command to confirm the VM status is "sus‐
738 pended"
739
740 The following errors may be returned:
741
742 • If hybrid suspend is not supported, Unsupported
743
744 Notes
745 It's strongly recommended to issue the guest-sync command before send‐
746 ing commands when the guest resumes
747
748 Since
749 1.1
750
751 GuestIpAddressType (Enum)
752 An enumeration of supported IP address types
753
754 Values
755 ipv4 IP version 4
756
757 ipv6 IP version 6
758
759 Since
760 1.1
761
762 GuestIpAddress (Object)
763 Members
764 ip-address: string
765 IP address
766
767 ip-address-type: GuestIpAddressType
768 Type of ip-address (e.g. ipv4, ipv6)
769
770 prefix: int
771 Network prefix length of ip-address
772
773 Since
774 1.1
775
776 GuestNetworkInterfaceStat (Object)
777 Members
778 rx-bytes: int
779 total bytes received
780
781 rx-packets: int
782 total packets received
783
784 rx-errs: int
785 bad packets received
786
787 rx-dropped: int
788 receiver dropped packets
789
790 tx-bytes: int
791 total bytes transmitted
792
793 tx-packets: int
794 total packets transmitted
795
796 tx-errs: int
797 packet transmit problems
798
799 tx-dropped: int
800 dropped packets transmitted
801
802 Since
803 2.11
804
805 GuestNetworkInterface (Object)
806 Members
807 name: string
808 The name of interface for which info are being delivered
809
810 hardware-address: string (optional)
811 Hardware address of name
812
813 ip-addresses: array of GuestIpAddress (optional)
814 List of addresses assigned to name
815
816 statistics: GuestNetworkInterfaceStat (optional)
817 various statistic counters related to name (since 2.11)
818
819 Since
820 1.1
821
822 guest-network-get-interfaces (Command)
823 Get list of guest IP addresses, MAC addresses and netmasks.
824
825 Returns
826 List of GuestNetworkInfo on success.
827
828 Since
829 1.1
830
831 GuestLogicalProcessor (Object)
832 Members
833 logical-id: int
834 Arbitrary guest-specific unique identifier of the VCPU.
835
836 online: boolean
837 Whether the VCPU is enabled.
838
839 can-offline: boolean (optional)
840 Whether offlining the VCPU is possible. This member is always
841 filled in by the guest agent when the structure is returned, and
842 always ignored on input (hence it can be omitted then).
843
844 Since
845 1.5
846
847 guest-get-vcpus (Command)
848 Retrieve the list of the guest's logical processors.
849
850 This is a read-only operation.
851
852 Returns
853 The list of all VCPUs the guest knows about. Each VCPU is put on the
854 list exactly once, but their order is unspecified.
855
856 Since
857 1.5
858
859 guest-set-vcpus (Command)
860 Attempt to reconfigure (currently: enable/disable) logical processors
861 inside the guest.
862
863 The input list is processed node by node in order. In each node logi‐
864 cal-id is used to look up the guest VCPU, for which online specifies
865 the requested state. The set of distinct logical-id's is only required
866 to be a subset of the guest-supported identifiers. There's no restric‐
867 tion on list length or on repeating the same logical-id (with possibly
868 different online field). Preferably the input list should describe a
869 modified subset of guest-get-vcpus' return value.
870
871 Arguments
872 vcpus: array of GuestLogicalProcessor
873 Not documented
874
875 Returns
876 The length of the initial sublist that has been successfully processed.
877 The guest agent maximizes this value. Possible cases:
878
879 • 0: if the vcpus list was empty on input. Guest state has not been
880 changed. Otherwise,
881
882 • Error: processing the first node of vcpus failed for the reason re‐
883 turned. Guest state has not been changed. Otherwise,
884
885 • < length(vcpus): more than zero initial nodes have been processed,
886 but not the entire vcpus list. Guest state has changed accordingly.
887 To retrieve the error (assuming it persists), repeat the call with
888 the successfully processed initial sublist removed. Otherwise,
889
890 • length(vcpus): call successful.
891
892 Since
893 1.5
894
895 GuestDiskBusType (Enum)
896 An enumeration of bus type of disks
897
898 Values
899 ide IDE disks
900
901 fdc floppy disks
902
903 scsi SCSI disks
904
905 virtio virtio disks
906
907 xen Xen disks
908
909 usb USB disks
910
911 uml UML disks
912
913 sata SATA disks
914
915 sd SD cards
916
917 unknown
918 Unknown bus type
919
920 ieee1394
921 Win IEEE 1394 bus type
922
923 ssa Win SSA bus type
924
925 fibre Win fiber channel bus type
926
927 raid Win RAID bus type
928
929 iscsi Win iScsi bus type
930
931 sas Win serial-attaches SCSI bus type
932
933 mmc Win multimedia card (MMC) bus type
934
935 virtual
936 Win virtual bus type
937
938 file-backed-virtual
939 Win file-backed bus type
940
941 nvme NVMe disks (since 7.1)
942
943 Since
944 2.2; 'Unknown' and all entries below since 2.4
945
946 GuestPCIAddress (Object)
947 Members
948 domain: int
949 domain id
950
951 bus: int
952 bus id
953
954 slot: int
955 slot id
956
957 function: int
958 function id
959
960 Since
961 2.2
962
963 GuestCCWAddress (Object)
964 Members
965 cssid: int
966 channel subsystem image id
967
968 ssid: int
969 subchannel set id
970
971 subchno: int
972 subchannel number
973
974 devno: int
975 device number
976
977 Since
978 6.0
979
980 GuestDiskAddress (Object)
981 Members
982 pci-controller: GuestPCIAddress
983 controller's PCI address (fields are set to -1 if invalid)
984
985 bus-type: GuestDiskBusType
986 bus type
987
988 bus: int
989 bus id
990
991 target: int
992 target id
993
994 unit: int
995 unit id
996
997 serial: string (optional)
998 serial number (since: 3.1)
999
1000 dev: string (optional)
1001 device node (POSIX) or device UNC (Windows) (since: 3.1)
1002
1003 ccw-address: GuestCCWAddress (optional)
1004 CCW address on s390x (since: 6.0)
1005
1006 Since
1007 2.2
1008
1009 GuestNVMeSmart (Object)
1010 NVMe smart informations, based on NVMe specification, section <SMART /
1011 Health Information (Log Identifier 02h)>
1012
1013 Members
1014 critical-warning: int
1015 Not documented
1016
1017 temperature: int
1018 Not documented
1019
1020 available-spare: int
1021 Not documented
1022
1023 available-spare-threshold: int
1024 Not documented
1025
1026 percentage-used: int
1027 Not documented
1028
1029 data-units-read-lo: int
1030 Not documented
1031
1032 data-units-read-hi: int
1033 Not documented
1034
1035 data-units-written-lo: int
1036 Not documented
1037
1038 data-units-written-hi: int
1039 Not documented
1040
1041 host-read-commands-lo: int
1042 Not documented
1043
1044 host-read-commands-hi: int
1045 Not documented
1046
1047 host-write-commands-lo: int
1048 Not documented
1049
1050 host-write-commands-hi: int
1051 Not documented
1052
1053 controller-busy-time-lo: int
1054 Not documented
1055
1056 controller-busy-time-hi: int
1057 Not documented
1058
1059 power-cycles-lo: int
1060 Not documented
1061
1062 power-cycles-hi: int
1063 Not documented
1064
1065 power-on-hours-lo: int
1066 Not documented
1067
1068 power-on-hours-hi: int
1069 Not documented
1070
1071 unsafe-shutdowns-lo: int
1072 Not documented
1073
1074 unsafe-shutdowns-hi: int
1075 Not documented
1076
1077 media-errors-lo: int
1078 Not documented
1079
1080 media-errors-hi: int
1081 Not documented
1082
1083 number-of-error-log-entries-lo: int
1084 Not documented
1085
1086 number-of-error-log-entries-hi: int
1087 Not documented
1088
1089 Since
1090 7.1
1091
1092 GuestDiskSmart (Object)
1093 Disk type related smart information.
1094
1095 • nvme: NVMe disk smart
1096
1097 Members
1098 type: GuestDiskBusType
1099 Not documented
1100
1101 The members of GuestNVMeSmart when type is "nvme"
1102
1103 Since
1104 7.1
1105
1106 GuestDiskInfo (Object)
1107 Members
1108 name: string
1109 device node (Linux) or device UNC (Windows)
1110
1111 partition: boolean
1112 whether this is a partition or disk
1113
1114 dependencies: array of string (optional)
1115 list of device dependencies; e.g. for LVs of the LVM this will
1116 hold the list of PVs, for LUKS encrypted volume this will con‐
1117 tain the disk where the volume is placed. (Linux)
1118
1119 address: GuestDiskAddress (optional)
1120 disk address information (only for non-virtual devices)
1121
1122 alias: string (optional)
1123 optional alias assigned to the disk, on Linux this is a name as‐
1124 signed by device mapper
1125
1126 smart: GuestDiskSmart (optional)
1127 disk smart information (Since 7.1)
1128
1129 Since
1130 5.2
1131
1132 guest-get-disks (Command)
1133 Returns
1134 The list of disks in the guest. For Windows these are only the physical
1135 disks. On Linux these are all root block devices of non-zero size in‐
1136 cluding e.g. removable devices, loop devices, NBD, etc.
1137
1138 Since
1139 5.2
1140
1141 GuestFilesystemInfo (Object)
1142 Members
1143 name: string
1144 disk name
1145
1146 mountpoint: string
1147 mount point path
1148
1149 type: string
1150 file system type string
1151
1152 used-bytes: int (optional)
1153 file system used bytes (since 3.0)
1154
1155 total-bytes: int (optional)
1156 non-root file system total bytes (since 3.0)
1157
1158 disk: array of GuestDiskAddress
1159 an array of disk hardware information that the volume lies on,
1160 which may be empty if the disk type is not supported
1161
1162 Since
1163 2.2
1164
1165 guest-get-fsinfo (Command)
1166 Returns
1167 The list of filesystems information mounted in the guest. The returned
1168 mountpoints may be specified to guest-fsfreeze-freeze-list. Network
1169 filesystems (such as CIFS and NFS) are not listed.
1170
1171 Since
1172 2.2
1173
1174 guest-set-user-password (Command)
1175 Arguments
1176 username: string
1177 the user account whose password to change
1178
1179 password: string
1180 the new password entry string, base64 encoded
1181
1182 crypted: boolean
1183 true if password is already crypt()d, false if raw
1184 If the crypted flag is true, it is the caller's responsibility to en‐
1185 sure the correct crypt() encryption scheme is used. This command does
1186 not attempt to interpret or report on the encryption scheme. Refer to
1187 the documentation of the guest operating system in question to deter‐
1188 mine what is supported.
1189
1190 Not all guest operating systems will support use of the crypted flag,
1191 as they may require the clear-text password
1192
1193 The password parameter must always be base64 encoded before transmis‐
1194 sion, even if already crypt()d, to ensure it is 8-bit safe when passed
1195 as JSON.
1196
1197 Returns
1198 Nothing on success.
1199
1200 Since
1201 2.3
1202
1203 GuestMemoryBlock (Object)
1204 Members
1205 phys-index: int
1206 Arbitrary guest-specific unique identifier of the MEMORY BLOCK.
1207
1208 online: boolean
1209 Whether the MEMORY BLOCK is enabled in guest.
1210
1211 can-offline: boolean (optional)
1212 Whether offlining the MEMORY BLOCK is possible. This member is
1213 always filled in by the guest agent when the structure is re‐
1214 turned, and always ignored on input (hence it can be omitted
1215 then).
1216
1217 Since
1218 2.3
1219
1220 guest-get-memory-blocks (Command)
1221 Retrieve the list of the guest's memory blocks.
1222
1223 This is a read-only operation.
1224
1225 Returns
1226 The list of all memory blocks the guest knows about. Each memory block
1227 is put on the list exactly once, but their order is unspecified.
1228
1229 Since
1230 2.3
1231
1232 GuestMemoryBlockResponseType (Enum)
1233 An enumeration of memory block operation result.
1234
1235 Values
1236 success
1237 the operation of online/offline memory block is successful.
1238
1239 not-found
1240 can't find the corresponding memoryXXX directory in sysfs.
1241
1242 operation-not-supported
1243 for some old kernels, it does not support online or offline mem‐
1244 ory block.
1245
1246 operation-failed
1247 the operation of online/offline memory block fails, because of
1248 some errors happen.
1249
1250 Since
1251 2.3
1252
1253 GuestMemoryBlockResponse (Object)
1254 Members
1255 phys-index: int
1256 same with the 'phys-index' member of GuestMemoryBlock.
1257
1258 response: GuestMemoryBlockResponseType
1259 the result of memory block operation.
1260
1261 error-code: int (optional)
1262 the error number. When memory block operation fails, we assign
1263 the value of 'errno' to this member, it indicates what goes
1264 wrong. When the operation succeeds, it will be omitted.
1265
1266 Since
1267 2.3
1268
1269 guest-set-memory-blocks (Command)
1270 Attempt to reconfigure (currently: enable/disable) state of memory
1271 blocks inside the guest.
1272
1273 The input list is processed node by node in order. In each node
1274 phys-index is used to look up the guest MEMORY BLOCK, for which online
1275 specifies the requested state. The set of distinct phys-index's is only
1276 required to be a subset of the guest-supported identifiers. There's no
1277 restriction on list length or on repeating the same phys-index (with
1278 possibly different online field). Preferably the input list should de‐
1279 scribe a modified subset of guest-get-memory-blocks' return value.
1280
1281 Arguments
1282 mem-blks: array of GuestMemoryBlock
1283 Not documented
1284
1285 Returns
1286 The operation results, it is a list of GuestMemoryBlockResponse, which
1287 is corresponding to the input list.
1288
1289 Note: it will return NULL if the mem-blks list was empty on input, or
1290 there is an error, and in this case, guest state will not be changed.
1291
1292 Since
1293 2.3
1294
1295 GuestMemoryBlockInfo (Object)
1296 Members
1297 size: int
1298 the size (in bytes) of the guest memory blocks, which are the
1299 minimal units of memory block online/offline operations (also
1300 called Logical Memory Hotplug).
1301
1302 Since
1303 2.3
1304
1305 guest-get-memory-block-info (Command)
1306 Get information relating to guest memory blocks.
1307
1308 Returns
1309 GuestMemoryBlockInfo
1310
1311 Since
1312 2.3
1313
1314 GuestExecStatus (Object)
1315 Members
1316 exited: boolean
1317 true if process has already terminated.
1318
1319 exitcode: int (optional)
1320 process exit code if it was normally terminated.
1321
1322 signal: int (optional)
1323 signal number (linux) or unhandled exception code (windows) if
1324 the process was abnormally terminated.
1325
1326 out-data: string (optional)
1327 base64-encoded stdout of the process
1328
1329 err-data: string (optional)
1330 base64-encoded stderr of the process Note: out-data and err-data
1331 are present only if 'capture-output' was specified for
1332 'guest-exec'
1333
1334 out-truncated: boolean (optional)
1335 true if stdout was not fully captured due to size limitation.
1336
1337 err-truncated: boolean (optional)
1338 true if stderr was not fully captured due to size limitation.
1339
1340 Since
1341 2.5
1342
1343 guest-exec-status (Command)
1344 Check status of process associated with PID retrieved via guest-exec.
1345 Reap the process and associated metadata if it has exited.
1346
1347 Arguments
1348 pid: int
1349 pid returned from guest-exec
1350
1351 Returns
1352 GuestExecStatus on success.
1353
1354 Since
1355 2.5
1356
1357 GuestExec (Object)
1358 Members
1359 pid: int
1360 pid of child process in guest OS
1361
1362 Since
1363 2.5
1364
1365 guest-exec (Command)
1366 Execute a command in the guest
1367
1368 Arguments
1369 path: string
1370 path or executable name to execute
1371
1372 arg: array of string (optional)
1373 argument list to pass to executable
1374
1375 env: array of string (optional)
1376 environment variables to pass to executable
1377
1378 input-data: string (optional)
1379 data to be passed to process stdin (base64 encoded)
1380
1381 capture-output: boolean (optional)
1382 bool flag to enable capture of stdout/stderr of running process.
1383 defaults to false.
1384
1385 Returns
1386 PID on success.
1387
1388 Since
1389 2.5
1390
1391 GuestHostName (Object)
1392 Members
1393 host-name: string
1394 Fully qualified domain name of the guest OS
1395
1396 Since
1397 2.10
1398
1399 guest-get-host-name (Command)
1400 Return a name for the machine.
1401
1402 The returned name is not necessarily a fully-qualified domain name, or
1403 even present in DNS or some other name service at all. It need not even
1404 be unique on your local network or site, but usually it is.
1405
1406 Returns
1407 the host name of the machine on success
1408
1409 Since
1410 2.10
1411
1412 GuestUser (Object)
1413 Members
1414 user: string
1415 Username
1416
1417 domain: string (optional)
1418 Logon domain (windows only)
1419
1420 login-time: number
1421 Time of login of this user on the computer. If multiple in‐
1422 stances of the user are logged in, the earliest login time is
1423 reported. The value is in fractional seconds since epoch time.
1424
1425 Since
1426 2.10
1427
1428 guest-get-users (Command)
1429 Retrieves a list of currently active users on the VM.
1430
1431 Returns
1432 A unique list of users.
1433
1434 Since
1435 2.10
1436
1437 GuestTimezone (Object)
1438 Members
1439 zone: string (optional)
1440 Timezone name. These values may differ depending on guest/OS and
1441 should only be used for informational purposes.
1442
1443 offset: int
1444 Offset to UTC in seconds, negative numbers for time zones west
1445 of GMT, positive numbers for east
1446
1447 Since
1448 2.10
1449
1450 guest-get-timezone (Command)
1451 Retrieves the timezone information from the guest.
1452
1453 Returns
1454 A GuestTimezone dictionary.
1455
1456 Since
1457 2.10
1458
1459 GuestOSInfo (Object)
1460 Members
1461 kernel-release: string (optional)
1462
1463 • POSIX: release field returned by uname(2)
1464
1465 • Windows: build number of the OS
1466
1467 kernel-version: string (optional)
1468
1469 • POSIX: version field returned by uname(2)
1470
1471 • Windows: version number of the OS
1472
1473 machine: string (optional)
1474
1475 • POSIX: machine field returned by uname(2)
1476
1477 • Windows: one of x86, x86_64, arm, ia64
1478
1479 id: string (optional)
1480
1481 • POSIX: as defined by os-release(5)
1482
1483 • Windows: contains string "mswindows"
1484
1485 name: string (optional)
1486
1487 • POSIX: as defined by os-release(5)
1488
1489 • Windows: contains string "Microsoft Windows"
1490
1491 pretty-name: string (optional)
1492
1493 • POSIX: as defined by os-release(5)
1494
1495 • Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1496
1497 version: string (optional)
1498
1499 • POSIX: as defined by os-release(5)
1500
1501 • Windows: long version string, e.g. "Microsoft Windows Server
1502 2008"
1503
1504 version-id: string (optional)
1505
1506 • POSIX: as defined by os-release(5)
1507
1508 • Windows: short version identifier, e.g. "7" or "20012r2"
1509
1510 variant: string (optional)
1511
1512 • POSIX: as defined by os-release(5)
1513
1514 • Windows: contains string "server" or "client"
1515
1516 variant-id: string (optional)
1517
1518 • POSIX: as defined by os-release(5)
1519
1520 • Windows: contains string "server" or "client"
1521
1522 Notes
1523 On POSIX systems the fields id, name, pretty-name, version, version-id,
1524 variant and variant-id follow the definition specified in os-re‐
1525 lease(5). Refer to the manual page for exact description of the
1526 fields. Their values are taken from the os-release file. If the file is
1527 not present in the system, or the values are not present in the file,
1528 the fields are not included.
1529
1530 On Windows the values are filled from information gathered from the
1531 system.
1532
1533 Since
1534 2.10
1535
1536 guest-get-osinfo (Command)
1537 Retrieve guest operating system information
1538
1539 Returns
1540 GuestOSInfo
1541
1542 Since
1543 2.10
1544
1545 GuestDeviceType (Enum)
1546 Values
1547 pci Not documented
1548
1549 GuestDeviceIdPCI (Object)
1550 Members
1551 vendor-id: int
1552 vendor ID
1553
1554 device-id: int
1555 device ID
1556
1557 Since
1558 5.2
1559
1560 GuestDeviceId (Object)
1561 Id of the device - pci: PCI ID, since: 5.2
1562
1563 Members
1564 type: GuestDeviceType
1565 Not documented
1566
1567 The members of GuestDeviceIdPCI when type is "pci"
1568
1569 Since
1570 5.2
1571
1572 GuestDeviceInfo (Object)
1573 Members
1574 driver-name: string
1575 name of the associated driver
1576
1577 driver-date: int (optional)
1578 driver release date, in nanoseconds since the epoch
1579
1580 driver-version: string (optional)
1581 driver version
1582
1583 id: GuestDeviceId (optional)
1584 device ID
1585
1586 Since
1587 5.2
1588
1589 guest-get-devices (Command)
1590 Retrieve information about device drivers in Windows guest
1591
1592 Returns
1593 GuestDeviceInfo
1594
1595 Since
1596 5.2
1597
1598 GuestAuthorizedKeys (Object)
1599 Members
1600 keys: array of string
1601 public keys (in OpenSSH/sshd(8) authorized_keys format)
1602
1603 Since
1604 5.2
1605
1606 If
1607 CONFIG_POSIX
1608
1609 guest-ssh-get-authorized-keys (Command)
1610 Arguments
1611 username: string
1612 the user account to add the authorized keys
1613 Return the public keys from user .ssh/authorized_keys on Unix systems
1614 (not implemented for other systems).
1615
1616 Returns
1617 GuestAuthorizedKeys
1618
1619 Since
1620 5.2
1621
1622 If
1623 CONFIG_POSIX
1624
1625 guest-ssh-add-authorized-keys (Command)
1626 Arguments
1627 username: string
1628 the user account to add the authorized keys
1629
1630 keys: array of string
1631 the public keys to add (in OpenSSH/sshd(8) authorized_keys for‐
1632 mat)
1633
1634 reset: boolean (optional)
1635 ignore the existing content, set it with the given keys only
1636 Append public keys to user .ssh/authorized_keys on Unix systems (not
1637 implemented for other systems).
1638
1639 Returns
1640 Nothing on success.
1641
1642 Since
1643 5.2
1644
1645 If
1646 CONFIG_POSIX
1647
1648 guest-ssh-remove-authorized-keys (Command)
1649 Arguments
1650 username: string
1651 the user account to remove the authorized keys
1652
1653 keys: array of string
1654 the public keys to remove (in OpenSSH/sshd(8) authorized_keys
1655 format)
1656 Remove public keys from the user .ssh/authorized_keys on Unix systems
1657 (not implemented for other systems). It's not an error if the key is
1658 already missing.
1659
1660 Returns
1661 Nothing on success.
1662
1663 Since
1664 5.2
1665
1666 If
1667 CONFIG_POSIX
1668
1669 GuestDiskStats (Object)
1670 Members
1671 read-sectors: int (optional)
1672 sectors read
1673
1674 read-ios: int (optional)
1675 reads completed successfully
1676
1677 read-merges: int (optional)
1678 read requests merged
1679
1680 write-sectors: int (optional)
1681 sectors written
1682
1683 write-ios: int (optional)
1684 writes completed
1685
1686 write-merges: int (optional)
1687 write requests merged
1688
1689 discard-sectors: int (optional)
1690 sectors discarded
1691
1692 discard-ios: int (optional)
1693 discards completed successfully
1694
1695 discard-merges: int (optional)
1696 discard requests merged
1697
1698 flush-ios: int (optional)
1699 flush requests completed successfully
1700
1701 read-ticks: int (optional)
1702 time spent reading(ms)
1703
1704 write-ticks: int (optional)
1705 time spent writing(ms)
1706
1707 discard-ticks: int (optional)
1708 time spent discarding(ms)
1709
1710 flush-ticks: int (optional)
1711 time spent flushing(ms)
1712
1713 ios-pgr: int (optional)
1714 number of I/Os currently in flight
1715
1716 total-ticks: int (optional)
1717 time spent doing I/Os (ms)
1718
1719 weight-ticks: int (optional)
1720 weighted time spent doing I/Os since the last update of this
1721 field(ms)
1722
1723 Since
1724 7.1
1725
1726 GuestDiskStatsInfo (Object)
1727 name disk name
1728
1729 major major device number of disk
1730
1731 minor minor device number of disk
1732
1733 Members
1734 name: string
1735 Not documented
1736
1737 major: int
1738 Not documented
1739
1740 minor: int
1741 Not documented
1742
1743 stats: GuestDiskStats
1744 Not documented
1745
1746 guest-get-diskstats (Command)
1747 Retrieve information about disk stats.
1748
1749 Returns
1750 List of disk stats of guest.
1751
1752 Since
1753 7.1
1754
1755 GuestCpuStatsType (Enum)
1756 An enumeration of OS type
1757
1758 Values
1759 linux Not documented
1760
1761 Since
1762 7.1
1763
1764 GuestLinuxCpuStats (Object)
1765 CPU statistics of Linux
1766
1767 Members
1768 cpu: int
1769 CPU index in guest OS
1770
1771 user: int
1772 Time spent in user mode
1773
1774 nice: int
1775 Time spent in user mode with low priority (nice)
1776
1777 system: int
1778 Time spent in system mode
1779
1780 idle: int
1781 Time spent in the idle task
1782
1783 iowait: int (optional)
1784 Time waiting for I/O to complete (since Linux 2.5.41)
1785
1786 irq: int (optional)
1787 Time servicing interrupts (since Linux 2.6.0-test4)
1788
1789 softirq: int (optional)
1790 Time servicing softirqs (since Linux 2.6.0-test4)
1791
1792 steal: int (optional)
1793 Stolen time by host (since Linux 2.6.11)
1794
1795 guest: int (optional)
1796 ime spent running a virtual CPU for guest operating systems un‐
1797 der the control of the Linux kernel (since Linux 2.6.24)
1798
1799 guestnice: int (optional)
1800 Time spent running a niced guest (since Linux 2.6.33)
1801
1802 Since
1803 7.1
1804
1805 GuestCpuStats (Object)
1806 Get statistics of each CPU in millisecond.
1807
1808 • linux: Linux style CPU statistics
1809
1810 Members
1811 type: GuestCpuStatsType
1812 Not documented
1813
1814 The members of GuestLinuxCpuStats when type is "linux"
1815
1816 Since
1817 7.1
1818
1819 guest-get-cpustats (Command)
1820 Retrieve information about CPU stats.
1821
1822 Returns
1823 List of CPU stats of guest.
1824
1825 Since
1826 7.1
1827
1829 2023, The QEMU Project Developers
1830
1831
1832
1833
18347.2.6 Sep 26, 2023 QEMU-GA-REF(7)