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