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