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' ],
37 # Types and commands with undocumented members:
38 'documentation-exceptions': [
39 'GuestNVMeSmart' ] } }
42 # @guest-sync-delimited:
44 # Echo back a unique integer value, and prepend to response a leading
45 # sentinel byte (0xFF) the client can check scan for.
47 # This is used by clients talking to the guest agent over the wire to
48 # ensure the stream is in sync and doesn't contain stale data from
49 # previous client. It must be issued upon initial connection, and
50 # after any client-side timeouts (including timeouts on receiving a
51 # response to this command).
53 # After issuing this request, all guest agent responses should be
54 # ignored until the response containing the unique integer value the
55 # client passed in is returned. Receival of the 0xFF sentinel byte
56 # must be handled as an indication that the client's
57 # lexer/tokenizer/parser state should be flushed/reset in preparation
58 # for reliably receiving the subsequent response. As an optimization,
59 # clients may opt to ignore all data until a sentinel value is
60 # receiving to avoid unnecessary processing of stale data.
62 # Similarly, clients should also precede this *request* with a 0xFF
63 # byte to make sure the guest agent flushes any partially read JSON
64 # data from a previous client connection.
66 # @id: randomly generated 64-bit integer
68 # Returns: The unique integer id passed in by the client
72 { 'command': 'guest-sync-delimited',
73 'data': { 'id': 'int' },
79 # Echo back a unique integer value
81 # This is used by clients talking to the guest agent over the wire to
82 # ensure the stream is in sync and doesn't contain stale data from
83 # previous client. All guest agent responses should be ignored until
84 # the provided unique integer value is returned, and it is up to the
85 # client to handle stale whole or partially-delivered JSON text in
86 # such a way that this response can be obtained.
88 # In cases where a partial stale response was previously received by
89 # the client, this cannot always be done reliably. One particular
90 # scenario being if qemu-ga responses are fed character-by-character
91 # into a JSON parser. In these situations, using guest-sync-delimited
94 # For clients that fetch responses line by line and convert them to
95 # JSON objects, guest-sync should be sufficient, but note that in
96 # cases where the channel is dirty some attempts at parsing the
97 # response may result in a parser error.
99 # Such clients should also precede this command with a 0xFF byte to
100 # make sure the guest agent flushes any partially read JSON data from
101 # a previous session.
103 # @id: randomly generated 64-bit integer
105 # Returns: The unique integer id passed in by the client
109 { 'command': 'guest-sync',
110 'data': { 'id': 'int' },
116 # Ping the guest agent, a non-error return implies success
120 { 'command': 'guest-ping' }
125 # Get the information about guest's System Time relative to the Epoch
126 # of 1970-01-01 in UTC.
128 # Returns: Time in nanoseconds.
132 { 'command': 'guest-get-time',
140 # When a guest is paused or migrated to a file then loaded from that
141 # file, the guest OS has no idea that there was a big gap in the time.
142 # Depending on how long the gap was, NTP might not be able to
143 # resynchronize the guest.
145 # This command tries to set guest's System Time to the given value,
146 # then sets the Hardware Clock (RTC) to the current System Time. This
147 # will make it easier for a guest to resynchronize without waiting for
148 # NTP. If no @time is specified, then the time to set is read from
149 # RTC. However, this may not be supported on all platforms (i.e.
150 # Windows). If that's the case users are advised to always pass a
153 # @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in
156 # Returns: Nothing on success.
160 { 'command': 'guest-set-time',
161 'data': { '*time': 'int' } }
164 # @GuestAgentCommandInfo:
166 # Information about guest agent commands.
168 # @name: name of the command
170 # @enabled: whether command is currently enabled by guest admin
172 # @success-response: whether command returns a response on success
177 { 'struct': 'GuestAgentCommandInfo',
178 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
183 # Information about guest agent.
185 # @version: guest agent version
187 # @supported_commands: Information about guest agent commands
191 { 'struct': 'GuestAgentInfo',
192 'data': { 'version': 'str',
193 'supported_commands': ['GuestAgentCommandInfo'] } }
197 # Get some information about the guest agent.
199 # Returns: @GuestAgentInfo
203 { 'command': 'guest-info',
204 'returns': 'GuestAgentInfo' }
209 # Initiate guest-activated shutdown. Note: this is an asynchronous
210 # shutdown request, with no guarantee of successful shutdown.
212 # @mode: "halt", "powerdown" (default), or "reboot"
214 # This command does NOT return a response on success. Success
215 # condition is indicated by the VM exiting with a zero exit status or,
216 # when running with --no-shutdown, by issuing the query-status QMP
217 # command to confirm the VM status is "shutdown".
221 { 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
222 'success-response': false }
227 # Open a file in the guest and retrieve a file handle for it
229 # @path: Full path to the file in the guest to open.
231 # @mode: open mode, as per fopen(), "r" is the default.
233 # Returns: Guest file handle on success.
237 { 'command': 'guest-file-open',
238 'data': { 'path': 'str', '*mode': 'str' },
244 # Close an open file in the guest
246 # @handle: filehandle returned by guest-file-open
248 # Returns: Nothing on success.
252 { 'command': 'guest-file-close',
253 'data': { 'handle': 'int' } }
258 # Result of guest agent file-read operation
260 # @count: number of bytes read (note: count is *before*
261 # base64-encoding is applied)
263 # @buf-b64: base64-encoded bytes read
265 # @eof: whether EOF was encountered during read operation.
269 { 'struct': 'GuestFileRead',
270 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
275 # Read from an open file in the guest. Data will be base64-encoded.
276 # As this command is just for limited, ad-hoc debugging, such as log
277 # file access, the number of bytes to read is limited to 48 MB.
279 # @handle: filehandle returned by guest-file-open
281 # @count: maximum number of bytes to read (default is 4KB, maximum is
284 # Returns: @GuestFileRead on success.
288 { 'command': 'guest-file-read',
289 'data': { 'handle': 'int', '*count': 'int' },
290 'returns': 'GuestFileRead' }
295 # Result of guest agent file-write operation
297 # @count: number of bytes written (note: count is actual bytes
298 # written, after base64-decoding of provided buffer)
300 # @eof: whether EOF was encountered during write operation.
304 { 'struct': 'GuestFileWrite',
305 'data': { 'count': 'int', 'eof': 'bool' } }
310 # Write to an open file in the guest.
312 # @handle: filehandle returned by guest-file-open
314 # @buf-b64: base64-encoded string representing data to be written
316 # @count: bytes to write (actual bytes, after base64-decode), default
317 # is all content in buf-b64 buffer after base64 decoding
319 # Returns: @GuestFileWrite on success.
323 { 'command': 'guest-file-write',
324 'data': { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
325 'returns': 'GuestFileWrite' }
331 # Result of guest agent file-seek operation
333 # @position: current file position
335 # @eof: whether EOF was encountered during file seek
339 { 'struct': 'GuestFileSeek',
340 'data': { 'position': 'int', 'eof': 'bool' } }
345 # Symbolic names for use in @guest-file-seek
347 # @set: Set to the specified offset (same effect as 'whence':0)
349 # @cur: Add offset to the current location (same effect as 'whence':1)
351 # @end: Add offset to the end of the file (same effect as 'whence':2)
355 { 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
360 # Controls the meaning of offset to @guest-file-seek.
362 # @value: Integral value (0 for set, 1 for cur, 2 for end), available
363 # for historical reasons, and might differ from the host's or
364 # guest's SEEK_* values (since: 0.15)
366 # @name: Symbolic name, and preferred interface
370 { 'alternate': 'GuestFileWhence',
371 'data': { 'value': 'int', 'name': 'QGASeek' } }
376 # Seek to a position in the file, as with fseek(), and return the
377 # current file position afterward. Also encapsulates ftell()'s
378 # functionality, with offset=0 and whence=1.
380 # @handle: filehandle returned by guest-file-open
382 # @offset: bytes to skip over in the file stream
384 # @whence: Symbolic or numeric code for interpreting offset
386 # Returns: @GuestFileSeek on success.
390 { 'command': 'guest-file-seek',
391 'data': { 'handle': 'int', 'offset': 'int',
392 'whence': 'GuestFileWhence' },
393 'returns': 'GuestFileSeek' }
398 # Write file changes buffered in userspace to disk/kernel buffers
400 # @handle: filehandle returned by guest-file-open
402 # Returns: Nothing on success.
406 { 'command': 'guest-file-flush',
407 'data': { 'handle': 'int' } }
410 # @GuestFsfreezeStatus:
412 # An enumeration of filesystem freeze states
414 # @thawed: filesystems thawed/unfrozen
416 # @frozen: all non-network guest filesystems frozen
420 { 'enum': 'GuestFsfreezeStatus',
421 'data': [ 'thawed', 'frozen' ] }
424 # @guest-fsfreeze-status:
426 # Get guest fsfreeze state.
428 # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined
431 # Note: This may fail to properly report the current state as a result
432 # of some other guest processes having issued an fs freeze/thaw.
436 { 'command': 'guest-fsfreeze-status',
437 'returns': 'GuestFsfreezeStatus' }
440 # @guest-fsfreeze-freeze:
442 # Sync and freeze all freezable, local guest filesystems. If this
443 # command succeeded, you may call @guest-fsfreeze-thaw later to
446 # Note: On Windows, the command is implemented with the help of a
447 # Volume Shadow-copy Service DLL helper. The frozen state is
448 # limited for up to 10 seconds by VSS.
450 # Returns: Number of file systems currently frozen. On error, all
451 # filesystems will be thawed. If no filesystems are frozen as a
452 # result of this call, then @guest-fsfreeze-status will remain
453 # "thawed" and calling @guest-fsfreeze-thaw is not necessary.
457 { 'command': 'guest-fsfreeze-freeze',
461 # @guest-fsfreeze-freeze-list:
463 # Sync and freeze specified guest filesystems. See also
464 # @guest-fsfreeze-freeze.
466 # @mountpoints: an array of mountpoints of filesystems to be frozen.
467 # If omitted, every mounted filesystem is frozen. Invalid mount
468 # points are ignored.
470 # Returns: Number of file systems currently frozen. On error, all
471 # filesystems will be thawed.
475 { 'command': 'guest-fsfreeze-freeze-list',
476 'data': { '*mountpoints': ['str'] },
480 # @guest-fsfreeze-thaw:
482 # Unfreeze all frozen guest filesystems
484 # Returns: Number of file systems thawed by this call
486 # Note: if return value does not match the previous call to
487 # guest-fsfreeze-freeze, this likely means some freezable
488 # filesystems were unfrozen before this call, and that the
489 # filesystem state may have changed before issuing this command.
493 { 'command': 'guest-fsfreeze-thaw',
497 # @GuestFilesystemTrimResult:
499 # @path: path that was trimmed
501 # @error: an error message when trim failed
503 # @trimmed: bytes trimmed for this path
505 # @minimum: reported effective minimum for this path
509 { 'struct': 'GuestFilesystemTrimResult',
510 'data': {'path': 'str',
511 '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
514 # @GuestFilesystemTrimResponse:
516 # @paths: list of @GuestFilesystemTrimResult per path that was trimmed
520 { 'struct': 'GuestFilesystemTrimResponse',
521 'data': {'paths': ['GuestFilesystemTrimResult']} }
526 # Discard (or "trim") blocks which are not in use by the filesystem.
528 # @minimum: Minimum contiguous free range to discard, in bytes. Free
529 # ranges smaller than this may be ignored (this is a hint and the
530 # guest may not respect it). By increasing this value, the fstrim
531 # operation will complete more quickly for filesystems with badly
532 # fragmented free space, although not all blocks will be
533 # discarded. The default value is zero, meaning "discard every
536 # Returns: A @GuestFilesystemTrimResponse which contains the status of
537 # all trimmed paths. (since 2.4)
541 { 'command': 'guest-fstrim',
542 'data': { '*minimum': 'int' },
543 'returns': 'GuestFilesystemTrimResponse' }
546 # @guest-suspend-disk:
548 # Suspend guest to disk.
550 # This command attempts to suspend the guest using three strategies,
553 # - systemd hibernate
554 # - pm-utils (via pm-hibernate)
555 # - manual write into sysfs
557 # This command does NOT return a response on success. There is a high
558 # chance the command succeeded if the VM exits with a zero exit status
559 # or, when running with --no-shutdown, by issuing the query-status QMP
560 # command to to confirm the VM status is "shutdown". However, the VM
561 # could also exit (or set its status to "shutdown") due to other
564 # The following errors may be returned:
566 # - If suspend to disk is not supported, Unsupported
568 # Notes: It's strongly recommended to issue the guest-sync command
569 # before sending commands when the guest resumes
573 { 'command': 'guest-suspend-disk', 'success-response': false }
576 # @guest-suspend-ram:
578 # Suspend guest to ram.
580 # This command attempts to suspend the guest using three strategies,
583 # - systemd hibernate
584 # - pm-utils (via pm-hibernate)
585 # - manual write into sysfs
587 # IMPORTANT: guest-suspend-ram requires working wakeup support in
588 # QEMU. You should check QMP command query-current-machine returns
589 # wakeup-suspend-support: true before issuing this command. Failure
590 # in doing so can result in a suspended guest that QEMU will not be
591 # able to awaken, forcing the user to power cycle the guest to bring
594 # This command does NOT return a response on success. There are two
595 # options to check for success:
597 # 1. Wait for the SUSPEND QMP event from QEMU
598 # 2. Issue the query-status QMP command to confirm the VM status is
601 # The following errors may be returned:
603 # - If suspend to ram is not supported, Unsupported
605 # Notes: It's strongly recommended to issue the guest-sync command
606 # before sending commands when the guest resumes
610 { 'command': 'guest-suspend-ram', 'success-response': false }
613 # @guest-suspend-hybrid:
615 # Save guest state to disk and suspend to ram.
617 # This command attempts to suspend the guest by executing, in this
620 # - systemd hybrid-sleep
621 # - pm-utils (via pm-suspend-hybrid)
623 # IMPORTANT: guest-suspend-hybrid requires working wakeup support in
624 # QEMU. You should check QMP command query-current-machine returns
625 # wakeup-suspend-support: true before issuing this command. Failure
626 # in doing so can result in a suspended guest that QEMU will not be
627 # able to awaken, forcing the user to power cycle the guest to bring
630 # This command does NOT return a response on success. There are two
631 # options to check for success:
633 # 1. Wait for the SUSPEND QMP event from QEMU
634 # 2. Issue the query-status QMP command to confirm the VM status is
637 # The following errors may be returned:
639 # - If hybrid suspend is not supported, Unsupported
641 # Notes: It's strongly recommended to issue the guest-sync command
642 # before sending commands when the guest resumes
646 { 'command': 'guest-suspend-hybrid', 'success-response': false }
649 # @GuestIpAddressType:
651 # An enumeration of supported IP address types
653 # @ipv4: IP version 4
655 # @ipv6: IP version 6
659 { 'enum': 'GuestIpAddressType',
660 'data': [ 'ipv4', 'ipv6' ] }
665 # @ip-address: IP address
667 # @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
669 # @prefix: Network prefix length of @ip-address
673 { 'struct': 'GuestIpAddress',
674 'data': {'ip-address': 'str',
675 'ip-address-type': 'GuestIpAddressType',
679 # @GuestNetworkInterfaceStat:
681 # @rx-bytes: total bytes received
683 # @rx-packets: total packets received
685 # @rx-errs: bad packets received
687 # @rx-dropped: receiver dropped packets
689 # @tx-bytes: total bytes transmitted
691 # @tx-packets: total packets transmitted
693 # @tx-errs: packet transmit problems
695 # @tx-dropped: dropped packets transmitted
699 { 'struct': 'GuestNetworkInterfaceStat',
700 'data': {'rx-bytes': 'uint64',
701 'rx-packets': 'uint64',
703 'rx-dropped': 'uint64',
704 'tx-bytes': 'uint64',
705 'tx-packets': 'uint64',
707 'tx-dropped': 'uint64'
711 # @GuestNetworkInterface:
713 # @name: The name of interface for which info are being delivered
715 # @hardware-address: Hardware address of @name
717 # @ip-addresses: List of addresses assigned to @name
719 # @statistics: various statistic counters related to @name (since
724 { 'struct': 'GuestNetworkInterface',
725 'data': {'name': 'str',
726 '*hardware-address': 'str',
727 '*ip-addresses': ['GuestIpAddress'],
728 '*statistics': 'GuestNetworkInterfaceStat' } }
731 # @guest-network-get-interfaces:
733 # Get list of guest IP addresses, MAC addresses and netmasks.
735 # Returns: List of GuestNetworkInterface on success.
739 { 'command': 'guest-network-get-interfaces',
740 'returns': ['GuestNetworkInterface'] }
743 # @GuestLogicalProcessor:
745 # @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
747 # @online: Whether the VCPU is enabled.
749 # @can-offline: Whether offlining the VCPU is possible. This member
750 # is always filled in by the guest agent when the structure is
751 # returned, and always ignored on input (hence it can be omitted
756 { 'struct': 'GuestLogicalProcessor',
757 'data': {'logical-id': 'int',
759 '*can-offline': 'bool'} }
764 # Retrieve the list of the guest's logical processors.
766 # This is a read-only operation.
768 # Returns: The list of all VCPUs the guest knows about. Each VCPU is
769 # put on the list exactly once, but their order is unspecified.
773 { 'command': 'guest-get-vcpus',
774 'returns': ['GuestLogicalProcessor'] }
779 # Attempt to reconfigure (currently: enable/disable) logical
780 # processors inside the guest.
782 # @vcpus: The logical processors to be reconfigured. This list is
783 # processed node by node in order. In each node @logical-id is
784 # used to look up the guest VCPU, for which @online specifies the
785 # requested state. The set of distinct @logical-id's is only
786 # required to be a subset of the guest-supported identifiers.
787 # There's no restriction on list length or on repeating the same
788 # @logical-id (with possibly different @online field). Preferably
789 # the input list should describe a modified subset of
790 # @guest-get-vcpus' return value.
792 # Returns: The length of the initial sublist that has been
793 # successfully processed. The guest agent maximizes this value.
797 # if the @vcpus list was empty on input. Guest state has not
798 # been changed. Otherwise,
800 # processing the first node of @vcpus failed for the reason
801 # returned. Guest state has not been changed. Otherwise,
802 # - < length(@vcpus):
803 # more than zero initial nodes have been processed, but not the
804 # entire @vcpus list. Guest state has changed accordingly. To
805 # retrieve the error (assuming it persists), repeat the call
806 # with the successfully processed initial sublist removed.
813 { 'command': 'guest-set-vcpus',
814 'data': {'vcpus': ['GuestLogicalProcessor'] },
820 # An enumeration of bus type of disks
828 # @virtio: virtio disks
840 # @unknown: Unknown bus type
842 # @ieee1394: Win IEEE 1394 bus type
844 # @ssa: Win SSA bus type
846 # @fibre: Win fiber channel bus type
848 # @raid: Win RAID bus type
850 # @iscsi: Win iScsi bus type
852 # @sas: Win serial-attaches SCSI bus type
854 # @mmc: Win multimedia card (MMC) bus type
856 # @virtual: Win virtual bus type
858 # @file-backed-virtual: Win file-backed bus type
860 # @nvme: NVMe disks (since 7.1)
862 # Since: 2.2; 'Unknown' and all entries below since 2.4
864 { 'enum': 'GuestDiskBusType',
865 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
866 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
867 'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] }
879 # @function: function id
883 { 'struct': 'GuestPCIAddress',
884 'data': {'domain': 'int', 'bus': 'int',
885 'slot': 'int', 'function': 'int'} }
890 # @cssid: channel subsystem image id
892 # @ssid: subchannel set id
894 # @subchno: subchannel number
896 # @devno: device number
900 { 'struct': 'GuestCCWAddress',
901 'data': {'cssid': 'int',
909 # @pci-controller: controller's PCI address (fields are set to -1 if
912 # @bus-type: bus type
920 # @serial: serial number (since: 3.1)
922 # @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
924 # @ccw-address: CCW address on s390x (since: 6.0)
928 { 'struct': 'GuestDiskAddress',
929 'data': {'pci-controller': 'GuestPCIAddress',
930 'bus-type': 'GuestDiskBusType',
931 'bus': 'int', 'target': 'int', 'unit': 'int',
932 '*serial': 'str', '*dev': 'str',
933 '*ccw-address': 'GuestCCWAddress'} }
938 # NVMe smart information, based on NVMe specification, section
939 # <SMART / Health Information (Log Identifier 02h)>
941 # TODO: document members briefly
945 { 'struct': 'GuestNVMeSmart',
946 'data': {'critical-warning': 'int',
947 'temperature': 'int',
948 'available-spare': 'int',
949 'available-spare-threshold': 'int',
950 'percentage-used': 'int',
951 'data-units-read-lo': 'uint64',
952 'data-units-read-hi': 'uint64',
953 'data-units-written-lo': 'uint64',
954 'data-units-written-hi': 'uint64',
955 'host-read-commands-lo': 'uint64',
956 'host-read-commands-hi': 'uint64',
957 'host-write-commands-lo': 'uint64',
958 'host-write-commands-hi': 'uint64',
959 'controller-busy-time-lo': 'uint64',
960 'controller-busy-time-hi': 'uint64',
961 'power-cycles-lo': 'uint64',
962 'power-cycles-hi': 'uint64',
963 'power-on-hours-lo': 'uint64',
964 'power-on-hours-hi': 'uint64',
965 'unsafe-shutdowns-lo': 'uint64',
966 'unsafe-shutdowns-hi': 'uint64',
967 'media-errors-lo': 'uint64',
968 'media-errors-hi': 'uint64',
969 'number-of-error-log-entries-lo': 'uint64',
970 'number-of-error-log-entries-hi': 'uint64' } }
975 # Disk type related smart information.
977 # @type: disk bus type
981 { 'union': 'GuestDiskSmart',
982 'base': { 'type': 'GuestDiskBusType' },
983 'discriminator': 'type',
984 'data': { 'nvme': 'GuestNVMeSmart' } }
989 # @name: device node (Linux) or device UNC (Windows)
991 # @partition: whether this is a partition or disk
993 # @dependencies: list of device dependencies; e.g. for LVs of the LVM
994 # this will hold the list of PVs, for LUKS encrypted volume this
995 # will contain the disk where the volume is placed. (Linux)
997 # @address: disk address information (only for non-virtual devices)
999 # @alias: optional alias assigned to the disk, on Linux this is a name
1000 # assigned by device mapper
1002 # @smart: disk smart information (Since 7.1)
1006 { 'struct': 'GuestDiskInfo',
1007 'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
1008 '*address': 'GuestDiskAddress', '*alias': 'str',
1009 '*smart': 'GuestDiskSmart'} }
1014 # Returns: The list of disks in the guest. For Windows these are only
1015 # the physical disks. On Linux these are all root block devices
1016 # of non-zero size including e.g. removable devices, loop devices,
1021 { 'command': 'guest-get-disks',
1022 'returns': ['GuestDiskInfo'] }
1025 # @GuestFilesystemInfo:
1029 # @mountpoint: mount point path
1031 # @type: file system type string
1033 # @used-bytes: file system used bytes (since 3.0)
1035 # @total-bytes: non-root file system total bytes (since 3.0)
1037 # @disk: an array of disk hardware information that the volume lies
1038 # on, which may be empty if the disk type is not supported
1042 { 'struct': 'GuestFilesystemInfo',
1043 'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
1044 '*used-bytes': 'uint64', '*total-bytes': 'uint64',
1045 'disk': ['GuestDiskAddress']} }
1048 # @guest-get-fsinfo:
1050 # Returns: The list of filesystems information mounted in the guest.
1051 # The returned mountpoints may be specified to
1052 # @guest-fsfreeze-freeze-list. Network filesystems (such as CIFS
1053 # and NFS) are not listed.
1057 { 'command': 'guest-get-fsinfo',
1058 'returns': ['GuestFilesystemInfo'] }
1061 # @guest-set-user-password:
1063 # @username: the user account whose password to change
1065 # @password: the new password entry string, base64 encoded
1067 # @crypted: true if password is already crypt()d, false if raw
1069 # If the @crypted flag is true, it is the caller's responsibility to
1070 # ensure the correct crypt() encryption scheme is used. This command
1071 # does not attempt to interpret or report on the encryption scheme.
1072 # Refer to the documentation of the guest operating system in question
1073 # to determine what is supported.
1075 # Not all guest operating systems will support use of the @crypted
1076 # flag, as they may require the clear-text password
1078 # The @password parameter must always be base64 encoded before
1079 # transmission, even if already crypt()d, to ensure it is 8-bit safe
1080 # when passed as JSON.
1082 # Returns: Nothing on success.
1086 { 'command': 'guest-set-user-password',
1087 'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
1090 # @GuestMemoryBlock:
1092 # @phys-index: Arbitrary guest-specific unique identifier of the
1095 # @online: Whether the MEMORY BLOCK is enabled in guest.
1097 # @can-offline: Whether offlining the MEMORY BLOCK is possible. This
1098 # member is always filled in by the guest agent when the structure
1099 # is returned, and always ignored on input (hence it can be
1104 { 'struct': 'GuestMemoryBlock',
1105 'data': {'phys-index': 'uint64',
1107 '*can-offline': 'bool'} }
1110 # @guest-get-memory-blocks:
1112 # Retrieve the list of the guest's memory blocks.
1114 # This is a read-only operation.
1116 # Returns: The list of all memory blocks the guest knows about. Each
1117 # memory block is put on the list exactly once, but their order is
1122 { 'command': 'guest-get-memory-blocks',
1123 'returns': ['GuestMemoryBlock'] }
1126 # @GuestMemoryBlockResponseType:
1128 # An enumeration of memory block operation result.
1130 # @success: the operation of online/offline memory block is
1133 # @not-found: can't find the corresponding memoryXXX directory in
1136 # @operation-not-supported: for some old kernels, it does not support
1137 # online or offline memory block.
1139 # @operation-failed: the operation of online/offline memory block
1140 # fails, because of some errors happen.
1144 { 'enum': 'GuestMemoryBlockResponseType',
1145 'data': ['success', 'not-found', 'operation-not-supported',
1146 'operation-failed'] }
1149 # @GuestMemoryBlockResponse:
1151 # @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1153 # @response: the result of memory block operation.
1155 # @error-code: the error number. When memory block operation fails,
1156 # we assign the value of 'errno' to this member, it indicates what
1157 # goes wrong. When the operation succeeds, it will be omitted.
1161 { 'struct': 'GuestMemoryBlockResponse',
1162 'data': { 'phys-index': 'uint64',
1163 'response': 'GuestMemoryBlockResponseType',
1164 '*error-code': 'int' }}
1167 # @guest-set-memory-blocks:
1169 # Attempt to reconfigure (currently: enable/disable) state of memory
1170 # blocks inside the guest.
1172 # @mem-blks: The memory blocks to be reconfigured. This list is
1173 # processed node by node in order. In each node @phys-index is
1174 # used to look up the guest MEMORY BLOCK, for which @online
1175 # specifies the requested state. The set of distinct
1176 # @phys-index's is only required to be a subset of the
1177 # guest-supported identifiers. There's no restriction on list
1178 # length or on repeating the same @phys-index (with possibly
1179 # different @online field). Preferably the input list should
1180 # describe a modified subset of @guest-get-memory-blocks' return
1183 # Returns: The operation results, it is a list of
1184 # @GuestMemoryBlockResponse, which is corresponding to the input
1187 # Note: it will return NULL if the @mem-blks list was empty on
1188 # input, or there is an error, and in this case, guest state will
1193 { 'command': 'guest-set-memory-blocks',
1194 'data': {'mem-blks': ['GuestMemoryBlock'] },
1195 'returns': ['GuestMemoryBlockResponse'] }
1198 # @GuestMemoryBlockInfo:
1200 # @size: the size (in bytes) of the guest memory blocks, which are the
1201 # minimal units of memory block online/offline operations (also
1202 # called Logical Memory Hotplug).
1206 { 'struct': 'GuestMemoryBlockInfo',
1207 'data': {'size': 'uint64'} }
1210 # @guest-get-memory-block-info:
1212 # Get information relating to guest memory blocks.
1214 # Returns: @GuestMemoryBlockInfo
1218 { 'command': 'guest-get-memory-block-info',
1219 'returns': 'GuestMemoryBlockInfo' }
1224 # @exited: true if process has already terminated.
1226 # @exitcode: process exit code if it was normally terminated.
1228 # @signal: signal number (linux) or unhandled exception code (windows)
1229 # if the process was abnormally terminated.
1231 # @out-data: base64-encoded stdout of the process. This field will only
1232 # be populated after the process exits.
1234 # @err-data: base64-encoded stderr of the process. Note: @out-data and
1235 # @err-data are present only if 'capture-output' was specified for
1236 # 'guest-exec'. This field will only be populated after the process
1239 # @out-truncated: true if stdout was not fully captured due to size
1242 # @err-truncated: true if stderr was not fully captured due to size
1247 { 'struct': 'GuestExecStatus',
1248 'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1249 '*out-data': 'str', '*err-data': 'str',
1250 '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1252 # @guest-exec-status:
1254 # Check status of process associated with PID retrieved via
1255 # guest-exec. Reap the process and associated metadata if it has
1258 # @pid: pid returned from guest-exec
1260 # Returns: GuestExecStatus on success.
1264 { 'command': 'guest-exec-status',
1265 'data': { 'pid': 'int' },
1266 'returns': 'GuestExecStatus' }
1271 # @pid: pid of child process in guest OS
1275 { 'struct': 'GuestExec',
1276 'data': { 'pid': 'int'} }
1279 # @GuestExecCaptureOutputMode:
1281 # An enumeration of guest-exec capture modes.
1283 # @none: do not capture any output
1284 # @stdout: only capture stdout
1285 # @stderr: only capture stderr
1286 # @separated: capture both stdout and stderr, but separated into
1287 # GuestExecStatus out-data and err-data, respectively
1288 # @merged: capture both stdout and stderr, but merge together
1289 # into out-data. not effective on windows guests.
1293 { 'enum': 'GuestExecCaptureOutputMode',
1294 'data': [ 'none', 'stdout', 'stderr', 'separated',
1295 { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
1298 # @GuestExecCaptureOutput:
1300 # Controls what guest-exec output gets captures.
1302 # @flag: captures both stdout and stderr if true. Equivalent
1303 # to GuestExecCaptureOutputMode::all. (since 2.5)
1304 # @mode: capture mode; preferred interface
1308 { 'alternate': 'GuestExecCaptureOutput',
1309 'data': { 'flag': 'bool',
1310 'mode': 'GuestExecCaptureOutputMode'} }
1315 # Execute a command in the guest
1317 # @path: path or executable name to execute
1319 # @arg: argument list to pass to executable
1321 # @env: environment variables to pass to executable
1323 # @input-data: data to be passed to process stdin (base64 encoded)
1325 # @capture-output: bool flag to enable capture of stdout/stderr of
1326 # running process. defaults to false.
1328 # Returns: PID on success.
1332 { 'command': 'guest-exec',
1333 'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1334 '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
1335 'returns': 'GuestExec' }
1341 # @host-name: Fully qualified domain name of the guest OS
1345 { 'struct': 'GuestHostName',
1346 'data': { 'host-name': 'str' } }
1349 # @guest-get-host-name:
1351 # Return a name for the machine.
1353 # The returned name is not necessarily a fully-qualified domain name,
1354 # or even present in DNS or some other name service at all. It need
1355 # not even be unique on your local network or site, but usually it is.
1357 # Returns: the host name of the machine on success
1361 { 'command': 'guest-get-host-name',
1362 'returns': 'GuestHostName' }
1370 # @domain: Logon domain (windows only)
1372 # @login-time: Time of login of this user on the computer. If
1373 # multiple instances of the user are logged in, the earliest login
1374 # time is reported. The value is in fractional seconds since
1379 { 'struct': 'GuestUser',
1380 'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1385 # Retrieves a list of currently active users on the VM.
1387 # Returns: A unique list of users.
1391 { 'command': 'guest-get-users',
1392 'returns': ['GuestUser'] }
1397 # @zone: Timezone name. These values may differ depending on guest/OS
1398 # and should only be used for informational purposes.
1400 # @offset: Offset to UTC in seconds, negative numbers for time zones
1401 # west of GMT, positive numbers for east
1405 { 'struct': 'GuestTimezone',
1406 'data': { '*zone': 'str', 'offset': 'int' } }
1409 # @guest-get-timezone:
1411 # Retrieves the timezone information from the guest.
1413 # Returns: A GuestTimezone dictionary.
1417 { 'command': 'guest-get-timezone',
1418 'returns': 'GuestTimezone' }
1424 # * POSIX: release field returned by uname(2)
1425 # * Windows: build number of the OS
1428 # * POSIX: version field returned by uname(2)
1429 # * Windows: version number of the OS
1432 # * POSIX: machine field returned by uname(2)
1433 # * Windows: one of x86, x86_64, arm, ia64
1436 # * POSIX: as defined by os-release(5)
1437 # * Windows: contains string "mswindows"
1440 # * POSIX: as defined by os-release(5)
1441 # * Windows: contains string "Microsoft Windows"
1444 # * POSIX: as defined by os-release(5)
1445 # * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1448 # * POSIX: as defined by os-release(5)
1449 # * Windows: long version string, e.g. "Microsoft Windows Server
1453 # * POSIX: as defined by os-release(5)
1454 # * Windows: short version identifier, e.g. "7" or "20012r2"
1457 # * POSIX: as defined by os-release(5)
1458 # * Windows: contains string "server" or "client"
1461 # * POSIX: as defined by os-release(5)
1462 # * Windows: contains string "server" or "client"
1464 # Notes: On POSIX systems the fields @id, @name, @pretty-name,
1465 # @version, @version-id, @variant and @variant-id follow the
1466 # definition specified in os-release(5). Refer to the manual page
1467 # for exact description of the fields. Their values are taken
1468 # from the os-release file. If the file is not present in the
1469 # system, or the values are not present in the file, the fields
1472 # On Windows the values are filled from information gathered from
1477 { 'struct': 'GuestOSInfo',
1479 '*kernel-release': 'str', '*kernel-version': 'str',
1480 '*machine': 'str', '*id': 'str', '*name': 'str',
1481 '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1482 '*variant': 'str', '*variant-id': 'str' } }
1485 # @guest-get-osinfo:
1487 # Retrieve guest operating system information
1489 # Returns: @GuestOSInfo
1493 { 'command': 'guest-get-osinfo',
1494 'returns': 'GuestOSInfo' }
1501 { 'enum': 'GuestDeviceType',
1505 # @GuestDeviceIdPCI:
1507 # @vendor-id: vendor ID
1509 # @device-id: device ID
1513 { 'struct': 'GuestDeviceIdPCI',
1514 'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1521 # @type: device type
1525 { 'union': 'GuestDeviceId',
1526 'base': { 'type': 'GuestDeviceType' },
1527 'discriminator': 'type',
1528 'data': { 'pci': 'GuestDeviceIdPCI' } }
1533 # @driver-name: name of the associated driver
1535 # @driver-date: driver release date, in nanoseconds since the epoch
1537 # @driver-version: driver version
1543 { 'struct': 'GuestDeviceInfo',
1545 'driver-name': 'str',
1546 '*driver-date': 'int',
1547 '*driver-version': 'str',
1548 '*id': 'GuestDeviceId'
1552 # @guest-get-devices:
1554 # Retrieve information about device drivers in Windows guest
1556 # Returns: @GuestDeviceInfo
1560 { 'command': 'guest-get-devices',
1561 'returns': ['GuestDeviceInfo'] }
1564 # @GuestAuthorizedKeys:
1566 # @keys: public keys (in OpenSSH/sshd(8) authorized_keys format)
1570 { 'struct': 'GuestAuthorizedKeys',
1574 'if': 'CONFIG_POSIX' }
1578 # @guest-ssh-get-authorized-keys:
1580 # Return the public keys from user .ssh/authorized_keys on Unix
1581 # systems (not implemented for other systems).
1583 # @username: the user account to add the authorized keys
1585 # Returns: @GuestAuthorizedKeys
1589 { 'command': 'guest-ssh-get-authorized-keys',
1590 'data': { 'username': 'str' },
1591 'returns': 'GuestAuthorizedKeys',
1592 'if': 'CONFIG_POSIX' }
1595 # @guest-ssh-add-authorized-keys:
1597 # Append public keys to user .ssh/authorized_keys on Unix systems (not
1598 # implemented for other systems).
1600 # @username: the user account to add the authorized keys
1602 # @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys
1605 # @reset: ignore the existing content, set it with the given keys only
1607 # Returns: Nothing on success.
1611 { 'command': 'guest-ssh-add-authorized-keys',
1612 'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' },
1613 'if': 'CONFIG_POSIX' }
1616 # @guest-ssh-remove-authorized-keys:
1618 # Remove public keys from the user .ssh/authorized_keys on Unix
1619 # systems (not implemented for other systems). It's not an error if
1620 # the key is already missing.
1622 # @username: the user account to remove the authorized keys
1624 # @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys
1627 # Returns: Nothing on success.
1631 { 'command': 'guest-ssh-remove-authorized-keys',
1632 'data': { 'username': 'str', 'keys': ['str'] },
1633 'if': 'CONFIG_POSIX' }
1638 # @read-sectors: sectors read
1640 # @read-ios: reads completed successfully
1642 # @read-merges: read requests merged
1644 # @write-sectors: sectors written
1646 # @write-ios: writes completed
1648 # @write-merges: write requests merged
1650 # @discard-sectors: sectors discarded
1652 # @discard-ios: discards completed successfully
1654 # @discard-merges: discard requests merged
1656 # @flush-ios: flush requests completed successfully
1658 # @read-ticks: time spent reading(ms)
1660 # @write-ticks: time spent writing(ms)
1662 # @discard-ticks: time spent discarding(ms)
1664 # @flush-ticks: time spent flushing(ms)
1666 # @ios-pgr: number of I/Os currently in flight
1668 # @total-ticks: time spent doing I/Os (ms)
1670 # @weight-ticks: weighted time spent doing I/Os since the last update
1675 { 'struct': 'GuestDiskStats',
1676 'data': {'*read-sectors': 'uint64',
1677 '*read-ios': 'uint64',
1678 '*read-merges': 'uint64',
1679 '*write-sectors': 'uint64',
1680 '*write-ios': 'uint64',
1681 '*write-merges': 'uint64',
1682 '*discard-sectors': 'uint64',
1683 '*discard-ios': 'uint64',
1684 '*discard-merges': 'uint64',
1685 '*flush-ios': 'uint64',
1686 '*read-ticks': 'uint64',
1687 '*write-ticks': 'uint64',
1688 '*discard-ticks': 'uint64',
1689 '*flush-ticks': 'uint64',
1690 '*ios-pgr': 'uint64',
1691 '*total-ticks': 'uint64',
1692 '*weight-ticks': 'uint64'
1696 # @GuestDiskStatsInfo:
1700 # @major: major device number of disk
1702 # @minor: minor device number of disk
1704 # @stats: I/O statistics
1706 { 'struct': 'GuestDiskStatsInfo',
1707 'data': {'name': 'str',
1710 'stats': 'GuestDiskStats' } }
1713 # @guest-get-diskstats:
1715 # Retrieve information about disk stats.
1717 # Returns: List of disk stats of guest.
1721 { 'command': 'guest-get-diskstats',
1722 'returns': ['GuestDiskStatsInfo']
1726 # @GuestCpuStatsType:
1728 # Guest operating systems supporting CPU statistics
1734 { 'enum': 'GuestCpuStatsType',
1735 'data': [ 'linux' ] }
1739 # @GuestLinuxCpuStats:
1741 # CPU statistics of Linux
1743 # @cpu: CPU index in guest OS
1745 # @user: Time spent in user mode
1747 # @nice: Time spent in user mode with low priority (nice)
1749 # @system: Time spent in system mode
1751 # @idle: Time spent in the idle task
1753 # @iowait: Time waiting for I/O to complete (since Linux 2.5.41)
1755 # @irq: Time servicing interrupts (since Linux 2.6.0-test4)
1757 # @softirq: Time servicing softirqs (since Linux 2.6.0-test4)
1759 # @steal: Stolen time by host (since Linux 2.6.11)
1761 # @guest: ime spent running a virtual CPU for guest operating systems
1762 # under the control of the Linux kernel (since Linux 2.6.24)
1764 # @guestnice: Time spent running a niced guest (since Linux 2.6.33)
1768 { 'struct': 'GuestLinuxCpuStats',
1769 'data': {'cpu': 'int',
1774 '*iowait': 'uint64',
1776 '*softirq': 'uint64',
1779 '*guestnice': 'uint64'
1785 # Get statistics of each CPU in millisecond.
1787 # @type: guest operating system
1791 { 'union': 'GuestCpuStats',
1792 'base': { 'type': 'GuestCpuStatsType' },
1793 'discriminator': 'type',
1794 'data': { 'linux': 'GuestLinuxCpuStats' } }
1797 # @guest-get-cpustats:
1799 # Retrieve information about CPU stats.
1801 # Returns: List of CPU stats of guest.
1805 { 'command': 'guest-get-cpustats',
1806 'returns': ['GuestCpuStats']