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': [
45 'GuestNVMeSmart' ] } }
48 # @guest-sync-delimited:
50 # Echo back a unique integer value, and prepend to response a leading
51 # sentinel byte (0xFF) the client can check scan for.
53 # This is used by clients talking to the guest agent over the wire to
54 # ensure the stream is in sync and doesn't contain stale data from
55 # previous client. It must be issued upon initial connection, and
56 # after any client-side timeouts (including timeouts on receiving a
57 # response to this command).
59 # After issuing this request, all guest agent responses should be
60 # ignored until the response containing the unique integer value the
61 # client passed in is returned. Receival of the 0xFF sentinel byte
62 # must be handled as an indication that the client's
63 # lexer/tokenizer/parser state should be flushed/reset in preparation
64 # for reliably receiving the subsequent response. As an optimization,
65 # clients may opt to ignore all data until a sentinel value is
66 # receiving to avoid unnecessary processing of stale data.
68 # Similarly, clients should also precede this *request* with a 0xFF
69 # byte to make sure the guest agent flushes any partially read JSON
70 # data from a previous client connection.
72 # @id: randomly generated 64-bit integer
74 # Returns: The unique integer id passed in by the client
78 { 'command': 'guest-sync-delimited',
79 'data': { 'id': 'int' },
85 # Echo back a unique integer value
87 # This is used by clients talking to the guest agent over the wire to
88 # ensure the stream is in sync and doesn't contain stale data from
89 # previous client. All guest agent responses should be ignored until
90 # the provided unique integer value is returned, and it is up to the
91 # client to handle stale whole or partially-delivered JSON text in
92 # such a way that this response can be obtained.
94 # In cases where a partial stale response was previously received by
95 # the client, this cannot always be done reliably. One particular
96 # scenario being if qemu-ga responses are fed character-by-character
97 # into a JSON parser. In these situations, using guest-sync-delimited
100 # For clients that fetch responses line by line and convert them to
101 # JSON objects, guest-sync should be sufficient, but note that in
102 # cases where the channel is dirty some attempts at parsing the
103 # response may result in a parser error.
105 # Such clients should also precede this command with a 0xFF byte to
106 # make sure the guest agent flushes any partially read JSON data from
107 # a previous session.
109 # @id: randomly generated 64-bit integer
111 # Returns: The unique integer id passed in by the client
115 { 'command': 'guest-sync',
116 'data': { 'id': 'int' },
122 # Ping the guest agent, a non-error return implies success
126 { 'command': 'guest-ping' }
131 # Get the information about guest's System Time relative to the Epoch
132 # of 1970-01-01 in UTC.
134 # Returns: Time in nanoseconds.
138 { 'command': 'guest-get-time',
146 # When a guest is paused or migrated to a file then loaded from that
147 # file, the guest OS has no idea that there was a big gap in the time.
148 # Depending on how long the gap was, NTP might not be able to
149 # resynchronize the guest.
151 # This command tries to set guest's System Time to the given value,
152 # then sets the Hardware Clock (RTC) to the current System Time. This
153 # will make it easier for a guest to resynchronize without waiting for
154 # NTP. If no @time is specified, then the time to set is read from
155 # RTC. However, this may not be supported on all platforms (i.e.
156 # Windows). If that's the case users are advised to always pass a
159 # @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in
162 # Returns: Nothing on success.
166 { 'command': 'guest-set-time',
167 'data': { '*time': 'int' } }
170 # @GuestAgentCommandInfo:
172 # Information about guest agent commands.
174 # @name: name of the command
176 # @enabled: whether command is currently enabled by guest admin
178 # @success-response: whether command returns a response on success
183 { 'struct': 'GuestAgentCommandInfo',
184 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
189 # Information about guest agent.
191 # @version: guest agent version
193 # @supported_commands: Information about guest agent commands
197 { 'struct': 'GuestAgentInfo',
198 'data': { 'version': 'str',
199 'supported_commands': ['GuestAgentCommandInfo'] } }
203 # Get some information about the guest agent.
205 # Returns: @GuestAgentInfo
209 { 'command': 'guest-info',
210 'returns': 'GuestAgentInfo' }
215 # Initiate guest-activated shutdown. Note: this is an asynchronous
216 # shutdown request, with no guarantee of successful shutdown.
218 # @mode: "halt", "powerdown" (default), or "reboot"
220 # This command does NOT return a response on success. Success
221 # condition is indicated by the VM exiting with a zero exit status or,
222 # when running with --no-shutdown, by issuing the query-status QMP
223 # command to confirm the VM status is "shutdown".
227 { 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
228 'success-response': false }
233 # Open a file in the guest and retrieve a file handle for it
235 # @path: Full path to the file in the guest to open.
237 # @mode: open mode, as per fopen(), "r" is the default.
239 # Returns: Guest file handle on success.
243 { 'command': 'guest-file-open',
244 'data': { 'path': 'str', '*mode': 'str' },
250 # Close an open file in the guest
252 # @handle: filehandle returned by guest-file-open
254 # Returns: Nothing on success.
258 { 'command': 'guest-file-close',
259 'data': { 'handle': 'int' } }
264 # Result of guest agent file-read operation
266 # @count: number of bytes read (note: count is *before*
267 # base64-encoding is applied)
269 # @buf-b64: base64-encoded bytes read
271 # @eof: whether EOF was encountered during read operation.
275 { 'struct': 'GuestFileRead',
276 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
281 # Read from an open file in the guest. Data will be base64-encoded.
282 # As this command is just for limited, ad-hoc debugging, such as log
283 # file access, the number of bytes to read is limited to 48 MB.
285 # @handle: filehandle returned by guest-file-open
287 # @count: maximum number of bytes to read (default is 4KB, maximum is
290 # Returns: @GuestFileRead on success.
294 { 'command': 'guest-file-read',
295 'data': { 'handle': 'int', '*count': 'int' },
296 'returns': 'GuestFileRead' }
301 # Result of guest agent file-write operation
303 # @count: number of bytes written (note: count is actual bytes
304 # written, after base64-decoding of provided buffer)
306 # @eof: whether EOF was encountered during write operation.
310 { 'struct': 'GuestFileWrite',
311 'data': { 'count': 'int', 'eof': 'bool' } }
316 # Write to an open file in the guest.
318 # @handle: filehandle returned by guest-file-open
320 # @buf-b64: base64-encoded string representing data to be written
322 # @count: bytes to write (actual bytes, after base64-decode), default
323 # is all content in buf-b64 buffer after base64 decoding
325 # Returns: @GuestFileWrite on success.
329 { 'command': 'guest-file-write',
330 'data': { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
331 'returns': 'GuestFileWrite' }
337 # Result of guest agent file-seek operation
339 # @position: current file position
341 # @eof: whether EOF was encountered during file seek
345 { 'struct': 'GuestFileSeek',
346 'data': { 'position': 'int', 'eof': 'bool' } }
351 # Symbolic names for use in @guest-file-seek
353 # @set: Set to the specified offset (same effect as 'whence':0)
355 # @cur: Add offset to the current location (same effect as 'whence':1)
357 # @end: Add offset to the end of the file (same effect as 'whence':2)
361 { 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
366 # Controls the meaning of offset to @guest-file-seek.
368 # @value: Integral value (0 for set, 1 for cur, 2 for end), available
369 # for historical reasons, and might differ from the host's or
370 # guest's SEEK_* values (since: 0.15)
372 # @name: Symbolic name, and preferred interface
376 { 'alternate': 'GuestFileWhence',
377 'data': { 'value': 'int', 'name': 'QGASeek' } }
382 # Seek to a position in the file, as with fseek(), and return the
383 # current file position afterward. Also encapsulates ftell()'s
384 # functionality, with offset=0 and whence=1.
386 # @handle: filehandle returned by guest-file-open
388 # @offset: bytes to skip over in the file stream
390 # @whence: Symbolic or numeric code for interpreting offset
392 # Returns: @GuestFileSeek on success.
396 { 'command': 'guest-file-seek',
397 'data': { 'handle': 'int', 'offset': 'int',
398 'whence': 'GuestFileWhence' },
399 'returns': 'GuestFileSeek' }
404 # Write file changes buffered in userspace to disk/kernel buffers
406 # @handle: filehandle returned by guest-file-open
408 # Returns: Nothing on success.
412 { 'command': 'guest-file-flush',
413 'data': { 'handle': 'int' } }
416 # @GuestFsfreezeStatus:
418 # An enumeration of filesystem freeze states
420 # @thawed: filesystems thawed/unfrozen
422 # @frozen: all non-network guest filesystems frozen
426 { 'enum': 'GuestFsfreezeStatus',
427 'data': [ 'thawed', 'frozen' ] }
430 # @guest-fsfreeze-status:
432 # Get guest fsfreeze state.
434 # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined
437 # Note: This may fail to properly report the current state as a result
438 # of some other guest processes having issued an fs freeze/thaw.
442 { 'command': 'guest-fsfreeze-status',
443 'returns': 'GuestFsfreezeStatus' }
446 # @guest-fsfreeze-freeze:
448 # Sync and freeze all freezable, local guest filesystems. If this
449 # command succeeded, you may call @guest-fsfreeze-thaw later to
452 # Note: On Windows, the command is implemented with the help of a
453 # Volume Shadow-copy Service DLL helper. The frozen state is
454 # limited for up to 10 seconds by VSS.
456 # Returns: Number of file systems currently frozen. On error, all
457 # filesystems will be thawed. If no filesystems are frozen as a
458 # result of this call, then @guest-fsfreeze-status will remain
459 # "thawed" and calling @guest-fsfreeze-thaw is not necessary.
463 { 'command': 'guest-fsfreeze-freeze',
467 # @guest-fsfreeze-freeze-list:
469 # Sync and freeze specified guest filesystems. See also
470 # @guest-fsfreeze-freeze.
472 # @mountpoints: an array of mountpoints of filesystems to be frozen.
473 # If omitted, every mounted filesystem is frozen. Invalid mount
474 # points are ignored.
476 # Returns: Number of file systems currently frozen. On error, all
477 # filesystems will be thawed.
481 { 'command': 'guest-fsfreeze-freeze-list',
482 'data': { '*mountpoints': ['str'] },
486 # @guest-fsfreeze-thaw:
488 # Unfreeze all frozen guest filesystems
490 # Returns: Number of file systems thawed by this call
492 # Note: if return value does not match the previous call to
493 # guest-fsfreeze-freeze, this likely means some freezable
494 # filesystems were unfrozen before this call, and that the
495 # filesystem state may have changed before issuing this command.
499 { 'command': 'guest-fsfreeze-thaw',
503 # @GuestFilesystemTrimResult:
505 # @path: path that was trimmed
507 # @error: an error message when trim failed
509 # @trimmed: bytes trimmed for this path
511 # @minimum: reported effective minimum for this path
515 { 'struct': 'GuestFilesystemTrimResult',
516 'data': {'path': 'str',
517 '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
520 # @GuestFilesystemTrimResponse:
522 # @paths: list of @GuestFilesystemTrimResult per path that was trimmed
526 { 'struct': 'GuestFilesystemTrimResponse',
527 'data': {'paths': ['GuestFilesystemTrimResult']} }
532 # Discard (or "trim") blocks which are not in use by the filesystem.
534 # @minimum: Minimum contiguous free range to discard, in bytes. Free
535 # ranges smaller than this may be ignored (this is a hint and the
536 # guest may not respect it). By increasing this value, the fstrim
537 # operation will complete more quickly for filesystems with badly
538 # fragmented free space, although not all blocks will be
539 # discarded. The default value is zero, meaning "discard every
542 # Returns: A @GuestFilesystemTrimResponse which contains the status of
543 # all trimmed paths. (since 2.4)
547 { 'command': 'guest-fstrim',
548 'data': { '*minimum': 'int' },
549 'returns': 'GuestFilesystemTrimResponse' }
552 # @guest-suspend-disk:
554 # Suspend guest to disk.
556 # This command attempts to suspend the guest using three strategies,
559 # - systemd hibernate
560 # - pm-utils (via pm-hibernate)
561 # - manual write into sysfs
563 # This command does NOT return a response on success. There is a high
564 # chance the command succeeded if the VM exits with a zero exit status
565 # or, when running with --no-shutdown, by issuing the query-status QMP
566 # command to to confirm the VM status is "shutdown". However, the VM
567 # could also exit (or set its status to "shutdown") due to other
570 # The following errors may be returned:
572 # - If suspend to disk is not supported, Unsupported
574 # Notes: It's strongly recommended to issue the guest-sync command
575 # before sending commands when the guest resumes
579 { 'command': 'guest-suspend-disk', 'success-response': false }
582 # @guest-suspend-ram:
584 # Suspend guest to ram.
586 # This command attempts to suspend the guest using three strategies,
589 # - systemd hibernate
590 # - pm-utils (via pm-hibernate)
591 # - manual write into sysfs
593 # IMPORTANT: guest-suspend-ram requires working wakeup support in
594 # QEMU. You should check QMP command query-current-machine returns
595 # wakeup-suspend-support: true before issuing this command. Failure
596 # in doing so can result in a suspended guest that QEMU will not be
597 # able to awaken, forcing the user to power cycle the guest to bring
600 # This command does NOT return a response on success. There are two
601 # options to check for success:
603 # 1. Wait for the SUSPEND QMP event from QEMU
604 # 2. Issue the query-status QMP command to confirm the VM status is
607 # The following errors may be returned:
609 # - If suspend to ram is not supported, Unsupported
611 # Notes: It's strongly recommended to issue the guest-sync command
612 # before sending commands when the guest resumes
616 { 'command': 'guest-suspend-ram', 'success-response': false }
619 # @guest-suspend-hybrid:
621 # Save guest state to disk and suspend to ram.
623 # This command attempts to suspend the guest by executing, in this
626 # - systemd hybrid-sleep
627 # - pm-utils (via pm-suspend-hybrid)
629 # IMPORTANT: guest-suspend-hybrid requires working wakeup support in
630 # QEMU. You should check QMP command query-current-machine returns
631 # wakeup-suspend-support: true before issuing this command. Failure
632 # in doing so can result in a suspended guest that QEMU will not be
633 # able to awaken, forcing the user to power cycle the guest to bring
636 # This command does NOT return a response on success. There are two
637 # options to check for success:
639 # 1. Wait for the SUSPEND QMP event from QEMU
640 # 2. Issue the query-status QMP command to confirm the VM status is
643 # The following errors may be returned:
645 # - If hybrid suspend is not supported, Unsupported
647 # Notes: It's strongly recommended to issue the guest-sync command
648 # before sending commands when the guest resumes
652 { 'command': 'guest-suspend-hybrid', 'success-response': false }
655 # @GuestIpAddressType:
657 # An enumeration of supported IP address types
659 # @ipv4: IP version 4
661 # @ipv6: IP version 6
665 { 'enum': 'GuestIpAddressType',
666 'data': [ 'ipv4', 'ipv6' ] }
671 # @ip-address: IP address
673 # @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
675 # @prefix: Network prefix length of @ip-address
679 { 'struct': 'GuestIpAddress',
680 'data': {'ip-address': 'str',
681 'ip-address-type': 'GuestIpAddressType',
685 # @GuestNetworkInterfaceStat:
687 # @rx-bytes: total bytes received
689 # @rx-packets: total packets received
691 # @rx-errs: bad packets received
693 # @rx-dropped: receiver dropped packets
695 # @tx-bytes: total bytes transmitted
697 # @tx-packets: total packets transmitted
699 # @tx-errs: packet transmit problems
701 # @tx-dropped: dropped packets transmitted
705 { 'struct': 'GuestNetworkInterfaceStat',
706 'data': {'rx-bytes': 'uint64',
707 'rx-packets': 'uint64',
709 'rx-dropped': 'uint64',
710 'tx-bytes': 'uint64',
711 'tx-packets': 'uint64',
713 'tx-dropped': 'uint64'
717 # @GuestNetworkInterface:
719 # @name: The name of interface for which info are being delivered
721 # @hardware-address: Hardware address of @name
723 # @ip-addresses: List of addresses assigned to @name
725 # @statistics: various statistic counters related to @name (since
730 { 'struct': 'GuestNetworkInterface',
731 'data': {'name': 'str',
732 '*hardware-address': 'str',
733 '*ip-addresses': ['GuestIpAddress'],
734 '*statistics': 'GuestNetworkInterfaceStat' } }
737 # @guest-network-get-interfaces:
739 # Get list of guest IP addresses, MAC addresses and netmasks.
741 # Returns: List of GuestNetworkInterface on success.
745 { 'command': 'guest-network-get-interfaces',
746 'returns': ['GuestNetworkInterface'] }
749 # @GuestLogicalProcessor:
751 # @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
753 # @online: Whether the VCPU is enabled.
755 # @can-offline: Whether offlining the VCPU is possible. This member
756 # is always filled in by the guest agent when the structure is
757 # returned, and always ignored on input (hence it can be omitted
762 { 'struct': 'GuestLogicalProcessor',
763 'data': {'logical-id': 'int',
765 '*can-offline': 'bool'} }
770 # Retrieve the list of the guest's logical processors.
772 # This is a read-only operation.
774 # Returns: The list of all VCPUs the guest knows about. Each VCPU is
775 # put on the list exactly once, but their order is unspecified.
779 { 'command': 'guest-get-vcpus',
780 'returns': ['GuestLogicalProcessor'] }
785 # Attempt to reconfigure (currently: enable/disable) logical
786 # processors inside the guest.
788 # @vcpus: The logical processors to be reconfigured. This list is
789 # processed node by node in order. In each node @logical-id is
790 # used to look up the guest VCPU, for which @online specifies the
791 # requested state. The set of distinct @logical-id's is only
792 # required to be a subset of the guest-supported identifiers.
793 # There's no restriction on list length or on repeating the same
794 # @logical-id (with possibly different @online field). Preferably
795 # the input list should describe a modified subset of
796 # @guest-get-vcpus' return value.
798 # Returns: The length of the initial sublist that has been
799 # successfully processed. The guest agent maximizes this value.
803 # if the @vcpus list was empty on input. Guest state has not
804 # been changed. Otherwise,
806 # processing the first node of @vcpus failed for the reason
807 # returned. Guest state has not been changed. Otherwise,
808 # - < length(@vcpus):
809 # more than zero initial nodes have been processed, but not the
810 # entire @vcpus list. Guest state has changed accordingly. To
811 # retrieve the error (assuming it persists), repeat the call
812 # with the successfully processed initial sublist removed.
819 { 'command': 'guest-set-vcpus',
820 'data': {'vcpus': ['GuestLogicalProcessor'] },
826 # An enumeration of bus type of disks
834 # @virtio: virtio disks
846 # @unknown: Unknown bus type
848 # @ieee1394: Win IEEE 1394 bus type
850 # @ssa: Win SSA bus type
852 # @fibre: Win fiber channel bus type
854 # @raid: Win RAID bus type
856 # @iscsi: Win iScsi bus type
858 # @sas: Win serial-attaches SCSI bus type
860 # @mmc: Win multimedia card (MMC) bus type
862 # @virtual: Win virtual bus type
864 # @file-backed-virtual: Win file-backed bus type
866 # @nvme: NVMe disks (since 7.1)
868 # Since: 2.2; 'Unknown' and all entries below since 2.4
870 { 'enum': 'GuestDiskBusType',
871 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
872 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
873 'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] }
885 # @function: function id
889 { 'struct': 'GuestPCIAddress',
890 'data': {'domain': 'int', 'bus': 'int',
891 'slot': 'int', 'function': 'int'} }
896 # @cssid: channel subsystem image id
898 # @ssid: subchannel set id
900 # @subchno: subchannel number
902 # @devno: device number
906 { 'struct': 'GuestCCWAddress',
907 'data': {'cssid': 'int',
915 # @pci-controller: controller's PCI address (fields are set to -1 if
918 # @bus-type: bus type
926 # @serial: serial number (since: 3.1)
928 # @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
930 # @ccw-address: CCW address on s390x (since: 6.0)
934 { 'struct': 'GuestDiskAddress',
935 'data': {'pci-controller': 'GuestPCIAddress',
936 'bus-type': 'GuestDiskBusType',
937 'bus': 'int', 'target': 'int', 'unit': 'int',
938 '*serial': 'str', '*dev': 'str',
939 '*ccw-address': 'GuestCCWAddress'} }
944 # NVMe smart information, based on NVMe specification, section
945 # <SMART / Health Information (Log Identifier 02h)>
949 { 'struct': 'GuestNVMeSmart',
950 'data': {'critical-warning': 'int',
951 'temperature': 'int',
952 'available-spare': 'int',
953 'available-spare-threshold': 'int',
954 'percentage-used': 'int',
955 'data-units-read-lo': 'uint64',
956 'data-units-read-hi': 'uint64',
957 'data-units-written-lo': 'uint64',
958 'data-units-written-hi': 'uint64',
959 'host-read-commands-lo': 'uint64',
960 'host-read-commands-hi': 'uint64',
961 'host-write-commands-lo': 'uint64',
962 'host-write-commands-hi': 'uint64',
963 'controller-busy-time-lo': 'uint64',
964 'controller-busy-time-hi': 'uint64',
965 'power-cycles-lo': 'uint64',
966 'power-cycles-hi': 'uint64',
967 'power-on-hours-lo': 'uint64',
968 'power-on-hours-hi': 'uint64',
969 'unsafe-shutdowns-lo': 'uint64',
970 'unsafe-shutdowns-hi': 'uint64',
971 'media-errors-lo': 'uint64',
972 'media-errors-hi': 'uint64',
973 'number-of-error-log-entries-lo': 'uint64',
974 'number-of-error-log-entries-hi': 'uint64' } }
979 # Disk type related smart information.
981 # - @nvme: NVMe disk smart
985 { 'union': 'GuestDiskSmart',
986 'base': { 'type': 'GuestDiskBusType' },
987 'discriminator': 'type',
988 'data': { 'nvme': 'GuestNVMeSmart' } }
993 # @name: device node (Linux) or device UNC (Windows)
995 # @partition: whether this is a partition or disk
997 # @dependencies: list of device dependencies; e.g. for LVs of the LVM
998 # this will hold the list of PVs, for LUKS encrypted volume this
999 # will contain the disk where the volume is placed. (Linux)
1001 # @address: disk address information (only for non-virtual devices)
1003 # @alias: optional alias assigned to the disk, on Linux this is a name
1004 # assigned by device mapper
1006 # @smart: disk smart information (Since 7.1)
1010 { 'struct': 'GuestDiskInfo',
1011 'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
1012 '*address': 'GuestDiskAddress', '*alias': 'str',
1013 '*smart': 'GuestDiskSmart'} }
1018 # Returns: The list of disks in the guest. For Windows these are only
1019 # the physical disks. On Linux these are all root block devices
1020 # of non-zero size including e.g. removable devices, loop devices,
1025 { 'command': 'guest-get-disks',
1026 'returns': ['GuestDiskInfo'] }
1029 # @GuestFilesystemInfo:
1033 # @mountpoint: mount point path
1035 # @type: file system type string
1037 # @used-bytes: file system used bytes (since 3.0)
1039 # @total-bytes: non-root file system total bytes (since 3.0)
1041 # @disk: an array of disk hardware information that the volume lies
1042 # on, which may be empty if the disk type is not supported
1046 { 'struct': 'GuestFilesystemInfo',
1047 'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
1048 '*used-bytes': 'uint64', '*total-bytes': 'uint64',
1049 'disk': ['GuestDiskAddress']} }
1052 # @guest-get-fsinfo:
1054 # Returns: The list of filesystems information mounted in the guest.
1055 # The returned mountpoints may be specified to
1056 # @guest-fsfreeze-freeze-list. Network filesystems (such as CIFS
1057 # and NFS) are not listed.
1061 { 'command': 'guest-get-fsinfo',
1062 'returns': ['GuestFilesystemInfo'] }
1065 # @guest-set-user-password:
1067 # @username: the user account whose password to change
1069 # @password: the new password entry string, base64 encoded
1071 # @crypted: true if password is already crypt()d, false if raw
1073 # If the @crypted flag is true, it is the caller's responsibility to
1074 # ensure the correct crypt() encryption scheme is used. This command
1075 # does not attempt to interpret or report on the encryption scheme.
1076 # Refer to the documentation of the guest operating system in question
1077 # to determine what is supported.
1079 # Not all guest operating systems will support use of the @crypted
1080 # flag, as they may require the clear-text password
1082 # The @password parameter must always be base64 encoded before
1083 # transmission, even if already crypt()d, to ensure it is 8-bit safe
1084 # when passed as JSON.
1086 # Returns: Nothing on success.
1090 { 'command': 'guest-set-user-password',
1091 'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
1094 # @GuestMemoryBlock:
1096 # @phys-index: Arbitrary guest-specific unique identifier of the
1099 # @online: Whether the MEMORY BLOCK is enabled in guest.
1101 # @can-offline: Whether offlining the MEMORY BLOCK is possible. This
1102 # member is always filled in by the guest agent when the structure
1103 # is returned, and always ignored on input (hence it can be
1108 { 'struct': 'GuestMemoryBlock',
1109 'data': {'phys-index': 'uint64',
1111 '*can-offline': 'bool'} }
1114 # @guest-get-memory-blocks:
1116 # Retrieve the list of the guest's memory blocks.
1118 # This is a read-only operation.
1120 # Returns: The list of all memory blocks the guest knows about. Each
1121 # memory block is put on the list exactly once, but their order is
1126 { 'command': 'guest-get-memory-blocks',
1127 'returns': ['GuestMemoryBlock'] }
1130 # @GuestMemoryBlockResponseType:
1132 # An enumeration of memory block operation result.
1134 # @success: the operation of online/offline memory block is
1137 # @not-found: can't find the corresponding memoryXXX directory in
1140 # @operation-not-supported: for some old kernels, it does not support
1141 # online or offline memory block.
1143 # @operation-failed: the operation of online/offline memory block
1144 # fails, because of some errors happen.
1148 { 'enum': 'GuestMemoryBlockResponseType',
1149 'data': ['success', 'not-found', 'operation-not-supported',
1150 'operation-failed'] }
1153 # @GuestMemoryBlockResponse:
1155 # @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1157 # @response: the result of memory block operation.
1159 # @error-code: the error number. When memory block operation fails,
1160 # we assign the value of 'errno' to this member, it indicates what
1161 # goes wrong. When the operation succeeds, it will be omitted.
1165 { 'struct': 'GuestMemoryBlockResponse',
1166 'data': { 'phys-index': 'uint64',
1167 'response': 'GuestMemoryBlockResponseType',
1168 '*error-code': 'int' }}
1171 # @guest-set-memory-blocks:
1173 # Attempt to reconfigure (currently: enable/disable) state of memory
1174 # blocks inside the guest.
1176 # @mem-blks: The memory blocks to be reconfigured. This list is
1177 # processed node by node in order. In each node @phys-index is
1178 # used to look up the guest MEMORY BLOCK, for which @online
1179 # specifies the requested state. The set of distinct
1180 # @phys-index's is only required to be a subset of the
1181 # guest-supported identifiers. There's no restriction on list
1182 # length or on repeating the same @phys-index (with possibly
1183 # different @online field). Preferably the input list should
1184 # describe a modified subset of @guest-get-memory-blocks' return
1187 # Returns: The operation results, it is a list of
1188 # @GuestMemoryBlockResponse, which is corresponding to the input
1191 # Note: it will return NULL if the @mem-blks list was empty on
1192 # input, or there is an error, and in this case, guest state will
1197 { 'command': 'guest-set-memory-blocks',
1198 'data': {'mem-blks': ['GuestMemoryBlock'] },
1199 'returns': ['GuestMemoryBlockResponse'] }
1202 # @GuestMemoryBlockInfo:
1204 # @size: the size (in bytes) of the guest memory blocks, which are the
1205 # minimal units of memory block online/offline operations (also
1206 # called Logical Memory Hotplug).
1210 { 'struct': 'GuestMemoryBlockInfo',
1211 'data': {'size': 'uint64'} }
1214 # @guest-get-memory-block-info:
1216 # Get information relating to guest memory blocks.
1218 # Returns: @GuestMemoryBlockInfo
1222 { 'command': 'guest-get-memory-block-info',
1223 'returns': 'GuestMemoryBlockInfo' }
1228 # @exited: true if process has already terminated.
1230 # @exitcode: process exit code if it was normally terminated.
1232 # @signal: signal number (linux) or unhandled exception code (windows)
1233 # if the process was abnormally terminated.
1235 # @out-data: base64-encoded stdout of the process. This field will only
1236 # be populated after the process exits.
1238 # @err-data: base64-encoded stderr of the process. Note: @out-data and
1239 # @err-data are present only if 'capture-output' was specified for
1240 # 'guest-exec'. This field will only be populated after the process
1243 # @out-truncated: true if stdout was not fully captured due to size
1246 # @err-truncated: true if stderr was not fully captured due to size
1251 { 'struct': 'GuestExecStatus',
1252 'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1253 '*out-data': 'str', '*err-data': 'str',
1254 '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1256 # @guest-exec-status:
1258 # Check status of process associated with PID retrieved via
1259 # guest-exec. Reap the process and associated metadata if it has
1262 # @pid: pid returned from guest-exec
1264 # Returns: GuestExecStatus on success.
1268 { 'command': 'guest-exec-status',
1269 'data': { 'pid': 'int' },
1270 'returns': 'GuestExecStatus' }
1275 # @pid: pid of child process in guest OS
1279 { 'struct': 'GuestExec',
1280 'data': { 'pid': 'int'} }
1283 # @GuestExecCaptureOutputMode:
1285 # An enumeration of guest-exec capture modes.
1287 # @none: do not capture any output
1288 # @stdout: only capture stdout
1289 # @stderr: only capture stderr
1290 # @separated: capture both stdout and stderr, but separated into
1291 # GuestExecStatus out-data and err-data, respectively
1292 # @merged: capture both stdout and stderr, but merge together
1293 # into out-data. not effective on windows guests.
1297 { 'enum': 'GuestExecCaptureOutputMode',
1298 'data': [ 'none', 'stdout', 'stderr', 'separated',
1299 { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
1302 # @GuestExecCaptureOutput:
1304 # Controls what guest-exec output gets captures.
1306 # @flag: captures both stdout and stderr if true. Equivalent
1307 # to GuestExecCaptureOutputMode::all. (since 2.5)
1308 # @mode: capture mode; preferred interface
1312 { 'alternate': 'GuestExecCaptureOutput',
1313 'data': { 'flag': 'bool',
1314 'mode': 'GuestExecCaptureOutputMode'} }
1319 # Execute a command in the guest
1321 # @path: path or executable name to execute
1323 # @arg: argument list to pass to executable
1325 # @env: environment variables to pass to executable
1327 # @input-data: data to be passed to process stdin (base64 encoded)
1329 # @capture-output: bool flag to enable capture of stdout/stderr of
1330 # running process. defaults to false.
1332 # Returns: PID on success.
1336 { 'command': 'guest-exec',
1337 'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1338 '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
1339 'returns': 'GuestExec' }
1345 # @host-name: Fully qualified domain name of the guest OS
1349 { 'struct': 'GuestHostName',
1350 'data': { 'host-name': 'str' } }
1353 # @guest-get-host-name:
1355 # Return a name for the machine.
1357 # The returned name is not necessarily a fully-qualified domain name,
1358 # or even present in DNS or some other name service at all. It need
1359 # not even be unique on your local network or site, but usually it is.
1361 # Returns: the host name of the machine on success
1365 { 'command': 'guest-get-host-name',
1366 'returns': 'GuestHostName' }
1374 # @domain: Logon domain (windows only)
1376 # @login-time: Time of login of this user on the computer. If
1377 # multiple instances of the user are logged in, the earliest login
1378 # time is reported. The value is in fractional seconds since
1383 { 'struct': 'GuestUser',
1384 'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1389 # Retrieves a list of currently active users on the VM.
1391 # Returns: A unique list of users.
1395 { 'command': 'guest-get-users',
1396 'returns': ['GuestUser'] }
1401 # @zone: Timezone name. These values may differ depending on guest/OS
1402 # and should only be used for informational purposes.
1404 # @offset: Offset to UTC in seconds, negative numbers for time zones
1405 # west of GMT, positive numbers for east
1409 { 'struct': 'GuestTimezone',
1410 'data': { '*zone': 'str', 'offset': 'int' } }
1413 # @guest-get-timezone:
1415 # Retrieves the timezone information from the guest.
1417 # Returns: A GuestTimezone dictionary.
1421 { 'command': 'guest-get-timezone',
1422 'returns': 'GuestTimezone' }
1428 # * POSIX: release field returned by uname(2)
1429 # * Windows: build number of the OS
1432 # * POSIX: version field returned by uname(2)
1433 # * Windows: version number of the OS
1436 # * POSIX: machine field returned by uname(2)
1437 # * Windows: one of x86, x86_64, arm, ia64
1440 # * POSIX: as defined by os-release(5)
1441 # * Windows: contains string "mswindows"
1444 # * POSIX: as defined by os-release(5)
1445 # * Windows: contains string "Microsoft Windows"
1448 # * POSIX: as defined by os-release(5)
1449 # * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1452 # * POSIX: as defined by os-release(5)
1453 # * Windows: long version string, e.g. "Microsoft Windows Server
1457 # * POSIX: as defined by os-release(5)
1458 # * Windows: short version identifier, e.g. "7" or "20012r2"
1461 # * POSIX: as defined by os-release(5)
1462 # * Windows: contains string "server" or "client"
1465 # * POSIX: as defined by os-release(5)
1466 # * Windows: contains string "server" or "client"
1468 # Notes: On POSIX systems the fields @id, @name, @pretty-name,
1469 # @version, @version-id, @variant and @variant-id follow the
1470 # definition specified in os-release(5). Refer to the manual page
1471 # for exact description of the fields. Their values are taken
1472 # from the os-release file. If the file is not present in the
1473 # system, or the values are not present in the file, the fields
1476 # On Windows the values are filled from information gathered from
1481 { 'struct': 'GuestOSInfo',
1483 '*kernel-release': 'str', '*kernel-version': 'str',
1484 '*machine': 'str', '*id': 'str', '*name': 'str',
1485 '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1486 '*variant': 'str', '*variant-id': 'str' } }
1489 # @guest-get-osinfo:
1491 # Retrieve guest operating system information
1493 # Returns: @GuestOSInfo
1497 { 'command': 'guest-get-osinfo',
1498 'returns': 'GuestOSInfo' }
1503 { 'enum': 'GuestDeviceType',
1507 # @GuestDeviceIdPCI:
1509 # @vendor-id: vendor ID
1511 # @device-id: device ID
1515 { 'struct': 'GuestDeviceIdPCI',
1516 'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1521 # Id of the device - @pci: PCI ID, since: 5.2
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 { 'struct': 'GuestDiskStatsInfo',
1705 'data': {'name': 'str',
1708 'stats': 'GuestDiskStats' } }
1711 # @guest-get-diskstats:
1713 # Retrieve information about disk stats.
1715 # Returns: List of disk stats of guest.
1719 { 'command': 'guest-get-diskstats',
1720 'returns': ['GuestDiskStatsInfo']
1724 # @GuestCpuStatsType:
1726 # An enumeration of OS type
1730 { 'enum': 'GuestCpuStatsType',
1731 'data': [ 'linux' ] }
1735 # @GuestLinuxCpuStats:
1737 # CPU statistics of Linux
1739 # @cpu: CPU index in guest OS
1741 # @user: Time spent in user mode
1743 # @nice: Time spent in user mode with low priority (nice)
1745 # @system: Time spent in system mode
1747 # @idle: Time spent in the idle task
1749 # @iowait: Time waiting for I/O to complete (since Linux 2.5.41)
1751 # @irq: Time servicing interrupts (since Linux 2.6.0-test4)
1753 # @softirq: Time servicing softirqs (since Linux 2.6.0-test4)
1755 # @steal: Stolen time by host (since Linux 2.6.11)
1757 # @guest: ime spent running a virtual CPU for guest operating systems
1758 # under the control of the Linux kernel (since Linux 2.6.24)
1760 # @guestnice: Time spent running a niced guest (since Linux 2.6.33)
1764 { 'struct': 'GuestLinuxCpuStats',
1765 'data': {'cpu': 'int',
1770 '*iowait': 'uint64',
1772 '*softirq': 'uint64',
1775 '*guestnice': 'uint64'
1781 # Get statistics of each CPU in millisecond.
1783 # - @linux: Linux style CPU statistics
1787 { 'union': 'GuestCpuStats',
1788 'base': { 'type': 'GuestCpuStatsType' },
1789 'discriminator': 'type',
1790 'data': { 'linux': 'GuestLinuxCpuStats' } }
1793 # @guest-get-cpustats:
1795 # Retrieve information about CPU stats.
1797 # Returns: List of CPU stats of guest.
1801 { 'command': 'guest-get-cpustats',
1802 'returns': ['GuestCpuStats']