]> git.proxmox.com Git - mirror_qemu.git/blame - qga/qapi-schema.json
Merge tag 'pull-maintainer-may24-160524-2' of https://gitlab.com/stsquad/qemu into...
[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 6#
059d341a
MA
7# "unsupported" is a higher-level error than the errors that
8# individual commands might document. The caller should always be
9# prepared to receive QERR_UNSUPPORTED, even if the given command
10# doesn't specify it, or doesn't 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
0e4ef702
TH
19# Lists with items allowed to permit QAPI rule violations; think twice
20# before you add to them!
1554a8fa 21{ 'pragma': {
5aceeac0
MA
22 # Types whose member names may use '_'
23 'member-name-exceptions': [
24 'GuestAgentInfo'
25 ],
1554a8fa 26 # Commands allowed to return a non-dictionary:
b86df374 27 'command-returns-exceptions': [
1554a8fa
MA
28 'guest-file-open',
29 'guest-fsfreeze-freeze',
30 'guest-fsfreeze-freeze-list',
31 'guest-fsfreeze-status',
32 'guest-fsfreeze-thaw',
33 'guest-get-time',
34 'guest-set-vcpus',
35 'guest-sync',
0cec5011
MA
36 'guest-sync-delimited' ],
37 # Types and commands with undocumented members:
38 'documentation-exceptions': [
0b34cf84 39 'GuestNVMeSmart' ] } }
1554a8fa 40
3cf0bed8 41##
71e0e067 42# @guest-sync-delimited:
3cf0bed8 43#
059d341a
MA
44# Echo back a unique integer value, and prepend to response a leading
45# sentinel byte (0xFF) the client can check scan for.
3cf0bed8 46#
059d341a
MA
47# This is used by clients talking to the guest agent over the wire to
48# ensure the stream is in sync and doesn't contain stale data from
49# previous client. It must be issued upon initial connection, and
50# after any client-side timeouts (including timeouts on receiving a
51# response to this command).
3cf0bed8
MR
52#
53# After issuing this request, all guest agent responses should be
059d341a
MA
54# ignored until the response containing the unique integer value the
55# client passed in is returned. Receival of the 0xFF sentinel byte
56# must be handled as an indication that the client's
57# lexer/tokenizer/parser state should be flushed/reset in preparation
58# for reliably receiving the subsequent response. As an optimization,
59# clients may opt to ignore all data until a sentinel value is
60# receiving to avoid unnecessary processing of stale data.
61#
62# Similarly, clients should also precede this *request* with a 0xFF
63# byte to make sure the guest agent flushes any partially read JSON
64# data from a previous client connection.
3cf0bed8
MR
65#
66# @id: randomly generated 64-bit integer
67#
68# Returns: The unique integer id passed in by the client
69#
70# Since: 1.1
71e0e067 71##
01b87f6d 72{ 'command': 'guest-sync-delimited',
3cf0bed8
MR
73 'data': { 'id': 'int' },
74 'returns': 'int' }
75
e3d4d252
MR
76##
77# @guest-sync:
78#
79# Echo back a unique integer value
80#
059d341a
MA
81# This is used by clients talking to the guest agent over the wire to
82# ensure the stream is in sync and doesn't contain stale data from
83# previous client. All guest agent responses should be ignored until
84# the provided unique integer value is returned, and it is up to the
85# client to handle stale whole or partially-delivered JSON text in
86# such a way that this response can be obtained.
87#
88# In cases where a partial stale response was previously received by
89# the client, this cannot always be done reliably. One particular
90# scenario being if qemu-ga responses are fed character-by-character
91# into a JSON parser. In these situations, using guest-sync-delimited
92# may be optimal.
93#
94# For clients that fetch responses line by line and convert them to
95# JSON objects, guest-sync should be sufficient, but note that in
96# cases where the channel is dirty some attempts at parsing the
3cf0bed8
MR
97# response may result in a parser error.
98#
059d341a
MA
99# Such clients should also precede this command with a 0xFF byte to
100# make sure the guest agent flushes any partially read JSON data from
101# a previous session.
e3d4d252
MR
102#
103# @id: randomly generated 64-bit integer
104#
105# Returns: The unique integer id passed in by the client
106#
107# Since: 0.15.0
108##
01b87f6d 109{ 'command': 'guest-sync',
e3d4d252
MR
110 'data': { 'id': 'int' },
111 'returns': 'int' }
112
113##
114# @guest-ping:
115#
116# Ping the guest agent, a non-error return implies success
117#
118# Since: 0.15.0
119##
120{ 'command': 'guest-ping' }
121
6912e6a9
LL
122##
123# @guest-get-time:
124#
059d341a
MA
125# Get the information about guest's System Time relative to the Epoch
126# of 1970-01-01 in UTC.
6912e6a9
LL
127#
128# Returns: Time in nanoseconds.
129#
5072f7b3 130# Since: 1.5
6912e6a9
LL
131##
132{ 'command': 'guest-get-time',
133 'returns': 'int' }
134
a1bca57f
LL
135##
136# @guest-set-time:
137#
138# Set guest time.
139#
059d341a
MA
140# When a guest is paused or migrated to a file then loaded from that
141# file, the guest OS has no idea that there was a big gap in the time.
142# Depending on how long the gap was, NTP might not be able to
143# resynchronize the guest.
144#
145# This command tries to set guest's System Time to the given value,
146# then sets the Hardware Clock (RTC) to the current System Time. This
147# will make it easier for a guest to resynchronize without waiting for
148# NTP. If no @time is specified, then the time to set is read from
149# RTC. However, this may not be supported on all platforms (i.e.
150# Windows). If that's the case users are advised to always pass a
ee17cbdc 151# value.
a1bca57f 152#
059d341a
MA
153# @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in
154# UTC.
a1bca57f 155#
a1bca57f
LL
156# Since: 1.5
157##
158{ 'command': 'guest-set-time',
2c958923 159 'data': { '*time': 'int' } }
a1bca57f 160
e3d4d252 161##
54383726 162# @GuestAgentCommandInfo:
e3d4d252 163#
54383726 164# Information about guest agent commands.
e3d4d252 165#
54383726
MR
166# @name: name of the command
167#
168# @enabled: whether command is currently enabled by guest admin
169#
0106dc4f 170# @success-response: whether command returns a response on success
059d341a 171# (since 1.7)
0106dc4f 172#
5072f7b3 173# Since: 1.1.0
e3d4d252 174##
895a2a80 175{ 'struct': 'GuestAgentCommandInfo',
0106dc4f 176 'data': { 'name': 'str', 'enabled': 'bool', 'success-response': 'bool' } }
54383726
MR
177
178##
5072f7b3 179# @GuestAgentInfo:
54383726
MR
180#
181# Information about guest agent.
182#
183# @version: guest agent version
184#
185# @supported_commands: Information about guest agent commands
186#
5072f7b3 187# Since: 0.15.0
54383726 188##
895a2a80 189{ 'struct': 'GuestAgentInfo',
bf95c0d5
MR
190 'data': { 'version': 'str',
191 'supported_commands': ['GuestAgentCommandInfo'] } }
54383726
MR
192##
193# @guest-info:
194#
195# Get some information about the guest agent.
196#
197# Returns: @GuestAgentInfo
198#
199# Since: 0.15.0
200##
e3d4d252
MR
201{ 'command': 'guest-info',
202 'returns': 'GuestAgentInfo' }
203
204##
205# @guest-shutdown:
206#
059d341a 207# Initiate guest-activated shutdown. Note: this is an asynchronous
3674838c 208# shutdown request, with no guarantee of successful shutdown.
e3d4d252 209#
1d8bda12 210# @mode: "halt", "powerdown" (default), or "reboot"
e3d4d252 211#
059d341a
MA
212# This command does NOT return a response on success. Success
213# condition is indicated by the VM exiting with a zero exit status or,
214# when running with --no-shutdown, by issuing the query-status QMP
215# command to confirm the VM status is "shutdown".
e3d4d252
MR
216#
217# Since: 0.15.0
218##
89268172 219{ 'command': 'guest-shutdown', 'data': { '*mode': 'str' },
d708cdbe 220 'success-response': false }
e3d4d252
MR
221
222##
223# @guest-file-open:
224#
225# Open a file in the guest and retrieve a file handle for it
226#
4d5c8bc4 227# @path: Full path to the file in the guest to open.
e3d4d252 228#
1d8bda12 229# @mode: open mode, as per fopen(), "r" is the default.
e3d4d252 230#
6a90cc82 231# Returns: Guest file handle
e3d4d252
MR
232#
233# Since: 0.15.0
234##
235{ 'command': 'guest-file-open',
236 'data': { 'path': 'str', '*mode': 'str' },
237 'returns': 'int' }
238
239##
240# @guest-file-close:
241#
242# Close an open file in the guest
243#
244# @handle: filehandle returned by guest-file-open
245#
e3d4d252
MR
246# Since: 0.15.0
247##
248{ 'command': 'guest-file-close',
249 'data': { 'handle': 'int' } }
250
54383726 251##
5072f7b3 252# @GuestFileRead:
54383726
MR
253#
254# Result of guest agent file-read operation
255#
256# @count: number of bytes read (note: count is *before*
059d341a 257# base64-encoding is applied)
54383726
MR
258#
259# @buf-b64: base64-encoded bytes read
260#
261# @eof: whether EOF was encountered during read operation.
262#
263# Since: 0.15.0
264##
895a2a80 265{ 'struct': 'GuestFileRead',
54383726
MR
266 'data': { 'count': 'int', 'buf-b64': 'str', 'eof': 'bool' } }
267
e3d4d252
MR
268##
269# @guest-file-read:
270#
059d341a 271# Read from an open file in the guest. Data will be base64-encoded.
1329651f
PMD
272# As this command is just for limited, ad-hoc debugging, such as log
273# file access, the number of bytes to read is limited to 48 MB.
e3d4d252
MR
274#
275# @handle: filehandle returned by guest-file-open
276#
059d341a
MA
277# @count: maximum number of bytes to read (default is 4KB, maximum is
278# 48MB)
e3d4d252 279#
6a90cc82 280# Returns: @GuestFileRead
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
059d341a 294# written, after base64-decoding of provided buffer)
54383726
MR
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#
059d341a
MA
312# @count: bytes to write (actual bytes, after base64-decode), default
313# is all content in buf-b64 buffer after base64 decoding
e3d4d252 314#
6a90cc82 315# Returns: @GuestFileWrite
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)
059d341a 344#
0b4b4938 345# @cur: Add offset to the current location (same effect as 'whence':1)
059d341a 346#
0b4b4938
EB
347# @end: Add offset to the end of the file (same effect as 'whence':2)
348#
349# Since: 2.6
350##
351{ 'enum': 'QGASeek', 'data': [ 'set', 'cur', 'end' ] }
352
353##
354# @GuestFileWhence:
355#
356# Controls the meaning of offset to @guest-file-seek.
357#
358# @value: Integral value (0 for set, 1 for cur, 2 for end), available
059d341a
MA
359# for historical reasons, and might differ from the host's or
360# guest's SEEK_* values (since: 0.15)
361#
0b4b4938
EB
362# @name: Symbolic name, and preferred interface
363#
364# Since: 2.6
365##
366{ 'alternate': 'GuestFileWhence',
367 'data': { 'value': 'int', 'name': 'QGASeek' } }
368
e3d4d252
MR
369##
370# @guest-file-seek:
371#
372# Seek to a position in the file, as with fseek(), and return the
059d341a 373# current file position afterward. Also encapsulates ftell()'s
0a982b1b 374# functionality, with offset=0 and whence=1.
e3d4d252
MR
375#
376# @handle: filehandle returned by guest-file-open
377#
378# @offset: bytes to skip over in the file stream
379#
0b4b4938 380# @whence: Symbolic or numeric code for interpreting offset
e3d4d252 381#
6a90cc82 382# Returns: @GuestFileSeek
e3d4d252
MR
383#
384# Since: 0.15.0
385##
e3d4d252 386{ 'command': 'guest-file-seek',
0b4b4938
EB
387 'data': { 'handle': 'int', 'offset': 'int',
388 'whence': 'GuestFileWhence' },
e3d4d252
MR
389 'returns': 'GuestFileSeek' }
390
391##
392# @guest-file-flush:
393#
1e458f11 394# Write file changes buffered in userspace to disk/kernel buffers
e3d4d252
MR
395#
396# @handle: filehandle returned by guest-file-open
397#
e3d4d252
MR
398# Since: 0.15.0
399##
400{ 'command': 'guest-file-flush',
401 'data': { 'handle': 'int' } }
402
403##
5072f7b3 404# @GuestFsfreezeStatus:
e3d4d252 405#
6932a69b 406# An enumeration of filesystem freeze states
e3d4d252 407#
54383726
MR
408# @thawed: filesystems thawed/unfrozen
409#
410# @frozen: all non-network guest filesystems frozen
411#
e3d4d252
MR
412# Since: 0.15.0
413##
414{ 'enum': 'GuestFsfreezeStatus',
9e8aded4 415 'data': [ 'thawed', 'frozen' ] }
54383726
MR
416
417##
418# @guest-fsfreeze-status:
419#
a36c8653 420# Get guest fsfreeze state.
54383726 421#
059d341a
MA
422# Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined
423# below)
54383726 424#
059d341a
MA
425# Note: This may fail to properly report the current state as a result
426# of some other guest processes having issued an fs freeze/thaw.
9e8aded4 427#
54383726
MR
428# Since: 0.15.0
429##
e3d4d252
MR
430{ 'command': 'guest-fsfreeze-status',
431 'returns': 'GuestFsfreezeStatus' }
432
433##
434# @guest-fsfreeze-freeze:
435#
059d341a 436# Sync and freeze all freezable, local guest filesystems. If this
1dbfbc17
MAL
437# command succeeded, you may call @guest-fsfreeze-thaw later to
438# unfreeze.
439#
e22955e7
MA
440# On error, all filesystems will be thawed. If no filesystems are
441# frozen as a result of this call, then @guest-fsfreeze-status will
442# remain "thawed" and calling @guest-fsfreeze-thaw is not necessary.
443#
444# Returns: Number of file systems currently frozen.
445#
1dbfbc17 446# Note: On Windows, the command is implemented with the help of a
059d341a
MA
447# Volume Shadow-copy Service DLL helper. The frozen state is
448# limited for up to 10 seconds by VSS.
e3d4d252 449#
e3d4d252
MR
450# Since: 0.15.0
451##
452{ 'command': 'guest-fsfreeze-freeze',
453 'returns': 'int' }
454
e99bce20
TS
455##
456# @guest-fsfreeze-freeze-list:
457#
059d341a
MA
458# Sync and freeze specified guest filesystems. See also
459# @guest-fsfreeze-freeze.
e99bce20 460#
e22955e7
MA
461# On error, all filesystems will be thawed.
462#
1d8bda12 463# @mountpoints: an array of mountpoints of filesystems to be frozen.
059d341a
MA
464# If omitted, every mounted filesystem is frozen. Invalid mount
465# points are ignored.
e99bce20 466#
e22955e7 467# Returns: Number of file systems currently frozen.
e99bce20
TS
468#
469# Since: 2.2
470##
471{ 'command': 'guest-fsfreeze-freeze-list',
472 'data': { '*mountpoints': ['str'] },
473 'returns': 'int' }
474
e3d4d252
MR
475##
476# @guest-fsfreeze-thaw:
477#
9e8aded4
MR
478# Unfreeze all frozen guest filesystems
479#
480# Returns: Number of file systems thawed by this call
e3d4d252 481#
9e8aded4 482# Note: if return value does not match the previous call to
059d341a
MA
483# guest-fsfreeze-freeze, this likely means some freezable
484# filesystems were unfrozen before this call, and that the
485# filesystem state may have changed before issuing this command.
e3d4d252
MR
486#
487# Since: 0.15.0
488##
489{ 'command': 'guest-fsfreeze-thaw',
490 'returns': 'int' }
11d0f125 491
e82855d9 492##
5072f7b3 493# @GuestFilesystemTrimResult:
e82855d9
JO
494#
495# @path: path that was trimmed
059d341a 496#
e82855d9 497# @error: an error message when trim failed
059d341a 498#
e82855d9 499# @trimmed: bytes trimmed for this path
059d341a 500#
e82855d9
JO
501# @minimum: reported effective minimum for this path
502#
503# Since: 2.4
504##
505{ 'struct': 'GuestFilesystemTrimResult',
506 'data': {'path': 'str',
507 '*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
508
509##
5072f7b3 510# @GuestFilesystemTrimResponse:
e82855d9
JO
511#
512# @paths: list of @GuestFilesystemTrimResult per path that was trimmed
513#
514# Since: 2.4
515##
516{ 'struct': 'GuestFilesystemTrimResponse',
517 'data': {'paths': ['GuestFilesystemTrimResult']} }
518
eab5fd59
PB
519##
520# @guest-fstrim:
521#
522# Discard (or "trim") blocks which are not in use by the filesystem.
523#
059d341a
MA
524# @minimum: Minimum contiguous free range to discard, in bytes. Free
525# ranges smaller than this may be ignored (this is a hint and the
526# guest may not respect it). By increasing this value, the fstrim
527# operation will complete more quickly for filesystems with badly
528# fragmented free space, although not all blocks will be
529# discarded. The default value is zero, meaning "discard every
530# free block".
eab5fd59 531#
059d341a
MA
532# Returns: A @GuestFilesystemTrimResponse which contains the status of
533# all trimmed paths. (since 2.4)
eab5fd59
PB
534#
535# Since: 1.2
536##
537{ 'command': 'guest-fstrim',
e82855d9
JO
538 'data': { '*minimum': 'int' },
539 'returns': 'GuestFilesystemTrimResponse' }
eab5fd59 540
11d0f125 541##
5072f7b3 542# @guest-suspend-disk:
11d0f125
LC
543#
544# Suspend guest to disk.
545#
059d341a
MA
546# This command attempts to suspend the guest using three strategies,
547# in this order:
11d0f125 548#
bb6c8d40
DHB
549# - systemd hibernate
550# - pm-utils (via pm-hibernate)
551# - manual write into sysfs
11d0f125 552#
059d341a
MA
553# This command does NOT return a response on success. There is a high
554# chance the command succeeded if the VM exits with a zero exit status
555# or, when running with --no-shutdown, by issuing the query-status QMP
556# command to to confirm the VM status is "shutdown". However, the VM
557# could also exit (or set its status to "shutdown") due to other
558# reasons.
c6fcc10a 559#
3ef507fe
MA
560# Errors:
561# - If suspend to disk is not supported, Unsupported
11d0f125 562#
059d341a
MA
563# Notes: It's strongly recommended to issue the guest-sync command
564# before sending commands when the guest resumes
11d0f125
LC
565#
566# Since: 1.1
567##
d708cdbe 568{ 'command': 'guest-suspend-disk', 'success-response': false }
fbf42210
LC
569
570##
5072f7b3 571# @guest-suspend-ram:
fbf42210
LC
572#
573# Suspend guest to ram.
574#
059d341a
MA
575# This command attempts to suspend the guest using three strategies,
576# in this order:
fbf42210 577#
059d341a
MA
578# - systemd hibernate
579# - pm-utils (via pm-hibernate)
bb6c8d40 580# - manual write into sysfs
fbf42210 581#
f8a57777
DHB
582# IMPORTANT: guest-suspend-ram requires working wakeup support in
583# QEMU. You should check QMP command query-current-machine returns
059d341a
MA
584# wakeup-suspend-support: true before issuing this command. Failure
585# in doing so can result in a suspended guest that QEMU will not be
586# able to awaken, forcing the user to power cycle the guest to bring
587# it back.
fbf42210 588#
059d341a
MA
589# This command does NOT return a response on success. There are two
590# options to check for success:
a7b6e896
PM
591#
592# 1. Wait for the SUSPEND QMP event from QEMU
593# 2. Issue the query-status QMP command to confirm the VM status is
594# "suspended"
432d29db 595#
3ef507fe
MA
596# Errors:
597# - If suspend to ram is not supported, Unsupported
fbf42210 598#
059d341a
MA
599# Notes: It's strongly recommended to issue the guest-sync command
600# before sending commands when the guest resumes
fbf42210
LC
601#
602# Since: 1.1
603##
d708cdbe 604{ 'command': 'guest-suspend-ram', 'success-response': false }
95f4f404
LC
605
606##
5072f7b3 607# @guest-suspend-hybrid:
95f4f404
LC
608#
609# Save guest state to disk and suspend to ram.
610#
059d341a
MA
611# This command attempts to suspend the guest by executing, in this
612# order:
bb6c8d40
DHB
613#
614# - systemd hybrid-sleep
615# - pm-utils (via pm-suspend-hybrid)
95f4f404 616#
f8a57777
DHB
617# IMPORTANT: guest-suspend-hybrid requires working wakeup support in
618# QEMU. You should check QMP command query-current-machine returns
059d341a
MA
619# wakeup-suspend-support: true before issuing this command. Failure
620# in doing so can result in a suspended guest that QEMU will not be
621# able to awaken, forcing the user to power cycle the guest to bring
622# it back.
95f4f404 623#
059d341a
MA
624# This command does NOT return a response on success. There are two
625# options to check for success:
a7b6e896
PM
626#
627# 1. Wait for the SUSPEND QMP event from QEMU
628# 2. Issue the query-status QMP command to confirm the VM status is
629# "suspended"
d9fcd2a1 630#
3ef507fe
MA
631# Errors:
632# - If hybrid suspend is not supported, Unsupported
95f4f404 633#
059d341a
MA
634# Notes: It's strongly recommended to issue the guest-sync command
635# before sending commands when the guest resumes
95f4f404
LC
636#
637# Since: 1.1
638##
d708cdbe 639{ 'command': 'guest-suspend-hybrid', 'success-response': false }
3424fc9f
MP
640
641##
642# @GuestIpAddressType:
643#
644# An enumeration of supported IP address types
645#
646# @ipv4: IP version 4
647#
648# @ipv6: IP version 6
649#
650# Since: 1.1
651##
652{ 'enum': 'GuestIpAddressType',
653 'data': [ 'ipv4', 'ipv6' ] }
654
655##
656# @GuestIpAddress:
657#
658# @ip-address: IP address
659#
660# @ip-address-type: Type of @ip-address (e.g. ipv4, ipv6)
661#
662# @prefix: Network prefix length of @ip-address
663#
664# Since: 1.1
665##
895a2a80 666{ 'struct': 'GuestIpAddress',
3424fc9f
MP
667 'data': {'ip-address': 'str',
668 'ip-address-type': 'GuestIpAddressType',
669 'prefix': 'int'} }
670
53f9fcb2
ZL
671##
672# @GuestNetworkInterfaceStat:
673#
674# @rx-bytes: total bytes received
675#
676# @rx-packets: total packets received
677#
678# @rx-errs: bad packets received
679#
680# @rx-dropped: receiver dropped packets
681#
682# @tx-bytes: total bytes transmitted
683#
684# @tx-packets: total packets transmitted
685#
686# @tx-errs: packet transmit problems
687#
688# @tx-dropped: dropped packets transmitted
689#
690# Since: 2.11
691##
692{ 'struct': 'GuestNetworkInterfaceStat',
693 'data': {'rx-bytes': 'uint64',
694 'rx-packets': 'uint64',
695 'rx-errs': 'uint64',
696 'rx-dropped': 'uint64',
697 'tx-bytes': 'uint64',
698 'tx-packets': 'uint64',
699 'tx-errs': 'uint64',
700 'tx-dropped': 'uint64'
701 } }
702
3424fc9f
MP
703##
704# @GuestNetworkInterface:
705#
706# @name: The name of interface for which info are being delivered
707#
708# @hardware-address: Hardware address of @name
709#
710# @ip-addresses: List of addresses assigned to @name
711#
059d341a
MA
712# @statistics: various statistic counters related to @name (since
713# 2.11)
53f9fcb2 714#
3424fc9f
MP
715# Since: 1.1
716##
895a2a80 717{ 'struct': 'GuestNetworkInterface',
3424fc9f
MP
718 'data': {'name': 'str',
719 '*hardware-address': 'str',
53f9fcb2
ZL
720 '*ip-addresses': ['GuestIpAddress'],
721 '*statistics': 'GuestNetworkInterfaceStat' } }
3424fc9f
MP
722
723##
724# @guest-network-get-interfaces:
725#
059d341a 726# Get list of guest IP addresses, MAC addresses and netmasks.
3424fc9f 727#
6a90cc82 728# Returns: List of GuestNetworkInterface
3424fc9f
MP
729#
730# Since: 1.1
731##
732{ 'command': 'guest-network-get-interfaces',
733 'returns': ['GuestNetworkInterface'] }
70e133a7
LE
734
735##
736# @GuestLogicalProcessor:
737#
738# @logical-id: Arbitrary guest-specific unique identifier of the VCPU.
739#
740# @online: Whether the VCPU is enabled.
741#
059d341a
MA
742# @can-offline: Whether offlining the VCPU is possible. This member
743# is always filled in by the guest agent when the structure is
744# returned, and always ignored on input (hence it can be omitted
745# then).
70e133a7
LE
746#
747# Since: 1.5
748##
895a2a80 749{ 'struct': 'GuestLogicalProcessor',
70e133a7
LE
750 'data': {'logical-id': 'int',
751 'online': 'bool',
752 '*can-offline': 'bool'} }
753
754##
755# @guest-get-vcpus:
756#
757# Retrieve the list of the guest's logical processors.
758#
759# This is a read-only operation.
760#
059d341a
MA
761# Returns: The list of all VCPUs the guest knows about. Each VCPU is
762# put on the list exactly once, but their order is unspecified.
70e133a7
LE
763#
764# Since: 1.5
765##
766{ 'command': 'guest-get-vcpus',
767 'returns': ['GuestLogicalProcessor'] }
768
769##
770# @guest-set-vcpus:
771#
059d341a
MA
772# Attempt to reconfigure (currently: enable/disable) logical
773# processors inside the guest.
774#
0b34cf84
MA
775# @vcpus: The logical processors to be reconfigured. This list is
776# processed node by node in order. In each node @logical-id is
777# used to look up the guest VCPU, for which @online specifies the
778# requested state. The set of distinct @logical-id's is only
779# required to be a subset of the guest-supported identifiers.
780# There's no restriction on list length or on repeating the same
781# @logical-id (with possibly different @online field). Preferably
782# the input list should describe a modified subset of
783# @guest-get-vcpus' return value.
059d341a
MA
784#
785# Returns: The length of the initial sublist that has been
786# successfully processed. The guest agent maximizes this value.
787# Possible cases:
788#
789# - 0:
790# if the @vcpus list was empty on input. Guest state has not
791# been changed. Otherwise,
059d341a
MA
792# - < length(@vcpus):
793# more than zero initial nodes have been processed, but not the
794# entire @vcpus list. Guest state has changed accordingly. To
795# retrieve the error (assuming it persists), repeat the call
796# with the successfully processed initial sublist removed.
797# Otherwise,
798# - length(@vcpus):
799# call successful.
70e133a7 800#
3ef507fe
MA
801# Errors:
802# - If the reconfiguration of the first node in @vcpus failed.
803# Guest state has not been changed.
804#
70e133a7
LE
805# Since: 1.5
806##
807{ 'command': 'guest-set-vcpus',
808 'data': {'vcpus': ['GuestLogicalProcessor'] },
809 'returns': 'int' }
46d4c572
TS
810
811##
5072f7b3 812# @GuestDiskBusType:
46d4c572
TS
813#
814# An enumeration of bus type of disks
815#
816# @ide: IDE disks
059d341a 817#
46d4c572 818# @fdc: floppy disks
059d341a 819#
46d4c572 820# @scsi: SCSI disks
059d341a 821#
46d4c572 822# @virtio: virtio disks
059d341a 823#
46d4c572 824# @xen: Xen disks
059d341a 825#
46d4c572 826# @usb: USB disks
059d341a 827#
46d4c572 828# @uml: UML disks
059d341a 829#
46d4c572 830# @sata: SATA disks
059d341a 831#
46d4c572 832# @sd: SD cards
059d341a 833#
a3ef3b22 834# @unknown: Unknown bus type
059d341a 835#
a3ef3b22 836# @ieee1394: Win IEEE 1394 bus type
059d341a 837#
a3ef3b22 838# @ssa: Win SSA bus type
059d341a 839#
a3ef3b22 840# @fibre: Win fiber channel bus type
059d341a 841#
a3ef3b22 842# @raid: Win RAID bus type
059d341a 843#
a3ef3b22 844# @iscsi: Win iScsi bus type
059d341a 845#
a3ef3b22 846# @sas: Win serial-attaches SCSI bus type
059d341a 847#
a3ef3b22 848# @mmc: Win multimedia card (MMC) bus type
059d341a 849#
a3ef3b22 850# @virtual: Win virtual bus type
059d341a 851#
72ec8bf3 852# @file-backed-virtual: Win file-backed bus type
059d341a 853#
d48f61c8 854# @nvme: NVMe disks (since 7.1)
46d4c572 855#
5f8343d0 856# Since: 2.2; 'Unknown' and all entries below since 2.4
46d4c572
TS
857##
858{ 'enum': 'GuestDiskBusType',
859 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
a3ef3b22 860 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
d48f61c8 861 'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] }
a3ef3b22 862
46d4c572
TS
863
864##
865# @GuestPCIAddress:
866#
867# @domain: domain id
059d341a 868#
46d4c572 869# @bus: bus id
059d341a 870#
46d4c572 871# @slot: slot id
059d341a 872#
46d4c572
TS
873# @function: function id
874#
875# Since: 2.2
876##
895a2a80 877{ 'struct': 'GuestPCIAddress',
46d4c572
TS
878 'data': {'domain': 'int', 'bus': 'int',
879 'slot': 'int', 'function': 'int'} }
880
5b723a5d
TH
881##
882# @GuestCCWAddress:
883#
884# @cssid: channel subsystem image id
059d341a 885#
5b723a5d 886# @ssid: subchannel set id
059d341a 887#
5b723a5d 888# @subchno: subchannel number
059d341a 889#
5b723a5d
TH
890# @devno: device number
891#
892# Since: 6.0
893##
894{ 'struct': 'GuestCCWAddress',
895 'data': {'cssid': 'int',
896 'ssid': 'int',
897 'subchno': 'int',
898 'devno': 'int'} }
899
46d4c572
TS
900##
901# @GuestDiskAddress:
902#
059d341a
MA
903# @pci-controller: controller's PCI address (fields are set to -1 if
904# invalid)
905#
4d5c8bc4 906# @bus-type: bus type
059d341a 907#
46d4c572 908# @bus: bus id
059d341a 909#
46d4c572 910# @target: target id
059d341a 911#
46d4c572 912# @unit: unit id
059d341a 913#
b616105a 914# @serial: serial number (since: 3.1)
059d341a 915#
6589ce35 916# @dev: device node (POSIX) or device UNC (Windows) (since: 3.1)
059d341a 917#
5b723a5d 918# @ccw-address: CCW address on s390x (since: 6.0)
46d4c572
TS
919#
920# Since: 2.2
921##
895a2a80 922{ 'struct': 'GuestDiskAddress',
46d4c572
TS
923 'data': {'pci-controller': 'GuestPCIAddress',
924 'bus-type': 'GuestDiskBusType',
b616105a 925 'bus': 'int', 'target': 'int', 'unit': 'int',
5b723a5d
TH
926 '*serial': 'str', '*dev': 'str',
927 '*ccw-address': 'GuestCCWAddress'} }
46d4c572 928
22668881
ZP
929##
930# @GuestNVMeSmart:
931#
40b89515 932# NVMe smart information, based on NVMe specification, section
059d341a 933# <SMART / Health Information (Log Identifier 02h)>
22668881 934#
ca86608f
MA
935# TODO: document members briefly
936#
22668881
ZP
937# Since: 7.1
938##
939{ 'struct': 'GuestNVMeSmart',
940 'data': {'critical-warning': 'int',
941 'temperature': 'int',
942 'available-spare': 'int',
943 'available-spare-threshold': 'int',
944 'percentage-used': 'int',
945 'data-units-read-lo': 'uint64',
946 'data-units-read-hi': 'uint64',
947 'data-units-written-lo': 'uint64',
948 'data-units-written-hi': 'uint64',
949 'host-read-commands-lo': 'uint64',
950 'host-read-commands-hi': 'uint64',
951 'host-write-commands-lo': 'uint64',
952 'host-write-commands-hi': 'uint64',
953 'controller-busy-time-lo': 'uint64',
954 'controller-busy-time-hi': 'uint64',
955 'power-cycles-lo': 'uint64',
956 'power-cycles-hi': 'uint64',
957 'power-on-hours-lo': 'uint64',
958 'power-on-hours-hi': 'uint64',
959 'unsafe-shutdowns-lo': 'uint64',
960 'unsafe-shutdowns-hi': 'uint64',
961 'media-errors-lo': 'uint64',
962 'media-errors-hi': 'uint64',
963 'number-of-error-log-entries-lo': 'uint64',
964 'number-of-error-log-entries-hi': 'uint64' } }
965
966##
967# @GuestDiskSmart:
968#
969# Disk type related smart information.
970#
ca86608f 971# @type: disk bus type
22668881
ZP
972#
973# Since: 7.1
974##
975{ 'union': 'GuestDiskSmart',
976 'base': { 'type': 'GuestDiskBusType' },
977 'discriminator': 'type',
978 'data': { 'nvme': 'GuestNVMeSmart' } }
979
c27ea3f9
TG
980##
981# @GuestDiskInfo:
982#
983# @name: device node (Linux) or device UNC (Windows)
059d341a 984#
c27ea3f9 985# @partition: whether this is a partition or disk
059d341a
MA
986#
987# @dependencies: list of device dependencies; e.g. for LVs of the LVM
988# this will hold the list of PVs, for LUKS encrypted volume this
989# will contain the disk where the volume is placed. (Linux)
990#
c27ea3f9 991# @address: disk address information (only for non-virtual devices)
059d341a
MA
992#
993# @alias: optional alias assigned to the disk, on Linux this is a name
994# assigned by device mapper
995#
22668881 996# @smart: disk smart information (Since 7.1)
c27ea3f9 997#
433a4fdc 998# Since: 5.2
c27ea3f9
TG
999##
1000{ 'struct': 'GuestDiskInfo',
a8aa94b5 1001 'data': {'name': 'str', 'partition': 'bool', '*dependencies': ['str'],
22668881
ZP
1002 '*address': 'GuestDiskAddress', '*alias': 'str',
1003 '*smart': 'GuestDiskSmart'} }
c27ea3f9
TG
1004
1005##
1006# @guest-get-disks:
1007#
059d341a
MA
1008# Returns: The list of disks in the guest. For Windows these are only
1009# the physical disks. On Linux these are all root block devices
1010# of non-zero size including e.g. removable devices, loop devices,
1011# NBD, etc.
c27ea3f9
TG
1012#
1013# Since: 5.2
1014##
1015{ 'command': 'guest-get-disks',
1016 'returns': ['GuestDiskInfo'] }
1017
46d4c572 1018##
5072f7b3 1019# @GuestFilesystemInfo:
46d4c572
TS
1020#
1021# @name: disk name
059d341a 1022#
46d4c572 1023# @mountpoint: mount point path
059d341a 1024#
46d4c572 1025# @type: file system type string
059d341a 1026#
25b5ff1a 1027# @used-bytes: file system used bytes (since 3.0)
059d341a 1028#
50761a5a
AD
1029# @total-bytes: filesystem capacity in bytes for unprivileged users (since 3.0)
1030#
1031# @total-bytes-privileged: filesystem capacity in bytes for privileged users
1032# (since 9.1)
059d341a
MA
1033#
1034# @disk: an array of disk hardware information that the volume lies
1035# on, which may be empty if the disk type is not supported
46d4c572
TS
1036#
1037# Since: 2.2
1038##
895a2a80 1039{ 'struct': 'GuestFilesystemInfo',
46d4c572 1040 'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
25b5ff1a 1041 '*used-bytes': 'uint64', '*total-bytes': 'uint64',
50761a5a 1042 '*total-bytes-privileged': 'uint64', 'disk': ['GuestDiskAddress']} }
46d4c572
TS
1043
1044##
1045# @guest-get-fsinfo:
1046#
1047# Returns: The list of filesystems information mounted in the guest.
059d341a
MA
1048# The returned mountpoints may be specified to
1049# @guest-fsfreeze-freeze-list. Network filesystems (such as CIFS
1050# and NFS) are not listed.
46d4c572
TS
1051#
1052# Since: 2.2
1053##
1054{ 'command': 'guest-get-fsinfo',
1055 'returns': ['GuestFilesystemInfo'] }
215a2771
DB
1056
1057##
5072f7b3 1058# @guest-set-user-password:
215a2771
DB
1059#
1060# @username: the user account whose password to change
059d341a 1061#
215a2771 1062# @password: the new password entry string, base64 encoded
059d341a 1063#
215a2771
DB
1064# @crypted: true if password is already crypt()d, false if raw
1065#
059d341a
MA
1066# If the @crypted flag is true, it is the caller's responsibility to
1067# ensure the correct crypt() encryption scheme is used. This command
1068# does not attempt to interpret or report on the encryption scheme.
1069# Refer to the documentation of the guest operating system in question
1070# to determine what is supported.
215a2771 1071#
059d341a
MA
1072# Not all guest operating systems will support use of the @crypted
1073# flag, as they may require the clear-text password
215a2771
DB
1074#
1075# The @password parameter must always be base64 encoded before
059d341a
MA
1076# transmission, even if already crypt()d, to ensure it is 8-bit safe
1077# when passed as JSON.
215a2771 1078#
5072f7b3 1079# Since: 2.3
215a2771
DB
1080##
1081{ 'command': 'guest-set-user-password',
1082 'data': { 'username': 'str', 'password': 'str', 'crypted': 'bool' } }
a065aaa9 1083
49687ace 1084##
a065aaa9
HZ
1085# @GuestMemoryBlock:
1086#
059d341a
MA
1087# @phys-index: Arbitrary guest-specific unique identifier of the
1088# MEMORY BLOCK.
a065aaa9
HZ
1089#
1090# @online: Whether the MEMORY BLOCK is enabled in guest.
1091#
059d341a
MA
1092# @can-offline: Whether offlining the MEMORY BLOCK is possible. This
1093# member is always filled in by the guest agent when the structure
1094# is returned, and always ignored on input (hence it can be
1095# omitted then).
a065aaa9
HZ
1096#
1097# Since: 2.3
1098##
895a2a80 1099{ 'struct': 'GuestMemoryBlock',
a065aaa9
HZ
1100 'data': {'phys-index': 'uint64',
1101 'online': 'bool',
1102 '*can-offline': 'bool'} }
1103
1104##
1105# @guest-get-memory-blocks:
1106#
1107# Retrieve the list of the guest's memory blocks.
1108#
1109# This is a read-only operation.
1110#
059d341a
MA
1111# Returns: The list of all memory blocks the guest knows about. Each
1112# memory block is put on the list exactly once, but their order is
1113# unspecified.
a065aaa9
HZ
1114#
1115# Since: 2.3
1116##
1117{ 'command': 'guest-get-memory-blocks',
1118 'returns': ['GuestMemoryBlock'] }
1119
1120##
5072f7b3 1121# @GuestMemoryBlockResponseType:
a065aaa9
HZ
1122#
1123# An enumeration of memory block operation result.
1124#
059d341a
MA
1125# @success: the operation of online/offline memory block is
1126# successful.
1127#
1128# @not-found: can't find the corresponding memoryXXX directory in
1129# sysfs.
1130#
a065aaa9 1131# @operation-not-supported: for some old kernels, it does not support
059d341a
MA
1132# online or offline memory block.
1133#
1134# @operation-failed: the operation of online/offline memory block
1135# fails, because of some errors happen.
a065aaa9
HZ
1136#
1137# Since: 2.3
1138##
1139{ 'enum': 'GuestMemoryBlockResponseType',
1140 'data': ['success', 'not-found', 'operation-not-supported',
1141 'operation-failed'] }
1142
1143##
1144# @GuestMemoryBlockResponse:
1145#
1146# @phys-index: same with the 'phys-index' member of @GuestMemoryBlock.
1147#
1148# @response: the result of memory block operation.
1149#
059d341a
MA
1150# @error-code: the error number. When memory block operation fails,
1151# we assign the value of 'errno' to this member, it indicates what
1152# goes wrong. When the operation succeeds, it will be omitted.
a065aaa9
HZ
1153#
1154# Since: 2.3
1155##
895a2a80 1156{ 'struct': 'GuestMemoryBlockResponse',
a065aaa9
HZ
1157 'data': { 'phys-index': 'uint64',
1158 'response': 'GuestMemoryBlockResponseType',
1159 '*error-code': 'int' }}
1160
1161##
1162# @guest-set-memory-blocks:
1163#
059d341a
MA
1164# Attempt to reconfigure (currently: enable/disable) state of memory
1165# blocks inside the guest.
a065aaa9 1166#
ab27bb03
MA
1167# @mem-blks: The memory blocks to be reconfigured. This list is
1168# processed node by node in order. In each node @phys-index is
1169# used to look up the guest MEMORY BLOCK, for which @online
1170# specifies the requested state. The set of distinct
1171# @phys-index's is only required to be a subset of the
1172# guest-supported identifiers. There's no restriction on list
1173# length or on repeating the same @phys-index (with possibly
1174# different @online field). Preferably the input list should
1175# describe a modified subset of @guest-get-memory-blocks' return
1176# value.
a065aaa9 1177#
059d341a
MA
1178# Returns: The operation results, it is a list of
1179# @GuestMemoryBlockResponse, which is corresponding to the input
1180# list.
a065aaa9 1181#
ab07e96c
MA
1182# Note: it will return an empty list if the @mem-blks list was
1183# empty on input, or there is an error, and in this case, guest
1184# state will not be changed.
a065aaa9
HZ
1185#
1186# Since: 2.3
1187##
1188{ 'command': 'guest-set-memory-blocks',
1189 'data': {'mem-blks': ['GuestMemoryBlock'] },
1190 'returns': ['GuestMemoryBlockResponse'] }
1191
49687ace 1192##
a065aaa9
HZ
1193# @GuestMemoryBlockInfo:
1194#
059d341a
MA
1195# @size: the size (in bytes) of the guest memory blocks, which are the
1196# minimal units of memory block online/offline operations (also
1197# called Logical Memory Hotplug).
a065aaa9
HZ
1198#
1199# Since: 2.3
1200##
895a2a80 1201{ 'struct': 'GuestMemoryBlockInfo',
a065aaa9
HZ
1202 'data': {'size': 'uint64'} }
1203
1204##
1205# @guest-get-memory-block-info:
1206#
1207# Get information relating to guest memory blocks.
1208#
a065aaa9
HZ
1209# Returns: @GuestMemoryBlockInfo
1210#
5072f7b3 1211# Since: 2.3
a065aaa9
HZ
1212##
1213{ 'command': 'guest-get-memory-block-info',
1214 'returns': 'GuestMemoryBlockInfo' }
d697e30c 1215
49687ace 1216##
d697e30c
YP
1217# @GuestExecStatus:
1218#
1219# @exited: true if process has already terminated.
059d341a 1220#
1d8bda12 1221# @exitcode: process exit code if it was normally terminated.
059d341a
MA
1222#
1223# @signal: signal number (linux) or unhandled exception code (windows)
1224# if the process was abnormally terminated.
1225#
72708193
MA
1226# @out-data: base64-encoded stdout of the process. This field will
1227# only be populated after the process exits.
059d341a 1228#
72708193
MA
1229# @err-data: base64-encoded stderr of the process. Note: @out-data
1230# and @err-data are present only if 'capture-output' was specified
1231# for 'guest-exec'. This field will only be populated after the
1232# process exits.
059d341a
MA
1233#
1234# @out-truncated: true if stdout was not fully captured due to size
1235# limitation.
1236#
1237# @err-truncated: true if stderr was not fully captured due to size
1238# limitation.
d697e30c
YP
1239#
1240# Since: 2.5
1241##
1242{ 'struct': 'GuestExecStatus',
1243 'data': { 'exited': 'bool', '*exitcode': 'int', '*signal': 'int',
a1853dca
YP
1244 '*out-data': 'str', '*err-data': 'str',
1245 '*out-truncated': 'bool', '*err-truncated': 'bool' }}
d697e30c 1246##
5072f7b3 1247# @guest-exec-status:
d697e30c 1248#
059d341a
MA
1249# Check status of process associated with PID retrieved via
1250# guest-exec. Reap the process and associated metadata if it has
1251# exited.
d697e30c
YP
1252#
1253# @pid: pid returned from guest-exec
1254#
6a90cc82 1255# Returns: GuestExecStatus
d697e30c 1256#
5072f7b3 1257# Since: 2.5
d697e30c
YP
1258##
1259{ 'command': 'guest-exec-status',
1260 'data': { 'pid': 'int' },
1261 'returns': 'GuestExecStatus' }
1262
1263##
1264# @GuestExec:
a9e2eb06 1265#
d697e30c
YP
1266# @pid: pid of child process in guest OS
1267#
5072f7b3 1268# Since: 2.5
d697e30c
YP
1269##
1270{ 'struct': 'GuestExec',
1271 'data': { 'pid': 'int'} }
1272
9c5ccc52
DX
1273##
1274# @GuestExecCaptureOutputMode:
1275#
1276# An enumeration of guest-exec capture modes.
1277#
1278# @none: do not capture any output
72708193 1279#
9c5ccc52 1280# @stdout: only capture stdout
72708193 1281#
9c5ccc52 1282# @stderr: only capture stderr
72708193 1283#
9c5ccc52 1284# @separated: capture both stdout and stderr, but separated into
72708193
MA
1285# GuestExecStatus out-data and err-data, respectively
1286#
1287# @merged: capture both stdout and stderr, but merge together into
1288# out-data. Not effective on windows guests.
9c5ccc52
DX
1289#
1290# Since: 8.0
1291##
1292 { 'enum': 'GuestExecCaptureOutputMode',
810f677a
DX
1293 'data': [ 'none', 'stdout', 'stderr', 'separated',
1294 { 'name': 'merged', 'if': { 'not': 'CONFIG_WIN32' } } ] }
9c5ccc52
DX
1295
1296##
1297# @GuestExecCaptureOutput:
1298#
1299# Controls what guest-exec output gets captures.
1300#
72708193
MA
1301# @flag: captures both stdout and stderr if true. Equivalent to
1302# GuestExecCaptureOutputMode::all. (since 2.5)
1303#
9c5ccc52
DX
1304# @mode: capture mode; preferred interface
1305#
1306# Since: 8.0
1307##
1308 { 'alternate': 'GuestExecCaptureOutput',
1309 'data': { 'flag': 'bool',
1310 'mode': 'GuestExecCaptureOutputMode'} }
1311
d697e30c
YP
1312##
1313# @guest-exec:
1314#
1315# Execute a command in the guest
1316#
1317# @path: path or executable name to execute
059d341a 1318#
1d8bda12 1319# @arg: argument list to pass to executable
059d341a 1320#
1d8bda12 1321# @env: environment variables to pass to executable
059d341a 1322#
1d8bda12 1323# @input-data: data to be passed to process stdin (base64 encoded)
059d341a
MA
1324#
1325# @capture-output: bool flag to enable capture of stdout/stderr of
72708193 1326# running process. Defaults to false.
d697e30c 1327#
6a90cc82 1328# Returns: PID
d697e30c
YP
1329#
1330# Since: 2.5
1331##
1332{ 'command': 'guest-exec',
1333 'data': { 'path': 'str', '*arg': ['str'], '*env': ['str'],
9c5ccc52 1334 '*input-data': 'str', '*capture-output': 'GuestExecCaptureOutput' },
d697e30c 1335 'returns': 'GuestExec' }
0a3d197a
VF
1336
1337
1338##
1339# @GuestHostName:
a9e2eb06 1340#
0a3d197a
VF
1341# @host-name: Fully qualified domain name of the guest OS
1342#
1343# Since: 2.10
1344##
1345{ 'struct': 'GuestHostName',
1346 'data': { 'host-name': 'str' } }
1347
1348##
1349# @guest-get-host-name:
1350#
1351# Return a name for the machine.
1352#
059d341a
MA
1353# The returned name is not necessarily a fully-qualified domain name,
1354# or even present in DNS or some other name service at all. It need
1355# not even be unique on your local network or site, but usually it is.
0a3d197a 1356#
6a90cc82 1357# Returns: the host name of the machine
0a3d197a
VF
1358#
1359# Since: 2.10
1360##
1361{ 'command': 'guest-get-host-name',
1362 'returns': 'GuestHostName' }
161a56a9
VF
1363
1364
1365##
1366# @GuestUser:
a9e2eb06 1367#
883aff68 1368# @user: Username
059d341a 1369#
883aff68 1370# @domain: Logon domain (windows only)
059d341a
MA
1371#
1372# @login-time: Time of login of this user on the computer. If
1373# multiple instances of the user are logged in, the earliest login
1374# time is reported. The value is in fractional seconds since
1375# epoch time.
161a56a9
VF
1376#
1377# Since: 2.10
1378##
1379{ 'struct': 'GuestUser',
1380 'data': { 'user': 'str', 'login-time': 'number', '*domain': 'str' } }
1381
1382##
1383# @guest-get-users:
059d341a 1384#
161a56a9
VF
1385# Retrieves a list of currently active users on the VM.
1386#
1387# Returns: A unique list of users.
1388#
1389# Since: 2.10
1390##
1391{ 'command': 'guest-get-users',
1392 'returns': ['GuestUser'] }
53c58e64
VF
1393
1394##
1395# @GuestTimezone:
1396#
059d341a
MA
1397# @zone: Timezone name. These values may differ depending on guest/OS
1398# and should only be used for informational purposes.
1399#
1400# @offset: Offset to UTC in seconds, negative numbers for time zones
1401# west of GMT, positive numbers for east
53c58e64
VF
1402#
1403# Since: 2.10
1404##
1405{ 'struct': 'GuestTimezone',
1406 'data': { '*zone': 'str', 'offset': 'int' } }
1407
1408##
1409# @guest-get-timezone:
1410#
1411# Retrieves the timezone information from the guest.
1412#
1413# Returns: A GuestTimezone dictionary.
1414#
1415# Since: 2.10
1416##
1417{ 'command': 'guest-get-timezone',
1418 'returns': 'GuestTimezone' }
9848f797
TG
1419
1420##
1421# @GuestOSInfo:
1422#
1423# @kernel-release:
059d341a
MA
1424# * POSIX: release field returned by uname(2)
1425# * Windows: build number of the OS
1426#
9848f797 1427# @kernel-version:
059d341a
MA
1428# * POSIX: version field returned by uname(2)
1429# * Windows: version number of the OS
1430#
9848f797 1431# @machine:
059d341a
MA
1432# * POSIX: machine field returned by uname(2)
1433# * Windows: one of x86, x86_64, arm, ia64
1434#
9848f797 1435# @id:
059d341a
MA
1436# * POSIX: as defined by os-release(5)
1437# * Windows: contains string "mswindows"
1438#
9848f797 1439# @name:
059d341a
MA
1440# * POSIX: as defined by os-release(5)
1441# * Windows: contains string "Microsoft Windows"
1442#
9848f797 1443# @pretty-name:
059d341a
MA
1444# * POSIX: as defined by os-release(5)
1445# * Windows: product name, e.g. "Microsoft Windows 10 Enterprise"
1446#
9848f797 1447# @version:
059d341a
MA
1448# * POSIX: as defined by os-release(5)
1449# * Windows: long version string, e.g. "Microsoft Windows Server
1450# 2008"
1451#
9848f797 1452# @version-id:
059d341a
MA
1453# * POSIX: as defined by os-release(5)
1454# * Windows: short version identifier, e.g. "7" or "20012r2"
1455#
9848f797 1456# @variant:
059d341a
MA
1457# * POSIX: as defined by os-release(5)
1458# * Windows: contains string "server" or "client"
9848f797 1459#
059d341a
MA
1460# @variant-id:
1461# * POSIX: as defined by os-release(5)
1462# * Windows: contains string "server" or "client"
9848f797 1463#
059d341a
MA
1464# Notes: On POSIX systems the fields @id, @name, @pretty-name,
1465# @version, @version-id, @variant and @variant-id follow the
1466# definition specified in os-release(5). Refer to the manual page
1467# for exact description of the fields. Their values are taken
1468# from the os-release file. If the file is not present in the
1469# system, or the values are not present in the file, the fields
1470# are not included.
9848f797 1471#
059d341a
MA
1472# On Windows the values are filled from information gathered from
1473# the system.
9848f797
TG
1474#
1475# Since: 2.10
1476##
1477{ 'struct': 'GuestOSInfo',
1478 'data': {
1479 '*kernel-release': 'str', '*kernel-version': 'str',
1480 '*machine': 'str', '*id': 'str', '*name': 'str',
1481 '*pretty-name': 'str', '*version': 'str', '*version-id': 'str',
1482 '*variant': 'str', '*variant-id': 'str' } }
1483
1484##
1485# @guest-get-osinfo:
1486#
1487# Retrieve guest operating system information
1488#
1489# Returns: @GuestOSInfo
1490#
1491# Since: 2.10
1492##
1493{ 'command': 'guest-get-osinfo',
1494 'returns': 'GuestOSInfo' }
2e4211ce 1495
0083124b
MA
1496##
1497# @GuestDeviceType:
ca86608f
MA
1498#
1499# @pci: PCI device
0083124b
MA
1500##
1501{ 'enum': 'GuestDeviceType',
1502 'data': [ 'pci' ] }
1503
2e4211ce 1504##
b519e2e9 1505# @GuestDeviceIdPCI:
2e4211ce
TG
1506#
1507# @vendor-id: vendor ID
059d341a 1508#
2e4211ce
TG
1509# @device-id: device ID
1510#
1511# Since: 5.2
1512##
b519e2e9 1513{ 'struct': 'GuestDeviceIdPCI',
2e4211ce
TG
1514 'data': { 'vendor-id': 'uint16', 'device-id': 'uint16' } }
1515
1516##
b519e2e9 1517# @GuestDeviceId:
2e4211ce 1518#
ca86608f
MA
1519# Id of the device
1520#
1521# @type: device type
2e4211ce
TG
1522#
1523# Since: 5.2
1524##
b519e2e9 1525{ 'union': 'GuestDeviceId',
0083124b
MA
1526 'base': { 'type': 'GuestDeviceType' },
1527 'discriminator': 'type',
b519e2e9 1528 'data': { 'pci': 'GuestDeviceIdPCI' } }
2e4211ce
TG
1529
1530##
1531# @GuestDeviceInfo:
1532#
1533# @driver-name: name of the associated driver
059d341a 1534#
a88bceef 1535# @driver-date: driver release date, in nanoseconds since the epoch
059d341a 1536#
2e4211ce 1537# @driver-version: driver version
059d341a 1538#
b519e2e9 1539# @id: device ID
2e4211ce
TG
1540#
1541# Since: 5.2
1542##
1543{ 'struct': 'GuestDeviceInfo',
1544 'data': {
1545 'driver-name': 'str',
a88bceef 1546 '*driver-date': 'int',
2e4211ce 1547 '*driver-version': 'str',
b519e2e9 1548 '*id': 'GuestDeviceId'
2e4211ce
TG
1549 } }
1550
1551##
1552# @guest-get-devices:
1553#
1554# Retrieve information about device drivers in Windows guest
1555#
1556# Returns: @GuestDeviceInfo
1557#
1558# Since: 5.2
1559##
1560{ 'command': 'guest-get-devices',
1561 'returns': ['GuestDeviceInfo'] }
8d769ec7 1562
cad97c08
MAL
1563##
1564# @GuestAuthorizedKeys:
1565#
1566# @keys: public keys (in OpenSSH/sshd(8) authorized_keys format)
1567#
1568# Since: 5.2
1569##
1570{ 'struct': 'GuestAuthorizedKeys',
1571 'data': {
1572 'keys': ['str']
6b9296ba 1573 }
1574}
cad97c08
MAL
1575
1576##
1577# @guest-ssh-get-authorized-keys:
1578#
059d341a
MA
1579# Return the public keys from user .ssh/authorized_keys on Unix
1580# systems (not implemented for other systems).
cad97c08 1581#
3424ed6c
MA
1582# @username: the user account to add the authorized keys
1583#
cad97c08
MAL
1584# Returns: @GuestAuthorizedKeys
1585#
1586# Since: 5.2
1587##
1588{ 'command': 'guest-ssh-get-authorized-keys',
1589 'data': { 'username': 'str' },
6b9296ba 1590 'returns': 'GuestAuthorizedKeys'
1591}
cad97c08 1592
8d769ec7
MAL
1593##
1594# @guest-ssh-add-authorized-keys:
1595#
3424ed6c
MA
1596# Append public keys to user .ssh/authorized_keys on Unix systems (not
1597# implemented for other systems).
1598#
8d769ec7 1599# @username: the user account to add the authorized keys
059d341a
MA
1600#
1601# @keys: the public keys to add (in OpenSSH/sshd(8) authorized_keys
1602# format)
1603#
0e3c9475 1604# @reset: ignore the existing content, set it with the given keys only
8d769ec7 1605#
8d769ec7
MAL
1606# Since: 5.2
1607##
1608{ 'command': 'guest-ssh-add-authorized-keys',
6b9296ba 1609 'data': { 'username': 'str', 'keys': ['str'], '*reset': 'bool' }
1610}
8d769ec7
MAL
1611
1612##
1613# @guest-ssh-remove-authorized-keys:
1614#
3424ed6c
MA
1615# Remove public keys from the user .ssh/authorized_keys on Unix
1616# systems (not implemented for other systems). It's not an error if
1617# the key is already missing.
1618#
8d769ec7 1619# @username: the user account to remove the authorized keys
8d769ec7 1620#
059d341a
MA
1621# @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys
1622# format)
1623#
8d769ec7
MAL
1624# Since: 5.2
1625##
1626{ 'command': 'guest-ssh-remove-authorized-keys',
6b9296ba 1627 'data': { 'username': 'str', 'keys': ['str'] }
1628}
3569664e 1629
1630##
1631# @GuestDiskStats:
1632#
1633# @read-sectors: sectors read
1634#
1635# @read-ios: reads completed successfully
1636#
1637# @read-merges: read requests merged
1638#
1639# @write-sectors: sectors written
1640#
1641# @write-ios: writes completed
1642#
1643# @write-merges: write requests merged
1644#
1645# @discard-sectors: sectors discarded
1646#
1647# @discard-ios: discards completed successfully
1648#
1649# @discard-merges: discard requests merged
1650#
1651# @flush-ios: flush requests completed successfully
1652#
1653# @read-ticks: time spent reading(ms)
1654#
1655# @write-ticks: time spent writing(ms)
1656#
1657# @discard-ticks: time spent discarding(ms)
1658#
1659# @flush-ticks: time spent flushing(ms)
1660#
1661# @ios-pgr: number of I/Os currently in flight
1662#
1663# @total-ticks: time spent doing I/Os (ms)
1664#
059d341a
MA
1665# @weight-ticks: weighted time spent doing I/Os since the last update
1666# of this field(ms)
3569664e 1667#
1668# Since: 7.1
1669##
1670{ 'struct': 'GuestDiskStats',
1671 'data': {'*read-sectors': 'uint64',
1672 '*read-ios': 'uint64',
1673 '*read-merges': 'uint64',
1674 '*write-sectors': 'uint64',
1675 '*write-ios': 'uint64',
1676 '*write-merges': 'uint64',
1677 '*discard-sectors': 'uint64',
1678 '*discard-ios': 'uint64',
1679 '*discard-merges': 'uint64',
1680 '*flush-ios': 'uint64',
1681 '*read-ticks': 'uint64',
1682 '*write-ticks': 'uint64',
1683 '*discard-ticks': 'uint64',
1684 '*flush-ticks': 'uint64',
1685 '*ios-pgr': 'uint64',
1686 '*total-ticks': 'uint64',
1687 '*weight-ticks': 'uint64'
1688 } }
1689
1690##
1691# @GuestDiskStatsInfo:
1692#
c0af9e1f 1693# @name: disk name
3569664e 1694#
c0af9e1f 1695# @major: major device number of disk
3569664e 1696#
c0af9e1f 1697# @minor: minor device number of disk
ca86608f
MA
1698#
1699# @stats: I/O statistics
3569664e 1700##
1701{ 'struct': 'GuestDiskStatsInfo',
1702 'data': {'name': 'str',
1703 'major': 'uint64',
1704 'minor': 'uint64',
1705 'stats': 'GuestDiskStats' } }
1706
1707##
1708# @guest-get-diskstats:
1709#
1710# Retrieve information about disk stats.
059d341a 1711#
3569664e 1712# Returns: List of disk stats of guest.
1713#
1714# Since: 7.1
1715##
1716{ 'command': 'guest-get-diskstats',
1717 'returns': ['GuestDiskStatsInfo']
1718}
1db8a0b0
ZP
1719
1720##
1721# @GuestCpuStatsType:
1722#
ca86608f
MA
1723# Guest operating systems supporting CPU statistics
1724#
1725# @linux: Linux
1db8a0b0
ZP
1726#
1727# Since: 7.1
1728##
1729{ 'enum': 'GuestCpuStatsType',
1730 'data': [ 'linux' ] }
1731
1732
1733##
1734# @GuestLinuxCpuStats:
1735#
1736# CPU statistics of Linux
1737#
1738# @cpu: CPU index in guest OS
1739#
1740# @user: Time spent in user mode
1741#
1742# @nice: Time spent in user mode with low priority (nice)
1743#
1744# @system: Time spent in system mode
1745#
1746# @idle: Time spent in the idle task
1747#
1748# @iowait: Time waiting for I/O to complete (since Linux 2.5.41)
1749#
1750# @irq: Time servicing interrupts (since Linux 2.6.0-test4)
1751#
1752# @softirq: Time servicing softirqs (since Linux 2.6.0-test4)
1753#
1754# @steal: Stolen time by host (since Linux 2.6.11)
1755#
059d341a
MA
1756# @guest: ime spent running a virtual CPU for guest operating systems
1757# under the control of the Linux kernel (since Linux 2.6.24)
1db8a0b0
ZP
1758#
1759# @guestnice: Time spent running a niced guest (since Linux 2.6.33)
1760#
1761# Since: 7.1
1762##
1763{ 'struct': 'GuestLinuxCpuStats',
1764 'data': {'cpu': 'int',
1765 'user': 'uint64',
1766 'nice': 'uint64',
1767 'system': 'uint64',
1768 'idle': 'uint64',
1769 '*iowait': 'uint64',
1770 '*irq': 'uint64',
1771 '*softirq': 'uint64',
1772 '*steal': 'uint64',
1773 '*guest': 'uint64',
1774 '*guestnice': 'uint64'
1775 } }
1776
1777##
1778# @GuestCpuStats:
1779#
1780# Get statistics of each CPU in millisecond.
1781#
ca86608f 1782# @type: guest operating system
1db8a0b0
ZP
1783#
1784# Since: 7.1
1785##
1786{ 'union': 'GuestCpuStats',
1787 'base': { 'type': 'GuestCpuStatsType' },
1788 'discriminator': 'type',
1789 'data': { 'linux': 'GuestLinuxCpuStats' } }
1790
1791##
1792# @guest-get-cpustats:
1793#
1794# Retrieve information about CPU stats.
059d341a 1795#
1db8a0b0
ZP
1796# Returns: List of CPU stats of guest.
1797#
1798# Since: 7.1
1799##
1800{ 'command': 'guest-get-cpustats',
1801 'returns': ['GuestCpuStats']
1802}