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