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