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