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