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