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