xref: /openbmc/qemu/qga/qapi-schema.json (revision 9c489ea6)
1# *-*- Mode: Python -*-*
2
3##
4#
5# General note concerning the use of guest agent interfaces:
6#
7# "unsupported" is a higher-level error than the errors that individual
8# commands might document. The caller should always be prepared to receive
9# QERR_UNSUPPORTED, even if the given command doesn't specify it, or doesn't
10# document any failure mode at all.
11#
12##
13
14{ 'pragma': { 'doc-required': true } }
15
16# Whitelists to permit QAPI rule violations; think twice before you
17# add to them!
18{ 'pragma': {
19    # Commands allowed to return a non-dictionary:
20    'returns-whitelist': [
21        'guest-file-open',
22        'guest-fsfreeze-freeze',
23        'guest-fsfreeze-freeze-list',
24        'guest-fsfreeze-status',
25        'guest-fsfreeze-thaw',
26        'guest-get-time',
27        'guest-set-vcpus',
28        'guest-sync',
29        'guest-sync-delimited' ] } }
30
31##
32# @guest-sync-delimited:
33#
34# Echo back a unique integer value, and prepend to response a
35# leading sentinel byte (0xFF) the client can check scan for.
36#
37# This is used by clients talking to the guest agent over the
38# wire to ensure the stream is in sync and doesn't contain stale
39# data from previous client. It must be issued upon initial
40# connection, and after any client-side timeouts (including
41# timeouts on receiving a response to this command).
42#
43# After issuing this request, all guest agent responses should be
44# ignored until the response containing the unique integer value
45# the client passed in is returned. Receival of the 0xFF sentinel
46# byte must be handled as an indication that the client's
47# lexer/tokenizer/parser state should be flushed/reset in
48# preparation for reliably receiving the subsequent response. As
49# an optimization, clients may opt to ignore all data until a
50# sentinel value is receiving to avoid unnecessary processing of
51# stale data.
52#
53# Similarly, clients should also precede this *request*
54# with a 0xFF byte to make sure the guest agent flushes any
55# partially read JSON data from a previous client connection.
56#
57# @id: randomly generated 64-bit integer
58#
59# Returns: The unique integer id passed in by the client
60#
61# Since: 1.1
62##
63{ 'command': 'guest-sync-delimited',
64  'data':    { 'id': 'int' },
65  'returns': 'int' }
66
67##
68# @guest-sync:
69#
70# Echo back a unique integer value
71#
72# This is used by clients talking to the guest agent over the
73# wire to ensure the stream is in sync and doesn't contain stale
74# data from previous client. All guest agent responses should be
75# ignored until the provided unique integer value is returned,
76# and it is up to the client to handle stale whole or
77# partially-delivered JSON text in such a way that this response
78# can be obtained.
79#
80# In cases where a partial stale response was previously
81# received by the client, this cannot always be done reliably.
82# One particular scenario being if qemu-ga responses are fed
83# character-by-character into a JSON parser. In these situations,
84# using guest-sync-delimited may be optimal.
85#
86# For clients that fetch responses line by line and convert them
87# to JSON objects, guest-sync should be sufficient, but note that
88# in cases where the channel is dirty some attempts at parsing the
89# response may result in a parser error.
90#
91# Such clients should also precede this command
92# with a 0xFF byte to make sure the guest agent flushes any
93# partially read JSON data from a previous session.
94#
95# @id: randomly generated 64-bit integer
96#
97# Returns: The unique integer id passed in by the client
98#
99# Since: 0.15.0
100##
101{ 'command': 'guest-sync',
102  'data':    { 'id': 'int' },
103  'returns': 'int' }
104
105##
106# @guest-ping:
107#
108# Ping the guest agent, a non-error return implies success
109#
110# Since: 0.15.0
111##
112{ 'command': 'guest-ping' }
113
114##
115# @guest-get-time:
116#
117# Get the information about guest's System Time relative to
118# the Epoch of 1970-01-01 in UTC.
119#
120# Returns: Time in nanoseconds.
121#
122# Since: 1.5
123##
124{ 'command': 'guest-get-time',
125  'returns': 'int' }
126
127##
128# @guest-set-time:
129#
130# Set guest time.
131#
132# When a guest is paused or migrated to a file then loaded
133# from that file, the guest OS has no idea that there
134# was a big gap in the time. Depending on how long the
135# gap was, NTP might not be able to resynchronize the
136# guest.
137#
138# This command tries to set guest's System Time to the
139# given value, then sets the Hardware Clock (RTC) to the
140# current System Time. This will make it easier for a guest
141# to resynchronize without waiting for NTP. If no @time is
142# specified, then the time to set is read from RTC. However,
143# this may not be supported on all platforms (i.e. Windows).
144# If that's the case users are advised to always pass a
145# value.
146#
147# @time: time of nanoseconds, relative to the Epoch
148#        of 1970-01-01 in UTC.
149#
150# Returns: Nothing on success.
151#
152# Since: 1.5
153##
154{ 'command': 'guest-set-time',
155  'data': { '*time': 'int' } }
156
157##
158# @GuestAgentCommandInfo:
159#
160# Information about guest agent commands.
161#
162# @name: name of the command
163#
164# @enabled: whether command is currently enabled by guest admin
165#
166# @success-response: whether command returns a response on success
167#                    (since 1.7)
168#
169# Since: 1.1.0
170##
171{ 'struct': 'GuestAgentCommandInfo',
172  'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
173
174##
175# @GuestAgentInfo:
176#
177# Information about guest agent.
178#
179# @version: guest agent version
180#
181# @supported_commands: Information about guest agent commands
182#
183# Since: 0.15.0
184##
185{ 'struct': 'GuestAgentInfo',
186  'data': { 'version': 'str',
187            'supported_commands': ['GuestAgentCommandInfo'] } }
188##
189# @guest-info:
190#
191# Get some information about the guest agent.
192#
193# Returns: @GuestAgentInfo
194#
195# Since: 0.15.0
196##
197{ 'command': 'guest-info',
198  'returns': 'GuestAgentInfo' }
199
200##
201# @guest-shutdown:
202#
203# Initiate guest-activated shutdown. Note: this is an asynchronous
204# shutdown request, with no guarantee of successful shutdown.
205#
206# @mode: "halt", "powerdown" (default), or "reboot"
207#
208# This command does NOT return a response on success. Success condition
209# is indicated by the VM exiting with a zero exit status or, when
210# running with --no-shutdown, by issuing the query-status QMP command
211# to confirm the VM status is "shutdown".
212#
213# Since: 0.15.0
214##
215{ 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
216  'success-response': false }
217
218##
219# @guest-file-open:
220#
221# Open a file in the guest and retrieve a file handle for it
222#
223# @path: Full path to the file in the guest to open.
224#
225# @mode: open mode, as per fopen(), "r" is the default.
226#
227# Returns: Guest file handle on success.
228#
229# Since: 0.15.0
230##
231{ 'command': 'guest-file-open',
232  'data':    { 'path': 'str', '*mode': 'str' },
233  'returns': 'int' }
234
235##
236# @guest-file-close:
237#
238# Close an open file in the guest
239#
240# @handle: filehandle returned by guest-file-open
241#
242# Returns: Nothing on success.
243#
244# Since: 0.15.0
245##
246{ 'command': 'guest-file-close',
247  'data': { 'handle': 'int' } }
248
249##
250# @GuestFileRead:
251#
252# Result of guest agent file-read operation
253#
254# @count: number of bytes read (note: count is *before*
255#         base64-encoding is applied)
256#
257# @buf-b64: base64-encoded bytes read
258#
259# @eof: whether EOF was encountered during read operation.
260#
261# Since: 0.15.0
262##
263{ 'struct': 'GuestFileRead',
264  'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
265
266##
267# @guest-file-read:
268#
269# Read from an open file in the guest. Data will be base64-encoded
270#
271# @handle: filehandle returned by guest-file-open
272#
273# @count: maximum number of bytes to read (default is 4KB)
274#
275# Returns: @GuestFileRead on success.
276#
277# Since: 0.15.0
278##
279{ 'command': 'guest-file-read',
280  'data':    { 'handle': 'int', '*count': 'int' },
281  'returns': 'GuestFileRead' }
282
283##
284# @GuestFileWrite:
285#
286# Result of guest agent file-write operation
287#
288# @count: number of bytes written (note: count is actual bytes
289#         written, after base64-decoding of provided buffer)
290#
291# @eof: whether EOF was encountered during write operation.
292#
293# Since: 0.15.0
294##
295{ 'struct': 'GuestFileWrite',
296  'data': { 'count': 'int', 'eof': 'bool' } }
297
298##
299# @guest-file-write:
300#
301# Write to an open file in the guest.
302#
303# @handle: filehandle returned by guest-file-open
304#
305# @buf-b64: base64-encoded string representing data to be written
306#
307# @count: bytes to write (actual bytes, after base64-decode),
308#         default is all content in buf-b64 buffer after base64 decoding
309#
310# Returns: @GuestFileWrite on success.
311#
312# Since: 0.15.0
313##
314{ 'command': 'guest-file-write',
315  'data':    { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
316  'returns': 'GuestFileWrite' }
317
318
319##
320# @GuestFileSeek:
321#
322# Result of guest agent file-seek operation
323#
324# @position: current file position
325#
326# @eof: whether EOF was encountered during file seek
327#
328# Since: 0.15.0
329##
330{ 'struct': 'GuestFileSeek',
331  'data': { 'position': 'int', 'eof': 'bool' } }
332
333##
334# @QGASeek:
335#
336# Symbolic names for use in @guest-file-seek
337#
338# @set: Set to the specified offset (same effect as 'whence':0)
339# @cur: Add offset to the current location (same effect as 'whence':1)
340# @end: Add offset to the end of the file (same effect as 'whence':2)
341#
342# Since: 2.6
343##
344{ 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
345
346##
347# @GuestFileWhence:
348#
349# Controls the meaning of offset to @guest-file-seek.
350#
351# @value: Integral value (0 for set, 1 for cur, 2 for end), available
352#         for historical reasons, and might differ from the host's or
353#         guest's SEEK_* values (since: 0.15)
354# @name: Symbolic name, and preferred interface
355#
356# Since: 2.6
357##
358{ 'alternate': 'GuestFileWhence',
359  'data': { 'value': 'int', 'name': 'QGASeek' } }
360
361##
362# @guest-file-seek:
363#
364# Seek to a position in the file, as with fseek(), and return the
365# current file position afterward. Also encapsulates ftell()'s
366# functionality, with offset=0 and whence=1.
367#
368# @handle: filehandle returned by guest-file-open
369#
370# @offset: bytes to skip over in the file stream
371#
372# @whence: Symbolic or numeric code for interpreting offset
373#
374# Returns: @GuestFileSeek on success.
375#
376# Since: 0.15.0
377##
378{ 'command': 'guest-file-seek',
379  'data':    { 'handle': 'int', 'offset': 'int',
380               'whence': 'GuestFileWhence' },
381  'returns': 'GuestFileSeek' }
382
383##
384# @guest-file-flush:
385#
386# Write file changes bufferred in userspace to disk/kernel buffers
387#
388# @handle: filehandle returned by guest-file-open
389#
390# Returns: Nothing on success.
391#
392# Since: 0.15.0
393##
394{ 'command': 'guest-file-flush',
395  'data': { 'handle': 'int' } }
396
397##
398# @GuestFsfreezeStatus:
399#
400# An enumeration of filesystem freeze states
401#
402# @thawed: filesystems thawed/unfrozen
403#
404# @frozen: all non-network guest filesystems frozen
405#
406# Since: 0.15.0
407##
408{ 'enum': 'GuestFsfreezeStatus',
409  'data': [ 'thawed', 'frozen' ] }
410
411##
412# @guest-fsfreeze-status:
413#
414# Get guest fsfreeze state. error state indicates
415#
416# Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
417#
418# Note: This may fail to properly report the current state as a result of
419# some other guest processes having issued an fs freeze/thaw.
420#
421# Since: 0.15.0
422##
423{ 'command': 'guest-fsfreeze-status',
424  'returns': 'GuestFsfreezeStatus' }
425
426##
427# @guest-fsfreeze-freeze:
428#
429# Sync and freeze all freezable, local guest filesystems. If this
430# command succeeded, you may call @guest-fsfreeze-thaw later to
431# unfreeze.
432#
433# Note: On Windows, the command is implemented with the help of a
434# Volume Shadow-copy Service DLL helper. The frozen state is limited
435# for up to 10 seconds by VSS.
436#
437# Returns: Number of file systems currently frozen. On error, all filesystems
438# will be thawed.
439#
440# Since: 0.15.0
441##
442{ 'command': 'guest-fsfreeze-freeze',
443  'returns': 'int' }
444
445##
446# @guest-fsfreeze-freeze-list:
447#
448# Sync and freeze specified guest filesystems.
449# See also @guest-fsfreeze-freeze.
450#
451# @mountpoints: an array of mountpoints of filesystems to be frozen.
452#               If omitted, every mounted filesystem is frozen.
453#               Invalid mount points are ignored.
454#
455# Returns: Number of file systems currently frozen. On error, all filesystems
456# will be thawed.
457#
458# Since: 2.2
459##
460{ 'command': 'guest-fsfreeze-freeze-list',
461  'data':    { '*mountpoints': ['str'] },
462  'returns': 'int' }
463
464##
465# @guest-fsfreeze-thaw:
466#
467# Unfreeze all frozen guest filesystems
468#
469# Returns: Number of file systems thawed by this call
470#
471# Note: if return value does not match the previous call to
472#       guest-fsfreeze-freeze, this likely means some freezable
473#       filesystems were unfrozen before this call, and that the
474#       filesystem state may have changed before issuing this
475#       command.
476#
477# Since: 0.15.0
478##
479{ 'command': 'guest-fsfreeze-thaw',
480  'returns': 'int' }
481
482##
483# @GuestFilesystemTrimResult:
484#
485# @path: path that was trimmed
486# @error: an error message when trim failed
487# @trimmed: bytes trimmed for this path
488# @minimum: reported effective minimum for this path
489#
490# Since: 2.4
491##
492{ 'struct': 'GuestFilesystemTrimResult',
493  'data': {'path': 'str',
494           '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
495
496##
497# @GuestFilesystemTrimResponse:
498#
499# @paths: list of @GuestFilesystemTrimResult per path that was trimmed
500#
501# Since: 2.4
502##
503{ 'struct': 'GuestFilesystemTrimResponse',
504  'data': {'paths': ['GuestFilesystemTrimResult']} }
505
506##
507# @guest-fstrim:
508#
509# Discard (or "trim") blocks which are not in use by the filesystem.
510#
511# @minimum:
512#       Minimum contiguous free range to discard, in bytes. Free ranges
513#       smaller than this may be ignored (this is a hint and the guest
514#       may not respect it).  By increasing this value, the fstrim
515#       operation will complete more quickly for filesystems with badly
516#       fragmented free space, although not all blocks will be discarded.
517#       The default value is zero, meaning "discard every free block".
518#
519# Returns: A @GuestFilesystemTrimResponse which contains the
520#          status of all trimmed paths. (since 2.4)
521#
522# Since: 1.2
523##
524{ 'command': 'guest-fstrim',
525  'data': { '*minimum': 'int' },
526  'returns': 'GuestFilesystemTrimResponse' }
527
528##
529# @guest-suspend-disk:
530#
531# Suspend guest to disk.
532#
533# This command tries to execute the scripts provided by the pm-utils package.
534# If it's not available, the suspend operation will be performed by manually
535# writing to a sysfs file.
536#
537# For the best results it's strongly recommended to have the pm-utils
538# package installed in the guest.
539#
540# This command does NOT return a response on success. There is a high chance
541# the command succeeded if the VM exits with a zero exit status or, when
542# running with --no-shutdown, by issuing the query-status QMP command to
543# to confirm the VM status is "shutdown". However, the VM could also exit
544# (or set its status to "shutdown") due to other reasons.
545#
546# The following errors may be returned:
547#          If suspend to disk is not supported, Unsupported
548#
549# Notes: It's strongly recommended to issue the guest-sync command before
550#        sending commands when the guest resumes
551#
552# Since: 1.1
553##
554{ 'command': 'guest-suspend-disk', 'success-response': false }
555
556##
557# @guest-suspend-ram:
558#
559# Suspend guest to ram.
560#
561# This command tries to execute the scripts provided by the pm-utils package.
562# If it's not available, the suspend operation will be performed by manually
563# writing to a sysfs file.
564#
565# For the best results it's strongly recommended to have the pm-utils
566# package installed in the guest.
567#
568# IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup'
569# command.  Thus, it's *required* to query QEMU for the presence of the
570# 'system_wakeup' command before issuing guest-suspend-ram.
571#
572# This command does NOT return a response on success. There are two options
573# to check for success:
574#   1. Wait for the SUSPEND QMP event from QEMU
575#   2. Issue the query-status QMP command to confirm the VM status is
576#      "suspended"
577#
578# The following errors may be returned:
579#          If suspend to ram is not supported, Unsupported
580#
581# Notes: It's strongly recommended to issue the guest-sync command before
582#        sending commands when the guest resumes
583#
584# Since: 1.1
585##
586{ 'command': 'guest-suspend-ram', 'success-response': false }
587
588##
589# @guest-suspend-hybrid:
590#
591# Save guest state to disk and suspend to ram.
592#
593# This command requires the pm-utils package to be installed in the guest.
594#
595# IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup'
596# command.  Thus, it's *required* to query QEMU for the presence of the
597# 'system_wakeup' command before issuing guest-suspend-hybrid.
598#
599# This command does NOT return a response on success. There are two options
600# to check for success:
601#   1. Wait for the SUSPEND QMP event from QEMU
602#   2. Issue the query-status QMP command to confirm the VM status is
603#      "suspended"
604#
605# The following errors may be returned:
606#          If hybrid suspend is not supported, Unsupported
607#
608# Notes: It's strongly recommended to issue the guest-sync command before
609#        sending commands when the guest resumes
610#
611# Since: 1.1
612##
613{ 'command': 'guest-suspend-hybrid', 'success-response': false }
614
615##
616# @GuestIpAddressType:
617#
618# An enumeration of supported IP address types
619#
620# @ipv4: IP version 4
621#
622# @ipv6: IP version 6
623#
624# Since: 1.1
625##
626{ 'enum': 'GuestIpAddressType',
627  'data': [ 'ipv4', 'ipv6' ] }
628
629##
630# @GuestIpAddress:
631#
632# @ip-address: IP address
633#
634# @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
635#
636# @prefix: Network prefix length of @ip-address
637#
638# Since: 1.1
639##
640{ 'struct': 'GuestIpAddress',
641  'data': {'ip-address': 'str',
642           'ip-address-type': 'GuestIpAddressType',
643           'prefix': 'int'} }
644
645##
646# @GuestNetworkInterface:
647#
648# @name: The name of interface for which info are being delivered
649#
650# @hardware-address: Hardware address of @name
651#
652# @ip-addresses: List of addresses assigned to @name
653#
654# Since: 1.1
655##
656{ 'struct': 'GuestNetworkInterface',
657  'data': {'name': 'str',
658           '*hardware-address': 'str',
659           '*ip-addresses': ['GuestIpAddress'] } }
660
661##
662# @guest-network-get-interfaces:
663#
664# Get list of guest IP addresses, MAC addresses
665# and netmasks.
666#
667# Returns: List of GuestNetworkInfo on success.
668#
669# Since: 1.1
670##
671{ 'command': 'guest-network-get-interfaces',
672  'returns': ['GuestNetworkInterface'] }
673
674##
675# @GuestLogicalProcessor:
676#
677# @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
678#
679# @online: Whether the VCPU is enabled.
680#
681# @can-offline: Whether offlining the VCPU is possible. This member
682#               is always filled in by the guest agent when the structure is
683#               returned, and always ignored on input (hence it can be omitted
684#               then).
685#
686# Since: 1.5
687##
688{ 'struct': 'GuestLogicalProcessor',
689  'data': {'logical-id': 'int',
690           'online': 'bool',
691           '*can-offline': 'bool'} }
692
693##
694# @guest-get-vcpus:
695#
696# Retrieve the list of the guest's logical processors.
697#
698# This is a read-only operation.
699#
700# Returns: The list of all VCPUs the guest knows about. Each VCPU is put on the
701# list exactly once, but their order is unspecified.
702#
703# Since: 1.5
704##
705{ 'command': 'guest-get-vcpus',
706  'returns': ['GuestLogicalProcessor'] }
707
708##
709# @guest-set-vcpus:
710#
711# Attempt to reconfigure (currently: enable/disable) logical processors inside
712# the guest.
713#
714# The input list is processed node by node in order. In each node @logical-id
715# is used to look up the guest VCPU, for which @online specifies the requested
716# state. The set of distinct @logical-id's is only required to be a subset of
717# the guest-supported identifiers. There's no restriction on list length or on
718# repeating the same @logical-id (with possibly different @online field).
719# Preferably the input list should describe a modified subset of
720# @guest-get-vcpus' return value.
721#
722# Returns: The length of the initial sublist that has been successfully
723#          processed. The guest agent maximizes this value. Possible cases:
724#
725#          - 0:              if the @vcpus list was empty on input. Guest state
726#                            has not been changed. Otherwise,
727#          - Error:          processing the first node of @vcpus failed for the
728#                            reason returned. Guest state has not been changed.
729#                            Otherwise,
730#          - < length(@vcpus): more than zero initial nodes have been processed,
731#                            but not the entire @vcpus list. Guest state has
732#                            changed accordingly. To retrieve the error
733#                            (assuming it persists), repeat the call with the
734#                            successfully processed initial sublist removed.
735#                            Otherwise,
736#          - length(@vcpus): call successful.
737#
738# Since: 1.5
739##
740{ 'command': 'guest-set-vcpus',
741  'data':    {'vcpus': ['GuestLogicalProcessor'] },
742  'returns': 'int' }
743
744##
745# @GuestDiskBusType:
746#
747# An enumeration of bus type of disks
748#
749# @ide: IDE disks
750# @fdc: floppy disks
751# @scsi: SCSI disks
752# @virtio: virtio disks
753# @xen: Xen disks
754# @usb: USB disks
755# @uml: UML disks
756# @sata: SATA disks
757# @sd: SD cards
758# @unknown: Unknown bus type
759# @ieee1394: Win IEEE 1394 bus type
760# @ssa: Win SSA bus type
761# @fibre: Win fiber channel bus type
762# @raid: Win RAID bus type
763# @iscsi: Win iScsi bus type
764# @sas: Win serial-attaches SCSI bus type
765# @mmc: Win multimedia card (MMC) bus type
766# @virtual: Win virtual bus type
767# @file-backed virtual: Win file-backed bus type
768#
769# Since: 2.2; 'Unknown' and all entries below since 2.4
770##
771{ 'enum': 'GuestDiskBusType',
772  'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
773            'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
774            'sas', 'mmc', 'virtual', 'file-backed-virtual' ] }
775
776
777##
778# @GuestPCIAddress:
779#
780# @domain: domain id
781# @bus: bus id
782# @slot: slot id
783# @function: function id
784#
785# Since: 2.2
786##
787{ 'struct': 'GuestPCIAddress',
788  'data': {'domain': 'int', 'bus': 'int',
789           'slot': 'int', 'function': 'int'} }
790
791##
792# @GuestDiskAddress:
793#
794# @pci-controller: controller's PCI address
795# @bus-type: bus type
796# @bus: bus id
797# @target: target id
798# @unit: unit id
799#
800# Since: 2.2
801##
802{ 'struct': 'GuestDiskAddress',
803  'data': {'pci-controller': 'GuestPCIAddress',
804           'bus-type': 'GuestDiskBusType',
805           'bus': 'int', 'target': 'int', 'unit': 'int'} }
806
807##
808# @GuestFilesystemInfo:
809#
810# @name: disk name
811# @mountpoint: mount point path
812# @type: file system type string
813# @disk: an array of disk hardware information that the volume lies on,
814#        which may be empty if the disk type is not supported
815#
816# Since: 2.2
817##
818{ 'struct': 'GuestFilesystemInfo',
819  'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
820           'disk': ['GuestDiskAddress']} }
821
822##
823# @guest-get-fsinfo:
824#
825# Returns: The list of filesystems information mounted in the guest.
826#          The returned mountpoints may be specified to
827#          @guest-fsfreeze-freeze-list.
828#          Network filesystems (such as CIFS and NFS) are not listed.
829#
830# Since: 2.2
831##
832{ 'command': 'guest-get-fsinfo',
833  'returns': ['GuestFilesystemInfo'] }
834
835##
836# @guest-set-user-password:
837#
838# @username: the user account whose password to change
839# @password: the new password entry string, base64 encoded
840# @crypted: true if password is already crypt()d, false if raw
841#
842# If the @crypted flag is true, it is the caller's responsibility
843# to ensure the correct crypt() encryption scheme is used. This
844# command does not attempt to interpret or report on the encryption
845# scheme. Refer to the documentation of the guest operating system
846# in question to determine what is supported.
847#
848# Not all guest operating systems will support use of the
849# @crypted flag, as they may require the clear-text password
850#
851# The @password parameter must always be base64 encoded before
852# transmission, even if already crypt()d, to ensure it is 8-bit
853# safe when passed as JSON.
854#
855# Returns: Nothing on success.
856#
857# Since: 2.3
858##
859{ 'command': 'guest-set-user-password',
860  'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
861
862##
863# @GuestMemoryBlock:
864#
865# @phys-index: Arbitrary guest-specific unique identifier of the MEMORY BLOCK.
866#
867# @online: Whether the MEMORY BLOCK is enabled in guest.
868#
869# @can-offline: Whether offlining the MEMORY BLOCK is possible.
870#               This member is always filled in by the guest agent when the
871#               structure is returned, and always ignored on input (hence it
872#               can be omitted then).
873#
874# Since: 2.3
875##
876{ 'struct': 'GuestMemoryBlock',
877  'data': {'phys-index': 'uint64',
878           'online': 'bool',
879           '*can-offline': 'bool'} }
880
881##
882# @guest-get-memory-blocks:
883#
884# Retrieve the list of the guest's memory blocks.
885#
886# This is a read-only operation.
887#
888# Returns: The list of all memory blocks the guest knows about.
889# Each memory block is put on the list exactly once, but their order
890# is unspecified.
891#
892# Since: 2.3
893##
894{ 'command': 'guest-get-memory-blocks',
895  'returns': ['GuestMemoryBlock'] }
896
897##
898# @GuestMemoryBlockResponseType:
899#
900# An enumeration of memory block operation result.
901#
902# @success: the operation of online/offline memory block is successful.
903# @not-found: can't find the corresponding memoryXXX directory in sysfs.
904# @operation-not-supported: for some old kernels, it does not support
905#                           online or offline memory block.
906# @operation-failed: the operation of online/offline memory block fails,
907#                    because of some errors happen.
908#
909# Since: 2.3
910##
911{ 'enum': 'GuestMemoryBlockResponseType',
912  'data': ['success', 'not-found', 'operation-not-supported',
913           'operation-failed'] }
914
915##
916# @GuestMemoryBlockResponse:
917#
918# @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
919#
920# @response: the result of memory block operation.
921#
922# @error-code: the error number.
923#               When memory block operation fails, we assign the value of
924#               'errno' to this member, it indicates what goes wrong.
925#               When the operation succeeds, it will be omitted.
926#
927# Since: 2.3
928##
929{ 'struct': 'GuestMemoryBlockResponse',
930  'data': { 'phys-index': 'uint64',
931            'response': 'GuestMemoryBlockResponseType',
932            '*error-code': 'int' }}
933
934##
935# @guest-set-memory-blocks:
936#
937# Attempt to reconfigure (currently: enable/disable) state of memory blocks
938# inside the guest.
939#
940# The input list is processed node by node in order. In each node @phys-index
941# is used to look up the guest MEMORY BLOCK, for which @online specifies the
942# requested state. The set of distinct @phys-index's is only required to be a
943# subset of the guest-supported identifiers. There's no restriction on list
944# length or on repeating the same @phys-index (with possibly different @online
945# field).
946# Preferably the input list should describe a modified subset of
947# @guest-get-memory-blocks' return value.
948#
949# Returns: The operation results, it is a list of @GuestMemoryBlockResponse,
950#          which is corresponding to the input list.
951#
952#          Note: it will return NULL if the @mem-blks list was empty on input,
953#          or there is an error, and in this case, guest state will not be
954#          changed.
955#
956# Since: 2.3
957##
958{ 'command': 'guest-set-memory-blocks',
959  'data':    {'mem-blks': ['GuestMemoryBlock'] },
960  'returns': ['GuestMemoryBlockResponse'] }
961
962##
963# @GuestMemoryBlockInfo:
964#
965# @size: the size (in bytes) of the guest memory blocks,
966#        which are the minimal units of memory block online/offline
967#        operations (also called Logical Memory Hotplug).
968#
969# Since: 2.3
970##
971{ 'struct': 'GuestMemoryBlockInfo',
972  'data': {'size': 'uint64'} }
973
974##
975# @guest-get-memory-block-info:
976#
977# Get information relating to guest memory blocks.
978#
979# Returns: @GuestMemoryBlockInfo
980#
981# Since: 2.3
982##
983{ 'command': 'guest-get-memory-block-info',
984  'returns': 'GuestMemoryBlockInfo' }
985
986##
987# @GuestExecStatus:
988#
989# @exited: true if process has already terminated.
990# @exitcode: process exit code if it was normally terminated.
991# @signal: signal number (linux) or unhandled exception code
992#       (windows) if the process was abnormally terminated.
993# @out-data: base64-encoded stdout of the process
994# @err-data: base64-encoded stderr of the process
995#       Note: @out-data and @err-data are present only
996#       if 'capture-output' was specified for 'guest-exec'
997# @out-truncated: true if stdout was not fully captured
998#       due to size limitation.
999# @err-truncated: true if stderr was not fully captured
1000#       due to size limitation.
1001#
1002# Since: 2.5
1003##
1004{ 'struct': 'GuestExecStatus',
1005  'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
1006            '*out-data': 'str', '*err-data': 'str',
1007            '*out-truncated': 'bool', '*err-truncated': 'bool' }}
1008##
1009# @guest-exec-status:
1010#
1011# Check status of process associated with PID retrieved via guest-exec.
1012# Reap the process and associated metadata if it has exited.
1013#
1014# @pid: pid returned from guest-exec
1015#
1016# Returns: GuestExecStatus on success.
1017#
1018# Since: 2.5
1019##
1020{ 'command': 'guest-exec-status',
1021  'data':    { 'pid': 'int' },
1022  'returns': 'GuestExecStatus' }
1023
1024##
1025# @GuestExec:
1026# @pid: pid of child process in guest OS
1027#
1028# Since: 2.5
1029##
1030{ 'struct': 'GuestExec',
1031  'data': { 'pid': 'int'} }
1032
1033##
1034# @guest-exec:
1035#
1036# Execute a command in the guest
1037#
1038# @path: path or executable name to execute
1039# @arg: argument list to pass to executable
1040# @env: environment variables to pass to executable
1041# @input-data: data to be passed to process stdin (base64 encoded)
1042# @capture-output: bool flag to enable capture of
1043#                  stdout/stderr of running process. defaults to false.
1044#
1045# Returns: PID on success.
1046#
1047# Since: 2.5
1048##
1049{ 'command': 'guest-exec',
1050  'data':    { 'path': 'str', '*arg': ['str'], '*env': ['str'],
1051               '*input-data': 'str', '*capture-output': 'bool' },
1052  'returns': 'GuestExec' }
1053
1054
1055##
1056# @GuestHostName:
1057# @host-name: Fully qualified domain name of the guest OS
1058#
1059# Since: 2.10
1060##
1061{ 'struct': 'GuestHostName',
1062  'data':   { 'host-name': 'str' } }
1063
1064##
1065# @guest-get-host-name:
1066#
1067# Return a name for the machine.
1068#
1069# The returned name is not necessarily a fully-qualified domain name, or even
1070# present in DNS or some other name service at all. It need not even be unique
1071# on your local network or site, but usually it is.
1072#
1073# Returns: the host name of the machine on success
1074#
1075# Since: 2.10
1076##
1077{ 'command': 'guest-get-host-name',
1078  'returns': 'GuestHostName' }
1079
1080
1081##
1082# @GuestUser:
1083# @user:       Username
1084# @domain:     Logon domain (windows only)
1085# @login-time: Time of login of this user on the computer. If multiple
1086#              instances of the user are logged in, the earliest login time is
1087#              reported. The value is in fractional seconds since epoch time.
1088#
1089# Since: 2.10
1090##
1091{ 'struct': 'GuestUser',
1092  'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1093
1094##
1095# @guest-get-users:
1096# Retrieves a list of currently active users on the VM.
1097#
1098# Returns: A unique list of users.
1099#
1100# Since: 2.10
1101##
1102{ 'command': 'guest-get-users',
1103  'returns': ['GuestUser'] }
1104
1105##
1106# @GuestTimezone:
1107#
1108# @zone:    Timezone name. These values may differ depending on guest/OS and
1109#           should only be used for informational purposes.
1110# @offset:  Offset to UTC in seconds, negative numbers for time zones west of
1111#           GMT, positive numbers for east
1112#
1113# Since: 2.10
1114##
1115{ 'struct': 'GuestTimezone',
1116  'data':   { '*zone': 'str', 'offset': 'int' } }
1117
1118##
1119# @guest-get-timezone:
1120#
1121# Retrieves the timezone information from the guest.
1122#
1123# Returns: A GuestTimezone dictionary.
1124#
1125# Since: 2.10
1126##
1127{ 'command': 'guest-get-timezone',
1128  'returns': 'GuestTimezone' }
1129
1130##
1131# @GuestOSInfo:
1132#
1133# @kernel-release:
1134#     * POSIX: release field returned by uname(2)
1135#     * Windows: version number of the OS
1136# @kernel-version:
1137#     * POSIX: version field returned by uname(2)
1138#     * Windows: build number of the OS
1139# @machine:
1140#     * POSIX: machine field returned by uname(2)
1141#     * Windows: one of x86, x86_64, arm, ia64
1142# @id:
1143#     * POSIX: as defined by os-release(5)
1144#     * Windows: contains string "mswindows"
1145# @name:
1146#     * POSIX: as defined by os-release(5)
1147#     * Windows: contains string "Microsoft Windows"
1148# @pretty-name:
1149#     * POSIX: as defined by os-release(5)
1150#     * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1151# @version:
1152#     * POSIX: as defined by os-release(5)
1153#     * Windows: long version string, e.g. "Microsoft Windows Server 2008"
1154# @version-id:
1155#     * POSIX: as defined by os-release(5)
1156#     * Windows: short version identifier, e.g. "7" or "20012r2"
1157# @variant:
1158#     * POSIX: as defined by os-release(5)
1159#     * Windows: contains string "server" or "client"
1160# @variant-id:
1161#     * POSIX: as defined by os-release(5)
1162#     * Windows: contains string "server" or "client"
1163#
1164# Notes:
1165#
1166# On POSIX systems the fields @id, @name, @pretty-name, @version, @version-id,
1167# @variant and @variant-id follow the definition specified in os-release(5).
1168# Refer to the manual page for exact description of the fields. Their values
1169# are taken from the os-release file. If the file is not present in the system,
1170# or the values are not present in the file, the fields are not included.
1171#
1172# On Windows the values are filled from information gathered from the system.
1173#
1174# Since: 2.10
1175##
1176{ 'struct': 'GuestOSInfo',
1177  'data': {
1178      '*kernel-release': 'str', '*kernel-version': 'str',
1179      '*machine': 'str', '*id': 'str', '*name': 'str',
1180      '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1181      '*variant': 'str', '*variant-id': 'str' } }
1182
1183##
1184# @guest-get-osinfo:
1185#
1186# Retrieve guest operating system information
1187#
1188# Returns: @GuestOSInfo
1189#
1190# Since: 2.10
1191##
1192{ 'command': 'guest-get-osinfo',
1193  'returns': 'GuestOSInfo' }
1194