#
##
+{ 'pragma': { 'doc-required': true } }
+
+# Whitelists to permit QAPI rule violations; think twice before you
+# add to them!
+{ 'pragma': {
+ # Commands allowed to return a non-dictionary:
+ 'returns-whitelist': [
+ 'guest-file-open',
+ 'guest-fsfreeze-freeze',
+ 'guest-fsfreeze-freeze-list',
+ 'guest-fsfreeze-status',
+ 'guest-fsfreeze-thaw',
+ 'guest-get-time',
+ 'guest-set-vcpus',
+ 'guest-sync',
+ 'guest-sync-delimited' ] } }
+
##
+# @guest-sync-delimited:
#
# Echo back a unique integer value, and prepend to response a
# leading sentinel byte (0xFF) the client can check scan for.
# Returns: The unique integer id passed in by the client
#
# Since: 1.1
-# ##
+##
{ 'command': 'guest-sync-delimited',
'data': { 'id': 'int' },
'returns': 'int' }
#
# Returns: Time in nanoseconds.
#
-# Since 1.5
+# Since: 1.5
##
{ 'command': 'guest-get-time',
'returns': 'int' }
# If that's the case users are advised to always pass a
# value.
#
-# @time: #optional time of nanoseconds, relative to the Epoch
+# @time: time of nanoseconds, relative to the Epoch
# of 1970-01-01 in UTC.
#
# Returns: Nothing on success.
# @success-response: whether command returns a response on success
# (since 1.7)
#
-# Since 1.1.0
+# Since: 1.1.0
##
{ 'struct': 'GuestAgentCommandInfo',
'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
##
-# @GuestAgentInfo
+# @GuestAgentInfo:
#
# Information about guest agent.
#
#
# @supported_commands: Information about guest agent commands
#
-# Since 0.15.0
+# Since: 0.15.0
##
{ 'struct': 'GuestAgentInfo',
'data': { 'version': 'str',
# Initiate guest-activated shutdown. Note: this is an asynchronous
# shutdown request, with no guarantee of successful shutdown.
#
-# @mode: #optional "halt", "powerdown" (default), or "reboot"
+# @mode: "halt", "powerdown" (default), or "reboot"
#
# This command does NOT return a response on success. Success condition
# is indicated by the VM exiting with a zero exit status or, when
#
# Open a file in the guest and retrieve a file handle for it
#
-# @filepath: Full path to the file in the guest to open.
+# @path: Full path to the file in the guest to open.
#
-# @mode: #optional open mode, as per fopen(), "r" is the default.
+# @mode: open mode, as per fopen(), "r" is the default.
#
# Returns: Guest file handle on success.
#
'data': { 'handle': 'int' } }
##
-# @GuestFileRead
+# @GuestFileRead:
#
# Result of guest agent file-read operation
#
#
# @handle: filehandle returned by guest-file-open
#
-# @count: #optional maximum number of bytes to read (default is 4KB)
+# @count: maximum number of bytes to read (default is 4KB)
#
# Returns: @GuestFileRead on success.
#
'returns': 'GuestFileRead' }
##
-# @GuestFileWrite
+# @GuestFileWrite:
#
# Result of guest agent file-write operation
#
#
# @buf-b64: base64-encoded string representing data to be written
#
-# @count: #optional bytes to write (actual bytes, after base64-decode),
+# @count: bytes to write (actual bytes, after base64-decode),
# default is all content in buf-b64 buffer after base64 decoding
#
# Returns: @GuestFileWrite on success.
##
-# @GuestFileSeek
+# @GuestFileSeek:
#
# Result of guest agent file-seek operation
#
{ 'struct': 'GuestFileSeek',
'data': { 'position': 'int', 'eof': 'bool' } }
+##
+# @QGASeek:
+#
+# Symbolic names for use in @guest-file-seek
+#
+# @set: Set to the specified offset (same effect as 'whence':0)
+# @cur: Add offset to the current location (same effect as 'whence':1)
+# @end: Add offset to the end of the file (same effect as 'whence':2)
+#
+# Since: 2.6
+##
+{ 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
+
+##
+# @GuestFileWhence:
+#
+# Controls the meaning of offset to @guest-file-seek.
+#
+# @value: Integral value (0 for set, 1 for cur, 2 for end), available
+# for historical reasons, and might differ from the host's or
+# guest's SEEK_* values (since: 0.15)
+# @name: Symbolic name, and preferred interface
+#
+# Since: 2.6
+##
+{ 'alternate': 'GuestFileWhence',
+ 'data': { 'value': 'int', 'name': 'QGASeek' } }
+
##
# @guest-file-seek:
#
# Seek to a position in the file, as with fseek(), and return the
# current file position afterward. Also encapsulates ftell()'s
-# functionality, just Set offset=0, whence=SEEK_CUR.
+# functionality, with offset=0 and whence=1.
#
# @handle: filehandle returned by guest-file-open
#
# @offset: bytes to skip over in the file stream
#
-# @whence: SEEK_SET, SEEK_CUR, or SEEK_END, as with fseek()
+# @whence: Symbolic or numeric code for interpreting offset
#
# Returns: @GuestFileSeek on success.
#
# Since: 0.15.0
##
{ 'command': 'guest-file-seek',
- 'data': { 'handle': 'int', 'offset': 'int', 'whence': 'int' },
+ 'data': { 'handle': 'int', 'offset': 'int',
+ 'whence': 'GuestFileWhence' },
'returns': 'GuestFileSeek' }
##
'data': { 'handle': 'int' } }
##
-# @GuestFsFreezeStatus
+# @GuestFsfreezeStatus:
#
# An enumeration of filesystem freeze states
#
##
# @guest-fsfreeze-freeze:
#
-# Sync and freeze all freezable, local guest filesystems
+# Sync and freeze all freezable, local guest filesystems. If this
+# command succeeded, you may call @guest-fsfreeze-thaw later to
+# unfreeze.
+#
+# Note: On Windows, the command is implemented with the help of a
+# Volume Shadow-copy Service DLL helper. The frozen state is limited
+# for up to 10 seconds by VSS.
#
# Returns: Number of file systems currently frozen. On error, all filesystems
# will be thawed.
##
# @guest-fsfreeze-freeze-list:
#
-# Sync and freeze specified guest filesystems
+# Sync and freeze specified guest filesystems.
+# See also @guest-fsfreeze-freeze.
#
-# @mountpoints: #optional an array of mountpoints of filesystems to be frozen.
+# @mountpoints: an array of mountpoints of filesystems to be frozen.
# If omitted, every mounted filesystem is frozen.
+# Invalid mount points are ignored.
#
# Returns: Number of file systems currently frozen. On error, all filesystems
# will be thawed.
{ 'command': 'guest-fsfreeze-thaw',
'returns': 'int' }
+##
+# @GuestFilesystemTrimResult:
+#
+# @path: path that was trimmed
+# @error: an error message when trim failed
+# @trimmed: bytes trimmed for this path
+# @minimum: reported effective minimum for this path
+#
+# Since: 2.4
+##
+{ 'struct': 'GuestFilesystemTrimResult',
+ 'data': {'path': 'str',
+ '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
+
+##
+# @GuestFilesystemTrimResponse:
+#
+# @paths: list of @GuestFilesystemTrimResult per path that was trimmed
+#
+# Since: 2.4
+##
+{ 'struct': 'GuestFilesystemTrimResponse',
+ 'data': {'paths': ['GuestFilesystemTrimResult']} }
+
##
# @guest-fstrim:
#
# fragmented free space, although not all blocks will be discarded.
# The default value is zero, meaning "discard every free block".
#
-# Returns: Nothing.
+# Returns: A @GuestFilesystemTrimResponse which contains the
+# status of all trimmed paths. (since 2.4)
#
# Since: 1.2
##
{ 'command': 'guest-fstrim',
- 'data': { '*minimum': 'int' } }
+ 'data': { '*minimum': 'int' },
+ 'returns': 'GuestFilesystemTrimResponse' }
##
-# @guest-suspend-disk
+# @guest-suspend-disk:
#
# Suspend guest to disk.
#
{ 'command': 'guest-suspend-disk', 'success-response': false }
##
-# @guest-suspend-ram
+# @guest-suspend-ram:
#
# Suspend guest to ram.
#
{ 'command': 'guest-suspend-ram', 'success-response': false }
##
-# @guest-suspend-hybrid
+# @guest-suspend-hybrid:
#
# Save guest state to disk and suspend to ram.
#
#
# @online: Whether the VCPU is enabled.
#
-# @can-offline: #optional Whether offlining the VCPU is possible. This member
+# @can-offline: Whether offlining the VCPU is possible. This member
# is always filled in by the guest agent when the structure is
# returned, and always ignored on input (hence it can be omitted
# then).
# Returns: The length of the initial sublist that has been successfully
# processed. The guest agent maximizes this value. Possible cases:
#
-# 0: if the @vcpus list was empty on input. Guest state
+# - 0: if the @vcpus list was empty on input. Guest state
# has not been changed. Otherwise,
-#
-# Error: processing the first node of @vcpus failed for the
+# - Error: processing the first node of @vcpus failed for the
# reason returned. Guest state has not been changed.
# Otherwise,
-#
-# < length(@vcpus): more than zero initial nodes have been processed,
+# - < length(@vcpus): more than zero initial nodes have been processed,
# but not the entire @vcpus list. Guest state has
# changed accordingly. To retrieve the error
# (assuming it persists), repeat the call with the
# successfully processed initial sublist removed.
# Otherwise,
-#
-# length(@vcpus): call successful.
+# - length(@vcpus): call successful.
#
# Since: 1.5
##
'returns': 'int' }
##
-# @GuestDiskBusType
+# @GuestDiskBusType:
#
# An enumeration of bus type of disks
#
# @uml: UML disks
# @sata: SATA disks
# @sd: SD cards
-#
-# Since: 2.2
+# @unknown: Unknown bus type
+# @ieee1394: Win IEEE 1394 bus type
+# @ssa: Win SSA bus type
+# @fibre: Win fiber channel bus type
+# @raid: Win RAID bus type
+# @iscsi: Win iScsi bus type
+# @sas: Win serial-attaches SCSI bus type
+# @mmc: Win multimedia card (MMC) bus type
+# @virtual: Win virtual bus type
+# @file-backed virtual: Win file-backed bus type
+#
+# Since: 2.2; 'Unknown' and all entries below since 2.4
##
{ 'enum': 'GuestDiskBusType',
'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
- 'sd' ] }
+ 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
+ 'sas', 'mmc', 'virtual', 'file-backed-virtual' ] }
+
##
# @GuestPCIAddress:
# @GuestDiskAddress:
#
# @pci-controller: controller's PCI address
-# @type: bus type
+# @bus-type: bus type
# @bus: bus id
# @target: target id
# @unit: unit id
'bus': 'int', 'target': 'int', 'unit': 'int'} }
##
-# @GuestFilesystemInfo
+# @GuestFilesystemInfo:
#
# @name: disk name
# @mountpoint: mount point path
'returns': ['GuestFilesystemInfo'] }
##
-# @guest-set-user-password
+# @guest-set-user-password:
#
# @username: the user account whose password to change
# @password: the new password entry string, base64 encoded
# scheme. Refer to the documentation of the guest operating system
# in question to determine what is supported.
#
-# Note all guest operating systems will support use of the
+# Not all guest operating systems will support use of the
# @crypted flag, as they may require the clear-text password
#
# The @password parameter must always be base64 encoded before
#
# Returns: Nothing on success.
#
-# Since 2.3
+# Since: 2.3
##
{ 'command': 'guest-set-user-password',
'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
+##
# @GuestMemoryBlock:
#
# @phys-index: Arbitrary guest-specific unique identifier of the MEMORY BLOCK.
#
# @online: Whether the MEMORY BLOCK is enabled in guest.
#
-# @can-offline: #optional Whether offlining the MEMORY BLOCK is possible.
+# @can-offline: Whether offlining the MEMORY BLOCK is possible.
# This member is always filled in by the guest agent when the
# structure is returned, and always ignored on input (hence it
# can be omitted then).
'returns': ['GuestMemoryBlock'] }
##
-# @GuestMemoryBlockResponseType
+# @GuestMemoryBlockResponseType:
#
# An enumeration of memory block operation result.
#
#
# @response: the result of memory block operation.
#
-# @error-code: #optional the error number.
+# @error-code: the error number.
# When memory block operation fails, we assign the value of
# 'errno' to this member, it indicates what goes wrong.
# When the operation succeeds, it will be omitted.
'data': {'mem-blks': ['GuestMemoryBlock'] },
'returns': ['GuestMemoryBlockResponse'] }
+##
# @GuestMemoryBlockInfo:
#
# @size: the size (in bytes) of the guest memory blocks,
#
# Get information relating to guest memory blocks.
#
-# Returns: memory block size in bytes.
# Returns: @GuestMemoryBlockInfo
#
-# Since 2.3
+# Since: 2.3
##
{ 'command': 'guest-get-memory-block-info',
'returns': 'GuestMemoryBlockInfo' }
+
+##
+# @GuestExecStatus:
+#
+# @exited: true if process has already terminated.
+# @exitcode: process exit code if it was normally terminated.
+# @signal: signal number (linux) or unhandled exception code
+# (windows) if the process was abnormally terminated.
+# @out-data: base64-encoded stdout of the process
+# @err-data: base64-encoded stderr of the process
+# Note: @out-data and @err-data are present only
+# if 'capture-output' was specified for 'guest-exec'
+# @out-truncated: true if stdout was not fully captured
+# due to size limitation.
+# @err-truncated: true if stderr was not fully captured
+# due to size limitation.
+#
+# Since: 2.5
+##
+{ 'struct': 'GuestExecStatus',
+ 'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
+ '*out-data': 'str', '*err-data': 'str',
+ '*out-truncated': 'bool', '*err-truncated': 'bool' }}
+##
+# @guest-exec-status:
+#
+# Check status of process associated with PID retrieved via guest-exec.
+# Reap the process and associated metadata if it has exited.
+#
+# @pid: pid returned from guest-exec
+#
+# Returns: GuestExecStatus on success.
+#
+# Since: 2.5
+##
+{ 'command': 'guest-exec-status',
+ 'data': { 'pid': 'int' },
+ 'returns': 'GuestExecStatus' }
+
+##
+# @GuestExec:
+# @pid: pid of child process in guest OS
+#
+# Since: 2.5
+##
+{ 'struct': 'GuestExec',
+ 'data': { 'pid': 'int'} }
+
+##
+# @guest-exec:
+#
+# Execute a command in the guest
+#
+# @path: path or executable name to execute
+# @arg: argument list to pass to executable
+# @env: environment variables to pass to executable
+# @input-data: data to be passed to process stdin (base64 encoded)
+# @capture-output: bool flag to enable capture of
+# stdout/stderr of running process. defaults to false.
+#
+# Returns: PID on success.
+#
+# Since: 2.5
+##
+{ 'command': 'guest-exec',
+ 'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
+ '*input-data': 'str', '*capture-output': 'bool' },
+ 'returns': 'GuestExec' }
+
+
+##
+# @GuestHostName:
+# @host-name: Fully qualified domain name of the guest OS
+#
+# Since: 2.10
+##
+{ 'struct': 'GuestHostName',
+ 'data': { 'host-name': 'str' } }
+
+##
+# @guest-get-host-name:
+#
+# Return a name for the machine.
+#
+# The returned name is not necessarily a fully-qualified domain name, or even
+# present in DNS or some other name service at all. It need not even be unique
+# on your local network or site, but usually it is.
+#
+# Returns: the host name of the machine on success
+#
+# Since: 2.10
+##
+{ 'command': 'guest-get-host-name',
+ 'returns': 'GuestHostName' }
+
+
+##
+# @GuestUser:
+# @user: Username
+# @domain: Logon domain (windows only)
+# @login-time: Time of login of this user on the computer. If multiple
+# instances of the user are logged in, the earliest login time is
+# reported. The value is in fractional seconds since epoch time.
+#
+# Since: 2.10
+##
+{ 'struct': 'GuestUser',
+ 'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
+
+##
+# @guest-get-users:
+# Retrieves a list of currently active users on the VM.
+#
+# Returns: A unique list of users.
+#
+# Since: 2.10
+##
+{ 'command': 'guest-get-users',
+ 'returns': ['GuestUser'] }
+
+##
+# @GuestTimezone:
+#
+# @zone: Timezone name. These values may differ depending on guest/OS and
+# should only be used for informational purposes.
+# @offset: Offset to UTC in seconds, negative numbers for time zones west of
+# GMT, positive numbers for east
+#
+# Since: 2.10
+##
+{ 'struct': 'GuestTimezone',
+ 'data': { '*zone': 'str', 'offset': 'int' } }
+
+##
+# @guest-get-timezone:
+#
+# Retrieves the timezone information from the guest.
+#
+# Returns: A GuestTimezone dictionary.
+#
+# Since: 2.10
+##
+{ 'command': 'guest-get-timezone',
+ 'returns': 'GuestTimezone' }
+
+##
+# @GuestOSInfo:
+#
+# @kernel-release:
+# * POSIX: release field returned by uname(2)
+# * Windows: version number of the OS
+# @kernel-version:
+# * POSIX: version field returned by uname(2)
+# * Windows: build number of the OS
+# @machine:
+# * POSIX: machine field returned by uname(2)
+# * Windows: one of x86, x86_64, arm, ia64
+# @id:
+# * POSIX: as defined by os-release(5)
+# * Windows: contains string "mswindows"
+# @name:
+# * POSIX: as defined by os-release(5)
+# * Windows: contains string "Microsoft Windows"
+# @pretty-name:
+# * POSIX: as defined by os-release(5)
+# * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
+# @version:
+# * POSIX: as defined by os-release(5)
+# * Windows: long version string, e.g. "Microsoft Windows Server 2008"
+# @version-id:
+# * POSIX: as defined by os-release(5)
+# * Windows: short version identifier, e.g. "7" or "20012r2"
+# @variant:
+# * POSIX: as defined by os-release(5)
+# * Windows: contains string "server" or "client"
+# @variant-id:
+# * POSIX: as defined by os-release(5)
+# * Windows: contains string "server" or "client"
+#
+# Notes:
+#
+# On POSIX systems the fields @id, @name, @pretty-name, @version, @version-id,
+# @variant and @variant-id follow the definition specified in os-release(5).
+# Refer to the manual page for exact description of the fields. Their values
+# are taken from the os-release file. If the file is not present in the system,
+# or the values are not present in the file, the fields are not included.
+#
+# On Windows the values are filled from information gathered from the system.
+#
+# Since: 2.10
+##
+{ 'struct': 'GuestOSInfo',
+ 'data': {
+ '*kernel-release': 'str', '*kernel-version': 'str',
+ '*machine': 'str', '*id': 'str', '*name': 'str',
+ '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
+ '*variant': 'str', '*variant-id': 'str' } }
+
+##
+# @guest-get-osinfo:
+#
+# Retrieve guest operating system information
+#
+# Returns: @GuestOSInfo
+#
+# Since: 2.10
+##
+{ 'command': 'guest-get-osinfo',
+ 'returns': 'GuestOSInfo' }