1 # *-*- Mode: Python -*-*
5 # = General note concerning the use of guest agent interfaces
7 # "unsupported" is a higher-level error than the errors that individual
8 # commands might document. The caller should always be prepared to receive
9 # QERR_UNSUPPORTED, even if the given command doesn't specify it, or doesn't
10 # document any failure mode at all.
14 # = QEMU guest agent protocol commands and structs
17 { 'pragma': { 'doc-required': true } }
19 # Whitelists to permit QAPI rule violations; think twice before you
22 # Commands allowed to return a non-dictionary:
23 'returns-whitelist': [
25 'guest-fsfreeze-freeze',
26 'guest-fsfreeze-freeze-list',
27 'guest-fsfreeze-status',
28 'guest-fsfreeze-thaw',
32 'guest-sync-delimited' ] } }
35 # @guest-sync-delimited:
37 # Echo back a unique integer value, and prepend to response a
38 # leading sentinel byte (0xFF) the client can check scan for.
40 # This is used by clients talking to the guest agent over the
41 # wire to ensure the stream is in sync and doesn't contain stale
42 # data from previous client. It must be issued upon initial
43 # connection, and after any client-side timeouts (including
44 # timeouts on receiving a response to this command).
46 # After issuing this request, all guest agent responses should be
47 # ignored until the response containing the unique integer value
48 # the client passed in is returned. Receival of the 0xFF sentinel
49 # byte must be handled as an indication that the client's
50 # lexer/tokenizer/parser state should be flushed/reset in
51 # preparation for reliably receiving the subsequent response. As
52 # an optimization, clients may opt to ignore all data until a
53 # sentinel value is receiving to avoid unnecessary processing of
56 # Similarly, clients should also precede this *request*
57 # with a 0xFF byte to make sure the guest agent flushes any
58 # partially read JSON data from a previous client connection.
60 # @id: randomly generated 64-bit integer
62 # Returns: The unique integer id passed in by the client
66 { 'command': 'guest-sync-delimited',
67 'data': { 'id': 'int' },
73 # Echo back a unique integer value
75 # This is used by clients talking to the guest agent over the
76 # wire to ensure the stream is in sync and doesn't contain stale
77 # data from previous client. All guest agent responses should be
78 # ignored until the provided unique integer value is returned,
79 # and it is up to the client to handle stale whole or
80 # partially-delivered JSON text in such a way that this response
83 # In cases where a partial stale response was previously
84 # received by the client, this cannot always be done reliably.
85 # One particular scenario being if qemu-ga responses are fed
86 # character-by-character into a JSON parser. In these situations,
87 # using guest-sync-delimited may be optimal.
89 # For clients that fetch responses line by line and convert them
90 # to JSON objects, guest-sync should be sufficient, but note that
91 # in cases where the channel is dirty some attempts at parsing the
92 # response may result in a parser error.
94 # Such clients should also precede this command
95 # with a 0xFF byte to make sure the guest agent flushes any
96 # partially read JSON data from a previous session.
98 # @id: randomly generated 64-bit integer
100 # Returns: The unique integer id passed in by the client
104 { 'command': 'guest-sync',
105 'data': { 'id': 'int' },
111 # Ping the guest agent, a non-error return implies success
115 { 'command': 'guest-ping' }
120 # Get the information about guest's System Time relative to
121 # the Epoch of 1970-01-01 in UTC.
123 # Returns: Time in nanoseconds.
127 { 'command': 'guest-get-time',
135 # When a guest is paused or migrated to a file then loaded
136 # from that file, the guest OS has no idea that there
137 # was a big gap in the time. Depending on how long the
138 # gap was, NTP might not be able to resynchronize the
141 # This command tries to set guest's System Time to the
142 # given value, then sets the Hardware Clock (RTC) to the
143 # current System Time. This will make it easier for a guest
144 # to resynchronize without waiting for NTP. If no @time is
145 # specified, then the time to set is read from RTC. However,
146 # this may not be supported on all platforms (i.e. Windows).
147 # If that's the case users are advised to always pass a
150 # @time: time of nanoseconds, relative to the Epoch
151 # of 1970-01-01 in UTC.
153 # Returns: Nothing on success.
157 { 'command': 'guest-set-time',
158 'data': { '*time': 'int' } }
161 # @GuestAgentCommandInfo:
163 # Information about guest agent commands.
165 # @name: name of the command
167 # @enabled: whether command is currently enabled by guest admin
169 # @success-response: whether command returns a response on success
174 { 'struct': 'GuestAgentCommandInfo',
175 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
180 # Information about guest agent.
182 # @version: guest agent version
184 # @supported_commands: Information about guest agent commands
188 { 'struct': 'GuestAgentInfo',
189 'data': { 'version': 'str',
190 'supported_commands': ['GuestAgentCommandInfo'] } }
194 # Get some information about the guest agent.
196 # Returns: @GuestAgentInfo
200 { 'command': 'guest-info',
201 'returns': 'GuestAgentInfo' }
206 # Initiate guest-activated shutdown. Note: this is an asynchronous
207 # shutdown request, with no guarantee of successful shutdown.
209 # @mode: "halt", "powerdown" (default), or "reboot"
211 # This command does NOT return a response on success. Success condition
212 # is indicated by the VM exiting with a zero exit status or, when
213 # running with --no-shutdown, by issuing the query-status QMP command
214 # to confirm the VM status is "shutdown".
218 { 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
219 'success-response': false }
224 # Open a file in the guest and retrieve a file handle for it
226 # @path: Full path to the file in the guest to open.
228 # @mode: open mode, as per fopen(), "r" is the default.
230 # Returns: Guest file handle on success.
234 { 'command': 'guest-file-open',
235 'data': { 'path': 'str', '*mode': 'str' },
241 # Close an open file in the guest
243 # @handle: filehandle returned by guest-file-open
245 # Returns: Nothing on success.
249 { 'command': 'guest-file-close',
250 'data': { 'handle': 'int' } }
255 # Result of guest agent file-read operation
257 # @count: number of bytes read (note: count is *before*
258 # base64-encoding is applied)
260 # @buf-b64: base64-encoded bytes read
262 # @eof: whether EOF was encountered during read operation.
266 { 'struct': 'GuestFileRead',
267 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
272 # Read from an open file in the guest. Data will be base64-encoded.
273 # As this command is just for limited, ad-hoc debugging, such as log
274 # file access, the number of bytes to read is limited to 48 MB.
276 # @handle: filehandle returned by guest-file-open
278 # @count: maximum number of bytes to read (default is 4KB, maximum is 48MB)
280 # Returns: @GuestFileRead on success.
284 { 'command': 'guest-file-read',
285 'data': { 'handle': 'int', '*count': 'int' },
286 'returns': 'GuestFileRead' }
291 # Result of guest agent file-write operation
293 # @count: number of bytes written (note: count is actual bytes
294 # written, after base64-decoding of provided buffer)
296 # @eof: whether EOF was encountered during write operation.
300 { 'struct': 'GuestFileWrite',
301 'data': { 'count': 'int', 'eof': 'bool' } }
306 # Write to an open file in the guest.
308 # @handle: filehandle returned by guest-file-open
310 # @buf-b64: base64-encoded string representing data to be written
312 # @count: bytes to write (actual bytes, after base64-decode),
313 # default is all content in buf-b64 buffer after base64 decoding
315 # Returns: @GuestFileWrite on success.
319 { 'command': 'guest-file-write',
320 'data': { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
321 'returns': 'GuestFileWrite' }
327 # Result of guest agent file-seek operation
329 # @position: current file position
331 # @eof: whether EOF was encountered during file seek
335 { 'struct': 'GuestFileSeek',
336 'data': { 'position': 'int', 'eof': 'bool' } }
341 # Symbolic names for use in @guest-file-seek
343 # @set: Set to the specified offset (same effect as 'whence':0)
344 # @cur: Add offset to the current location (same effect as 'whence':1)
345 # @end: Add offset to the end of the file (same effect as 'whence':2)
349 { 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
354 # Controls the meaning of offset to @guest-file-seek.
356 # @value: Integral value (0 for set, 1 for cur, 2 for end), available
357 # for historical reasons, and might differ from the host's or
358 # guest's SEEK_* values (since: 0.15)
359 # @name: Symbolic name, and preferred interface
363 { 'alternate': 'GuestFileWhence',
364 'data': { 'value': 'int', 'name': 'QGASeek' } }
369 # Seek to a position in the file, as with fseek(), and return the
370 # current file position afterward. Also encapsulates ftell()'s
371 # functionality, with offset=0 and whence=1.
373 # @handle: filehandle returned by guest-file-open
375 # @offset: bytes to skip over in the file stream
377 # @whence: Symbolic or numeric code for interpreting offset
379 # Returns: @GuestFileSeek on success.
383 { 'command': 'guest-file-seek',
384 'data': { 'handle': 'int', 'offset': 'int',
385 'whence': 'GuestFileWhence' },
386 'returns': 'GuestFileSeek' }
391 # Write file changes bufferred in userspace to disk/kernel buffers
393 # @handle: filehandle returned by guest-file-open
395 # Returns: Nothing on success.
399 { 'command': 'guest-file-flush',
400 'data': { 'handle': 'int' } }
403 # @GuestFsfreezeStatus:
405 # An enumeration of filesystem freeze states
407 # @thawed: filesystems thawed/unfrozen
409 # @frozen: all non-network guest filesystems frozen
413 { 'enum': 'GuestFsfreezeStatus',
414 'data': [ 'thawed', 'frozen' ] }
417 # @guest-fsfreeze-status:
419 # Get guest fsfreeze state. error state indicates
421 # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
423 # Note: This may fail to properly report the current state as a result of
424 # some other guest processes having issued an fs freeze/thaw.
428 { 'command': 'guest-fsfreeze-status',
429 'returns': 'GuestFsfreezeStatus' }
432 # @guest-fsfreeze-freeze:
434 # Sync and freeze all freezable, local guest filesystems. If this
435 # command succeeded, you may call @guest-fsfreeze-thaw later to
438 # Note: On Windows, the command is implemented with the help of a
439 # Volume Shadow-copy Service DLL helper. The frozen state is limited
440 # for up to 10 seconds by VSS.
442 # Returns: Number of file systems currently frozen. On error, all filesystems
443 # will be thawed. If no filesystems are frozen as a result of this call,
444 # then @guest-fsfreeze-status will remain "thawed" and calling
445 # @guest-fsfreeze-thaw is not necessary.
449 { 'command': 'guest-fsfreeze-freeze',
453 # @guest-fsfreeze-freeze-list:
455 # Sync and freeze specified guest filesystems.
456 # See also @guest-fsfreeze-freeze.
458 # @mountpoints: an array of mountpoints of filesystems to be frozen.
459 # If omitted, every mounted filesystem is frozen.
460 # Invalid mount points are ignored.
462 # Returns: Number of file systems currently frozen. On error, all filesystems
467 { 'command': 'guest-fsfreeze-freeze-list',
468 'data': { '*mountpoints': ['str'] },
472 # @guest-fsfreeze-thaw:
474 # Unfreeze all frozen guest filesystems
476 # Returns: Number of file systems thawed by this call
478 # Note: if return value does not match the previous call to
479 # guest-fsfreeze-freeze, this likely means some freezable
480 # filesystems were unfrozen before this call, and that the
481 # filesystem state may have changed before issuing this
486 { 'command': 'guest-fsfreeze-thaw',
490 # @GuestFilesystemTrimResult:
492 # @path: path that was trimmed
493 # @error: an error message when trim failed
494 # @trimmed: bytes trimmed for this path
495 # @minimum: reported effective minimum for this path
499 { 'struct': 'GuestFilesystemTrimResult',
500 'data': {'path': 'str',
501 '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
504 # @GuestFilesystemTrimResponse:
506 # @paths: list of @GuestFilesystemTrimResult per path that was trimmed
510 { 'struct': 'GuestFilesystemTrimResponse',
511 'data': {'paths': ['GuestFilesystemTrimResult']} }
516 # Discard (or "trim") blocks which are not in use by the filesystem.
518 # @minimum: Minimum contiguous free range to discard, in bytes. Free ranges
519 # smaller than this may be ignored (this is a hint and the guest
520 # may not respect it). By increasing this value, the fstrim
521 # operation will complete more quickly for filesystems with badly
522 # fragmented free space, although not all blocks will be discarded.
523 # The default value is zero, meaning "discard every free block".
525 # Returns: A @GuestFilesystemTrimResponse which contains the
526 # status of all trimmed paths. (since 2.4)
530 { 'command': 'guest-fstrim',
531 'data': { '*minimum': 'int' },
532 'returns': 'GuestFilesystemTrimResponse' }
535 # @guest-suspend-disk:
537 # Suspend guest to disk.
539 # This command attempts to suspend the guest using three strategies, in this
542 # - systemd hibernate
543 # - pm-utils (via pm-hibernate)
544 # - manual write into sysfs
546 # This command does NOT return a response on success. There is a high chance
547 # the command succeeded if the VM exits with a zero exit status or, when
548 # running with --no-shutdown, by issuing the query-status QMP command to
549 # to confirm the VM status is "shutdown". However, the VM could also exit
550 # (or set its status to "shutdown") due to other reasons.
552 # The following errors may be returned:
554 # - If suspend to disk is not supported, Unsupported
556 # Notes: It's strongly recommended to issue the guest-sync command before
557 # sending commands when the guest resumes
561 { 'command': 'guest-suspend-disk', 'success-response': false }
564 # @guest-suspend-ram:
566 # Suspend guest to ram.
568 # This command attempts to suspend the guest using three strategies, in this
572 # - pm-utils (via pm-suspend)
573 # - manual write into sysfs
575 # IMPORTANT: guest-suspend-ram requires working wakeup support in
576 # QEMU. You should check QMP command query-current-machine returns
577 # wakeup-suspend-support: true before issuing this command. Failure in
578 # doing so can result in a suspended guest that QEMU will not be able to
579 # awaken, forcing the user to power cycle the guest to bring it back.
581 # This command does NOT return a response on success. There are two options
582 # to check for success:
584 # 1. Wait for the SUSPEND QMP event from QEMU
585 # 2. Issue the query-status QMP command to confirm the VM status is
588 # The following errors may be returned:
590 # - If suspend to ram is not supported, Unsupported
592 # Notes: It's strongly recommended to issue the guest-sync command before
593 # sending commands when the guest resumes
597 { 'command': 'guest-suspend-ram', 'success-response': false }
600 # @guest-suspend-hybrid:
602 # Save guest state to disk and suspend to ram.
604 # This command attempts to suspend the guest by executing, in this order:
606 # - systemd hybrid-sleep
607 # - pm-utils (via pm-suspend-hybrid)
609 # IMPORTANT: guest-suspend-hybrid requires working wakeup support in
610 # QEMU. You should check QMP command query-current-machine returns
611 # wakeup-suspend-support: true before issuing this command. Failure in
612 # doing so can result in a suspended guest that QEMU will not be able to
613 # awaken, forcing the user to power cycle the guest to bring it back.
615 # This command does NOT return a response on success. There are two options
616 # to check for success:
618 # 1. Wait for the SUSPEND QMP event from QEMU
619 # 2. Issue the query-status QMP command to confirm the VM status is
622 # The following errors may be returned:
624 # - If hybrid suspend is not supported, Unsupported
626 # Notes: It's strongly recommended to issue the guest-sync command before
627 # sending commands when the guest resumes
631 { 'command': 'guest-suspend-hybrid', 'success-response': false }
634 # @GuestIpAddressType:
636 # An enumeration of supported IP address types
638 # @ipv4: IP version 4
640 # @ipv6: IP version 6
644 { 'enum': 'GuestIpAddressType',
645 'data': [ 'ipv4', 'ipv6' ] }
650 # @ip-address: IP address
652 # @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
654 # @prefix: Network prefix length of @ip-address
658 { 'struct': 'GuestIpAddress',
659 'data': {'ip-address': 'str',
660 'ip-address-type': 'GuestIpAddressType',
664 # @GuestNetworkInterfaceStat:
666 # @rx-bytes: total bytes received
668 # @rx-packets: total packets received
670 # @rx-errs: bad packets received
672 # @rx-dropped: receiver dropped packets
674 # @tx-bytes: total bytes transmitted
676 # @tx-packets: total packets transmitted
678 # @tx-errs: packet transmit problems
680 # @tx-dropped: dropped packets transmitted
684 { 'struct': 'GuestNetworkInterfaceStat',
685 'data': {'rx-bytes': 'uint64',
686 'rx-packets': 'uint64',
688 'rx-dropped': 'uint64',
689 'tx-bytes': 'uint64',
690 'tx-packets': 'uint64',
692 'tx-dropped': 'uint64'
696 # @GuestNetworkInterface:
698 # @name: The name of interface for which info are being delivered
700 # @hardware-address: Hardware address of @name
702 # @ip-addresses: List of addresses assigned to @name
704 # @statistics: various statistic counters related to @name
709 { 'struct': 'GuestNetworkInterface',
710 'data': {'name': 'str',
711 '*hardware-address': 'str',
712 '*ip-addresses': ['GuestIpAddress'],
713 '*statistics': 'GuestNetworkInterfaceStat' } }
716 # @guest-network-get-interfaces:
718 # Get list of guest IP addresses, MAC addresses
721 # Returns: List of GuestNetworkInfo on success.
725 { 'command': 'guest-network-get-interfaces',
726 'returns': ['GuestNetworkInterface'] }
729 # @GuestLogicalProcessor:
731 # @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
733 # @online: Whether the VCPU is enabled.
735 # @can-offline: Whether offlining the VCPU is possible. This member
736 # is always filled in by the guest agent when the structure is
737 # returned, and always ignored on input (hence it can be omitted
742 { 'struct': 'GuestLogicalProcessor',
743 'data': {'logical-id': 'int',
745 '*can-offline': 'bool'} }
750 # Retrieve the list of the guest's logical processors.
752 # This is a read-only operation.
754 # Returns: The list of all VCPUs the guest knows about. Each VCPU is put on the
755 # list exactly once, but their order is unspecified.
759 { 'command': 'guest-get-vcpus',
760 'returns': ['GuestLogicalProcessor'] }
765 # Attempt to reconfigure (currently: enable/disable) logical processors inside
768 # The input list is processed node by node in order. In each node @logical-id
769 # is used to look up the guest VCPU, for which @online specifies the requested
770 # state. The set of distinct @logical-id's is only required to be a subset of
771 # the guest-supported identifiers. There's no restriction on list length or on
772 # repeating the same @logical-id (with possibly different @online field).
773 # Preferably the input list should describe a modified subset of
774 # @guest-get-vcpus' return value.
776 # Returns: The length of the initial sublist that has been successfully
777 # processed. The guest agent maximizes this value. Possible cases:
780 # if the @vcpus list was empty on input. Guest state
781 # has not been changed. Otherwise,
783 # processing the first node of @vcpus failed for the
784 # reason returned. Guest state has not been changed.
786 # - < length(@vcpus):
787 # more than zero initial nodes have been processed,
788 # but not the entire @vcpus list. Guest state has
789 # changed accordingly. To retrieve the error
790 # (assuming it persists), repeat the call with the
791 # successfully processed initial sublist removed.
798 { 'command': 'guest-set-vcpus',
799 'data': {'vcpus': ['GuestLogicalProcessor'] },
805 # An enumeration of bus type of disks
810 # @virtio: virtio disks
816 # @unknown: Unknown bus type
817 # @ieee1394: Win IEEE 1394 bus type
818 # @ssa: Win SSA bus type
819 # @fibre: Win fiber channel bus type
820 # @raid: Win RAID bus type
821 # @iscsi: Win iScsi bus type
822 # @sas: Win serial-attaches SCSI bus type
823 # @mmc: Win multimedia card (MMC) bus type
824 # @virtual: Win virtual bus type
825 # @file-backed-virtual: Win file-backed bus type
827 # Since: 2.2; 'Unknown' and all entries below since 2.4
829 { 'enum': 'GuestDiskBusType',
830 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
831 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
832 'sas', 'mmc', 'virtual', 'file-backed-virtual' ] }
841 # @function: function id
845 { 'struct': 'GuestPCIAddress',
846 'data': {'domain': 'int', 'bus': 'int',
847 'slot': 'int', 'function': 'int'} }
852 # @cssid: channel subsystem image id
853 # @ssid: subchannel set id
854 # @subchno: subchannel number
855 # @devno: device number
859 { 'struct': 'GuestCCWAddress',
860 'data': {'cssid': 'int',
868 # @pci-controller: controller's PCI address (fields are set to -1 if invalid)
869 # @bus-type: bus type
873 # @serial: serial number (since: 3.1)
874 # @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
875 # @ccw-address: CCW address on s390x (since: 6.0)
879 { 'struct': 'GuestDiskAddress',
880 'data': {'pci-controller': 'GuestPCIAddress',
881 'bus-type': 'GuestDiskBusType',
882 'bus': 'int', 'target': 'int', 'unit': 'int',
883 '*serial': 'str', '*dev': 'str',
884 '*ccw-address': 'GuestCCWAddress'} }
889 # @name: device node (Linux) or device UNC (Windows)
890 # @partition: whether this is a partition or disk
891 # @dependencies: list of device dependencies; e.g. for LVs of the LVM this will
892 # hold the list of PVs, for LUKS encrypted volume this will
893 # contain the disk where the volume is placed. (Linux)
894 # @address: disk address information (only for non-virtual devices)
895 # @alias: optional alias assigned to the disk, on Linux this is a name assigned
900 { 'struct': 'GuestDiskInfo',
901 'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
902 '*address': 'GuestDiskAddress', '*alias': 'str'} }
907 # Returns: The list of disks in the guest. For Windows these are only the
908 # physical disks. On Linux these are all root block devices of
909 # non-zero size including e.g. removable devices, loop devices,
914 { 'command': 'guest-get-disks',
915 'returns': ['GuestDiskInfo'] }
918 # @GuestFilesystemInfo:
921 # @mountpoint: mount point path
922 # @type: file system type string
923 # @used-bytes: file system used bytes (since 3.0)
924 # @total-bytes: non-root file system total bytes (since 3.0)
925 # @disk: an array of disk hardware information that the volume lies on,
926 # which may be empty if the disk type is not supported
930 { 'struct': 'GuestFilesystemInfo',
931 'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
932 '*used-bytes': 'uint64', '*total-bytes': 'uint64',
933 'disk': ['GuestDiskAddress']} }
938 # Returns: The list of filesystems information mounted in the guest.
939 # The returned mountpoints may be specified to
940 # @guest-fsfreeze-freeze-list.
941 # Network filesystems (such as CIFS and NFS) are not listed.
945 { 'command': 'guest-get-fsinfo',
946 'returns': ['GuestFilesystemInfo'] }
949 # @guest-set-user-password:
951 # @username: the user account whose password to change
952 # @password: the new password entry string, base64 encoded
953 # @crypted: true if password is already crypt()d, false if raw
955 # If the @crypted flag is true, it is the caller's responsibility
956 # to ensure the correct crypt() encryption scheme is used. This
957 # command does not attempt to interpret or report on the encryption
958 # scheme. Refer to the documentation of the guest operating system
959 # in question to determine what is supported.
961 # Not all guest operating systems will support use of the
962 # @crypted flag, as they may require the clear-text password
964 # The @password parameter must always be base64 encoded before
965 # transmission, even if already crypt()d, to ensure it is 8-bit
966 # safe when passed as JSON.
968 # Returns: Nothing on success.
972 { 'command': 'guest-set-user-password',
973 'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
978 # @phys-index: Arbitrary guest-specific unique identifier of the MEMORY BLOCK.
980 # @online: Whether the MEMORY BLOCK is enabled in guest.
982 # @can-offline: Whether offlining the MEMORY BLOCK is possible.
983 # This member is always filled in by the guest agent when the
984 # structure is returned, and always ignored on input (hence it
985 # can be omitted then).
989 { 'struct': 'GuestMemoryBlock',
990 'data': {'phys-index': 'uint64',
992 '*can-offline': 'bool'} }
995 # @guest-get-memory-blocks:
997 # Retrieve the list of the guest's memory blocks.
999 # This is a read-only operation.
1001 # Returns: The list of all memory blocks the guest knows about.
1002 # Each memory block is put on the list exactly once, but their order
1007 { 'command': 'guest-get-memory-blocks',
1008 'returns': ['GuestMemoryBlock'] }
1011 # @GuestMemoryBlockResponseType:
1013 # An enumeration of memory block operation result.
1015 # @success: the operation of online/offline memory block is successful.
1016 # @not-found: can't find the corresponding memoryXXX directory in sysfs.
1017 # @operation-not-supported: for some old kernels, it does not support
1018 # online or offline memory block.
1019 # @operation-failed: the operation of online/offline memory block fails,
1020 # because of some errors happen.
1024 { 'enum': 'GuestMemoryBlockResponseType',
1025 'data': ['success', 'not-found', 'operation-not-supported',
1026 'operation-failed'] }
1029 # @GuestMemoryBlockResponse:
1031 # @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1033 # @response: the result of memory block operation.
1035 # @error-code: the error number.
1036 # When memory block operation fails, we assign the value of
1037 # 'errno' to this member, it indicates what goes wrong.
1038 # When the operation succeeds, it will be omitted.
1042 { 'struct': 'GuestMemoryBlockResponse',
1043 'data': { 'phys-index': 'uint64',
1044 'response': 'GuestMemoryBlockResponseType',
1045 '*error-code': 'int' }}
1048 # @guest-set-memory-blocks:
1050 # Attempt to reconfigure (currently: enable/disable) state of memory blocks
1053 # The input list is processed node by node in order. In each node @phys-index
1054 # is used to look up the guest MEMORY BLOCK, for which @online specifies the
1055 # requested state. The set of distinct @phys-index's is only required to be a
1056 # subset of the guest-supported identifiers. There's no restriction on list
1057 # length or on repeating the same @phys-index (with possibly different @online
1059 # Preferably the input list should describe a modified subset of
1060 # @guest-get-memory-blocks' return value.
1062 # Returns: The operation results, it is a list of @GuestMemoryBlockResponse,
1063 # which is corresponding to the input list.
1065 # Note: it will return NULL if the @mem-blks list was empty on input,
1066 # or there is an error, and in this case, guest state will not be
1071 { 'command': 'guest-set-memory-blocks',
1072 'data': {'mem-blks': ['GuestMemoryBlock'] },
1073 'returns': ['GuestMemoryBlockResponse'] }
1076 # @GuestMemoryBlockInfo:
1078 # @size: the size (in bytes) of the guest memory blocks,
1079 # which are the minimal units of memory block online/offline
1080 # operations (also called Logical Memory Hotplug).
1084 { 'struct': 'GuestMemoryBlockInfo',
1085 'data': {'size': 'uint64'} }
1088 # @guest-get-memory-block-info:
1090 # Get information relating to guest memory blocks.
1092 # Returns: @GuestMemoryBlockInfo
1096 { 'command': 'guest-get-memory-block-info',
1097 'returns': 'GuestMemoryBlockInfo' }
1102 # @exited: true if process has already terminated.
1103 # @exitcode: process exit code if it was normally terminated.
1104 # @signal: signal number (linux) or unhandled exception code
1105 # (windows) if the process was abnormally terminated.
1106 # @out-data: base64-encoded stdout of the process
1107 # @err-data: base64-encoded stderr of the process
1108 # Note: @out-data and @err-data are present only
1109 # if 'capture-output' was specified for 'guest-exec'
1110 # @out-truncated: true if stdout was not fully captured
1111 # due to size limitation.
1112 # @err-truncated: true if stderr was not fully captured
1113 # due to size limitation.
1117 { 'struct': 'GuestExecStatus',
1118 'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1119 '*out-data': 'str', '*err-data': 'str',
1120 '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1122 # @guest-exec-status:
1124 # Check status of process associated with PID retrieved via guest-exec.
1125 # Reap the process and associated metadata if it has exited.
1127 # @pid: pid returned from guest-exec
1129 # Returns: GuestExecStatus on success.
1133 { 'command': 'guest-exec-status',
1134 'data': { 'pid': 'int' },
1135 'returns': 'GuestExecStatus' }
1139 # @pid: pid of child process in guest OS
1143 { 'struct': 'GuestExec',
1144 'data': { 'pid': 'int'} }
1149 # Execute a command in the guest
1151 # @path: path or executable name to execute
1152 # @arg: argument list to pass to executable
1153 # @env: environment variables to pass to executable
1154 # @input-data: data to be passed to process stdin (base64 encoded)
1155 # @capture-output: bool flag to enable capture of
1156 # stdout/stderr of running process. defaults to false.
1158 # Returns: PID on success.
1162 { 'command': 'guest-exec',
1163 'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1164 '*input-data': 'str', '*capture-output': 'bool' },
1165 'returns': 'GuestExec' }
1170 # @host-name: Fully qualified domain name of the guest OS
1174 { 'struct': 'GuestHostName',
1175 'data': { 'host-name': 'str' } }
1178 # @guest-get-host-name:
1180 # Return a name for the machine.
1182 # The returned name is not necessarily a fully-qualified domain name, or even
1183 # present in DNS or some other name service at all. It need not even be unique
1184 # on your local network or site, but usually it is.
1186 # Returns: the host name of the machine on success
1190 { 'command': 'guest-get-host-name',
1191 'returns': 'GuestHostName' }
1197 # @domain: Logon domain (windows only)
1198 # @login-time: Time of login of this user on the computer. If multiple
1199 # instances of the user are logged in, the earliest login time is
1200 # reported. The value is in fractional seconds since epoch time.
1204 { 'struct': 'GuestUser',
1205 'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1209 # Retrieves a list of currently active users on the VM.
1211 # Returns: A unique list of users.
1215 { 'command': 'guest-get-users',
1216 'returns': ['GuestUser'] }
1221 # @zone: Timezone name. These values may differ depending on guest/OS and
1222 # should only be used for informational purposes.
1223 # @offset: Offset to UTC in seconds, negative numbers for time zones west of
1224 # GMT, positive numbers for east
1228 { 'struct': 'GuestTimezone',
1229 'data': { '*zone': 'str', 'offset': 'int' } }
1232 # @guest-get-timezone:
1234 # Retrieves the timezone information from the guest.
1236 # Returns: A GuestTimezone dictionary.
1240 { 'command': 'guest-get-timezone',
1241 'returns': 'GuestTimezone' }
1247 # * POSIX: release field returned by uname(2)
1248 # * Windows: build number of the OS
1250 # * POSIX: version field returned by uname(2)
1251 # * Windows: version number of the OS
1253 # * POSIX: machine field returned by uname(2)
1254 # * Windows: one of x86, x86_64, arm, ia64
1256 # * POSIX: as defined by os-release(5)
1257 # * Windows: contains string "mswindows"
1259 # * POSIX: as defined by os-release(5)
1260 # * Windows: contains string "Microsoft Windows"
1262 # * POSIX: as defined by os-release(5)
1263 # * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1265 # * POSIX: as defined by os-release(5)
1266 # * Windows: long version string, e.g. "Microsoft Windows Server 2008"
1268 # * POSIX: as defined by os-release(5)
1269 # * Windows: short version identifier, e.g. "7" or "20012r2"
1271 # * POSIX: as defined by os-release(5)
1272 # * Windows: contains string "server" or "client"
1274 # * POSIX: as defined by os-release(5)
1275 # * Windows: contains string "server" or "client"
1279 # On POSIX systems the fields @id, @name, @pretty-name, @version, @version-id,
1280 # @variant and @variant-id follow the definition specified in os-release(5).
1281 # Refer to the manual page for exact description of the fields. Their values
1282 # are taken from the os-release file. If the file is not present in the system,
1283 # or the values are not present in the file, the fields are not included.
1285 # On Windows the values are filled from information gathered from the system.
1289 { 'struct': 'GuestOSInfo',
1291 '*kernel-release': 'str', '*kernel-version': 'str',
1292 '*machine': 'str', '*id': 'str', '*name': 'str',
1293 '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1294 '*variant': 'str', '*variant-id': 'str' } }
1297 # @guest-get-osinfo:
1299 # Retrieve guest operating system information
1301 # Returns: @GuestOSInfo
1305 { 'command': 'guest-get-osinfo',
1306 'returns': 'GuestOSInfo' }
1311 { 'enum': 'GuestDeviceType',
1315 # @GuestDeviceIdPCI:
1317 # @vendor-id: vendor ID
1318 # @device-id: device ID
1322 { 'struct': 'GuestDeviceIdPCI',
1323 'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1329 # - @pci: PCI ID, since: 5.2
1333 { 'union': 'GuestDeviceId',
1334 'base': { 'type': 'GuestDeviceType' },
1335 'discriminator': 'type',
1336 'data': { 'pci': 'GuestDeviceIdPCI' } }
1341 # @driver-name: name of the associated driver
1342 # @driver-date: driver release date, in nanoseconds since the epoch
1343 # @driver-version: driver version
1348 { 'struct': 'GuestDeviceInfo',
1350 'driver-name': 'str',
1351 '*driver-date': 'int',
1352 '*driver-version': 'str',
1353 '*id': 'GuestDeviceId'
1357 # @guest-get-devices:
1359 # Retrieve information about device drivers in Windows guest
1361 # Returns: @GuestDeviceInfo
1365 { 'command': 'guest-get-devices',
1366 'returns': ['GuestDeviceInfo'] }
1369 # @GuestAuthorizedKeys:
1371 # @keys: public keys (in OpenSSH/sshd(8) authorized_keys format)
1375 { 'struct': 'GuestAuthorizedKeys',
1379 'if': 'defined(CONFIG_POSIX)' }
1383 # @guest-ssh-get-authorized-keys:
1385 # @username: the user account to add the authorized keys
1387 # Return the public keys from user .ssh/authorized_keys on Unix systems (not
1388 # implemented for other systems).
1390 # Returns: @GuestAuthorizedKeys
1394 { 'command': 'guest-ssh-get-authorized-keys',
1395 'data': { 'username': 'str' },
1396 'returns': 'GuestAuthorizedKeys',
1397 'if': 'defined(CONFIG_POSIX)' }
1400 # @guest-ssh-add-authorized-keys:
1402 # @username: the user account to add the authorized keys
1403 # @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys format)
1404 # @reset: ignore the existing content, set it with the given keys only
1406 # Append public keys to user .ssh/authorized_keys on Unix systems (not
1407 # implemented for other systems).
1409 # Returns: Nothing on success.
1413 { 'command': 'guest-ssh-add-authorized-keys',
1414 'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' },
1415 'if': 'defined(CONFIG_POSIX)' }
1418 # @guest-ssh-remove-authorized-keys:
1420 # @username: the user account to remove the authorized keys
1421 # @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys format)
1423 # Remove public keys from the user .ssh/authorized_keys on Unix systems (not
1424 # implemented for other systems). It's not an error if the key is already
1427 # Returns: Nothing on success.
1431 { 'command': 'guest-ssh-remove-authorized-keys',
1432 'data': { 'username': 'str', 'keys': ['str'] },
1433 'if': 'defined(CONFIG_POSIX)' }