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