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