xref: /qemu/qga/qapi-schema.json (revision 401e311f)
1# *-*- Mode: Python -*-*
2# vim: filetype=python
3
4##
5# = General note concerning the use of guest agent interfaces
6#
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.
11##
12
13##
14# = QEMU guest agent protocol commands and structs
15##
16
17{ 'pragma': { 'doc-required': true } }
18
19# Lists with items allowed to permit QAPI rule violations; think twice
20# before you add to them!
21{ 'pragma': {
22    # Types whose member names may use '_'
23    'member-name-exceptions': [
24        'GuestAgentInfo'
25    ],
26    # Commands allowed to return a non-dictionary:
27    'command-returns-exceptions': [
28        'guest-file-open',
29        'guest-fsfreeze-freeze',
30        'guest-fsfreeze-freeze-list',
31        'guest-fsfreeze-status',
32        'guest-fsfreeze-thaw',
33        'guest-get-time',
34        'guest-set-vcpus',
35        'guest-sync',
36        'guest-sync-delimited' ],
37    # Types and commands with undocumented members:
38    'documentation-exceptions': [
39        'GuestNVMeSmart' ] } }
40
41##
42# @guest-sync-delimited:
43#
44# Echo back a unique integer value, and prepend to response a leading
45# sentinel byte (0xFF) the client can check scan for.
46#
47# This is used by clients talking to the guest agent over the wire to
48# ensure the stream is in sync and doesn't contain stale data from
49# previous client.  It must be issued upon initial connection, and
50# after any client-side timeouts (including timeouts on receiving a
51# response to this command).
52#
53# After issuing this request, all guest agent responses should be
54# ignored until the response containing the unique integer value the
55# client passed in is returned.  Receival of the 0xFF sentinel byte
56# must be handled as an indication that the client's
57# lexer/tokenizer/parser state should be flushed/reset in preparation
58# for reliably receiving the subsequent response.  As an optimization,
59# clients may opt to ignore all data until a sentinel value is
60# receiving to avoid unnecessary processing of stale data.
61#
62# Similarly, clients should also precede this *request* with a 0xFF
63# byte to make sure the guest agent flushes any partially read JSON
64# data from a previous client connection.
65#
66# @id: randomly generated 64-bit integer
67#
68# Returns: The unique integer id passed in by the client
69#
70# Since: 1.1
71##
72{ 'command': 'guest-sync-delimited',
73  'data':    { 'id': 'int' },
74  'returns': 'int' }
75
76##
77# @guest-sync:
78#
79# Echo back a unique integer value
80#
81# This is used by clients talking to the guest agent over the wire to
82# ensure the stream is in sync and doesn't contain stale data from
83# previous client.  All guest agent responses should be ignored until
84# the provided unique integer value is returned, and it is up to the
85# client to handle stale whole or partially-delivered JSON text in
86# such a way that this response can be obtained.
87#
88# In cases where a partial stale response was previously received by
89# the client, this cannot always be done reliably.  One particular
90# scenario being if qemu-ga responses are fed character-by-character
91# into a JSON parser.  In these situations, using guest-sync-delimited
92# may be optimal.
93#
94# For clients that fetch responses line by line and convert them to
95# JSON objects, guest-sync should be sufficient, but note that in
96# cases where the channel is dirty some attempts at parsing the
97# response may result in a parser error.
98#
99# Such clients should also precede this command with a 0xFF byte to
100# make sure the guest agent flushes any partially read JSON data from
101# a previous session.
102#
103# @id: randomly generated 64-bit integer
104#
105# Returns: The unique integer id passed in by the client
106#
107# Since: 0.15.0
108##
109{ 'command': 'guest-sync',
110  'data':    { 'id': 'int' },
111  'returns': 'int' }
112
113##
114# @guest-ping:
115#
116# Ping the guest agent, a non-error return implies success
117#
118# Since: 0.15.0
119##
120{ 'command': 'guest-ping' }
121
122##
123# @guest-get-time:
124#
125# Get the information about guest's System Time relative to the Epoch
126# of 1970-01-01 in UTC.
127#
128# Returns: Time in nanoseconds.
129#
130# Since: 1.5
131##
132{ 'command': 'guest-get-time',
133  'returns': 'int' }
134
135##
136# @guest-set-time:
137#
138# Set guest time.
139#
140# When a guest is paused or migrated to a file then loaded from that
141# file, the guest OS has no idea that there was a big gap in the time.
142# Depending on how long the gap was, NTP might not be able to
143# resynchronize the guest.
144#
145# This command tries to set guest's System Time to the given value,
146# then sets the Hardware Clock (RTC) to the current System Time.  This
147# will make it easier for a guest to resynchronize without waiting for
148# NTP. If no @time is specified, then the time to set is read from
149# RTC. However, this may not be supported on all platforms (i.e.
150# Windows). If that's the case users are advised to always pass a
151# value.
152#
153# @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in
154#     UTC.
155#
156# Returns: Nothing on success.
157#
158# Since: 1.5
159##
160{ 'command': 'guest-set-time',
161  'data': { '*time': 'int' } }
162
163##
164# @GuestAgentCommandInfo:
165#
166# Information about guest agent commands.
167#
168# @name: name of the command
169#
170# @enabled: whether command is currently enabled by guest admin
171#
172# @success-response: whether command returns a response on success
173#     (since 1.7)
174#
175# Since: 1.1.0
176##
177{ 'struct': 'GuestAgentCommandInfo',
178  'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
179
180##
181# @GuestAgentInfo:
182#
183# Information about guest agent.
184#
185# @version: guest agent version
186#
187# @supported_commands: Information about guest agent commands
188#
189# Since: 0.15.0
190##
191{ 'struct': 'GuestAgentInfo',
192  'data': { 'version': 'str',
193            'supported_commands': ['GuestAgentCommandInfo'] } }
194##
195# @guest-info:
196#
197# Get some information about the guest agent.
198#
199# Returns: @GuestAgentInfo
200#
201# Since: 0.15.0
202##
203{ 'command': 'guest-info',
204  'returns': 'GuestAgentInfo' }
205
206##
207# @guest-shutdown:
208#
209# Initiate guest-activated shutdown.  Note: this is an asynchronous
210# shutdown request, with no guarantee of successful shutdown.
211#
212# @mode: "halt", "powerdown" (default), or "reboot"
213#
214# This command does NOT return a response on success.  Success
215# condition is indicated by the VM exiting with a zero exit status or,
216# when running with --no-shutdown, by issuing the query-status QMP
217# command to confirm the VM status is "shutdown".
218#
219# Since: 0.15.0
220##
221{ 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
222  'success-response': false }
223
224##
225# @guest-file-open:
226#
227# Open a file in the guest and retrieve a file handle for it
228#
229# @path: Full path to the file in the guest to open.
230#
231# @mode: open mode, as per fopen(), "r" is the default.
232#
233# Returns: Guest file handle on success.
234#
235# Since: 0.15.0
236##
237{ 'command': 'guest-file-open',
238  'data':    { 'path': 'str', '*mode': 'str' },
239  'returns': 'int' }
240
241##
242# @guest-file-close:
243#
244# Close an open file in the guest
245#
246# @handle: filehandle returned by guest-file-open
247#
248# Returns: Nothing on success.
249#
250# Since: 0.15.0
251##
252{ 'command': 'guest-file-close',
253  'data': { 'handle': 'int' } }
254
255##
256# @GuestFileRead:
257#
258# Result of guest agent file-read operation
259#
260# @count: number of bytes read (note: count is *before*
261#     base64-encoding is applied)
262#
263# @buf-b64: base64-encoded bytes read
264#
265# @eof: whether EOF was encountered during read operation.
266#
267# Since: 0.15.0
268##
269{ 'struct': 'GuestFileRead',
270  'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
271
272##
273# @guest-file-read:
274#
275# Read from an open file in the guest.  Data will be base64-encoded.
276# As this command is just for limited, ad-hoc debugging, such as log
277# file access, the number of bytes to read is limited to 48 MB.
278#
279# @handle: filehandle returned by guest-file-open
280#
281# @count: maximum number of bytes to read (default is 4KB, maximum is
282#     48MB)
283#
284# Returns: @GuestFileRead on success.
285#
286# Since: 0.15.0
287##
288{ 'command': 'guest-file-read',
289  'data':    { 'handle': 'int', '*count': 'int' },
290  'returns': 'GuestFileRead' }
291
292##
293# @GuestFileWrite:
294#
295# Result of guest agent file-write operation
296#
297# @count: number of bytes written (note: count is actual bytes
298#     written, after base64-decoding of provided buffer)
299#
300# @eof: whether EOF was encountered during write operation.
301#
302# Since: 0.15.0
303##
304{ 'struct': 'GuestFileWrite',
305  'data': { 'count': 'int', 'eof': 'bool' } }
306
307##
308# @guest-file-write:
309#
310# Write to an open file in the guest.
311#
312# @handle: filehandle returned by guest-file-open
313#
314# @buf-b64: base64-encoded string representing data to be written
315#
316# @count: bytes to write (actual bytes, after base64-decode), default
317#     is all content in buf-b64 buffer after base64 decoding
318#
319# Returns: @GuestFileWrite on success.
320#
321# Since: 0.15.0
322##
323{ 'command': 'guest-file-write',
324  'data':    { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
325  'returns': 'GuestFileWrite' }
326
327
328##
329# @GuestFileSeek:
330#
331# Result of guest agent file-seek operation
332#
333# @position: current file position
334#
335# @eof: whether EOF was encountered during file seek
336#
337# Since: 0.15.0
338##
339{ 'struct': 'GuestFileSeek',
340  'data': { 'position': 'int', 'eof': 'bool' } }
341
342##
343# @QGASeek:
344#
345# Symbolic names for use in @guest-file-seek
346#
347# @set: Set to the specified offset (same effect as 'whence':0)
348#
349# @cur: Add offset to the current location (same effect as 'whence':1)
350#
351# @end: Add offset to the end of the file (same effect as 'whence':2)
352#
353# Since: 2.6
354##
355{ 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
356
357##
358# @GuestFileWhence:
359#
360# Controls the meaning of offset to @guest-file-seek.
361#
362# @value: Integral value (0 for set, 1 for cur, 2 for end), available
363#     for historical reasons, and might differ from the host's or
364#     guest's SEEK_* values (since: 0.15)
365#
366# @name: Symbolic name, and preferred interface
367#
368# Since: 2.6
369##
370{ 'alternate': 'GuestFileWhence',
371  'data': { 'value': 'int', 'name': 'QGASeek' } }
372
373##
374# @guest-file-seek:
375#
376# Seek to a position in the file, as with fseek(), and return the
377# current file position afterward.  Also encapsulates ftell()'s
378# functionality, with offset=0 and whence=1.
379#
380# @handle: filehandle returned by guest-file-open
381#
382# @offset: bytes to skip over in the file stream
383#
384# @whence: Symbolic or numeric code for interpreting offset
385#
386# Returns: @GuestFileSeek on success.
387#
388# Since: 0.15.0
389##
390{ 'command': 'guest-file-seek',
391  'data':    { 'handle': 'int', 'offset': 'int',
392               'whence': 'GuestFileWhence' },
393  'returns': 'GuestFileSeek' }
394
395##
396# @guest-file-flush:
397#
398# Write file changes buffered in userspace to disk/kernel buffers
399#
400# @handle: filehandle returned by guest-file-open
401#
402# Returns: Nothing on success.
403#
404# Since: 0.15.0
405##
406{ 'command': 'guest-file-flush',
407  'data': { 'handle': 'int' } }
408
409##
410# @GuestFsfreezeStatus:
411#
412# An enumeration of filesystem freeze states
413#
414# @thawed: filesystems thawed/unfrozen
415#
416# @frozen: all non-network guest filesystems frozen
417#
418# Since: 0.15.0
419##
420{ 'enum': 'GuestFsfreezeStatus',
421  'data': [ 'thawed', 'frozen' ] }
422
423##
424# @guest-fsfreeze-status:
425#
426# Get guest fsfreeze state.
427#
428# Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined
429#     below)
430#
431# Note: This may fail to properly report the current state as a result
432#     of some other guest processes having issued an fs freeze/thaw.
433#
434# Since: 0.15.0
435##
436{ 'command': 'guest-fsfreeze-status',
437  'returns': 'GuestFsfreezeStatus' }
438
439##
440# @guest-fsfreeze-freeze:
441#
442# Sync and freeze all freezable, local guest filesystems.  If this
443# command succeeded, you may call @guest-fsfreeze-thaw later to
444# unfreeze.
445#
446# Note: On Windows, the command is implemented with the help of a
447#     Volume Shadow-copy Service DLL helper.  The frozen state is
448#     limited for up to 10 seconds by VSS.
449#
450# Returns: Number of file systems currently frozen.  On error, all
451#     filesystems will be thawed.  If no filesystems are frozen as a
452#     result of this call, then @guest-fsfreeze-status will remain
453#     "thawed" and calling @guest-fsfreeze-thaw is not necessary.
454#
455# Since: 0.15.0
456##
457{ 'command': 'guest-fsfreeze-freeze',
458  'returns': 'int' }
459
460##
461# @guest-fsfreeze-freeze-list:
462#
463# Sync and freeze specified guest filesystems.  See also
464# @guest-fsfreeze-freeze.
465#
466# @mountpoints: an array of mountpoints of filesystems to be frozen.
467#     If omitted, every mounted filesystem is frozen.  Invalid mount
468#     points are ignored.
469#
470# Returns: Number of file systems currently frozen.  On error, all
471#     filesystems will be thawed.
472#
473# Since: 2.2
474##
475{ 'command': 'guest-fsfreeze-freeze-list',
476  'data':    { '*mountpoints': ['str'] },
477  'returns': 'int' }
478
479##
480# @guest-fsfreeze-thaw:
481#
482# Unfreeze all frozen guest filesystems
483#
484# Returns: Number of file systems thawed by this call
485#
486# Note: if return value does not match the previous call to
487#     guest-fsfreeze-freeze, this likely means some freezable
488#     filesystems were unfrozen before this call, and that the
489#     filesystem state may have changed before issuing this command.
490#
491# Since: 0.15.0
492##
493{ 'command': 'guest-fsfreeze-thaw',
494  'returns': 'int' }
495
496##
497# @GuestFilesystemTrimResult:
498#
499# @path: path that was trimmed
500#
501# @error: an error message when trim failed
502#
503# @trimmed: bytes trimmed for this path
504#
505# @minimum: reported effective minimum for this path
506#
507# Since: 2.4
508##
509{ 'struct': 'GuestFilesystemTrimResult',
510  'data': {'path': 'str',
511           '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
512
513##
514# @GuestFilesystemTrimResponse:
515#
516# @paths: list of @GuestFilesystemTrimResult per path that was trimmed
517#
518# Since: 2.4
519##
520{ 'struct': 'GuestFilesystemTrimResponse',
521  'data': {'paths': ['GuestFilesystemTrimResult']} }
522
523##
524# @guest-fstrim:
525#
526# Discard (or "trim") blocks which are not in use by the filesystem.
527#
528# @minimum: Minimum contiguous free range to discard, in bytes.  Free
529#     ranges smaller than this may be ignored (this is a hint and the
530#     guest may not respect it).  By increasing this value, the fstrim
531#     operation will complete more quickly for filesystems with badly
532#     fragmented free space, although not all blocks will be
533#     discarded.  The default value is zero, meaning "discard every
534#     free block".
535#
536# Returns: A @GuestFilesystemTrimResponse which contains the status of
537#     all trimmed paths.  (since 2.4)
538#
539# Since: 1.2
540##
541{ 'command': 'guest-fstrim',
542  'data': { '*minimum': 'int' },
543  'returns': 'GuestFilesystemTrimResponse' }
544
545##
546# @guest-suspend-disk:
547#
548# Suspend guest to disk.
549#
550# This command attempts to suspend the guest using three strategies,
551# in this order:
552#
553# - systemd hibernate
554# - pm-utils (via pm-hibernate)
555# - manual write into sysfs
556#
557# This command does NOT return a response on success.  There is a high
558# chance the command succeeded if the VM exits with a zero exit status
559# or, when running with --no-shutdown, by issuing the query-status QMP
560# command to to confirm the VM status is "shutdown". However, the VM
561# could also exit (or set its status to "shutdown") due to other
562# reasons.
563#
564# The following errors may be returned:
565#
566# - If suspend to disk is not supported, Unsupported
567#
568# Notes: It's strongly recommended to issue the guest-sync command
569#     before sending commands when the guest resumes
570#
571# Since: 1.1
572##
573{ 'command': 'guest-suspend-disk', 'success-response': false }
574
575##
576# @guest-suspend-ram:
577#
578# Suspend guest to ram.
579#
580# This command attempts to suspend the guest using three strategies,
581# in this order:
582#
583# - systemd hibernate
584# - pm-utils (via pm-hibernate)
585# - manual write into sysfs
586#
587# IMPORTANT: guest-suspend-ram requires working wakeup support in
588# QEMU. You should check QMP command query-current-machine returns
589# wakeup-suspend-support: true before issuing this command.  Failure
590# in doing so can result in a suspended guest that QEMU will not be
591# able to awaken, forcing the user to power cycle the guest to bring
592# it back.
593#
594# This command does NOT return a response on success.  There are two
595# options to check for success:
596#
597# 1. Wait for the SUSPEND QMP event from QEMU
598# 2. Issue the query-status QMP command to confirm the VM status is
599#    "suspended"
600#
601# The following errors may be returned:
602#
603# - If suspend to ram is not supported, Unsupported
604#
605# Notes: It's strongly recommended to issue the guest-sync command
606#     before sending commands when the guest resumes
607#
608# Since: 1.1
609##
610{ 'command': 'guest-suspend-ram', 'success-response': false }
611
612##
613# @guest-suspend-hybrid:
614#
615# Save guest state to disk and suspend to ram.
616#
617# This command attempts to suspend the guest by executing, in this
618# order:
619#
620# - systemd hybrid-sleep
621# - pm-utils (via pm-suspend-hybrid)
622#
623# IMPORTANT: guest-suspend-hybrid requires working wakeup support in
624# QEMU. You should check QMP command query-current-machine returns
625# wakeup-suspend-support: true before issuing this command.  Failure
626# in doing so can result in a suspended guest that QEMU will not be
627# able to awaken, forcing the user to power cycle the guest to bring
628# it back.
629#
630# This command does NOT return a response on success.  There are two
631# options to check for success:
632#
633# 1. Wait for the SUSPEND QMP event from QEMU
634# 2. Issue the query-status QMP command to confirm the VM status is
635#    "suspended"
636#
637# The following errors may be returned:
638#
639# - If hybrid suspend is not supported, Unsupported
640#
641# Notes: It's strongly recommended to issue the guest-sync command
642#     before sending commands when the guest resumes
643#
644# Since: 1.1
645##
646{ 'command': 'guest-suspend-hybrid', 'success-response': false }
647
648##
649# @GuestIpAddressType:
650#
651# An enumeration of supported IP address types
652#
653# @ipv4: IP version 4
654#
655# @ipv6: IP version 6
656#
657# Since: 1.1
658##
659{ 'enum': 'GuestIpAddressType',
660  'data': [ 'ipv4', 'ipv6' ] }
661
662##
663# @GuestIpAddress:
664#
665# @ip-address: IP address
666#
667# @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
668#
669# @prefix: Network prefix length of @ip-address
670#
671# Since: 1.1
672##
673{ 'struct': 'GuestIpAddress',
674  'data': {'ip-address': 'str',
675           'ip-address-type': 'GuestIpAddressType',
676           'prefix': 'int'} }
677
678##
679# @GuestNetworkInterfaceStat:
680#
681# @rx-bytes: total bytes received
682#
683# @rx-packets: total packets received
684#
685# @rx-errs: bad packets received
686#
687# @rx-dropped: receiver dropped packets
688#
689# @tx-bytes: total bytes transmitted
690#
691# @tx-packets: total packets transmitted
692#
693# @tx-errs: packet transmit problems
694#
695# @tx-dropped: dropped packets transmitted
696#
697# Since: 2.11
698##
699{ 'struct': 'GuestNetworkInterfaceStat',
700  'data': {'rx-bytes': 'uint64',
701            'rx-packets': 'uint64',
702            'rx-errs': 'uint64',
703            'rx-dropped': 'uint64',
704            'tx-bytes': 'uint64',
705            'tx-packets': 'uint64',
706            'tx-errs': 'uint64',
707            'tx-dropped': 'uint64'
708           } }
709
710##
711# @GuestNetworkInterface:
712#
713# @name: The name of interface for which info are being delivered
714#
715# @hardware-address: Hardware address of @name
716#
717# @ip-addresses: List of addresses assigned to @name
718#
719# @statistics: various statistic counters related to @name (since
720#     2.11)
721#
722# Since: 1.1
723##
724{ 'struct': 'GuestNetworkInterface',
725  'data': {'name': 'str',
726           '*hardware-address': 'str',
727           '*ip-addresses': ['GuestIpAddress'],
728           '*statistics': 'GuestNetworkInterfaceStat' } }
729
730##
731# @guest-network-get-interfaces:
732#
733# Get list of guest IP addresses, MAC addresses and netmasks.
734#
735# Returns: List of GuestNetworkInterface on success.
736#
737# Since: 1.1
738##
739{ 'command': 'guest-network-get-interfaces',
740  'returns': ['GuestNetworkInterface'] }
741
742##
743# @GuestLogicalProcessor:
744#
745# @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
746#
747# @online: Whether the VCPU is enabled.
748#
749# @can-offline: Whether offlining the VCPU is possible.  This member
750#     is always filled in by the guest agent when the structure is
751#     returned, and always ignored on input (hence it can be omitted
752#     then).
753#
754# Since: 1.5
755##
756{ 'struct': 'GuestLogicalProcessor',
757  'data': {'logical-id': 'int',
758           'online': 'bool',
759           '*can-offline': 'bool'} }
760
761##
762# @guest-get-vcpus:
763#
764# Retrieve the list of the guest's logical processors.
765#
766# This is a read-only operation.
767#
768# Returns: The list of all VCPUs the guest knows about.  Each VCPU is
769#     put on the list exactly once, but their order is unspecified.
770#
771# Since: 1.5
772##
773{ 'command': 'guest-get-vcpus',
774  'returns': ['GuestLogicalProcessor'] }
775
776##
777# @guest-set-vcpus:
778#
779# Attempt to reconfigure (currently: enable/disable) logical
780# processors inside the guest.
781#
782# @vcpus: The logical processors to be reconfigured.  This list is
783#     processed node by node in order.  In each node @logical-id is
784#     used to look up the guest VCPU, for which @online specifies the
785#     requested state.  The set of distinct @logical-id's is only
786#     required to be a subset of the guest-supported identifiers.
787#     There's no restriction on list length or on repeating the same
788#     @logical-id (with possibly different @online field).  Preferably
789#     the input list should describe a modified subset of
790#     @guest-get-vcpus' return value.
791#
792# Returns: The length of the initial sublist that has been
793#     successfully processed.  The guest agent maximizes this value.
794#     Possible cases:
795#
796#     - 0:
797#       if the @vcpus list was empty on input.  Guest state has not
798#       been changed.  Otherwise,
799#     - Error:
800#       processing the first node of @vcpus failed for the reason
801#       returned.  Guest state has not been changed.  Otherwise,
802#     - < length(@vcpus):
803#       more than zero initial nodes have been processed, but not the
804#       entire @vcpus list.  Guest state has changed accordingly.  To
805#       retrieve the error (assuming it persists), repeat the call
806#       with the successfully processed initial sublist removed.
807#       Otherwise,
808#     - length(@vcpus):
809#       call successful.
810#
811# Since: 1.5
812##
813{ 'command': 'guest-set-vcpus',
814  'data':    {'vcpus': ['GuestLogicalProcessor'] },
815  'returns': 'int' }
816
817##
818# @GuestDiskBusType:
819#
820# An enumeration of bus type of disks
821#
822# @ide: IDE disks
823#
824# @fdc: floppy disks
825#
826# @scsi: SCSI disks
827#
828# @virtio: virtio disks
829#
830# @xen: Xen disks
831#
832# @usb: USB disks
833#
834# @uml: UML disks
835#
836# @sata: SATA disks
837#
838# @sd: SD cards
839#
840# @unknown: Unknown bus type
841#
842# @ieee1394: Win IEEE 1394 bus type
843#
844# @ssa: Win SSA bus type
845#
846# @fibre: Win fiber channel bus type
847#
848# @raid: Win RAID bus type
849#
850# @iscsi: Win iScsi bus type
851#
852# @sas: Win serial-attaches SCSI bus type
853#
854# @mmc: Win multimedia card (MMC) bus type
855#
856# @virtual: Win virtual bus type
857#
858# @file-backed-virtual: Win file-backed bus type
859#
860# @nvme: NVMe disks (since 7.1)
861#
862# Since: 2.2; 'Unknown' and all entries below since 2.4
863##
864{ 'enum': 'GuestDiskBusType',
865  'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
866            'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
867            'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] }
868
869
870##
871# @GuestPCIAddress:
872#
873# @domain: domain id
874#
875# @bus: bus id
876#
877# @slot: slot id
878#
879# @function: function id
880#
881# Since: 2.2
882##
883{ 'struct': 'GuestPCIAddress',
884  'data': {'domain': 'int', 'bus': 'int',
885           'slot': 'int', 'function': 'int'} }
886
887##
888# @GuestCCWAddress:
889#
890# @cssid: channel subsystem image id
891#
892# @ssid: subchannel set id
893#
894# @subchno: subchannel number
895#
896# @devno: device number
897#
898# Since: 6.0
899##
900{ 'struct': 'GuestCCWAddress',
901  'data': {'cssid': 'int',
902           'ssid': 'int',
903           'subchno': 'int',
904           'devno': 'int'} }
905
906##
907# @GuestDiskAddress:
908#
909# @pci-controller: controller's PCI address (fields are set to -1 if
910#     invalid)
911#
912# @bus-type: bus type
913#
914# @bus: bus id
915#
916# @target: target id
917#
918# @unit: unit id
919#
920# @serial: serial number (since: 3.1)
921#
922# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
923#
924# @ccw-address: CCW address on s390x (since: 6.0)
925#
926# Since: 2.2
927##
928{ 'struct': 'GuestDiskAddress',
929  'data': {'pci-controller': 'GuestPCIAddress',
930           'bus-type': 'GuestDiskBusType',
931           'bus': 'int', 'target': 'int', 'unit': 'int',
932           '*serial': 'str', '*dev': 'str',
933           '*ccw-address': 'GuestCCWAddress'} }
934
935##
936# @GuestNVMeSmart:
937#
938# NVMe smart information, based on NVMe specification, section
939# <SMART / Health Information (Log Identifier 02h)>
940#
941# TODO: document members briefly
942#
943# Since: 7.1
944##
945{ 'struct': 'GuestNVMeSmart',
946  'data': {'critical-warning': 'int',
947           'temperature': 'int',
948           'available-spare': 'int',
949           'available-spare-threshold': 'int',
950           'percentage-used': 'int',
951           'data-units-read-lo': 'uint64',
952           'data-units-read-hi': 'uint64',
953           'data-units-written-lo': 'uint64',
954           'data-units-written-hi': 'uint64',
955           'host-read-commands-lo': 'uint64',
956           'host-read-commands-hi': 'uint64',
957           'host-write-commands-lo': 'uint64',
958           'host-write-commands-hi': 'uint64',
959           'controller-busy-time-lo': 'uint64',
960           'controller-busy-time-hi': 'uint64',
961           'power-cycles-lo': 'uint64',
962           'power-cycles-hi': 'uint64',
963           'power-on-hours-lo': 'uint64',
964           'power-on-hours-hi': 'uint64',
965           'unsafe-shutdowns-lo': 'uint64',
966           'unsafe-shutdowns-hi': 'uint64',
967           'media-errors-lo': 'uint64',
968           'media-errors-hi': 'uint64',
969           'number-of-error-log-entries-lo': 'uint64',
970           'number-of-error-log-entries-hi': 'uint64' } }
971
972##
973# @GuestDiskSmart:
974#
975# Disk type related smart information.
976#
977# @type: disk bus type
978#
979# Since: 7.1
980##
981{ 'union': 'GuestDiskSmart',
982  'base': { 'type': 'GuestDiskBusType' },
983  'discriminator': 'type',
984  'data': { 'nvme': 'GuestNVMeSmart' } }
985
986##
987# @GuestDiskInfo:
988#
989# @name: device node (Linux) or device UNC (Windows)
990#
991# @partition: whether this is a partition or disk
992#
993# @dependencies: list of device dependencies; e.g. for LVs of the LVM
994#     this will hold the list of PVs, for LUKS encrypted volume this
995#     will contain the disk where the volume is placed.  (Linux)
996#
997# @address: disk address information (only for non-virtual devices)
998#
999# @alias: optional alias assigned to the disk, on Linux this is a name
1000#     assigned by device mapper
1001#
1002# @smart: disk smart information (Since 7.1)
1003#
1004# Since: 5.2
1005##
1006{ 'struct': 'GuestDiskInfo',
1007  'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
1008           '*address': 'GuestDiskAddress', '*alias': 'str',
1009           '*smart': 'GuestDiskSmart'} }
1010
1011##
1012# @guest-get-disks:
1013#
1014# Returns: The list of disks in the guest.  For Windows these are only
1015#     the physical disks.  On Linux these are all root block devices
1016#     of non-zero size including e.g. removable devices, loop devices,
1017#     NBD, etc.
1018#
1019# Since: 5.2
1020##
1021{ 'command': 'guest-get-disks',
1022  'returns': ['GuestDiskInfo'] }
1023
1024##
1025# @GuestFilesystemInfo:
1026#
1027# @name: disk name
1028#
1029# @mountpoint: mount point path
1030#
1031# @type: file system type string
1032#
1033# @used-bytes: file system used bytes (since 3.0)
1034#
1035# @total-bytes: non-root file system total bytes (since 3.0)
1036#
1037# @disk: an array of disk hardware information that the volume lies
1038#     on, which may be empty if the disk type is not supported
1039#
1040# Since: 2.2
1041##
1042{ 'struct': 'GuestFilesystemInfo',
1043  'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
1044           '*used-bytes': 'uint64', '*total-bytes': 'uint64',
1045           'disk': ['GuestDiskAddress']} }
1046
1047##
1048# @guest-get-fsinfo:
1049#
1050# Returns: The list of filesystems information mounted in the guest.
1051#     The returned mountpoints may be specified to
1052#     @guest-fsfreeze-freeze-list.  Network filesystems (such as CIFS
1053#     and NFS) are not listed.
1054#
1055# Since: 2.2
1056##
1057{ 'command': 'guest-get-fsinfo',
1058  'returns': ['GuestFilesystemInfo'] }
1059
1060##
1061# @guest-set-user-password:
1062#
1063# @username: the user account whose password to change
1064#
1065# @password: the new password entry string, base64 encoded
1066#
1067# @crypted: true if password is already crypt()d, false if raw
1068#
1069# If the @crypted flag is true, it is the caller's responsibility to
1070# ensure the correct crypt() encryption scheme is used.  This command
1071# does not attempt to interpret or report on the encryption scheme.
1072# Refer to the documentation of the guest operating system in question
1073# to determine what is supported.
1074#
1075# Not all guest operating systems will support use of the @crypted
1076# flag, as they may require the clear-text password
1077#
1078# The @password parameter must always be base64 encoded before
1079# transmission, even if already crypt()d, to ensure it is 8-bit safe
1080# when passed as JSON.
1081#
1082# Returns: Nothing on success.
1083#
1084# Since: 2.3
1085##
1086{ 'command': 'guest-set-user-password',
1087  'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
1088
1089##
1090# @GuestMemoryBlock:
1091#
1092# @phys-index: Arbitrary guest-specific unique identifier of the
1093#     MEMORY BLOCK.
1094#
1095# @online: Whether the MEMORY BLOCK is enabled in guest.
1096#
1097# @can-offline: Whether offlining the MEMORY BLOCK is possible.  This
1098#     member is always filled in by the guest agent when the structure
1099#     is returned, and always ignored on input (hence it can be
1100#     omitted then).
1101#
1102# Since: 2.3
1103##
1104{ 'struct': 'GuestMemoryBlock',
1105  'data': {'phys-index': 'uint64',
1106           'online': 'bool',
1107           '*can-offline': 'bool'} }
1108
1109##
1110# @guest-get-memory-blocks:
1111#
1112# Retrieve the list of the guest's memory blocks.
1113#
1114# This is a read-only operation.
1115#
1116# Returns: The list of all memory blocks the guest knows about.  Each
1117#     memory block is put on the list exactly once, but their order is
1118#     unspecified.
1119#
1120# Since: 2.3
1121##
1122{ 'command': 'guest-get-memory-blocks',
1123  'returns': ['GuestMemoryBlock'] }
1124
1125##
1126# @GuestMemoryBlockResponseType:
1127#
1128# An enumeration of memory block operation result.
1129#
1130# @success: the operation of online/offline memory block is
1131#     successful.
1132#
1133# @not-found: can't find the corresponding memoryXXX directory in
1134#     sysfs.
1135#
1136# @operation-not-supported: for some old kernels, it does not support
1137#     online or offline memory block.
1138#
1139# @operation-failed: the operation of online/offline memory block
1140#     fails, because of some errors happen.
1141#
1142# Since: 2.3
1143##
1144{ 'enum': 'GuestMemoryBlockResponseType',
1145  'data': ['success', 'not-found', 'operation-not-supported',
1146           'operation-failed'] }
1147
1148##
1149# @GuestMemoryBlockResponse:
1150#
1151# @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1152#
1153# @response: the result of memory block operation.
1154#
1155# @error-code: the error number.  When memory block operation fails,
1156#     we assign the value of 'errno' to this member, it indicates what
1157#     goes wrong.  When the operation succeeds, it will be omitted.
1158#
1159# Since: 2.3
1160##
1161{ 'struct': 'GuestMemoryBlockResponse',
1162  'data': { 'phys-index': 'uint64',
1163            'response': 'GuestMemoryBlockResponseType',
1164            '*error-code': 'int' }}
1165
1166##
1167# @guest-set-memory-blocks:
1168#
1169# Attempt to reconfigure (currently: enable/disable) state of memory
1170# blocks inside the guest.
1171#
1172# @mem-blks: The memory blocks to be reconfigured.  This list is
1173#     processed node by node in order.  In each node @phys-index is
1174#     used to look up the guest MEMORY BLOCK, for which @online
1175#     specifies the requested state.  The set of distinct
1176#     @phys-index's is only required to be a subset of the
1177#     guest-supported identifiers.  There's no restriction on list
1178#     length or on repeating the same @phys-index (with possibly
1179#     different @online field).  Preferably the input list should
1180#     describe a modified subset of @guest-get-memory-blocks' return
1181#     value.
1182#
1183# Returns: The operation results, it is a list of
1184#     @GuestMemoryBlockResponse, which is corresponding to the input
1185#     list.
1186#
1187#     Note: it will return NULL if the @mem-blks list was empty on
1188#     input, or there is an error, and in this case, guest state will
1189#     not be changed.
1190#
1191# Since: 2.3
1192##
1193{ 'command': 'guest-set-memory-blocks',
1194  'data':    {'mem-blks': ['GuestMemoryBlock'] },
1195  'returns': ['GuestMemoryBlockResponse'] }
1196
1197##
1198# @GuestMemoryBlockInfo:
1199#
1200# @size: the size (in bytes) of the guest memory blocks, which are the
1201#     minimal units of memory block online/offline operations (also
1202#     called Logical Memory Hotplug).
1203#
1204# Since: 2.3
1205##
1206{ 'struct': 'GuestMemoryBlockInfo',
1207  'data': {'size': 'uint64'} }
1208
1209##
1210# @guest-get-memory-block-info:
1211#
1212# Get information relating to guest memory blocks.
1213#
1214# Returns: @GuestMemoryBlockInfo
1215#
1216# Since: 2.3
1217##
1218{ 'command': 'guest-get-memory-block-info',
1219  'returns': 'GuestMemoryBlockInfo' }
1220
1221##
1222# @GuestExecStatus:
1223#
1224# @exited: true if process has already terminated.
1225#
1226# @exitcode: process exit code if it was normally terminated.
1227#
1228# @signal: signal number (linux) or unhandled exception code (windows)
1229#     if the process was abnormally terminated.
1230#
1231# @out-data: base64-encoded stdout of the process. This field will only
1232#     be populated after the process exits.
1233#
1234# @err-data: base64-encoded stderr of the process. Note: @out-data and
1235#     @err-data are present only if 'capture-output' was specified for
1236#     'guest-exec'. This field will only be populated after the process
1237#     exits.
1238#
1239# @out-truncated: true if stdout was not fully captured due to size
1240#     limitation.
1241#
1242# @err-truncated: true if stderr was not fully captured due to size
1243#     limitation.
1244#
1245# Since: 2.5
1246##
1247{ 'struct': 'GuestExecStatus',
1248  'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1249            '*out-data': 'str', '*err-data': 'str',
1250            '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1251##
1252# @guest-exec-status:
1253#
1254# Check status of process associated with PID retrieved via
1255# guest-exec.  Reap the process and associated metadata if it has
1256# exited.
1257#
1258# @pid: pid returned from guest-exec
1259#
1260# Returns: GuestExecStatus on success.
1261#
1262# Since: 2.5
1263##
1264{ 'command': 'guest-exec-status',
1265  'data':    { 'pid': 'int' },
1266  'returns': 'GuestExecStatus' }
1267
1268##
1269# @GuestExec:
1270#
1271# @pid: pid of child process in guest OS
1272#
1273# Since: 2.5
1274##
1275{ 'struct': 'GuestExec',
1276  'data': { 'pid': 'int'} }
1277
1278##
1279# @GuestExecCaptureOutputMode:
1280#
1281# An enumeration of guest-exec capture modes.
1282#
1283# @none: do not capture any output
1284# @stdout: only capture stdout
1285# @stderr: only capture stderr
1286# @separated: capture both stdout and stderr, but separated into
1287#             GuestExecStatus out-data and err-data, respectively
1288# @merged: capture both stdout and stderr, but merge together
1289#          into out-data. not effective on windows guests.
1290#
1291# Since: 8.0
1292##
1293 { 'enum': 'GuestExecCaptureOutputMode',
1294   'data': [ 'none', 'stdout', 'stderr', 'separated',
1295             { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
1296
1297##
1298# @GuestExecCaptureOutput:
1299#
1300# Controls what guest-exec output gets captures.
1301#
1302# @flag: captures both stdout and stderr if true. Equivalent
1303#        to GuestExecCaptureOutputMode::all. (since 2.5)
1304# @mode: capture mode; preferred interface
1305#
1306# Since: 8.0
1307##
1308 { 'alternate': 'GuestExecCaptureOutput',
1309   'data': { 'flag': 'bool',
1310             'mode': 'GuestExecCaptureOutputMode'} }
1311
1312##
1313# @guest-exec:
1314#
1315# Execute a command in the guest
1316#
1317# @path: path or executable name to execute
1318#
1319# @arg: argument list to pass to executable
1320#
1321# @env: environment variables to pass to executable
1322#
1323# @input-data: data to be passed to process stdin (base64 encoded)
1324#
1325# @capture-output: bool flag to enable capture of stdout/stderr of
1326#     running process.  defaults to false.
1327#
1328# Returns: PID on success.
1329#
1330# Since: 2.5
1331##
1332{ 'command': 'guest-exec',
1333  'data':    { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1334               '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
1335  'returns': 'GuestExec' }
1336
1337
1338##
1339# @GuestHostName:
1340#
1341# @host-name: Fully qualified domain name of the guest OS
1342#
1343# Since: 2.10
1344##
1345{ 'struct': 'GuestHostName',
1346  'data':   { 'host-name': 'str' } }
1347
1348##
1349# @guest-get-host-name:
1350#
1351# Return a name for the machine.
1352#
1353# The returned name is not necessarily a fully-qualified domain name,
1354# or even present in DNS or some other name service at all.  It need
1355# not even be unique on your local network or site, but usually it is.
1356#
1357# Returns: the host name of the machine on success
1358#
1359# Since: 2.10
1360##
1361{ 'command': 'guest-get-host-name',
1362  'returns': 'GuestHostName' }
1363
1364
1365##
1366# @GuestUser:
1367#
1368# @user: Username
1369#
1370# @domain: Logon domain (windows only)
1371#
1372# @login-time: Time of login of this user on the computer.  If
1373#     multiple instances of the user are logged in, the earliest login
1374#     time is reported.  The value is in fractional seconds since
1375#     epoch time.
1376#
1377# Since: 2.10
1378##
1379{ 'struct': 'GuestUser',
1380  'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1381
1382##
1383# @guest-get-users:
1384#
1385# Retrieves a list of currently active users on the VM.
1386#
1387# Returns: A unique list of users.
1388#
1389# Since: 2.10
1390##
1391{ 'command': 'guest-get-users',
1392  'returns': ['GuestUser'] }
1393
1394##
1395# @GuestTimezone:
1396#
1397# @zone: Timezone name.  These values may differ depending on guest/OS
1398#     and should only be used for informational purposes.
1399#
1400# @offset: Offset to UTC in seconds, negative numbers for time zones
1401#     west of GMT, positive numbers for east
1402#
1403# Since: 2.10
1404##
1405{ 'struct': 'GuestTimezone',
1406  'data':   { '*zone': 'str', 'offset': 'int' } }
1407
1408##
1409# @guest-get-timezone:
1410#
1411# Retrieves the timezone information from the guest.
1412#
1413# Returns: A GuestTimezone dictionary.
1414#
1415# Since: 2.10
1416##
1417{ 'command': 'guest-get-timezone',
1418  'returns': 'GuestTimezone' }
1419
1420##
1421# @GuestOSInfo:
1422#
1423# @kernel-release:
1424#     * POSIX: release field returned by uname(2)
1425#     * Windows: build number of the OS
1426#
1427# @kernel-version:
1428#     * POSIX: version field returned by uname(2)
1429#     * Windows: version number of the OS
1430#
1431# @machine:
1432#     * POSIX: machine field returned by uname(2)
1433#     * Windows: one of x86, x86_64, arm, ia64
1434#
1435# @id:
1436#     * POSIX: as defined by os-release(5)
1437#     * Windows: contains string "mswindows"
1438#
1439# @name:
1440#     * POSIX: as defined by os-release(5)
1441#     * Windows: contains string "Microsoft Windows"
1442#
1443# @pretty-name:
1444#     * POSIX: as defined by os-release(5)
1445#     * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1446#
1447# @version:
1448#     * POSIX: as defined by os-release(5)
1449#     * Windows: long version string, e.g. "Microsoft Windows Server
1450#       2008"
1451#
1452# @version-id:
1453#     * POSIX: as defined by os-release(5)
1454#     * Windows: short version identifier, e.g. "7" or "20012r2"
1455#
1456# @variant:
1457#     * POSIX: as defined by os-release(5)
1458#     * Windows: contains string "server" or "client"
1459#
1460# @variant-id:
1461#     * POSIX: as defined by os-release(5)
1462#     * Windows: contains string "server" or "client"
1463#
1464# Notes: On POSIX systems the fields @id, @name, @pretty-name,
1465#     @version, @version-id, @variant and @variant-id follow the
1466#     definition specified in os-release(5). Refer to the manual page
1467#     for exact description of the fields.  Their values are taken
1468#     from the os-release file.  If the file is not present in the
1469#     system, or the values are not present in the file, the fields
1470#     are not included.
1471#
1472#     On Windows the values are filled from information gathered from
1473#     the system.
1474#
1475# Since: 2.10
1476##
1477{ 'struct': 'GuestOSInfo',
1478  'data': {
1479      '*kernel-release': 'str', '*kernel-version': 'str',
1480      '*machine': 'str', '*id': 'str', '*name': 'str',
1481      '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1482      '*variant': 'str', '*variant-id': 'str' } }
1483
1484##
1485# @guest-get-osinfo:
1486#
1487# Retrieve guest operating system information
1488#
1489# Returns: @GuestOSInfo
1490#
1491# Since: 2.10
1492##
1493{ 'command': 'guest-get-osinfo',
1494  'returns': 'GuestOSInfo' }
1495
1496##
1497# @GuestDeviceType:
1498#
1499# @pci: PCI device
1500##
1501{ 'enum': 'GuestDeviceType',
1502  'data': [ 'pci' ] }
1503
1504##
1505# @GuestDeviceIdPCI:
1506#
1507# @vendor-id: vendor ID
1508#
1509# @device-id: device ID
1510#
1511# Since: 5.2
1512##
1513{ 'struct': 'GuestDeviceIdPCI',
1514  'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1515
1516##
1517# @GuestDeviceId:
1518#
1519# Id of the device
1520#
1521# @type: device type
1522#
1523# Since: 5.2
1524##
1525{ 'union': 'GuestDeviceId',
1526  'base': { 'type': 'GuestDeviceType' },
1527  'discriminator': 'type',
1528  'data': { 'pci': 'GuestDeviceIdPCI' } }
1529
1530##
1531# @GuestDeviceInfo:
1532#
1533# @driver-name: name of the associated driver
1534#
1535# @driver-date: driver release date, in nanoseconds since the epoch
1536#
1537# @driver-version: driver version
1538#
1539# @id: device ID
1540#
1541# Since: 5.2
1542##
1543{ 'struct': 'GuestDeviceInfo',
1544  'data': {
1545      'driver-name': 'str',
1546      '*driver-date': 'int',
1547      '*driver-version': 'str',
1548      '*id': 'GuestDeviceId'
1549  } }
1550
1551##
1552# @guest-get-devices:
1553#
1554# Retrieve information about device drivers in Windows guest
1555#
1556# Returns: @GuestDeviceInfo
1557#
1558# Since: 5.2
1559##
1560{ 'command': 'guest-get-devices',
1561  'returns': ['GuestDeviceInfo'] }
1562
1563##
1564# @GuestAuthorizedKeys:
1565#
1566# @keys: public keys (in OpenSSH/sshd(8) authorized_keys format)
1567#
1568# Since: 5.2
1569##
1570{ 'struct': 'GuestAuthorizedKeys',
1571  'data': {
1572      'keys': ['str']
1573  },
1574  'if': 'CONFIG_POSIX' }
1575
1576
1577##
1578# @guest-ssh-get-authorized-keys:
1579#
1580# Return the public keys from user .ssh/authorized_keys on Unix
1581# systems (not implemented for other systems).
1582#
1583# @username: the user account to add the authorized keys
1584#
1585# Returns: @GuestAuthorizedKeys
1586#
1587# Since: 5.2
1588##
1589{ 'command': 'guest-ssh-get-authorized-keys',
1590  'data': { 'username': 'str' },
1591  'returns': 'GuestAuthorizedKeys',
1592  'if': 'CONFIG_POSIX' }
1593
1594##
1595# @guest-ssh-add-authorized-keys:
1596#
1597# Append public keys to user .ssh/authorized_keys on Unix systems (not
1598# implemented for other systems).
1599#
1600# @username: the user account to add the authorized keys
1601#
1602# @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys
1603#     format)
1604#
1605# @reset: ignore the existing content, set it with the given keys only
1606#
1607# Returns: Nothing on success.
1608#
1609# Since: 5.2
1610##
1611{ 'command': 'guest-ssh-add-authorized-keys',
1612  'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' },
1613  'if': 'CONFIG_POSIX' }
1614
1615##
1616# @guest-ssh-remove-authorized-keys:
1617#
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.
1621#
1622# @username: the user account to remove the authorized keys
1623#
1624# @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys
1625#     format)
1626#
1627# Returns: Nothing on success.
1628#
1629# Since: 5.2
1630##
1631{ 'command': 'guest-ssh-remove-authorized-keys',
1632  'data': { 'username': 'str', 'keys': ['str'] },
1633  'if': 'CONFIG_POSIX' }
1634
1635##
1636# @GuestDiskStats:
1637#
1638# @read-sectors: sectors read
1639#
1640# @read-ios: reads completed successfully
1641#
1642# @read-merges: read requests merged
1643#
1644# @write-sectors: sectors written
1645#
1646# @write-ios: writes completed
1647#
1648# @write-merges: write requests merged
1649#
1650# @discard-sectors: sectors discarded
1651#
1652# @discard-ios: discards completed successfully
1653#
1654# @discard-merges: discard requests merged
1655#
1656# @flush-ios: flush requests completed successfully
1657#
1658# @read-ticks: time spent reading(ms)
1659#
1660# @write-ticks: time spent writing(ms)
1661#
1662# @discard-ticks: time spent discarding(ms)
1663#
1664# @flush-ticks: time spent flushing(ms)
1665#
1666# @ios-pgr: number of I/Os currently in flight
1667#
1668# @total-ticks: time spent doing I/Os (ms)
1669#
1670# @weight-ticks: weighted time spent doing I/Os since the last update
1671#     of this field(ms)
1672#
1673# Since: 7.1
1674##
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'
1693           } }
1694
1695##
1696# @GuestDiskStatsInfo:
1697#
1698# @name: disk name
1699#
1700# @major: major device number of disk
1701#
1702# @minor: minor device number of disk
1703#
1704# @stats: I/O statistics
1705##
1706{ 'struct': 'GuestDiskStatsInfo',
1707  'data': {'name': 'str',
1708           'major': 'uint64',
1709           'minor': 'uint64',
1710           'stats': 'GuestDiskStats' } }
1711
1712##
1713# @guest-get-diskstats:
1714#
1715# Retrieve information about disk stats.
1716#
1717# Returns: List of disk stats of guest.
1718#
1719# Since: 7.1
1720##
1721{ 'command': 'guest-get-diskstats',
1722  'returns': ['GuestDiskStatsInfo']
1723}
1724
1725##
1726# @GuestCpuStatsType:
1727#
1728# Guest operating systems supporting CPU statistics
1729#
1730# @linux: Linux
1731#
1732# Since: 7.1
1733##
1734{ 'enum': 'GuestCpuStatsType',
1735  'data': [ 'linux' ] }
1736
1737
1738##
1739# @GuestLinuxCpuStats:
1740#
1741# CPU statistics of Linux
1742#
1743# @cpu: CPU index in guest OS
1744#
1745# @user: Time spent in user mode
1746#
1747# @nice: Time spent in user mode with low priority (nice)
1748#
1749# @system: Time spent in system mode
1750#
1751# @idle: Time spent in the idle task
1752#
1753# @iowait: Time waiting for I/O to complete (since Linux 2.5.41)
1754#
1755# @irq: Time servicing interrupts (since Linux 2.6.0-test4)
1756#
1757# @softirq: Time servicing softirqs (since Linux 2.6.0-test4)
1758#
1759# @steal: Stolen time by host (since Linux 2.6.11)
1760#
1761# @guest: ime spent running a virtual CPU for guest operating systems
1762#     under the  control of the Linux kernel (since Linux 2.6.24)
1763#
1764# @guestnice: Time spent running a niced guest (since Linux 2.6.33)
1765#
1766# Since: 7.1
1767##
1768{ 'struct': 'GuestLinuxCpuStats',
1769  'data': {'cpu': 'int',
1770           'user': 'uint64',
1771           'nice': 'uint64',
1772           'system': 'uint64',
1773           'idle': 'uint64',
1774           '*iowait': 'uint64',
1775           '*irq': 'uint64',
1776           '*softirq': 'uint64',
1777           '*steal': 'uint64',
1778           '*guest': 'uint64',
1779           '*guestnice': 'uint64'
1780           } }
1781
1782##
1783# @GuestCpuStats:
1784#
1785# Get statistics of each CPU in millisecond.
1786#
1787# @type: guest operating system
1788#
1789# Since: 7.1
1790##
1791{ 'union': 'GuestCpuStats',
1792  'base': { 'type': 'GuestCpuStatsType' },
1793  'discriminator': 'type',
1794  'data': { 'linux': 'GuestLinuxCpuStats' } }
1795
1796##
1797# @guest-get-cpustats:
1798#
1799# Retrieve information about CPU stats.
1800#
1801# Returns: List of CPU stats of guest.
1802#
1803# Since: 7.1
1804##
1805{ 'command': 'guest-get-cpustats',
1806  'returns': ['GuestCpuStats']
1807}
1808