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