qapi: add support for command options
[qemu/ar7.git] / qapi-schema-guest.json
blob692b57067505836fe22dede0c5b757cbd46b2080
1 # *-*- Mode: Python -*-*
3 ##
5 # Echo back a unique integer value, and prepend to response a
6 # leading sentinel byte (0xFF) the client can check scan for.
8 # This is used by clients talking to the guest agent over the
9 # wire to ensure the stream is in sync and doesn't contain stale
10 # data from previous client. It must be issued upon initial
11 # connection, and after any client-side timeouts (including
12 # timeouts on receiving a response to this command).
14 # After issuing this request, all guest agent responses should be
15 # ignored until the response containing the unique integer value
16 # the client passed in is returned. Receival of the 0xFF sentinel
17 # byte must be handled as an indication that the client's
18 # lexer/tokenizer/parser state should be flushed/reset in
19 # preparation for reliably receiving the subsequent response. As
20 # an optimization, clients may opt to ignore all data until a
21 # sentinel value is receiving to avoid unnecessary processing of
22 # stale data.
24 # Similarly, clients should also precede this *request*
25 # with a 0xFF byte to make sure the guest agent flushes any
26 # partially read JSON data from a previous client connection.
28 # @id: randomly generated 64-bit integer
30 # Returns: The unique integer id passed in by the client
32 # Since: 1.1
33 # ##
34 { 'command': 'guest-sync-delimited'
35   'data':    { 'id': 'int' },
36   'returns': 'int' }
39 # @guest-sync:
41 # Echo back a unique integer value
43 # This is used by clients talking to the guest agent over the
44 # wire to ensure the stream is in sync and doesn't contain stale
45 # data from previous client. All guest agent responses should be
46 # ignored until the provided unique integer value is returned,
47 # and it is up to the client to handle stale whole or
48 # partially-delivered JSON text in such a way that this response
49 # can be obtained.
51 # In cases where a partial stale response was previously
52 # received by the client, this cannot always be done reliably.
53 # One particular scenario being if qemu-ga responses are fed
54 # character-by-character into a JSON parser. In these situations,
55 # using guest-sync-delimited may be optimal.
57 # For clients that fetch responses line by line and convert them
58 # to JSON objects, guest-sync should be sufficient, but note that
59 # in cases where the channel is dirty some attempts at parsing the
60 # response may result in a parser error.
62 # Such clients should also precede this command
63 # with a 0xFF byte to make sure the guest agent flushes any
64 # partially read JSON data from a previous session.
66 # @id: randomly generated 64-bit integer
68 # Returns: The unique integer id passed in by the client
70 # Since: 0.15.0
72 { 'command': 'guest-sync'
73   'data':    { 'id': 'int' },
74   'returns': 'int' }
77 # @guest-ping:
79 # Ping the guest agent, a non-error return implies success
81 # Since: 0.15.0
83 { 'command': 'guest-ping' }
86 # @GuestAgentCommandInfo:
88 # Information about guest agent commands.
90 # @name: name of the command
92 # @enabled: whether command is currently enabled by guest admin
94 # Since 1.1.0
96 { 'type': 'GuestAgentCommandInfo',
97   'data': { 'name': 'str', 'enabled': 'bool' } }
100 # @GuestAgentInfo
102 # Information about guest agent.
104 # @version: guest agent version
106 # @supported_commands: Information about guest agent commands
108 # Since 0.15.0
110 { 'type': 'GuestAgentInfo',
111   'data': { 'version': 'str',
112             'supported_commands': ['GuestAgentCommandInfo'] } }
114 # @guest-info:
116 # Get some information about the guest agent.
118 # Returns: @GuestAgentInfo
120 # Since: 0.15.0
122 { 'command': 'guest-info',
123   'returns': 'GuestAgentInfo' }
126 # @guest-shutdown:
128 # Initiate guest-activated shutdown. Note: this is an asynchronous
129 # shutdown request, with no guaruntee of successful shutdown. Errors
130 # will be logged to guest's syslog.
132 # @mode: #optional "halt", "powerdown" (default), or "reboot"
134 # Returns: Nothing on success
136 # Since: 0.15.0
138 { 'command': 'guest-shutdown', 'data': { '*mode': 'str' } }
141 # @guest-file-open:
143 # Open a file in the guest and retrieve a file handle for it
145 # @filepath: Full path to the file in the guest to open.
147 # @mode: #optional open mode, as per fopen(), "r" is the default.
149 # Returns: Guest file handle on success.
151 # Since: 0.15.0
153 { 'command': 'guest-file-open',
154   'data':    { 'path': 'str', '*mode': 'str' },
155   'returns': 'int' }
158 # @guest-file-close:
160 # Close an open file in the guest
162 # @handle: filehandle returned by guest-file-open
164 # Returns: Nothing on success.
166 # Since: 0.15.0
168 { 'command': 'guest-file-close',
169   'data': { 'handle': 'int' } }
172 # @GuestFileRead
174 # Result of guest agent file-read operation
176 # @count: number of bytes read (note: count is *before*
177 #         base64-encoding is applied)
179 # @buf-b64: base64-encoded bytes read
181 # @eof: whether EOF was encountered during read operation.
183 # Since: 0.15.0
185 { 'type': 'GuestFileRead',
186   'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
189 # @guest-file-read:
191 # Read from an open file in the guest. Data will be base64-encoded
193 # @handle: filehandle returned by guest-file-open
195 # @count: #optional maximum number of bytes to read (default is 4KB)
197 # Returns: @GuestFileRead on success.
199 # Since: 0.15.0
201 { 'command': 'guest-file-read',
202   'data':    { 'handle': 'int', '*count': 'int' },
203   'returns': 'GuestFileRead' }
206 # @GuestFileWrite
208 # Result of guest agent file-write operation
210 # @count: number of bytes written (note: count is actual bytes
211 #         written, after base64-decoding of provided buffer)
213 # @eof: whether EOF was encountered during write operation.
215 # Since: 0.15.0
217 { 'type': 'GuestFileWrite',
218   'data': { 'count': 'int', 'eof': 'bool' } }
221 # @guest-file-write:
223 # Write to an open file in the guest.
225 # @handle: filehandle returned by guest-file-open
227 # @buf-b64: base64-encoded string representing data to be written
229 # @count: #optional bytes to write (actual bytes, after base64-decode),
230 #         default is all content in buf-b64 buffer after base64 decoding
232 # Returns: @GuestFileWrite on success.
234 # Since: 0.15.0
236 { 'command': 'guest-file-write',
237   'data':    { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
238   'returns': 'GuestFileWrite' }
242 # @GuestFileSeek
244 # Result of guest agent file-seek operation
246 # @position: current file position
248 # @eof: whether EOF was encountered during file seek
250 # Since: 0.15.0
252 { 'type': 'GuestFileSeek',
253   'data': { 'position': 'int', 'eof': 'bool' } }
256 # @guest-file-seek:
258 # Seek to a position in the file, as with fseek(), and return the
259 # current file position afterward. Also encapsulates ftell()'s
260 # functionality, just Set offset=0, whence=SEEK_CUR.
262 # @handle: filehandle returned by guest-file-open
264 # @offset: bytes to skip over in the file stream
266 # @whence: SEEK_SET, SEEK_CUR, or SEEK_END, as with fseek()
268 # Returns: @GuestFileSeek on success.
270 # Since: 0.15.0
272 { 'command': 'guest-file-seek',
273   'data':    { 'handle': 'int', 'offset': 'int', 'whence': 'int' },
274   'returns': 'GuestFileSeek' }
277 # @guest-file-flush:
279 # Write file changes bufferred in userspace to disk/kernel buffers
281 # @handle: filehandle returned by guest-file-open
283 # Returns: Nothing on success.
285 # Since: 0.15.0
287 { 'command': 'guest-file-flush',
288   'data': { 'handle': 'int' } }
291 # @GuestFsFreezeStatus
293 # An enumation of filesystem freeze states
295 # @thawed: filesystems thawed/unfrozen
297 # @frozen: all non-network guest filesystems frozen
299 # Since: 0.15.0
301 { 'enum': 'GuestFsfreezeStatus',
302   'data': [ 'thawed', 'frozen' ] }
305 # @guest-fsfreeze-status:
307 # Get guest fsfreeze state. error state indicates
309 # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
311 # Note: This may fail to properly report the current state as a result of
312 # some other guest processes having issued an fs freeze/thaw.
314 # Since: 0.15.0
316 { 'command': 'guest-fsfreeze-status',
317   'returns': 'GuestFsfreezeStatus' }
320 # @guest-fsfreeze-freeze:
322 # Sync and freeze all freezable, local guest filesystems
324 # Returns: Number of file systems currently frozen. On error, all filesystems
325 # will be thawed.
327 # Since: 0.15.0
329 { 'command': 'guest-fsfreeze-freeze',
330   'returns': 'int' }
333 # @guest-fsfreeze-thaw:
335 # Unfreeze all frozen guest filesystems
337 # Returns: Number of file systems thawed by this call
339 # Note: if return value does not match the previous call to
340 #       guest-fsfreeze-freeze, this likely means some freezable
341 #       filesystems were unfrozen before this call, and that the
342 #       filesystem state may have changed before issuing this
343 #       command.
345 # Since: 0.15.0
347 { 'command': 'guest-fsfreeze-thaw',
348   'returns': 'int' }
351 # @guest-suspend-disk
353 # Suspend guest to disk.
355 # This command tries to execute the scripts provided by the pm-utils package.
356 # If it's not available, the suspend operation will be performed by manually
357 # writing to a sysfs file.
359 # For the best results it's strongly recommended to have the pm-utils
360 # package installed in the guest.
362 # Returns: nothing on success
363 #          If suspend to disk is not supported, Unsupported
365 # Notes: o This is an asynchronous request. There's no guarantee a response
366 #          will be sent
367 #        o It's strongly recommended to issue the guest-sync command before
368 #          sending commands when the guest resumes
370 # Since: 1.1
372 { 'command': 'guest-suspend-disk' }
375 # @guest-suspend-ram
377 # Suspend guest to ram.
379 # This command tries to execute the scripts provided by the pm-utils package.
380 # If it's not available, the suspend operation will be performed by manually
381 # writing to a sysfs file.
383 # For the best results it's strongly recommended to have the pm-utils
384 # package installed in the guest.
386 # IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup'
387 # command.  Thus, it's *required* to query QEMU for the presence of the
388 # 'system_wakeup' command before issuing guest-suspend-ram.
390 # Returns: nothing on success
391 #          If suspend to ram is not supported, Unsupported
393 # Notes: o This is an asynchronous request. There's no guarantee a response
394 #          will be sent
395 #        o It's strongly recommended to issue the guest-sync command before
396 #          sending commands when the guest resumes
398 # Since: 1.1
400 { 'command': 'guest-suspend-ram' }
403 # @guest-suspend-hybrid
405 # Save guest state to disk and suspend to ram.
407 # This command requires the pm-utils package to be installed in the guest.
409 # IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup'
410 # command.  Thus, it's *required* to query QEMU for the presence of the
411 # 'system_wakeup' command before issuing guest-suspend-hybrid.
413 # Returns: nothing on success
414 #          If hybrid suspend is not supported, Unsupported
416 # Notes: o This is an asynchronous request. There's no guarantee a response
417 #          will be sent
418 #        o It's strongly recommended to issue the guest-sync command before
419 #          sending commands when the guest resumes
421 # Since: 1.1
423 { 'command': 'guest-suspend-hybrid' }
426 # @GuestIpAddressType:
428 # An enumeration of supported IP address types
430 # @ipv4: IP version 4
432 # @ipv6: IP version 6
434 # Since: 1.1
436 { 'enum': 'GuestIpAddressType',
437   'data': [ 'ipv4', 'ipv6' ] }
440 # @GuestIpAddress:
442 # @ip-address: IP address
444 # @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
446 # @prefix: Network prefix length of @ip-address
448 # Since: 1.1
450 { 'type': 'GuestIpAddress',
451   'data': {'ip-address': 'str',
452            'ip-address-type': 'GuestIpAddressType',
453            'prefix': 'int'} }
456 # @GuestNetworkInterface:
458 # @name: The name of interface for which info are being delivered
460 # @hardware-address: Hardware address of @name
462 # @ip-addresses: List of addresses assigned to @name
464 # Since: 1.1
466 { 'type': 'GuestNetworkInterface',
467   'data': {'name': 'str',
468            '*hardware-address': 'str',
469            '*ip-addresses': ['GuestIpAddress'] } }
472 # @guest-network-get-interfaces:
474 # Get list of guest IP addresses, MAC addresses
475 # and netmasks.
477 # Returns: List of GuestNetworkInfo on success.
479 # Since: 1.1
481 { 'command': 'guest-network-get-interfaces',
482   'returns': ['GuestNetworkInterface'] }