OSDN Git Service

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