]> git.proxmox.com Git - qemu.git/blob - qapi-schema-guest.json
softfloat: Replace int16 type with int_fast16_t
[qemu.git] / qapi-schema-guest.json
1 # *-*- Mode: Python -*-*
2
3 ##
4 #
5 # Echo back a unique integer value, and prepend to response a
6 # leading sentinel byte (0xFF) the client can check scan for.
7 #
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).
13 #
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 unecessary processing of
22 # stale data.
23 #
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.
27 #
28 # @id: randomly generated 64-bit integer
29 #
30 # Returns: The unique integer id passed in by the client
31 #
32 # Since: 1.1
33 # ##
34 { 'command': 'guest-sync-delimited'
35 'data': { 'id': 'int' },
36 'returns': 'int' }
37
38 ##
39 # @guest-sync:
40 #
41 # Echo back a unique integer value
42 #
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.
50 #
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.
56 #
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.
61 #
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.
65 #
66 # @id: randomly generated 64-bit integer
67 #
68 # Returns: The unique integer id passed in by the client
69 #
70 # Since: 0.15.0
71 ##
72 { 'command': 'guest-sync'
73 'data': { 'id': 'int' },
74 'returns': 'int' }
75
76 ##
77 # @guest-ping:
78 #
79 # Ping the guest agent, a non-error return implies success
80 #
81 # Since: 0.15.0
82 ##
83 { 'command': 'guest-ping' }
84
85 ##
86 # @GuestAgentCommandInfo:
87 #
88 # Information about guest agent commands.
89 #
90 # @name: name of the command
91 #
92 # @enabled: whether command is currently enabled by guest admin
93 #
94 # Since 1.1.0
95 ##
96 { 'type': 'GuestAgentCommandInfo',
97 'data': { 'name': 'str', 'enabled': 'bool' } }
98
99 ##
100 # @GuestAgentInfo
101 #
102 # Information about guest agent.
103 #
104 # @version: guest agent version
105 #
106 # @supported_commands: Information about guest agent commands
107 #
108 # Since 0.15.0
109 ##
110 { 'type': 'GuestAgentInfo',
111 'data': { 'version': 'str',
112 'supported_commands': ['GuestAgentCommandInfo'] } }
113 ##
114 # @guest-info:
115 #
116 # Get some information about the guest agent.
117 #
118 # Returns: @GuestAgentInfo
119 #
120 # Since: 0.15.0
121 ##
122 { 'command': 'guest-info',
123 'returns': 'GuestAgentInfo' }
124
125 ##
126 # @guest-shutdown:
127 #
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.
131 #
132 # @mode: #optional "halt", "powerdown" (default), or "reboot"
133 #
134 # Returns: Nothing on success
135 #
136 # Since: 0.15.0
137 ##
138 { 'command': 'guest-shutdown', 'data': { '*mode': 'str' } }
139
140 ##
141 # @guest-file-open:
142 #
143 # Open a file in the guest and retrieve a file handle for it
144 #
145 # @filepath: Full path to the file in the guest to open.
146 #
147 # @mode: #optional open mode, as per fopen(), "r" is the default.
148 #
149 # Returns: Guest file handle on success.
150 #
151 # Since: 0.15.0
152 ##
153 { 'command': 'guest-file-open',
154 'data': { 'path': 'str', '*mode': 'str' },
155 'returns': 'int' }
156
157 ##
158 # @guest-file-close:
159 #
160 # Close an open file in the guest
161 #
162 # @handle: filehandle returned by guest-file-open
163 #
164 # Returns: Nothing on success.
165 #
166 # Since: 0.15.0
167 ##
168 { 'command': 'guest-file-close',
169 'data': { 'handle': 'int' } }
170
171 ##
172 # @GuestFileRead
173 #
174 # Result of guest agent file-read operation
175 #
176 # @count: number of bytes read (note: count is *before*
177 # base64-encoding is applied)
178 #
179 # @buf-b64: base64-encoded bytes read
180 #
181 # @eof: whether EOF was encountered during read operation.
182 #
183 # Since: 0.15.0
184 ##
185 { 'type': 'GuestFileRead',
186 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
187
188 ##
189 # @guest-file-read:
190 #
191 # Read from an open file in the guest. Data will be base64-encoded
192 #
193 # @handle: filehandle returned by guest-file-open
194 #
195 # @count: #optional maximum number of bytes to read (default is 4KB)
196 #
197 # Returns: @GuestFileRead on success.
198 #
199 # Since: 0.15.0
200 ##
201 { 'command': 'guest-file-read',
202 'data': { 'handle': 'int', '*count': 'int' },
203 'returns': 'GuestFileRead' }
204
205 ##
206 # @GuestFileWrite
207 #
208 # Result of guest agent file-write operation
209 #
210 # @count: number of bytes written (note: count is actual bytes
211 # written, after base64-decoding of provided buffer)
212 #
213 # @eof: whether EOF was encountered during write operation.
214 #
215 # Since: 0.15.0
216 ##
217 { 'type': 'GuestFileWrite',
218 'data': { 'count': 'int', 'eof': 'bool' } }
219
220 ##
221 # @guest-file-write:
222 #
223 # Write to an open file in the guest.
224 #
225 # @handle: filehandle returned by guest-file-open
226 #
227 # @buf-b64: base64-encoded string representing data to be written
228 #
229 # @count: #optional bytes to write (actual bytes, after base64-decode),
230 # default is all content in buf-b64 buffer after base64 decoding
231 #
232 # Returns: @GuestFileWrite on success.
233 #
234 # Since: 0.15.0
235 ##
236 { 'command': 'guest-file-write',
237 'data': { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
238 'returns': 'GuestFileWrite' }
239
240
241 ##
242 # @GuestFileSeek
243 #
244 # Result of guest agent file-seek operation
245 #
246 # @position: current file position
247 #
248 # @eof: whether EOF was encountered during file seek
249 #
250 # Since: 0.15.0
251 ##
252 { 'type': 'GuestFileSeek',
253 'data': { 'position': 'int', 'eof': 'bool' } }
254
255 ##
256 # @guest-file-seek:
257 #
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.
261 #
262 # @handle: filehandle returned by guest-file-open
263 #
264 # @offset: bytes to skip over in the file stream
265 #
266 # @whence: SEEK_SET, SEEK_CUR, or SEEK_END, as with fseek()
267 #
268 # Returns: @GuestFileSeek on success.
269 #
270 # Since: 0.15.0
271 ##
272 { 'command': 'guest-file-seek',
273 'data': { 'handle': 'int', 'offset': 'int', 'whence': 'int' },
274 'returns': 'GuestFileSeek' }
275
276 ##
277 # @guest-file-flush:
278 #
279 # Write file changes bufferred in userspace to disk/kernel buffers
280 #
281 # @handle: filehandle returned by guest-file-open
282 #
283 # Returns: Nothing on success.
284 #
285 # Since: 0.15.0
286 ##
287 { 'command': 'guest-file-flush',
288 'data': { 'handle': 'int' } }
289
290 ##
291 # @GuestFsFreezeStatus
292 #
293 # An enumation of filesystem freeze states
294 #
295 # @thawed: filesystems thawed/unfrozen
296 #
297 # @frozen: all non-network guest filesystems frozen
298 #
299 # @error: failure to thaw 1 or more
300 # previously frozen filesystems, or failure to open a previously
301 # cached filesytem (filesystem unmounted/directory changes, etc).
302 #
303 # Since: 0.15.0
304 ##
305 { 'enum': 'GuestFsfreezeStatus',
306 'data': [ 'thawed', 'frozen', 'error' ] }
307
308 ##
309 # @guest-fsfreeze-status:
310 #
311 # Get guest fsfreeze state. error state indicates
312 #
313 # Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
314 #
315 # Since: 0.15.0
316 ##
317 { 'command': 'guest-fsfreeze-status',
318 'returns': 'GuestFsfreezeStatus' }
319
320 ##
321 # @guest-fsfreeze-freeze:
322 #
323 # Sync and freeze all non-network guest filesystems
324 #
325 # Returns: Number of file systems frozen on success
326 #
327 # Since: 0.15.0
328 ##
329 { 'command': 'guest-fsfreeze-freeze',
330 'returns': 'int' }
331
332 ##
333 # @guest-fsfreeze-thaw:
334 #
335 # Unfreeze frozen guest fileystems
336 #
337 # Returns: Number of file systems thawed
338 # If error, -1 (unknown error) or -errno
339 #
340 # Since: 0.15.0
341 ##
342 { 'command': 'guest-fsfreeze-thaw',
343 'returns': 'int' }
344
345 ##
346 # @guest-suspend-disk
347 #
348 # Suspend guest to disk.
349 #
350 # This command tries to execute the scripts provided by the pm-utils package.
351 # If it's not available, the suspend operation will be performed by manually
352 # writing to a sysfs file.
353 #
354 # For the best results it's strongly recommended to have the pm-utils
355 # package installed in the guest.
356 #
357 # Returns: nothing on success
358 # If suspend to disk is not supported, Unsupported
359 #
360 # Notes: o This is an asynchronous request. There's no guarantee a response
361 # will be sent
362 # o It's strongly recommended to issue the guest-sync command before
363 # sending commands when the guest resumes
364 #
365 # Since: 1.1
366 ##
367 { 'command': 'guest-suspend-disk' }
368
369 ##
370 # @guest-suspend-ram
371 #
372 # Suspend guest to ram.
373 #
374 # This command tries to execute the scripts provided by the pm-utils package.
375 # If it's not available, the suspend operation will be performed by manually
376 # writing to a sysfs file.
377 #
378 # For the best results it's strongly recommended to have the pm-utils
379 # package installed in the guest.
380 #
381 # IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup'
382 # command. Thus, it's *required* to query QEMU for the presence of the
383 # 'system_wakeup' command before issuing guest-suspend-ram.
384 #
385 # Returns: nothing on success
386 # If suspend to ram is not supported, Unsupported
387 #
388 # Notes: o This is an asynchronous request. There's no guarantee a response
389 # will be sent
390 # o It's strongly recommended to issue the guest-sync command before
391 # sending commands when the guest resumes
392 #
393 # Since: 1.1
394 ##
395 { 'command': 'guest-suspend-ram' }
396
397 ##
398 # @guest-suspend-hybrid
399 #
400 # Save guest state to disk and suspend to ram.
401 #
402 # This command requires the pm-utils package to be installed in the guest.
403 #
404 # IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup'
405 # command. Thus, it's *required* to query QEMU for the presence of the
406 # 'system_wakeup' command before issuing guest-suspend-hybrid.
407 #
408 # Returns: nothing on success
409 # If hybrid suspend is not supported, Unsupported
410 #
411 # Notes: o This is an asynchronous request. There's no guarantee a response
412 # will be sent
413 # o It's strongly recommended to issue the guest-sync command before
414 # sending commands when the guest resumes
415 #
416 # Since: 1.1
417 ##
418 { 'command': 'guest-suspend-hybrid' }
419
420 ##
421 # @GuestIpAddressType:
422 #
423 # An enumeration of supported IP address types
424 #
425 # @ipv4: IP version 4
426 #
427 # @ipv6: IP version 6
428 #
429 # Since: 1.1
430 ##
431 { 'enum': 'GuestIpAddressType',
432 'data': [ 'ipv4', 'ipv6' ] }
433
434 ##
435 # @GuestIpAddress:
436 #
437 # @ip-address: IP address
438 #
439 # @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
440 #
441 # @prefix: Network prefix length of @ip-address
442 #
443 # Since: 1.1
444 ##
445 { 'type': 'GuestIpAddress',
446 'data': {'ip-address': 'str',
447 'ip-address-type': 'GuestIpAddressType',
448 'prefix': 'int'} }
449
450 ##
451 # @GuestNetworkInterface:
452 #
453 # @name: The name of interface for which info are being delivered
454 #
455 # @hardware-address: Hardware address of @name
456 #
457 # @ip-addresses: List of addresses assigned to @name
458 #
459 # Since: 1.1
460 ##
461 { 'type': 'GuestNetworkInterface',
462 'data': {'name': 'str',
463 '*hardware-address': 'str',
464 '*ip-addresses': ['GuestIpAddress'] } }
465
466 ##
467 # @guest-network-get-interfaces:
468 #
469 # Get list of guest IP addresses, MAC addresses
470 # and netmasks.
471 #
472 # Returns: List of GuestNetworkInfo on success.
473 #
474 # Since: 1.1
475 ##
476 { 'command': 'guest-network-get-interfaces',
477 'returns': ['GuestNetworkInterface'] }