]> git.proxmox.com Git - mirror_qemu.git/blame - qga/qapi-schema.json
ppc: use kvm_vcpu_enable_cap()
[mirror_qemu.git] / qga / qapi-schema.json
CommitLineData
e3d4d252
MR
1# *-*- Mode: Python -*-*
2
9481ecd7
LE
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
3cf0bed8
MR
14##
15#
16# Echo back a unique integer value, and prepend to response a
17# leading sentinel byte (0xFF) the client can check scan for.
18#
19# This is used by clients talking to the guest agent over the
20# wire to ensure the stream is in sync and doesn't contain stale
21# data from previous client. It must be issued upon initial
22# connection, and after any client-side timeouts (including
23# timeouts on receiving a response to this command).
24#
25# After issuing this request, all guest agent responses should be
26# ignored until the response containing the unique integer value
27# the client passed in is returned. Receival of the 0xFF sentinel
28# byte must be handled as an indication that the client's
29# lexer/tokenizer/parser state should be flushed/reset in
30# preparation for reliably receiving the subsequent response. As
31# an optimization, clients may opt to ignore all data until a
a31f0531 32# sentinel value is receiving to avoid unnecessary processing of
3cf0bed8
MR
33# stale data.
34#
35# Similarly, clients should also precede this *request*
36# with a 0xFF byte to make sure the guest agent flushes any
37# partially read JSON data from a previous client connection.
38#
39# @id: randomly generated 64-bit integer
40#
41# Returns: The unique integer id passed in by the client
42#
43# Since: 1.1
44# ##
01b87f6d 45{ 'command': 'guest-sync-delimited',
3cf0bed8
MR
46 'data': { 'id': 'int' },
47 'returns': 'int' }
48
e3d4d252
MR
49##
50# @guest-sync:
51#
52# Echo back a unique integer value
53#
54# This is used by clients talking to the guest agent over the
55# wire to ensure the stream is in sync and doesn't contain stale
56# data from previous client. All guest agent responses should be
57# ignored until the provided unique integer value is returned,
58# and it is up to the client to handle stale whole or
59# partially-delivered JSON text in such a way that this response
60# can be obtained.
61#
3cf0bed8
MR
62# In cases where a partial stale response was previously
63# received by the client, this cannot always be done reliably.
64# One particular scenario being if qemu-ga responses are fed
65# character-by-character into a JSON parser. In these situations,
66# using guest-sync-delimited may be optimal.
67#
68# For clients that fetch responses line by line and convert them
69# to JSON objects, guest-sync should be sufficient, but note that
70# in cases where the channel is dirty some attempts at parsing the
71# response may result in a parser error.
72#
e7d81004 73# Such clients should also precede this command
3cf0bed8 74# with a 0xFF byte to make sure the guest agent flushes any
e3d4d252
MR
75# partially read JSON data from a previous session.
76#
77# @id: randomly generated 64-bit integer
78#
79# Returns: The unique integer id passed in by the client
80#
81# Since: 0.15.0
82##
01b87f6d 83{ 'command': 'guest-sync',
e3d4d252
MR
84 'data': { 'id': 'int' },
85 'returns': 'int' }
86
87##
88# @guest-ping:
89#
90# Ping the guest agent, a non-error return implies success
91#
92# Since: 0.15.0
93##
94{ 'command': 'guest-ping' }
95
6912e6a9
LL
96##
97# @guest-get-time:
98#
1634df56
AK
99# Get the information about guest's System Time relative to
100# the Epoch of 1970-01-01 in UTC.
6912e6a9
LL
101#
102# Returns: Time in nanoseconds.
103#
104# Since 1.5
105##
106{ 'command': 'guest-get-time',
107 'returns': 'int' }
108
a1bca57f
LL
109##
110# @guest-set-time:
111#
112# Set guest time.
113#
114# When a guest is paused or migrated to a file then loaded
115# from that file, the guest OS has no idea that there
116# was a big gap in the time. Depending on how long the
117# gap was, NTP might not be able to resynchronize the
118# guest.
119#
1634df56
AK
120# This command tries to set guest's System Time to the
121# given value, then sets the Hardware Clock (RTC) to the
122# current System Time. This will make it easier for a guest
123# to resynchronize without waiting for NTP. If no @time is
124# specified, then the time to set is read from RTC.
a1bca57f 125#
2c958923
MP
126# @time: #optional time of nanoseconds, relative to the Epoch
127# of 1970-01-01 in UTC.
a1bca57f
LL
128#
129# Returns: Nothing on success.
130#
131# Since: 1.5
132##
133{ 'command': 'guest-set-time',
2c958923 134 'data': { '*time': 'int' } }
a1bca57f 135
e3d4d252 136##
54383726 137# @GuestAgentCommandInfo:
e3d4d252 138#
54383726 139# Information about guest agent commands.
e3d4d252 140#
54383726
MR
141# @name: name of the command
142#
143# @enabled: whether command is currently enabled by guest admin
144#
0106dc4f
MW
145# @success-response: whether command returns a response on success
146# (since 1.7)
147#
54383726 148# Since 1.1.0
e3d4d252 149##
bf95c0d5 150{ 'type': 'GuestAgentCommandInfo',
0106dc4f 151 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
54383726
MR
152
153##
154# @GuestAgentInfo
155#
156# Information about guest agent.
157#
158# @version: guest agent version
159#
160# @supported_commands: Information about guest agent commands
161#
162# Since 0.15.0
163##
bf95c0d5
MR
164{ 'type': 'GuestAgentInfo',
165 'data': { 'version': 'str',
166 'supported_commands': ['GuestAgentCommandInfo'] } }
54383726
MR
167##
168# @guest-info:
169#
170# Get some information about the guest agent.
171#
172# Returns: @GuestAgentInfo
173#
174# Since: 0.15.0
175##
e3d4d252
MR
176{ 'command': 'guest-info',
177 'returns': 'GuestAgentInfo' }
178
179##
180# @guest-shutdown:
181#
182# Initiate guest-activated shutdown. Note: this is an asynchronous
3674838c 183# shutdown request, with no guarantee of successful shutdown.
e3d4d252
MR
184#
185# @mode: #optional "halt", "powerdown" (default), or "reboot"
186#
89268172
LC
187# This command does NOT return a response on success. Success condition
188# is indicated by the VM exiting with a zero exit status or, when
189# running with --no-shutdown, by issuing the query-status QMP command
190# to confirm the VM status is "shutdown".
e3d4d252
MR
191#
192# Since: 0.15.0
193##
89268172
LC
194{ 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
195 'success-response': 'no' }
e3d4d252
MR
196
197##
198# @guest-file-open:
199#
200# Open a file in the guest and retrieve a file handle for it
201#
202# @filepath: Full path to the file in the guest to open.
203#
204# @mode: #optional open mode, as per fopen(), "r" is the default.
205#
206# Returns: Guest file handle on success.
207#
208# Since: 0.15.0
209##
210{ 'command': 'guest-file-open',
211 'data': { 'path': 'str', '*mode': 'str' },
212 'returns': 'int' }
213
214##
215# @guest-file-close:
216#
217# Close an open file in the guest
218#
219# @handle: filehandle returned by guest-file-open
220#
221# Returns: Nothing on success.
222#
223# Since: 0.15.0
224##
225{ 'command': 'guest-file-close',
226 'data': { 'handle': 'int' } }
227
54383726
MR
228##
229# @GuestFileRead
230#
231# Result of guest agent file-read operation
232#
233# @count: number of bytes read (note: count is *before*
234# base64-encoding is applied)
235#
236# @buf-b64: base64-encoded bytes read
237#
238# @eof: whether EOF was encountered during read operation.
239#
240# Since: 0.15.0
241##
242{ 'type': 'GuestFileRead',
243 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
244
e3d4d252
MR
245##
246# @guest-file-read:
247#
248# Read from an open file in the guest. Data will be base64-encoded
249#
250# @handle: filehandle returned by guest-file-open
251#
252# @count: #optional maximum number of bytes to read (default is 4KB)
253#
54383726 254# Returns: @GuestFileRead on success.
e3d4d252
MR
255#
256# Since: 0.15.0
257##
e3d4d252
MR
258{ 'command': 'guest-file-read',
259 'data': { 'handle': 'int', '*count': 'int' },
260 'returns': 'GuestFileRead' }
261
54383726
MR
262##
263# @GuestFileWrite
264#
265# Result of guest agent file-write operation
266#
267# @count: number of bytes written (note: count is actual bytes
268# written, after base64-decoding of provided buffer)
269#
270# @eof: whether EOF was encountered during write operation.
271#
272# Since: 0.15.0
273##
274{ 'type': 'GuestFileWrite',
275 'data': { 'count': 'int', 'eof': 'bool' } }
276
e3d4d252
MR
277##
278# @guest-file-write:
279#
280# Write to an open file in the guest.
281#
282# @handle: filehandle returned by guest-file-open
283#
284# @buf-b64: base64-encoded string representing data to be written
285#
286# @count: #optional bytes to write (actual bytes, after base64-decode),
287# default is all content in buf-b64 buffer after base64 decoding
288#
54383726 289# Returns: @GuestFileWrite on success.
e3d4d252
MR
290#
291# Since: 0.15.0
292##
e3d4d252
MR
293{ 'command': 'guest-file-write',
294 'data': { 'handle': 'int', 'buf-b64': 'str', '*count': 'int' },
295 'returns': 'GuestFileWrite' }
296
54383726
MR
297
298##
299# @GuestFileSeek
300#
301# Result of guest agent file-seek operation
302#
303# @position: current file position
304#
305# @eof: whether EOF was encountered during file seek
306#
307# Since: 0.15.0
308##
309{ 'type': 'GuestFileSeek',
310 'data': { 'position': 'int', 'eof': 'bool' } }
311
e3d4d252
MR
312##
313# @guest-file-seek:
314#
315# Seek to a position in the file, as with fseek(), and return the
316# current file position afterward. Also encapsulates ftell()'s
317# functionality, just Set offset=0, whence=SEEK_CUR.
318#
319# @handle: filehandle returned by guest-file-open
320#
321# @offset: bytes to skip over in the file stream
322#
323# @whence: SEEK_SET, SEEK_CUR, or SEEK_END, as with fseek()
324#
54383726 325# Returns: @GuestFileSeek on success.
e3d4d252
MR
326#
327# Since: 0.15.0
328##
e3d4d252
MR
329{ 'command': 'guest-file-seek',
330 'data': { 'handle': 'int', 'offset': 'int', 'whence': 'int' },
331 'returns': 'GuestFileSeek' }
332
333##
334# @guest-file-flush:
335#
336# Write file changes bufferred in userspace to disk/kernel buffers
337#
338# @handle: filehandle returned by guest-file-open
339#
340# Returns: Nothing on success.
341#
342# Since: 0.15.0
343##
344{ 'command': 'guest-file-flush',
345 'data': { 'handle': 'int' } }
346
347##
54383726 348# @GuestFsFreezeStatus
e3d4d252 349#
6932a69b 350# An enumeration of filesystem freeze states
e3d4d252 351#
54383726
MR
352# @thawed: filesystems thawed/unfrozen
353#
354# @frozen: all non-network guest filesystems frozen
355#
e3d4d252
MR
356# Since: 0.15.0
357##
358{ 'enum': 'GuestFsfreezeStatus',
9e8aded4 359 'data': [ 'thawed', 'frozen' ] }
54383726
MR
360
361##
362# @guest-fsfreeze-status:
363#
364# Get guest fsfreeze state. error state indicates
365#
366# Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
367#
9e8aded4 368# Note: This may fail to properly report the current state as a result of
f789aa7b 369# some other guest processes having issued an fs freeze/thaw.
9e8aded4 370#
54383726
MR
371# Since: 0.15.0
372##
e3d4d252
MR
373{ 'command': 'guest-fsfreeze-status',
374 'returns': 'GuestFsfreezeStatus' }
375
376##
377# @guest-fsfreeze-freeze:
378#
9e8aded4 379# Sync and freeze all freezable, local guest filesystems
e3d4d252 380#
9e8aded4
MR
381# Returns: Number of file systems currently frozen. On error, all filesystems
382# will be thawed.
e3d4d252
MR
383#
384# Since: 0.15.0
385##
386{ 'command': 'guest-fsfreeze-freeze',
387 'returns': 'int' }
388
389##
390# @guest-fsfreeze-thaw:
391#
9e8aded4
MR
392# Unfreeze all frozen guest filesystems
393#
394# Returns: Number of file systems thawed by this call
e3d4d252 395#
9e8aded4
MR
396# Note: if return value does not match the previous call to
397# guest-fsfreeze-freeze, this likely means some freezable
398# filesystems were unfrozen before this call, and that the
399# filesystem state may have changed before issuing this
400# command.
e3d4d252
MR
401#
402# Since: 0.15.0
403##
404{ 'command': 'guest-fsfreeze-thaw',
405 'returns': 'int' }
11d0f125 406
eab5fd59
PB
407##
408# @guest-fstrim:
409#
410# Discard (or "trim") blocks which are not in use by the filesystem.
411#
412# @minimum:
413# Minimum contiguous free range to discard, in bytes. Free ranges
414# smaller than this may be ignored (this is a hint and the guest
415# may not respect it). By increasing this value, the fstrim
416# operation will complete more quickly for filesystems with badly
417# fragmented free space, although not all blocks will be discarded.
418# The default value is zero, meaning "discard every free block".
419#
420# Returns: Nothing.
421#
422# Since: 1.2
423##
424{ 'command': 'guest-fstrim',
425 'data': { '*minimum': 'int' } }
426
11d0f125
LC
427##
428# @guest-suspend-disk
429#
430# Suspend guest to disk.
431#
432# This command tries to execute the scripts provided by the pm-utils package.
433# If it's not available, the suspend operation will be performed by manually
434# writing to a sysfs file.
435#
436# For the best results it's strongly recommended to have the pm-utils
437# package installed in the guest.
438#
c6fcc10a
LC
439# This command does NOT return a response on success. There is a high chance
440# the command succeeded if the VM exits with a zero exit status or, when
441# running with --no-shutdown, by issuing the query-status QMP command to
442# to confirm the VM status is "shutdown". However, the VM could also exit
443# (or set its status to "shutdown") due to other reasons.
444#
445# The following errors may be returned:
11d0f125
LC
446# If suspend to disk is not supported, Unsupported
447#
c6fcc10a
LC
448# Notes: It's strongly recommended to issue the guest-sync command before
449# sending commands when the guest resumes
11d0f125
LC
450#
451# Since: 1.1
452##
c6fcc10a 453{ 'command': 'guest-suspend-disk', 'success-response': 'no' }
fbf42210
LC
454
455##
456# @guest-suspend-ram
457#
458# Suspend guest to ram.
459#
460# This command tries to execute the scripts provided by the pm-utils package.
461# If it's not available, the suspend operation will be performed by manually
462# writing to a sysfs file.
463#
464# For the best results it's strongly recommended to have the pm-utils
465# package installed in the guest.
466#
467# IMPORTANT: guest-suspend-ram requires QEMU to support the 'system_wakeup'
468# command. Thus, it's *required* to query QEMU for the presence of the
469# 'system_wakeup' command before issuing guest-suspend-ram.
470#
432d29db
LC
471# This command does NOT return a response on success. There are two options
472# to check for success:
473# 1. Wait for the SUSPEND QMP event from QEMU
474# 2. Issue the query-status QMP command to confirm the VM status is
475# "suspended"
476#
477# The following errors may be returned:
fbf42210
LC
478# If suspend to ram is not supported, Unsupported
479#
432d29db
LC
480# Notes: It's strongly recommended to issue the guest-sync command before
481# sending commands when the guest resumes
fbf42210
LC
482#
483# Since: 1.1
484##
432d29db 485{ 'command': 'guest-suspend-ram', 'success-response': 'no' }
95f4f404
LC
486
487##
488# @guest-suspend-hybrid
489#
490# Save guest state to disk and suspend to ram.
491#
492# This command requires the pm-utils package to be installed in the guest.
493#
494# IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'system_wakeup'
495# command. Thus, it's *required* to query QEMU for the presence of the
496# 'system_wakeup' command before issuing guest-suspend-hybrid.
497#
d9fcd2a1
LC
498# This command does NOT return a response on success. There are two options
499# to check for success:
500# 1. Wait for the SUSPEND QMP event from QEMU
501# 2. Issue the query-status QMP command to confirm the VM status is
502# "suspended"
503#
504# The following errors may be returned:
95f4f404
LC
505# If hybrid suspend is not supported, Unsupported
506#
d9fcd2a1
LC
507# Notes: It's strongly recommended to issue the guest-sync command before
508# sending commands when the guest resumes
95f4f404
LC
509#
510# Since: 1.1
511##
d9fcd2a1 512{ 'command': 'guest-suspend-hybrid', 'success-response': 'no' }
3424fc9f
MP
513
514##
515# @GuestIpAddressType:
516#
517# An enumeration of supported IP address types
518#
519# @ipv4: IP version 4
520#
521# @ipv6: IP version 6
522#
523# Since: 1.1
524##
525{ 'enum': 'GuestIpAddressType',
526 'data': [ 'ipv4', 'ipv6' ] }
527
528##
529# @GuestIpAddress:
530#
531# @ip-address: IP address
532#
533# @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
534#
535# @prefix: Network prefix length of @ip-address
536#
537# Since: 1.1
538##
539{ 'type': 'GuestIpAddress',
540 'data': {'ip-address': 'str',
541 'ip-address-type': 'GuestIpAddressType',
542 'prefix': 'int'} }
543
544##
545# @GuestNetworkInterface:
546#
547# @name: The name of interface for which info are being delivered
548#
549# @hardware-address: Hardware address of @name
550#
551# @ip-addresses: List of addresses assigned to @name
552#
553# Since: 1.1
554##
555{ 'type': 'GuestNetworkInterface',
556 'data': {'name': 'str',
557 '*hardware-address': 'str',
558 '*ip-addresses': ['GuestIpAddress'] } }
559
560##
561# @guest-network-get-interfaces:
562#
563# Get list of guest IP addresses, MAC addresses
564# and netmasks.
565#
566# Returns: List of GuestNetworkInfo on success.
567#
568# Since: 1.1
569##
570{ 'command': 'guest-network-get-interfaces',
571 'returns': ['GuestNetworkInterface'] }
70e133a7
LE
572
573##
574# @GuestLogicalProcessor:
575#
576# @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
577#
578# @online: Whether the VCPU is enabled.
579#
c964c9e0
LE
580# @can-offline: #optional Whether offlining the VCPU is possible. This member
581# is always filled in by the guest agent when the structure is
582# returned, and always ignored on input (hence it can be omitted
583# then).
70e133a7
LE
584#
585# Since: 1.5
586##
587{ 'type': 'GuestLogicalProcessor',
588 'data': {'logical-id': 'int',
589 'online': 'bool',
590 '*can-offline': 'bool'} }
591
592##
593# @guest-get-vcpus:
594#
595# Retrieve the list of the guest's logical processors.
596#
597# This is a read-only operation.
598#
599# Returns: The list of all VCPUs the guest knows about. Each VCPU is put on the
600# list exactly once, but their order is unspecified.
601#
602# Since: 1.5
603##
604{ 'command': 'guest-get-vcpus',
605 'returns': ['GuestLogicalProcessor'] }
606
607##
608# @guest-set-vcpus:
609#
610# Attempt to reconfigure (currently: enable/disable) logical processors inside
611# the guest.
612#
613# The input list is processed node by node in order. In each node @logical-id
614# is used to look up the guest VCPU, for which @online specifies the requested
615# state. The set of distinct @logical-id's is only required to be a subset of
616# the guest-supported identifiers. There's no restriction on list length or on
617# repeating the same @logical-id (with possibly different @online field).
618# Preferably the input list should describe a modified subset of
619# @guest-get-vcpus' return value.
620#
621# Returns: The length of the initial sublist that has been successfully
622# processed. The guest agent maximizes this value. Possible cases:
623#
624# 0: if the @vcpus list was empty on input. Guest state
625# has not been changed. Otherwise,
626#
627# Error: processing the first node of @vcpus failed for the
628# reason returned. Guest state has not been changed.
629# Otherwise,
630#
631# < length(@vcpus): more than zero initial nodes have been processed,
632# but not the entire @vcpus list. Guest state has
633# changed accordingly. To retrieve the error
634# (assuming it persists), repeat the call with the
635# successfully processed initial sublist removed.
636# Otherwise,
637#
638# length(@vcpus): call successful.
639#
640# Since: 1.5
641##
642{ 'command': 'guest-set-vcpus',
643 'data': {'vcpus': ['GuestLogicalProcessor'] },
644 'returns': 'int' }