1 # *-*- Mode: Python -*-*
5 # = General note concerning the use of guest agent interfaces
7 # "unsupported" is a higher-level error than the errors that
8 # individual commands might document. The caller should always be
9 # prepared to receive QERR_UNSUPPORTED, even if the given command
10 # doesn't specify it, or doesn't document any failure mode at all.
14 # = QEMU guest agent protocol commands and structs
17 { 'pragma': { 'doc-required': true } }
19 # Lists with items allowed to permit QAPI rule violations; think twice
20 # before you add to them!
22 # Types whose member names may use '_'
23 'member-name-exceptions': [
26 # Commands allowed to return a non-dictionary:
27 'command-returns-exceptions': [
29 'guest-fsfreeze-freeze',
30 'guest-fsfreeze-freeze-list',
31 'guest-fsfreeze-status',
32 'guest-fsfreeze-thaw',
36 'guest-sync-delimited' ] } }
39 # @guest-sync-delimited:
41 # Echo back a unique integer value, and prepend to response a leading
42 # sentinel byte (0xFF) the client can check scan for.
44 # This is used by clients talking to the guest agent over the wire to
45 # ensure the stream is in sync and doesn't contain stale data from
46 # previous client. It must be issued upon initial connection, and
47 # after any client-side timeouts (including timeouts on receiving a
48 # response to this command).
50 # After issuing this request, all guest agent responses should be
51 # ignored until the response containing the unique integer value the
52 # client passed in is returned. Receival of the 0xFF sentinel byte
53 # must be handled as an indication that the client's
54 # lexer/tokenizer/parser state should be flushed/reset in preparation
55 # for reliably receiving the subsequent response. As an optimization,
56 # clients may opt to ignore all data until a sentinel value is
57 # receiving to avoid unnecessary processing of stale data.
59 # Similarly, clients should also precede this *request* with a 0xFF
60 # byte to make sure the guest agent flushes any partially read JSON
61 # data from a previous client connection.
63 # @id: randomly generated 64-bit integer
65 # Returns: The unique integer id passed in by the client
69 { 'command': 'guest-sync-delimited',
70 'data': { 'id': 'int' },
76 # Echo back a unique integer value
78 # This is used by clients talking to the guest agent over the wire to
79 # ensure the stream is in sync and doesn't contain stale data from
80 # previous client. All guest agent responses should be ignored until
81 # the provided unique integer value is returned, and it is up to the
82 # client to handle stale whole or partially-delivered JSON text in
83 # such a way that this response can be obtained.
85 # In cases where a partial stale response was previously received by
86 # the client, this cannot always be done reliably. One particular
87 # scenario being if qemu-ga responses are fed character-by-character
88 # into a JSON parser. In these situations, using guest-sync-delimited
91 # For clients that fetch responses line by line and convert them to
92 # JSON objects, guest-sync should be sufficient, but note that in
93 # cases where the channel is dirty some attempts at parsing the
94 # response may result in a parser error.
96 # Such clients should also precede this command with a 0xFF byte to
97 # make sure the guest agent flushes any partially read JSON data from
100 # @id: randomly generated 64-bit integer
102 # Returns: The unique integer id passed in by the client
106 { 'command': 'guest-sync',
107 'data': { 'id': 'int' },
113 # Ping the guest agent, a non-error return implies success
117 { 'command': 'guest-ping' }
122 # Get the information about guest's System Time relative to the Epoch
123 # of 1970-01-01 in UTC.
125 # Returns: Time in nanoseconds.
129 { 'command': 'guest-get-time',
137 # When a guest is paused or migrated to a file then loaded from that
138 # file, the guest OS has no idea that there was a big gap in the time.
139 # Depending on how long the gap was, NTP might not be able to
140 # resynchronize the guest.
142 # This command tries to set guest's System Time to the given value,
143 # then sets the Hardware Clock (RTC) to the current System Time. This
144 # will make it easier for a guest to resynchronize without waiting for
145 # NTP. If no @time is specified, then the time to set is read from
146 # RTC. However, this may not be supported on all platforms (i.e.
147 # Windows). If that's the case users are advised to always pass a
150 # @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in
153 # Returns: Nothing on success.
157 { 'command': 'guest-set-time',
158 'data': { '*time': 'int' } }
161 # @GuestAgentCommandInfo:
163 # Information about guest agent commands.
165 # @name: name of the command
167 # @enabled: whether command is currently enabled by guest admin
169 # @success-response: whether command returns a response on success
174 { 'struct': 'GuestAgentCommandInfo',
175 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
180 # Information about guest agent.
182 # @version: guest agent version
184 # @supported_commands: Information about guest agent commands
188 { 'struct': 'GuestAgentInfo',
189 'data': { 'version': 'str',
190 'supported_commands': ['GuestAgentCommandInfo'] } }
194 # Get some information about the guest agent.
196 # Returns: @GuestAgentInfo
200 { 'command': 'guest-info',
201 'returns': 'GuestAgentInfo' }
206 # Initiate guest-activated shutdown. Note: this is an asynchronous
207 # shutdown request, with no guarantee of successful shutdown.
209 # @mode: "halt", "powerdown" (default), or "reboot"
211 # This command does NOT return a response on success. Success
212 # condition is indicated by the VM exiting with a zero exit status or,
213 # when running with --no-shutdown, by issuing the query-status QMP
214 # command to confirm the VM status is "shutdown".
218 { 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
219 'success-response': false }
224 # Open a file in the guest and retrieve a file handle for it
226 # @path: Full path to the file in the guest to open.
228 # @mode: open mode, as per fopen(), "r" is the default.
230 # Returns: Guest file handle on success.
234 { 'command': 'guest-file-open',
235 'data': { 'path': 'str', '*mode': 'str' },
241 # Close an open file in the guest
243 # @handle: filehandle returned by guest-file-open
245 # Returns: Nothing on success.
249 { 'command': 'guest-file-close',
250 'data': { 'handle': 'int' } }
255 # Result of guest agent file-read operation
257 # @count: number of bytes read (note: count is *before*
258 # base64-encoding is applied)
260 # @buf-b64: base64-encoded bytes read
262 # @eof: whether EOF was encountered during read operation.
266 { 'struct': 'GuestFileRead',
267 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
272 # Read from an open file in the guest. Data will be base64-encoded.
273 # As this command is just for limited, ad-hoc debugging, such as log
274 # file access, the number of bytes to read is limited to 48 MB.
276 # @handle: filehandle returned by guest-file-open
278 # @count: maximum number of bytes to read (default is 4KB, maximum is
281 # Returns: @GuestFileRead on success.
285 { 'command': 'guest-file-read',
286 'data': { 'handle': 'int', '*count': 'int' },
287 'returns': 'GuestFileRead' }
292 # Result of guest agent file-write operation
294 # @count: number of bytes written (note: count is actual bytes
295 # written, after base64-decoding of provided buffer)
297 # @eof: whether EOF was encountered during write operation.
301 { 'struct': 'GuestFileWrite',
302 'data': { 'count': 'int', 'eof': 'bool' } }
307 # Write to an open file in the guest.
309 # @handle: filehandle returned by guest-file-open
311 # @buf-b64: base64-encoded string representing data to be written
313 # @count: bytes to write (actual bytes, after base64-decode), default
314 # is all content in buf-b64 buffer after base64 decoding
316 # Returns: @GuestFileWrite on success.
320 { 'command': 'guest-file-write',
321 'data': { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
322 'returns': 'GuestFileWrite' }
328 # Result of guest agent file-seek operation
330 # @position: current file position
332 # @eof: whether EOF was encountered during file seek
336 { 'struct': 'GuestFileSeek',
337 'data': { 'position': 'int', 'eof': 'bool' } }
342 # Symbolic names for use in @guest-file-seek
344 # @set: Set to the specified offset (same effect as 'whence':0)
346 # @cur: Add offset to the current location (same effect as 'whence':1)
348 # @end: Add offset to the end of the file (same effect as 'whence':2)
352 { 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
357 # Controls the meaning of offset to @guest-file-seek.
359 # @value: Integral value (0 for set, 1 for cur, 2 for end), available
360 # for historical reasons, and might differ from the host's or
361 # guest's SEEK_* values (since: 0.15)
363 # @name: Symbolic name, and preferred interface
367 { 'alternate': 'GuestFileWhence',
368 'data': { 'value': 'int', 'name': 'QGASeek' } }
373 # Seek to a position in the file, as with fseek(), and return the
374 # current file position afterward. Also encapsulates ftell()'s
375 # functionality, with offset=0 and whence=1.
377 # @handle: filehandle returned by guest-file-open
379 # @offset: bytes to skip over in the file stream
381 # @whence: Symbolic or numeric code for interpreting offset
383 # Returns: @GuestFileSeek on success.
387 { 'command': 'guest-file-seek',
388 'data': { 'handle': 'int', 'offset': 'int',
389 'whence': 'GuestFileWhence' },
390 'returns': 'GuestFileSeek' }
395 # Write file changes buffered in userspace to disk/kernel buffers
397 # @handle: filehandle returned by guest-file-open
399 # Returns: Nothing on success.
403 { 'command': 'guest-file-flush',
404 'data': { 'handle': 'int' } }
407 # @GuestFsfreezeStatus:
409 # An enumeration of filesystem freeze states
411 # @thawed: filesystems thawed/unfrozen
413 # @frozen: all non-network guest filesystems frozen
417 { 'enum': 'GuestFsfreezeStatus',
418 'data': [ 'thawed', 'frozen' ] }
421 # @guest-fsfreeze-status:
423 # Get guest fsfreeze state.
425 # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined
428 # Note: This may fail to properly report the current state as a result
429 # of some other guest processes having issued an fs freeze/thaw.
433 { 'command': 'guest-fsfreeze-status',
434 'returns': 'GuestFsfreezeStatus' }
437 # @guest-fsfreeze-freeze:
439 # Sync and freeze all freezable, local guest filesystems. If this
440 # command succeeded, you may call @guest-fsfreeze-thaw later to
443 # Note: On Windows, the command is implemented with the help of a
444 # Volume Shadow-copy Service DLL helper. The frozen state is
445 # limited for up to 10 seconds by VSS.
447 # Returns: Number of file systems currently frozen. On error, all
448 # filesystems will be thawed. If no filesystems are frozen as a
449 # result of this call, then @guest-fsfreeze-status will remain
450 # "thawed" and calling @guest-fsfreeze-thaw is not necessary.
454 { 'command': 'guest-fsfreeze-freeze',
458 # @guest-fsfreeze-freeze-list:
460 # Sync and freeze specified guest filesystems. See also
461 # @guest-fsfreeze-freeze.
463 # @mountpoints: an array of mountpoints of filesystems to be frozen.
464 # If omitted, every mounted filesystem is frozen. Invalid mount
465 # points are ignored.
467 # Returns: Number of file systems currently frozen. On error, all
468 # filesystems will be thawed.
472 { 'command': 'guest-fsfreeze-freeze-list',
473 'data': { '*mountpoints': ['str'] },
477 # @guest-fsfreeze-thaw:
479 # Unfreeze all frozen guest filesystems
481 # Returns: Number of file systems thawed by this call
483 # Note: if return value does not match the previous call to
484 # guest-fsfreeze-freeze, this likely means some freezable
485 # filesystems were unfrozen before this call, and that the
486 # filesystem state may have changed before issuing this command.
490 { 'command': 'guest-fsfreeze-thaw',
494 # @GuestFilesystemTrimResult:
496 # @path: path that was trimmed
498 # @error: an error message when trim failed
500 # @trimmed: bytes trimmed for this path
502 # @minimum: reported effective minimum for this path
506 { 'struct': 'GuestFilesystemTrimResult',
507 'data': {'path': 'str',
508 '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
511 # @GuestFilesystemTrimResponse:
513 # @paths: list of @GuestFilesystemTrimResult per path that was trimmed
517 { 'struct': 'GuestFilesystemTrimResponse',
518 'data': {'paths': ['GuestFilesystemTrimResult']} }
523 # Discard (or "trim") blocks which are not in use by the filesystem.
525 # @minimum: Minimum contiguous free range to discard, in bytes. Free
526 # ranges smaller than this may be ignored (this is a hint and the
527 # guest may not respect it). By increasing this value, the fstrim
528 # operation will complete more quickly for filesystems with badly
529 # fragmented free space, although not all blocks will be
530 # discarded. The default value is zero, meaning "discard every
533 # Returns: A @GuestFilesystemTrimResponse which contains the status of
534 # all trimmed paths. (since 2.4)
538 { 'command': 'guest-fstrim',
539 'data': { '*minimum': 'int' },
540 'returns': 'GuestFilesystemTrimResponse' }
543 # @guest-suspend-disk:
545 # Suspend guest to disk.
547 # This command attempts to suspend the guest using three strategies,
550 # - systemd hibernate
551 # - pm-utils (via pm-hibernate)
552 # - manual write into sysfs
554 # This command does NOT return a response on success. There is a high
555 # chance the command succeeded if the VM exits with a zero exit status
556 # or, when running with --no-shutdown, by issuing the query-status QMP
557 # command to to confirm the VM status is "shutdown". However, the VM
558 # could also exit (or set its status to "shutdown") due to other
561 # The following errors may be returned:
563 # - If suspend to disk is not supported, Unsupported
565 # Notes: It's strongly recommended to issue the guest-sync command
566 # before sending commands when the guest resumes
570 { 'command': 'guest-suspend-disk', 'success-response': false }
573 # @guest-suspend-ram:
575 # Suspend guest to ram.
577 # This command attempts to suspend the guest using three strategies,
580 # - systemd hibernate
581 # - pm-utils (via pm-hibernate)
582 # - manual write into sysfs
584 # IMPORTANT: guest-suspend-ram requires working wakeup support in
585 # QEMU. You should check QMP command query-current-machine returns
586 # wakeup-suspend-support: true before issuing this command. Failure
587 # in doing so can result in a suspended guest that QEMU will not be
588 # able to awaken, forcing the user to power cycle the guest to bring
591 # This command does NOT return a response on success. There are two
592 # options to check for success:
594 # 1. Wait for the SUSPEND QMP event from QEMU
595 # 2. Issue the query-status QMP command to confirm the VM status is
598 # The following errors may be returned:
600 # - If suspend to ram is not supported, Unsupported
602 # Notes: It's strongly recommended to issue the guest-sync command
603 # before sending commands when the guest resumes
607 { 'command': 'guest-suspend-ram', 'success-response': false }
610 # @guest-suspend-hybrid:
612 # Save guest state to disk and suspend to ram.
614 # This command attempts to suspend the guest by executing, in this
617 # - systemd hybrid-sleep
618 # - pm-utils (via pm-suspend-hybrid)
620 # IMPORTANT: guest-suspend-hybrid requires working wakeup support in
621 # QEMU. You should check QMP command query-current-machine returns
622 # wakeup-suspend-support: true before issuing this command. Failure
623 # in doing so can result in a suspended guest that QEMU will not be
624 # able to awaken, forcing the user to power cycle the guest to bring
627 # This command does NOT return a response on success. There are two
628 # options to check for success:
630 # 1. Wait for the SUSPEND QMP event from QEMU
631 # 2. Issue the query-status QMP command to confirm the VM status is
634 # The following errors may be returned:
636 # - If hybrid suspend is not supported, Unsupported
638 # Notes: It's strongly recommended to issue the guest-sync command
639 # before sending commands when the guest resumes
643 { 'command': 'guest-suspend-hybrid', 'success-response': false }
646 # @GuestIpAddressType:
648 # An enumeration of supported IP address types
650 # @ipv4: IP version 4
652 # @ipv6: IP version 6
656 { 'enum': 'GuestIpAddressType',
657 'data': [ 'ipv4', 'ipv6' ] }
662 # @ip-address: IP address
664 # @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
666 # @prefix: Network prefix length of @ip-address
670 { 'struct': 'GuestIpAddress',
671 'data': {'ip-address': 'str',
672 'ip-address-type': 'GuestIpAddressType',
676 # @GuestNetworkInterfaceStat:
678 # @rx-bytes: total bytes received
680 # @rx-packets: total packets received
682 # @rx-errs: bad packets received
684 # @rx-dropped: receiver dropped packets
686 # @tx-bytes: total bytes transmitted
688 # @tx-packets: total packets transmitted
690 # @tx-errs: packet transmit problems
692 # @tx-dropped: dropped packets transmitted
696 { 'struct': 'GuestNetworkInterfaceStat',
697 'data': {'rx-bytes': 'uint64',
698 'rx-packets': 'uint64',
700 'rx-dropped': 'uint64',
701 'tx-bytes': 'uint64',
702 'tx-packets': 'uint64',
704 'tx-dropped': 'uint64'
708 # @GuestNetworkInterface:
710 # @name: The name of interface for which info are being delivered
712 # @hardware-address: Hardware address of @name
714 # @ip-addresses: List of addresses assigned to @name
716 # @statistics: various statistic counters related to @name (since
721 { 'struct': 'GuestNetworkInterface',
722 'data': {'name': 'str',
723 '*hardware-address': 'str',
724 '*ip-addresses': ['GuestIpAddress'],
725 '*statistics': 'GuestNetworkInterfaceStat' } }
728 # @guest-network-get-interfaces:
730 # Get list of guest IP addresses, MAC addresses and netmasks.
732 # Returns: List of GuestNetworkInterface on success.
736 { 'command': 'guest-network-get-interfaces',
737 'returns': ['GuestNetworkInterface'] }
740 # @GuestLogicalProcessor:
742 # @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
744 # @online: Whether the VCPU is enabled.
746 # @can-offline: Whether offlining the VCPU is possible. This member
747 # is always filled in by the guest agent when the structure is
748 # returned, and always ignored on input (hence it can be omitted
753 { 'struct': 'GuestLogicalProcessor',
754 'data': {'logical-id': 'int',
756 '*can-offline': 'bool'} }
761 # Retrieve the list of the guest's logical processors.
763 # This is a read-only operation.
765 # Returns: The list of all VCPUs the guest knows about. Each VCPU is
766 # put on the list exactly once, but their order is unspecified.
770 { 'command': 'guest-get-vcpus',
771 'returns': ['GuestLogicalProcessor'] }
776 # Attempt to reconfigure (currently: enable/disable) logical
777 # processors inside the guest.
779 # The input list is processed node by node in order. In each node
780 # @logical-id is used to look up the guest VCPU, for which @online
781 # specifies the requested state. The set of distinct @logical-id's is
782 # only required to be a subset of the guest-supported identifiers.
783 # There's no restriction on list length or on repeating the same
784 # @logical-id (with possibly different @online field). Preferably the
785 # input list should describe a modified subset of @guest-get-vcpus'
788 # Returns: The length of the initial sublist that has been
789 # successfully processed. The guest agent maximizes this value.
793 # if the @vcpus list was empty on input. Guest state has not
794 # been changed. Otherwise,
796 # processing the first node of @vcpus failed for the reason
797 # returned. Guest state has not been changed. Otherwise,
798 # - < length(@vcpus):
799 # more than zero initial nodes have been processed, but not the
800 # entire @vcpus list. Guest state has changed accordingly. To
801 # retrieve the error (assuming it persists), repeat the call
802 # with the successfully processed initial sublist removed.
809 { 'command': 'guest-set-vcpus',
810 'data': {'vcpus': ['GuestLogicalProcessor'] },
816 # An enumeration of bus type of disks
824 # @virtio: virtio disks
836 # @unknown: Unknown bus type
838 # @ieee1394: Win IEEE 1394 bus type
840 # @ssa: Win SSA bus type
842 # @fibre: Win fiber channel bus type
844 # @raid: Win RAID bus type
846 # @iscsi: Win iScsi bus type
848 # @sas: Win serial-attaches SCSI bus type
850 # @mmc: Win multimedia card (MMC) bus type
852 # @virtual: Win virtual bus type
854 # @file-backed-virtual: Win file-backed bus type
856 # @nvme: NVMe disks (since 7.1)
858 # Since: 2.2; 'Unknown' and all entries below since 2.4
860 { 'enum': 'GuestDiskBusType',
861 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
862 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
863 'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] }
875 # @function: function id
879 { 'struct': 'GuestPCIAddress',
880 'data': {'domain': 'int', 'bus': 'int',
881 'slot': 'int', 'function': 'int'} }
886 # @cssid: channel subsystem image id
888 # @ssid: subchannel set id
890 # @subchno: subchannel number
892 # @devno: device number
896 { 'struct': 'GuestCCWAddress',
897 'data': {'cssid': 'int',
905 # @pci-controller: controller's PCI address (fields are set to -1 if
908 # @bus-type: bus type
916 # @serial: serial number (since: 3.1)
918 # @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
920 # @ccw-address: CCW address on s390x (since: 6.0)
924 { 'struct': 'GuestDiskAddress',
925 'data': {'pci-controller': 'GuestPCIAddress',
926 'bus-type': 'GuestDiskBusType',
927 'bus': 'int', 'target': 'int', 'unit': 'int',
928 '*serial': 'str', '*dev': 'str',
929 '*ccw-address': 'GuestCCWAddress'} }
934 # NVMe smart information, based on NVMe specification, section
935 # <SMART / Health Information (Log Identifier 02h)>
939 { 'struct': 'GuestNVMeSmart',
940 'data': {'critical-warning': 'int',
941 'temperature': 'int',
942 'available-spare': 'int',
943 'available-spare-threshold': 'int',
944 'percentage-used': 'int',
945 'data-units-read-lo': 'uint64',
946 'data-units-read-hi': 'uint64',
947 'data-units-written-lo': 'uint64',
948 'data-units-written-hi': 'uint64',
949 'host-read-commands-lo': 'uint64',
950 'host-read-commands-hi': 'uint64',
951 'host-write-commands-lo': 'uint64',
952 'host-write-commands-hi': 'uint64',
953 'controller-busy-time-lo': 'uint64',
954 'controller-busy-time-hi': 'uint64',
955 'power-cycles-lo': 'uint64',
956 'power-cycles-hi': 'uint64',
957 'power-on-hours-lo': 'uint64',
958 'power-on-hours-hi': 'uint64',
959 'unsafe-shutdowns-lo': 'uint64',
960 'unsafe-shutdowns-hi': 'uint64',
961 'media-errors-lo': 'uint64',
962 'media-errors-hi': 'uint64',
963 'number-of-error-log-entries-lo': 'uint64',
964 'number-of-error-log-entries-hi': 'uint64' } }
969 # Disk type related smart information.
971 # - @nvme: NVMe disk smart
975 { 'union': 'GuestDiskSmart',
976 'base': { 'type': 'GuestDiskBusType' },
977 'discriminator': 'type',
978 'data': { 'nvme': 'GuestNVMeSmart' } }
983 # @name: device node (Linux) or device UNC (Windows)
985 # @partition: whether this is a partition or disk
987 # @dependencies: list of device dependencies; e.g. for LVs of the LVM
988 # this will hold the list of PVs, for LUKS encrypted volume this
989 # will contain the disk where the volume is placed. (Linux)
991 # @address: disk address information (only for non-virtual devices)
993 # @alias: optional alias assigned to the disk, on Linux this is a name
994 # assigned by device mapper
996 # @smart: disk smart information (Since 7.1)
1000 { 'struct': 'GuestDiskInfo',
1001 'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
1002 '*address': 'GuestDiskAddress', '*alias': 'str',
1003 '*smart': 'GuestDiskSmart'} }
1008 # Returns: The list of disks in the guest. For Windows these are only
1009 # the physical disks. On Linux these are all root block devices
1010 # of non-zero size including e.g. removable devices, loop devices,
1015 { 'command': 'guest-get-disks',
1016 'returns': ['GuestDiskInfo'] }
1019 # @GuestFilesystemInfo:
1023 # @mountpoint: mount point path
1025 # @type: file system type string
1027 # @used-bytes: file system used bytes (since 3.0)
1029 # @total-bytes: non-root file system total bytes (since 3.0)
1031 # @disk: an array of disk hardware information that the volume lies
1032 # on, which may be empty if the disk type is not supported
1036 { 'struct': 'GuestFilesystemInfo',
1037 'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
1038 '*used-bytes': 'uint64', '*total-bytes': 'uint64',
1039 'disk': ['GuestDiskAddress']} }
1042 # @guest-get-fsinfo:
1044 # Returns: The list of filesystems information mounted in the guest.
1045 # The returned mountpoints may be specified to
1046 # @guest-fsfreeze-freeze-list. Network filesystems (such as CIFS
1047 # and NFS) are not listed.
1051 { 'command': 'guest-get-fsinfo',
1052 'returns': ['GuestFilesystemInfo'] }
1055 # @guest-set-user-password:
1057 # @username: the user account whose password to change
1059 # @password: the new password entry string, base64 encoded
1061 # @crypted: true if password is already crypt()d, false if raw
1063 # If the @crypted flag is true, it is the caller's responsibility to
1064 # ensure the correct crypt() encryption scheme is used. This command
1065 # does not attempt to interpret or report on the encryption scheme.
1066 # Refer to the documentation of the guest operating system in question
1067 # to determine what is supported.
1069 # Not all guest operating systems will support use of the @crypted
1070 # flag, as they may require the clear-text password
1072 # The @password parameter must always be base64 encoded before
1073 # transmission, even if already crypt()d, to ensure it is 8-bit safe
1074 # when passed as JSON.
1076 # Returns: Nothing on success.
1080 { 'command': 'guest-set-user-password',
1081 'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
1084 # @GuestMemoryBlock:
1086 # @phys-index: Arbitrary guest-specific unique identifier of the
1089 # @online: Whether the MEMORY BLOCK is enabled in guest.
1091 # @can-offline: Whether offlining the MEMORY BLOCK is possible. This
1092 # member is always filled in by the guest agent when the structure
1093 # is returned, and always ignored on input (hence it can be
1098 { 'struct': 'GuestMemoryBlock',
1099 'data': {'phys-index': 'uint64',
1101 '*can-offline': 'bool'} }
1104 # @guest-get-memory-blocks:
1106 # Retrieve the list of the guest's memory blocks.
1108 # This is a read-only operation.
1110 # Returns: The list of all memory blocks the guest knows about. Each
1111 # memory block is put on the list exactly once, but their order is
1116 { 'command': 'guest-get-memory-blocks',
1117 'returns': ['GuestMemoryBlock'] }
1120 # @GuestMemoryBlockResponseType:
1122 # An enumeration of memory block operation result.
1124 # @success: the operation of online/offline memory block is
1127 # @not-found: can't find the corresponding memoryXXX directory in
1130 # @operation-not-supported: for some old kernels, it does not support
1131 # online or offline memory block.
1133 # @operation-failed: the operation of online/offline memory block
1134 # fails, because of some errors happen.
1138 { 'enum': 'GuestMemoryBlockResponseType',
1139 'data': ['success', 'not-found', 'operation-not-supported',
1140 'operation-failed'] }
1143 # @GuestMemoryBlockResponse:
1145 # @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1147 # @response: the result of memory block operation.
1149 # @error-code: the error number. When memory block operation fails,
1150 # we assign the value of 'errno' to this member, it indicates what
1151 # goes wrong. When the operation succeeds, it will be omitted.
1155 { 'struct': 'GuestMemoryBlockResponse',
1156 'data': { 'phys-index': 'uint64',
1157 'response': 'GuestMemoryBlockResponseType',
1158 '*error-code': 'int' }}
1161 # @guest-set-memory-blocks:
1163 # Attempt to reconfigure (currently: enable/disable) state of memory
1164 # blocks inside the guest.
1166 # The input list is processed node by node in order. In each node
1167 # @phys-index is used to look up the guest MEMORY BLOCK, for which
1168 # @online specifies the requested state. The set of distinct
1169 # @phys-index's is only required to be a subset of the guest-supported
1170 # identifiers. There's no restriction on list length or on repeating
1171 # the same @phys-index (with possibly different @online field).
1172 # Preferably the input list should describe a modified subset of
1173 # @guest-get-memory-blocks' return value.
1175 # Returns: The operation results, it is a list of
1176 # @GuestMemoryBlockResponse, which is corresponding to the input
1179 # Note: it will return NULL if the @mem-blks list was empty on
1180 # input, or there is an error, and in this case, guest state will
1185 { 'command': 'guest-set-memory-blocks',
1186 'data': {'mem-blks': ['GuestMemoryBlock'] },
1187 'returns': ['GuestMemoryBlockResponse'] }
1190 # @GuestMemoryBlockInfo:
1192 # @size: the size (in bytes) of the guest memory blocks, which are the
1193 # minimal units of memory block online/offline operations (also
1194 # called Logical Memory Hotplug).
1198 { 'struct': 'GuestMemoryBlockInfo',
1199 'data': {'size': 'uint64'} }
1202 # @guest-get-memory-block-info:
1204 # Get information relating to guest memory blocks.
1206 # Returns: @GuestMemoryBlockInfo
1210 { 'command': 'guest-get-memory-block-info',
1211 'returns': 'GuestMemoryBlockInfo' }
1216 # @exited: true if process has already terminated.
1218 # @exitcode: process exit code if it was normally terminated.
1220 # @signal: signal number (linux) or unhandled exception code (windows)
1221 # if the process was abnormally terminated.
1223 # @out-data: base64-encoded stdout of the process. This field will only
1224 # be populated after the process exits.
1226 # @err-data: base64-encoded stderr of the process. Note: @out-data and
1227 # @err-data are present only if 'capture-output' was specified for
1228 # 'guest-exec'. This field will only be populated after the process
1231 # @out-truncated: true if stdout was not fully captured due to size
1234 # @err-truncated: true if stderr was not fully captured due to size
1239 { 'struct': 'GuestExecStatus',
1240 'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1241 '*out-data': 'str', '*err-data': 'str',
1242 '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1244 # @guest-exec-status:
1246 # Check status of process associated with PID retrieved via
1247 # guest-exec. Reap the process and associated metadata if it has
1250 # @pid: pid returned from guest-exec
1252 # Returns: GuestExecStatus on success.
1256 { 'command': 'guest-exec-status',
1257 'data': { 'pid': 'int' },
1258 'returns': 'GuestExecStatus' }
1263 # @pid: pid of child process in guest OS
1267 { 'struct': 'GuestExec',
1268 'data': { 'pid': 'int'} }
1271 # @GuestExecCaptureOutputMode:
1273 # An enumeration of guest-exec capture modes.
1275 # @none: do not capture any output
1276 # @stdout: only capture stdout
1277 # @stderr: only capture stderr
1278 # @separated: capture both stdout and stderr, but separated into
1279 # GuestExecStatus out-data and err-data, respectively
1280 # @merged: capture both stdout and stderr, but merge together
1281 # into out-data. not effective on windows guests.
1285 { 'enum': 'GuestExecCaptureOutputMode',
1286 'data': [ 'none', 'stdout', 'stderr', 'separated',
1287 { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
1290 # @GuestExecCaptureOutput:
1292 # Controls what guest-exec output gets captures.
1294 # @flag: captures both stdout and stderr if true. Equivalent
1295 # to GuestExecCaptureOutputMode::all. (since 2.5)
1296 # @mode: capture mode; preferred interface
1300 { 'alternate': 'GuestExecCaptureOutput',
1301 'data': { 'flag': 'bool',
1302 'mode': 'GuestExecCaptureOutputMode'} }
1307 # Execute a command in the guest
1309 # @path: path or executable name to execute
1311 # @arg: argument list to pass to executable
1313 # @env: environment variables to pass to executable
1315 # @input-data: data to be passed to process stdin (base64 encoded)
1317 # @capture-output: bool flag to enable capture of stdout/stderr of
1318 # running process. defaults to false.
1320 # Returns: PID on success.
1324 { 'command': 'guest-exec',
1325 'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1326 '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
1327 'returns': 'GuestExec' }
1333 # @host-name: Fully qualified domain name of the guest OS
1337 { 'struct': 'GuestHostName',
1338 'data': { 'host-name': 'str' } }
1341 # @guest-get-host-name:
1343 # Return a name for the machine.
1345 # The returned name is not necessarily a fully-qualified domain name,
1346 # or even present in DNS or some other name service at all. It need
1347 # not even be unique on your local network or site, but usually it is.
1349 # Returns: the host name of the machine on success
1353 { 'command': 'guest-get-host-name',
1354 'returns': 'GuestHostName' }
1362 # @domain: Logon domain (windows only)
1364 # @login-time: Time of login of this user on the computer. If
1365 # multiple instances of the user are logged in, the earliest login
1366 # time is reported. The value is in fractional seconds since
1371 { 'struct': 'GuestUser',
1372 'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1377 # Retrieves a list of currently active users on the VM.
1379 # Returns: A unique list of users.
1383 { 'command': 'guest-get-users',
1384 'returns': ['GuestUser'] }
1389 # @zone: Timezone name. These values may differ depending on guest/OS
1390 # and should only be used for informational purposes.
1392 # @offset: Offset to UTC in seconds, negative numbers for time zones
1393 # west of GMT, positive numbers for east
1397 { 'struct': 'GuestTimezone',
1398 'data': { '*zone': 'str', 'offset': 'int' } }
1401 # @guest-get-timezone:
1403 # Retrieves the timezone information from the guest.
1405 # Returns: A GuestTimezone dictionary.
1409 { 'command': 'guest-get-timezone',
1410 'returns': 'GuestTimezone' }
1416 # * POSIX: release field returned by uname(2)
1417 # * Windows: build number of the OS
1420 # * POSIX: version field returned by uname(2)
1421 # * Windows: version number of the OS
1424 # * POSIX: machine field returned by uname(2)
1425 # * Windows: one of x86, x86_64, arm, ia64
1428 # * POSIX: as defined by os-release(5)
1429 # * Windows: contains string "mswindows"
1432 # * POSIX: as defined by os-release(5)
1433 # * Windows: contains string "Microsoft Windows"
1436 # * POSIX: as defined by os-release(5)
1437 # * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1440 # * POSIX: as defined by os-release(5)
1441 # * Windows: long version string, e.g. "Microsoft Windows Server
1445 # * POSIX: as defined by os-release(5)
1446 # * Windows: short version identifier, e.g. "7" or "20012r2"
1449 # * POSIX: as defined by os-release(5)
1450 # * Windows: contains string "server" or "client"
1453 # * POSIX: as defined by os-release(5)
1454 # * Windows: contains string "server" or "client"
1456 # Notes: On POSIX systems the fields @id, @name, @pretty-name,
1457 # @version, @version-id, @variant and @variant-id follow the
1458 # definition specified in os-release(5). Refer to the manual page
1459 # for exact description of the fields. Their values are taken
1460 # from the os-release file. If the file is not present in the
1461 # system, or the values are not present in the file, the fields
1464 # On Windows the values are filled from information gathered from
1469 { 'struct': 'GuestOSInfo',
1471 '*kernel-release': 'str', '*kernel-version': 'str',
1472 '*machine': 'str', '*id': 'str', '*name': 'str',
1473 '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1474 '*variant': 'str', '*variant-id': 'str' } }
1477 # @guest-get-osinfo:
1479 # Retrieve guest operating system information
1481 # Returns: @GuestOSInfo
1485 { 'command': 'guest-get-osinfo',
1486 'returns': 'GuestOSInfo' }
1491 { 'enum': 'GuestDeviceType',
1495 # @GuestDeviceIdPCI:
1497 # @vendor-id: vendor ID
1499 # @device-id: device ID
1503 { 'struct': 'GuestDeviceIdPCI',
1504 'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1509 # Id of the device - @pci: PCI ID, since: 5.2
1513 { 'union': 'GuestDeviceId',
1514 'base': { 'type': 'GuestDeviceType' },
1515 'discriminator': 'type',
1516 'data': { 'pci': 'GuestDeviceIdPCI' } }
1521 # @driver-name: name of the associated driver
1523 # @driver-date: driver release date, in nanoseconds since the epoch
1525 # @driver-version: driver version
1531 { 'struct': 'GuestDeviceInfo',
1533 'driver-name': 'str',
1534 '*driver-date': 'int',
1535 '*driver-version': 'str',
1536 '*id': 'GuestDeviceId'
1540 # @guest-get-devices:
1542 # Retrieve information about device drivers in Windows guest
1544 # Returns: @GuestDeviceInfo
1548 { 'command': 'guest-get-devices',
1549 'returns': ['GuestDeviceInfo'] }
1552 # @GuestAuthorizedKeys:
1554 # @keys: public keys (in OpenSSH/sshd(8) authorized_keys format)
1558 { 'struct': 'GuestAuthorizedKeys',
1562 'if': 'CONFIG_POSIX' }
1566 # @guest-ssh-get-authorized-keys:
1568 # @username: the user account to add the authorized keys
1570 # Return the public keys from user .ssh/authorized_keys on Unix
1571 # systems (not implemented for other systems).
1573 # Returns: @GuestAuthorizedKeys
1577 { 'command': 'guest-ssh-get-authorized-keys',
1578 'data': { 'username': 'str' },
1579 'returns': 'GuestAuthorizedKeys',
1580 'if': 'CONFIG_POSIX' }
1583 # @guest-ssh-add-authorized-keys:
1585 # @username: the user account to add the authorized keys
1587 # @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys
1590 # @reset: ignore the existing content, set it with the given keys only
1592 # Append public keys to user .ssh/authorized_keys on Unix systems (not
1593 # implemented for other systems).
1595 # Returns: Nothing on success.
1599 { 'command': 'guest-ssh-add-authorized-keys',
1600 'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' },
1601 'if': 'CONFIG_POSIX' }
1604 # @guest-ssh-remove-authorized-keys:
1606 # @username: the user account to remove the authorized keys
1608 # @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys
1611 # Remove public keys from the user .ssh/authorized_keys on Unix
1612 # systems (not implemented for other systems). It's not an error if
1613 # the key is already missing.
1615 # Returns: Nothing on success.
1619 { 'command': 'guest-ssh-remove-authorized-keys',
1620 'data': { 'username': 'str', 'keys': ['str'] },
1621 'if': 'CONFIG_POSIX' }
1626 # @read-sectors: sectors read
1628 # @read-ios: reads completed successfully
1630 # @read-merges: read requests merged
1632 # @write-sectors: sectors written
1634 # @write-ios: writes completed
1636 # @write-merges: write requests merged
1638 # @discard-sectors: sectors discarded
1640 # @discard-ios: discards completed successfully
1642 # @discard-merges: discard requests merged
1644 # @flush-ios: flush requests completed successfully
1646 # @read-ticks: time spent reading(ms)
1648 # @write-ticks: time spent writing(ms)
1650 # @discard-ticks: time spent discarding(ms)
1652 # @flush-ticks: time spent flushing(ms)
1654 # @ios-pgr: number of I/Os currently in flight
1656 # @total-ticks: time spent doing I/Os (ms)
1658 # @weight-ticks: weighted time spent doing I/Os since the last update
1663 { 'struct': 'GuestDiskStats',
1664 'data': {'*read-sectors': 'uint64',
1665 '*read-ios': 'uint64',
1666 '*read-merges': 'uint64',
1667 '*write-sectors': 'uint64',
1668 '*write-ios': 'uint64',
1669 '*write-merges': 'uint64',
1670 '*discard-sectors': 'uint64',
1671 '*discard-ios': 'uint64',
1672 '*discard-merges': 'uint64',
1673 '*flush-ios': 'uint64',
1674 '*read-ticks': 'uint64',
1675 '*write-ticks': 'uint64',
1676 '*discard-ticks': 'uint64',
1677 '*flush-ticks': 'uint64',
1678 '*ios-pgr': 'uint64',
1679 '*total-ticks': 'uint64',
1680 '*weight-ticks': 'uint64'
1684 # @GuestDiskStatsInfo:
1688 # @major: major device number of disk
1690 # @minor: minor device number of disk
1692 { 'struct': 'GuestDiskStatsInfo',
1693 'data': {'name': 'str',
1696 'stats': 'GuestDiskStats' } }
1699 # @guest-get-diskstats:
1701 # Retrieve information about disk stats.
1703 # Returns: List of disk stats of guest.
1707 { 'command': 'guest-get-diskstats',
1708 'returns': ['GuestDiskStatsInfo']
1712 # @GuestCpuStatsType:
1714 # An enumeration of OS type
1718 { 'enum': 'GuestCpuStatsType',
1719 'data': [ 'linux' ] }
1723 # @GuestLinuxCpuStats:
1725 # CPU statistics of Linux
1727 # @cpu: CPU index in guest OS
1729 # @user: Time spent in user mode
1731 # @nice: Time spent in user mode with low priority (nice)
1733 # @system: Time spent in system mode
1735 # @idle: Time spent in the idle task
1737 # @iowait: Time waiting for I/O to complete (since Linux 2.5.41)
1739 # @irq: Time servicing interrupts (since Linux 2.6.0-test4)
1741 # @softirq: Time servicing softirqs (since Linux 2.6.0-test4)
1743 # @steal: Stolen time by host (since Linux 2.6.11)
1745 # @guest: ime spent running a virtual CPU for guest operating systems
1746 # under the control of the Linux kernel (since Linux 2.6.24)
1748 # @guestnice: Time spent running a niced guest (since Linux 2.6.33)
1752 { 'struct': 'GuestLinuxCpuStats',
1753 'data': {'cpu': 'int',
1758 '*iowait': 'uint64',
1760 '*softirq': 'uint64',
1763 '*guestnice': 'uint64'
1769 # Get statistics of each CPU in millisecond.
1771 # - @linux: Linux style CPU statistics
1775 { 'union': 'GuestCpuStats',
1776 'base': { 'type': 'GuestCpuStatsType' },
1777 'discriminator': 'type',
1778 'data': { 'linux': 'GuestLinuxCpuStats' } }
1781 # @guest-get-cpustats:
1783 # Retrieve information about CPU stats.
1785 # Returns: List of CPU stats of guest.
1789 { 'command': 'guest-get-cpustats',
1790 'returns': ['GuestCpuStats']