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