xref: /openbmc/qemu/qga/qapi-schema.json (revision dacc52461b045148d87606bada5cd24d1ca8c220)
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
659##
660# @GuestIpAddress:
661#
662# @ip-address: IP address
663#
664# @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
665#
666# @prefix: Network prefix length of @ip-address
667#
668# Since: 1.1
669##
670{ 'struct': 'GuestIpAddress',
671  'data': {'ip-address': 'str',
672           'ip-address-type': 'GuestIpAddressType',
673           'prefix': 'int'} }
674
675##
676# @GuestNetworkInterfaceStat:
677#
678# @rx-bytes: total bytes received
679#
680# @rx-packets: total packets received
681#
682# @rx-errs: bad packets received
683#
684# @rx-dropped: receiver dropped packets
685#
686# @tx-bytes: total bytes transmitted
687#
688# @tx-packets: total packets transmitted
689#
690# @tx-errs: packet transmit problems
691#
692# @tx-dropped: dropped packets transmitted
693#
694# Since: 2.11
695##
696{ 'struct': 'GuestNetworkInterfaceStat',
697  'data': {'rx-bytes': 'uint64',
698            'rx-packets': 'uint64',
699            'rx-errs': 'uint64',
700            'rx-dropped': 'uint64',
701            'tx-bytes': 'uint64',
702            'tx-packets': 'uint64',
703            'tx-errs': 'uint64',
704            'tx-dropped': 'uint64'
705           } }
706
707##
708# @GuestNetworkInterface:
709#
710# @name: The name of interface for which info are being delivered
711#
712# @hardware-address: Hardware address of @name
713#
714# @ip-addresses: List of addresses assigned to @name
715#
716# @statistics: various statistic counters related to @name (since
717#     2.11)
718#
719# Since: 1.1
720##
721{ 'struct': 'GuestNetworkInterface',
722  'data': {'name': 'str',
723           '*hardware-address': 'str',
724           '*ip-addresses': ['GuestIpAddress'],
725           '*statistics': 'GuestNetworkInterfaceStat' } }
726
727##
728# @guest-network-get-interfaces:
729#
730# Get list of guest IP addresses, MAC addresses and netmasks.
731#
732# Returns: List of GuestNetworkInterface
733#
734# Since: 1.1
735##
736{ 'command': 'guest-network-get-interfaces',
737  'returns': ['GuestNetworkInterface'] }
738
739##
740# @GuestLogicalProcessor:
741#
742# @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
743#
744# @online: Whether the VCPU is enabled.
745#
746# @can-offline: Whether offlining the VCPU is possible.  This member
747#     is always filled in by the guest agent when the structure is
748#     returned, and always ignored on input (hence it can be omitted
749#     then).
750#
751# Since: 1.5
752##
753{ 'struct': 'GuestLogicalProcessor',
754  'data': {'logical-id': 'int',
755           'online': 'bool',
756           '*can-offline': 'bool'},
757  'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32'] } }
758
759##
760# @guest-get-vcpus:
761#
762# Retrieve the list of the guest's logical processors.
763#
764# This is a read-only operation.
765#
766# Returns: The list of all VCPUs the guest knows about.  Each VCPU is
767#     put on the list exactly once, but their order is unspecified.
768#
769# Since: 1.5
770##
771{ 'command': 'guest-get-vcpus',
772  'returns': ['GuestLogicalProcessor'],
773  'if': { 'any': ['CONFIG_LINUX', 'CONFIG_WIN32'] } }
774
775##
776# @guest-set-vcpus:
777#
778# Attempt to reconfigure (currently: enable/disable) logical
779# processors inside the guest.
780#
781# @vcpus: The logical processors to be reconfigured.  This list is
782#     processed node by node in order.  In each node @logical-id is
783#     used to look up the guest VCPU, for which @online specifies the
784#     requested state.  The set of distinct @logical-id's is only
785#     required to be a subset of the guest-supported identifiers.
786#     There's no restriction on list length or on repeating the same
787#     @logical-id (with possibly different @online field).  Preferably
788#     the input list should describe a modified subset of
789#     @guest-get-vcpus' return value.
790#
791# Returns: The length of the initial sublist that has been
792#     successfully processed.  The guest agent maximizes this value.
793#     Possible cases:
794#
795#     - 0:
796#       if the @vcpus list was empty on input.  Guest state has not
797#       been changed.  Otherwise,
798#     - < length(@vcpus):
799#       more than zero initial nodes have been processed, but not the
800#       entire @vcpus list.  Guest state has changed accordingly.  To
801#       retrieve the error (assuming it persists), repeat the call
802#       with the successfully processed initial sublist removed.
803#       Otherwise,
804#     - length(@vcpus):
805#       call successful.
806#
807# Errors:
808#     - If the reconfiguration of the first node in @vcpus failed.
809#       Guest state has not been changed.
810#
811# Since: 1.5
812##
813{ 'command': 'guest-set-vcpus',
814  'data':    {'vcpus': ['GuestLogicalProcessor'] },
815  'returns': 'int',
816  'if': 'CONFIG_LINUX' }
817
818##
819# @GuestDiskBusType:
820#
821# An enumeration of bus type of disks
822#
823# @ide: IDE disks
824#
825# @fdc: floppy disks
826#
827# @scsi: SCSI disks
828#
829# @virtio: virtio disks
830#
831# @xen: Xen disks
832#
833# @usb: USB disks
834#
835# @uml: UML disks
836#
837# @sata: SATA disks
838#
839# @sd: SD cards
840#
841# @unknown: Unknown bus type
842#
843# @ieee1394: Win IEEE 1394 bus type
844#
845# @ssa: Win SSA bus type
846#
847# @fibre: Win fiber channel bus type
848#
849# @raid: Win RAID bus type
850#
851# @iscsi: Win iScsi bus type
852#
853# @sas: Win serial-attaches SCSI bus type
854#
855# @mmc: Win multimedia card (MMC) bus type
856#
857# @virtual: Win virtual bus type
858#
859# @file-backed-virtual: Win file-backed bus type
860#
861# @nvme: NVMe disks (since 7.1)
862#
863# Since: 2.2; 'Unknown' and all entries below since 2.4
864##
865{ 'enum': 'GuestDiskBusType',
866  'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
867            'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
868            'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] }
869
870
871##
872# @GuestPCIAddress:
873#
874# @domain: domain id
875#
876# @bus: bus id
877#
878# @slot: slot id
879#
880# @function: function id
881#
882# Since: 2.2
883##
884{ 'struct': 'GuestPCIAddress',
885  'data': {'domain': 'int', 'bus': 'int',
886           'slot': 'int', 'function': 'int'} }
887
888##
889# @GuestCCWAddress:
890#
891# @cssid: channel subsystem image id
892#
893# @ssid: subchannel set id
894#
895# @subchno: subchannel number
896#
897# @devno: device number
898#
899# Since: 6.0
900##
901{ 'struct': 'GuestCCWAddress',
902  'data': {'cssid': 'int',
903           'ssid': 'int',
904           'subchno': 'int',
905           'devno': 'int'} }
906
907##
908# @GuestDiskAddress:
909#
910# @pci-controller: controller's PCI address (fields are set to -1 if
911#     invalid)
912#
913# @bus-type: bus type
914#
915# @bus: bus id
916#
917# @target: target id
918#
919# @unit: unit id
920#
921# @serial: serial number (since: 3.1)
922#
923# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
924#
925# @ccw-address: CCW address on s390x (since: 6.0)
926#
927# Since: 2.2
928##
929{ 'struct': 'GuestDiskAddress',
930  'data': {'pci-controller': 'GuestPCIAddress',
931           'bus-type': 'GuestDiskBusType',
932           'bus': 'int', 'target': 'int', 'unit': 'int',
933           '*serial': 'str', '*dev': 'str',
934           '*ccw-address': 'GuestCCWAddress'} }
935
936##
937# @GuestNVMeSmart:
938#
939# NVMe smart information, based on NVMe specification, section
940# <SMART / Health Information (Log Identifier 02h)>
941#
942# TODO: document members briefly
943#
944# Since: 7.1
945##
946{ 'struct': 'GuestNVMeSmart',
947  'data': {'critical-warning': 'int',
948           'temperature': 'int',
949           'available-spare': 'int',
950           'available-spare-threshold': 'int',
951           'percentage-used': 'int',
952           'data-units-read-lo': 'uint64',
953           'data-units-read-hi': 'uint64',
954           'data-units-written-lo': 'uint64',
955           'data-units-written-hi': 'uint64',
956           'host-read-commands-lo': 'uint64',
957           'host-read-commands-hi': 'uint64',
958           'host-write-commands-lo': 'uint64',
959           'host-write-commands-hi': 'uint64',
960           'controller-busy-time-lo': 'uint64',
961           'controller-busy-time-hi': 'uint64',
962           'power-cycles-lo': 'uint64',
963           'power-cycles-hi': 'uint64',
964           'power-on-hours-lo': 'uint64',
965           'power-on-hours-hi': 'uint64',
966           'unsafe-shutdowns-lo': 'uint64',
967           'unsafe-shutdowns-hi': 'uint64',
968           'media-errors-lo': 'uint64',
969           'media-errors-hi': 'uint64',
970           'number-of-error-log-entries-lo': 'uint64',
971           'number-of-error-log-entries-hi': 'uint64' } }
972
973##
974# @GuestDiskSmart:
975#
976# Disk type related smart information.
977#
978# @type: disk bus type
979#
980# Since: 7.1
981##
982{ 'union': 'GuestDiskSmart',
983  'base': { 'type': 'GuestDiskBusType' },
984  'discriminator': 'type',
985  'data': { 'nvme': 'GuestNVMeSmart' } }
986
987##
988# @GuestDiskInfo:
989#
990# @name: device node (Linux) or device UNC (Windows)
991#
992# @partition: whether this is a partition or disk
993#
994# @dependencies: list of device dependencies; e.g. for LVs of the LVM
995#     this will hold the list of PVs, for LUKS encrypted volume this
996#     will contain the disk where the volume is placed.  (Linux)
997#
998# @address: disk address information (only for non-virtual devices)
999#
1000# @alias: optional alias assigned to the disk, on Linux this is a name
1001#     assigned by device mapper
1002#
1003# @smart: disk smart information (Since 7.1)
1004#
1005# Since: 5.2
1006##
1007{ 'struct': 'GuestDiskInfo',
1008  'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
1009           '*address': 'GuestDiskAddress', '*alias': 'str',
1010           '*smart': 'GuestDiskSmart'} }
1011
1012##
1013# @guest-get-disks:
1014#
1015# Returns: The list of disks in the guest.  For Windows these are only
1016#     the physical disks.  On Linux these are all root block devices
1017#     of non-zero size including e.g. removable devices, loop devices,
1018#     NBD, etc.
1019#
1020# Since: 5.2
1021##
1022{ 'command': 'guest-get-disks',
1023  'returns': ['GuestDiskInfo'] }
1024
1025##
1026# @GuestFilesystemInfo:
1027#
1028# @name: disk name
1029#
1030# @mountpoint: mount point path
1031#
1032# @type: file system type string
1033#
1034# @used-bytes: file system used bytes (since 3.0)
1035#
1036# @total-bytes: filesystem capacity in bytes for unprivileged users (since 3.0)
1037#
1038# @total-bytes-privileged: filesystem capacity in bytes for privileged users
1039#     (since 9.1)
1040#
1041# @disk: an array of disk hardware information that the volume lies
1042#     on, which may be empty if the disk type is not supported
1043#
1044# Since: 2.2
1045##
1046{ 'struct': 'GuestFilesystemInfo',
1047  'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
1048           '*used-bytes': 'uint64', '*total-bytes': 'uint64',
1049           '*total-bytes-privileged': 'uint64', 'disk': ['GuestDiskAddress']} }
1050
1051##
1052# @guest-get-fsinfo:
1053#
1054# Returns: The list of filesystems information mounted in the guest.
1055#     The returned mountpoints may be specified to
1056#     @guest-fsfreeze-freeze-list.  Network filesystems (such as CIFS
1057#     and NFS) are not listed.
1058#
1059# Since: 2.2
1060##
1061{ 'command': 'guest-get-fsinfo',
1062  'returns': ['GuestFilesystemInfo'] }
1063
1064##
1065# @guest-set-user-password:
1066#
1067# @username: the user account whose password to change
1068#
1069# @password: the new password entry string, base64 encoded
1070#
1071# @crypted: true if password is already crypt()d, false if raw
1072#
1073# If the @crypted flag is true, it is the caller's responsibility to
1074# ensure the correct crypt() encryption scheme is used.  This command
1075# does not attempt to interpret or report on the encryption scheme.
1076# Refer to the documentation of the guest operating system in question
1077# to determine what is supported.
1078#
1079# Not all guest operating systems will support use of the @crypted
1080# flag, as they may require the clear-text password
1081#
1082# The @password parameter must always be base64 encoded before
1083# transmission, even if already crypt()d, to ensure it is 8-bit safe
1084# when passed as JSON.
1085#
1086# Since: 2.3
1087##
1088{ 'command': 'guest-set-user-password',
1089  'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
1090
1091##
1092# @GuestMemoryBlock:
1093#
1094# @phys-index: Arbitrary guest-specific unique identifier of the
1095#     MEMORY BLOCK.
1096#
1097# @online: Whether the MEMORY BLOCK is enabled in guest.
1098#
1099# @can-offline: Whether offlining the MEMORY BLOCK is possible.  This
1100#     member is always filled in by the guest agent when the structure
1101#     is returned, and always ignored on input (hence it can be
1102#     omitted then).
1103#
1104# Since: 2.3
1105##
1106{ 'struct': 'GuestMemoryBlock',
1107  'data': {'phys-index': 'uint64',
1108           'online': 'bool',
1109           '*can-offline': 'bool'},
1110  'if': 'CONFIG_LINUX' }
1111
1112##
1113# @guest-get-memory-blocks:
1114#
1115# Retrieve the list of the guest's memory blocks.
1116#
1117# This is a read-only operation.
1118#
1119# Returns: The list of all memory blocks the guest knows about.  Each
1120#     memory block is put on the list exactly once, but their order is
1121#     unspecified.
1122#
1123# Since: 2.3
1124##
1125{ 'command': 'guest-get-memory-blocks',
1126  'returns': ['GuestMemoryBlock'],
1127  'if': 'CONFIG_LINUX' }
1128
1129##
1130# @GuestMemoryBlockResponseType:
1131#
1132# An enumeration of memory block operation result.
1133#
1134# @success: the operation of online/offline memory block is
1135#     successful.
1136#
1137# @not-found: can't find the corresponding memoryXXX directory in
1138#     sysfs.
1139#
1140# @operation-not-supported: for some old kernels, it does not support
1141#     online or offline memory block.
1142#
1143# @operation-failed: the operation of online/offline memory block
1144#     fails, because of some errors happen.
1145#
1146# Since: 2.3
1147##
1148{ 'enum': 'GuestMemoryBlockResponseType',
1149  'data': ['success', 'not-found', 'operation-not-supported',
1150           'operation-failed'],
1151  'if': 'CONFIG_LINUX' }
1152
1153##
1154# @GuestMemoryBlockResponse:
1155#
1156# @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1157#
1158# @response: the result of memory block operation.
1159#
1160# @error-code: the error number.  When memory block operation fails,
1161#     we assign the value of 'errno' to this member, it indicates what
1162#     goes wrong.  When the operation succeeds, it will be omitted.
1163#
1164# Since: 2.3
1165##
1166{ 'struct': 'GuestMemoryBlockResponse',
1167  'data': { 'phys-index': 'uint64',
1168            'response': 'GuestMemoryBlockResponseType',
1169            '*error-code': 'int' },
1170  'if': 'CONFIG_LINUX'}
1171
1172##
1173# @guest-set-memory-blocks:
1174#
1175# Attempt to reconfigure (currently: enable/disable) state of memory
1176# blocks inside the guest.
1177#
1178# @mem-blks: The memory blocks to be reconfigured.  This list is
1179#     processed node by node in order.  In each node @phys-index is
1180#     used to look up the guest MEMORY BLOCK, for which @online
1181#     specifies the requested state.  The set of distinct
1182#     @phys-index's is only required to be a subset of the
1183#     guest-supported identifiers.  There's no restriction on list
1184#     length or on repeating the same @phys-index (with possibly
1185#     different @online field).  Preferably the input list should
1186#     describe a modified subset of @guest-get-memory-blocks' return
1187#     value.
1188#
1189# Returns: The operation results, it is a list of
1190#     @GuestMemoryBlockResponse, which is corresponding to the input
1191#     list.
1192#
1193#     Note: it will return an empty list if the @mem-blks list was
1194#     empty on input, or there is an error, and in this case, guest
1195#     state will not be changed.
1196#
1197# Since: 2.3
1198##
1199{ 'command': 'guest-set-memory-blocks',
1200  'data':    {'mem-blks': ['GuestMemoryBlock'] },
1201  'returns': ['GuestMemoryBlockResponse'],
1202  'if': 'CONFIG_LINUX' }
1203
1204##
1205# @GuestMemoryBlockInfo:
1206#
1207# @size: the size (in bytes) of the guest memory blocks, which are the
1208#     minimal units of memory block online/offline operations (also
1209#     called Logical Memory Hotplug).
1210#
1211# Since: 2.3
1212##
1213{ 'struct': 'GuestMemoryBlockInfo',
1214  'data': {'size': 'uint64'},
1215  'if': 'CONFIG_LINUX' }
1216
1217##
1218# @guest-get-memory-block-info:
1219#
1220# Get information relating to guest memory blocks.
1221#
1222# Returns: @GuestMemoryBlockInfo
1223#
1224# Since: 2.3
1225##
1226{ 'command': 'guest-get-memory-block-info',
1227  'returns': 'GuestMemoryBlockInfo',
1228  'if': 'CONFIG_LINUX' }
1229
1230##
1231# @GuestExecStatus:
1232#
1233# @exited: true if process has already terminated.
1234#
1235# @exitcode: process exit code if it was normally terminated.
1236#
1237# @signal: signal number (linux) or unhandled exception code (windows)
1238#     if the process was abnormally terminated.
1239#
1240# @out-data: base64-encoded stdout of the process.  This field will
1241#     only be populated after the process exits.
1242#
1243# @err-data: base64-encoded stderr of the process.  Note: @out-data
1244#     and @err-data are present only if 'capture-output' was specified
1245#     for 'guest-exec'.  This field will only be populated after the
1246#     process exits.
1247#
1248# @out-truncated: true if stdout was not fully captured due to size
1249#     limitation.
1250#
1251# @err-truncated: true if stderr was not fully captured due to size
1252#     limitation.
1253#
1254# Since: 2.5
1255##
1256{ 'struct': 'GuestExecStatus',
1257  'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1258            '*out-data': 'str', '*err-data': 'str',
1259            '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1260##
1261# @guest-exec-status:
1262#
1263# Check status of process associated with PID retrieved via
1264# guest-exec.  Reap the process and associated metadata if it has
1265# exited.
1266#
1267# @pid: pid returned from guest-exec
1268#
1269# Returns: GuestExecStatus
1270#
1271# Since: 2.5
1272##
1273{ 'command': 'guest-exec-status',
1274  'data':    { 'pid': 'int' },
1275  'returns': 'GuestExecStatus' }
1276
1277##
1278# @GuestExec:
1279#
1280# @pid: pid of child process in guest OS
1281#
1282# Since: 2.5
1283##
1284{ 'struct': 'GuestExec',
1285  'data': { 'pid': 'int'} }
1286
1287##
1288# @GuestExecCaptureOutputMode:
1289#
1290# An enumeration of guest-exec capture modes.
1291#
1292# @none: do not capture any output
1293#
1294# @stdout: only capture stdout
1295#
1296# @stderr: only capture stderr
1297#
1298# @separated: capture both stdout and stderr, but separated into
1299#     GuestExecStatus out-data and err-data, respectively
1300#
1301# @merged: capture both stdout and stderr, but merge together into
1302#     out-data.  Not effective on windows guests.
1303#
1304# Since: 8.0
1305##
1306 { 'enum': 'GuestExecCaptureOutputMode',
1307   'data': [ 'none', 'stdout', 'stderr', 'separated',
1308             { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
1309
1310##
1311# @GuestExecCaptureOutput:
1312#
1313# Controls what guest-exec output gets captures.
1314#
1315# @flag: captures both stdout and stderr if true.  Equivalent to
1316#     GuestExecCaptureOutputMode::all.  (since 2.5)
1317#
1318# @mode: capture mode; preferred interface
1319#
1320# Since: 8.0
1321##
1322 { 'alternate': 'GuestExecCaptureOutput',
1323   'data': { 'flag': 'bool',
1324             'mode': 'GuestExecCaptureOutputMode'} }
1325
1326##
1327# @guest-exec:
1328#
1329# Execute a command in the guest
1330#
1331# @path: path or executable name to execute
1332#
1333# @arg: argument list to pass to executable
1334#
1335# @env: environment variables to pass to executable
1336#
1337# @input-data: data to be passed to process stdin (base64 encoded)
1338#
1339# @capture-output: bool flag to enable capture of stdout/stderr of
1340#     running process.  Defaults to false.
1341#
1342# Returns: PID
1343#
1344# Since: 2.5
1345##
1346{ 'command': 'guest-exec',
1347  'data':    { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1348               '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
1349  'returns': 'GuestExec' }
1350
1351
1352##
1353# @GuestHostName:
1354#
1355# @host-name: Fully qualified domain name of the guest OS
1356#
1357# Since: 2.10
1358##
1359{ 'struct': 'GuestHostName',
1360  'data':   { 'host-name': 'str' } }
1361
1362##
1363# @guest-get-host-name:
1364#
1365# Return a name for the machine.
1366#
1367# The returned name is not necessarily a fully-qualified domain name,
1368# or even present in DNS or some other name service at all.  It need
1369# not even be unique on your local network or site, but usually it is.
1370#
1371# Returns: the host name of the machine
1372#
1373# Since: 2.10
1374##
1375{ 'command': 'guest-get-host-name',
1376  'returns': 'GuestHostName' }
1377
1378
1379##
1380# @GuestUser:
1381#
1382# @user: Username
1383#
1384# @domain: Logon domain (windows only)
1385#
1386# @login-time: Time of login of this user on the computer.  If
1387#     multiple instances of the user are logged in, the earliest login
1388#     time is reported.  The value is in fractional seconds since
1389#     epoch time.
1390#
1391# Since: 2.10
1392##
1393{ 'struct': 'GuestUser',
1394  'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1395
1396##
1397# @guest-get-users:
1398#
1399# Retrieves a list of currently active users on the VM.
1400#
1401# Returns: A unique list of users.
1402#
1403# Since: 2.10
1404##
1405{ 'command': 'guest-get-users',
1406  'returns': ['GuestUser'] }
1407
1408##
1409# @GuestTimezone:
1410#
1411# @zone: Timezone name.  These values may differ depending on guest/OS
1412#     and should only be used for informational purposes.
1413#
1414# @offset: Offset to UTC in seconds, negative numbers for time zones
1415#     west of GMT, positive numbers for east
1416#
1417# Since: 2.10
1418##
1419{ 'struct': 'GuestTimezone',
1420  'data':   { '*zone': 'str', 'offset': 'int' } }
1421
1422##
1423# @guest-get-timezone:
1424#
1425# Retrieves the timezone information from the guest.
1426#
1427# Returns: A GuestTimezone dictionary.
1428#
1429# Since: 2.10
1430##
1431{ 'command': 'guest-get-timezone',
1432  'returns': 'GuestTimezone' }
1433
1434##
1435# @GuestOSInfo:
1436#
1437# @kernel-release:
1438#     * POSIX: release field returned by uname(2)
1439#     * Windows: build number of the OS
1440#
1441# @kernel-version:
1442#     * POSIX: version field returned by uname(2)
1443#     * Windows: version number of the OS
1444#
1445# @machine:
1446#     * POSIX: machine field returned by uname(2)
1447#     * Windows: one of x86, x86_64, arm, ia64
1448#
1449# @id:
1450#     * POSIX: as defined by os-release(5)
1451#     * Windows: contains string "mswindows"
1452#
1453# @name:
1454#     * POSIX: as defined by os-release(5)
1455#     * Windows: contains string "Microsoft Windows"
1456#
1457# @pretty-name:
1458#     * POSIX: as defined by os-release(5)
1459#     * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1460#
1461# @version:
1462#     * POSIX: as defined by os-release(5)
1463#     * Windows: long version string, e.g. "Microsoft Windows Server
1464#       2008"
1465#
1466# @version-id:
1467#     * POSIX: as defined by os-release(5)
1468#     * Windows: short version identifier, e.g. "7" or "20012r2"
1469#
1470# @variant:
1471#     * POSIX: as defined by os-release(5)
1472#     * Windows: contains string "server" or "client"
1473#
1474# @variant-id:
1475#     * POSIX: as defined by os-release(5)
1476#     * Windows: contains string "server" or "client"
1477#
1478# .. note:: On POSIX systems the fields @id, @name, @pretty-name,
1479#    @version, @version-id, @variant and @variant-id follow the
1480#    definition specified in os-release(5). Refer to the manual page for
1481#    exact description of the fields.  Their values are taken from the
1482#    os-release file.  If the file is not present in the system, or the
1483#    values are not present in the file, the fields are not included.
1484#
1485#    On Windows the values are filled from information gathered from
1486#    the system.
1487#
1488# Since: 2.10
1489##
1490{ 'struct': 'GuestOSInfo',
1491  'data': {
1492      '*kernel-release': 'str', '*kernel-version': 'str',
1493      '*machine': 'str', '*id': 'str', '*name': 'str',
1494      '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1495      '*variant': 'str', '*variant-id': 'str' } }
1496
1497##
1498# @guest-get-osinfo:
1499#
1500# Retrieve guest operating system information
1501#
1502# Returns: @GuestOSInfo
1503#
1504# Since: 2.10
1505##
1506{ 'command': 'guest-get-osinfo',
1507  'returns': 'GuestOSInfo' }
1508
1509##
1510# @GuestDeviceType:
1511#
1512# @pci: PCI device
1513##
1514{ 'enum': 'GuestDeviceType',
1515  'data': [ 'pci' ] }
1516
1517##
1518# @GuestDeviceIdPCI:
1519#
1520# @vendor-id: vendor ID
1521#
1522# @device-id: device ID
1523#
1524# Since: 5.2
1525##
1526{ 'struct': 'GuestDeviceIdPCI',
1527  'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1528
1529##
1530# @GuestDeviceId:
1531#
1532# Id of the device
1533#
1534# @type: device type
1535#
1536# Since: 5.2
1537##
1538{ 'union': 'GuestDeviceId',
1539  'base': { 'type': 'GuestDeviceType' },
1540  'discriminator': 'type',
1541  'data': { 'pci': 'GuestDeviceIdPCI' } }
1542
1543##
1544# @GuestDeviceInfo:
1545#
1546# @driver-name: name of the associated driver
1547#
1548# @driver-date: driver release date, in nanoseconds since the epoch
1549#
1550# @driver-version: driver version
1551#
1552# @id: device ID
1553#
1554# Since: 5.2
1555##
1556{ 'struct': 'GuestDeviceInfo',
1557  'data': {
1558      'driver-name': 'str',
1559      '*driver-date': 'int',
1560      '*driver-version': 'str',
1561      '*id': 'GuestDeviceId'
1562  } }
1563
1564##
1565# @guest-get-devices:
1566#
1567# Retrieve information about device drivers in Windows guest
1568#
1569# Returns: @GuestDeviceInfo
1570#
1571# Since: 5.2
1572##
1573{ 'command': 'guest-get-devices',
1574  'returns': ['GuestDeviceInfo'] }
1575
1576##
1577# @GuestAuthorizedKeys:
1578#
1579# @keys: public keys (in OpenSSH/sshd(8) authorized_keys format)
1580#
1581# Since: 5.2
1582##
1583{ 'struct': 'GuestAuthorizedKeys',
1584  'data': {
1585      'keys': ['str']
1586  }
1587}
1588
1589##
1590# @guest-ssh-get-authorized-keys:
1591#
1592# Return the public keys from user .ssh/authorized_keys on Unix
1593# systems (not implemented for other systems).
1594#
1595# @username: the user account to add the authorized keys
1596#
1597# Returns: @GuestAuthorizedKeys
1598#
1599# Since: 5.2
1600##
1601{ 'command': 'guest-ssh-get-authorized-keys',
1602  'data': { 'username': 'str' },
1603  'returns': 'GuestAuthorizedKeys'
1604}
1605
1606##
1607# @guest-ssh-add-authorized-keys:
1608#
1609# Append public keys to user .ssh/authorized_keys on Unix systems (not
1610# implemented for other systems).
1611#
1612# @username: the user account to add the authorized keys
1613#
1614# @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys
1615#     format)
1616#
1617# @reset: ignore the existing content, set it with the given keys only
1618#
1619# Since: 5.2
1620##
1621{ 'command': 'guest-ssh-add-authorized-keys',
1622  'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' }
1623}
1624
1625##
1626# @guest-ssh-remove-authorized-keys:
1627#
1628# Remove public keys from the user .ssh/authorized_keys on Unix
1629# systems (not implemented for other systems). It's not an error if
1630# the key is already missing.
1631#
1632# @username: the user account to remove the authorized keys
1633#
1634# @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys
1635#     format)
1636#
1637# Since: 5.2
1638##
1639{ 'command': 'guest-ssh-remove-authorized-keys',
1640  'data': { 'username': 'str', 'keys': ['str'] }
1641}
1642
1643##
1644# @GuestDiskStats:
1645#
1646# @read-sectors: sectors read
1647#
1648# @read-ios: reads completed successfully
1649#
1650# @read-merges: read requests merged
1651#
1652# @write-sectors: sectors written
1653#
1654# @write-ios: writes completed
1655#
1656# @write-merges: write requests merged
1657#
1658# @discard-sectors: sectors discarded
1659#
1660# @discard-ios: discards completed successfully
1661#
1662# @discard-merges: discard requests merged
1663#
1664# @flush-ios: flush requests completed successfully
1665#
1666# @read-ticks: time spent reading(ms)
1667#
1668# @write-ticks: time spent writing(ms)
1669#
1670# @discard-ticks: time spent discarding(ms)
1671#
1672# @flush-ticks: time spent flushing(ms)
1673#
1674# @ios-pgr: number of I/Os currently in flight
1675#
1676# @total-ticks: time spent doing I/Os (ms)
1677#
1678# @weight-ticks: weighted time spent doing I/Os since the last update
1679#     of this field(ms)
1680#
1681# Since: 7.1
1682##
1683{ 'struct': 'GuestDiskStats',
1684  'data': {'*read-sectors': 'uint64',
1685           '*read-ios': 'uint64',
1686           '*read-merges': 'uint64',
1687           '*write-sectors': 'uint64',
1688           '*write-ios': 'uint64',
1689           '*write-merges': 'uint64',
1690           '*discard-sectors': 'uint64',
1691           '*discard-ios': 'uint64',
1692           '*discard-merges': 'uint64',
1693           '*flush-ios': 'uint64',
1694           '*read-ticks': 'uint64',
1695           '*write-ticks': 'uint64',
1696           '*discard-ticks': 'uint64',
1697           '*flush-ticks': 'uint64',
1698           '*ios-pgr': 'uint64',
1699           '*total-ticks': 'uint64',
1700           '*weight-ticks': 'uint64'
1701           } }
1702
1703##
1704# @GuestDiskStatsInfo:
1705#
1706# @name: disk name
1707#
1708# @major: major device number of disk
1709#
1710# @minor: minor device number of disk
1711#
1712# @stats: I/O statistics
1713##
1714{ 'struct': 'GuestDiskStatsInfo',
1715  'data': {'name': 'str',
1716           'major': 'uint64',
1717           'minor': 'uint64',
1718           'stats': 'GuestDiskStats' },
1719  'if': 'CONFIG_POSIX' }
1720
1721##
1722# @guest-get-diskstats:
1723#
1724# Retrieve information about disk stats.
1725#
1726# Returns: List of disk stats of guest.
1727#
1728# Since: 7.1
1729##
1730{ 'command': 'guest-get-diskstats',
1731  'returns': ['GuestDiskStatsInfo'],
1732  'if': 'CONFIG_POSIX'
1733}
1734
1735##
1736# @GuestCpuStatsType:
1737#
1738# Guest operating systems supporting CPU statistics
1739#
1740# @linux: Linux
1741#
1742# Since: 7.1
1743##
1744{ 'enum': 'GuestCpuStatsType',
1745  'data': [ 'linux' ],
1746  'if': 'CONFIG_POSIX' }
1747
1748
1749##
1750# @GuestLinuxCpuStats:
1751#
1752# CPU statistics of Linux
1753#
1754# @cpu: CPU index in guest OS
1755#
1756# @user: Time spent in user mode
1757#
1758# @nice: Time spent in user mode with low priority (nice)
1759#
1760# @system: Time spent in system mode
1761#
1762# @idle: Time spent in the idle task
1763#
1764# @iowait: Time waiting for I/O to complete (since Linux 2.5.41)
1765#
1766# @irq: Time servicing interrupts (since Linux 2.6.0-test4)
1767#
1768# @softirq: Time servicing softirqs (since Linux 2.6.0-test4)
1769#
1770# @steal: Stolen time by host (since Linux 2.6.11)
1771#
1772# @guest: ime spent running a virtual CPU for guest operating systems
1773#     under the  control of the Linux kernel (since Linux 2.6.24)
1774#
1775# @guestnice: Time spent running a niced guest (since Linux 2.6.33)
1776#
1777# Since: 7.1
1778##
1779{ 'struct': 'GuestLinuxCpuStats',
1780  'data': {'cpu': 'int',
1781           'user': 'uint64',
1782           'nice': 'uint64',
1783           'system': 'uint64',
1784           'idle': 'uint64',
1785           '*iowait': 'uint64',
1786           '*irq': 'uint64',
1787           '*softirq': 'uint64',
1788           '*steal': 'uint64',
1789           '*guest': 'uint64',
1790           '*guestnice': 'uint64'
1791           },
1792  'if': 'CONFIG_POSIX' }
1793
1794##
1795# @GuestCpuStats:
1796#
1797# Get statistics of each CPU in millisecond.
1798#
1799# @type: guest operating system
1800#
1801# Since: 7.1
1802##
1803{ 'union': 'GuestCpuStats',
1804  'base': { 'type': 'GuestCpuStatsType' },
1805  'discriminator': 'type',
1806  'data': { 'linux': 'GuestLinuxCpuStats' },
1807  'if': 'CONFIG_POSIX' }
1808
1809##
1810# @guest-get-cpustats:
1811#
1812# Retrieve information about CPU stats.
1813#
1814# Returns: List of CPU stats of guest.
1815#
1816# Since: 7.1
1817##
1818{ 'command': 'guest-get-cpustats',
1819  'returns': ['GuestCpuStats'],
1820  'if': 'CONFIG_POSIX'
1821}
1822