xref: /qemu/qapi/misc.json (revision 7bdd67a5)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# = Miscellanea
7##
8
9{ 'include': 'common.json' }
10
11##
12# @add_client:
13#
14# Allow client connections for VNC, Spice and socket based
15# character devices to be passed in to QEMU via SCM_RIGHTS.
16#
17# If the FD associated with @fdname is not a socket, the command will fail and
18# the FD will be closed.
19#
20# @protocol: protocol name. Valid names are "vnc", "spice", "@dbus-display" or
21#            the name of a character device (eg. from -chardev id=XXXX)
22#
23# @fdname: file descriptor name previously passed via 'getfd' command
24#
25# @skipauth: whether to skip authentication. Only applies
26#            to "vnc" and "spice" protocols
27#
28# @tls: whether to perform TLS. Only applies to the "spice"
29#       protocol
30#
31# Returns: nothing on success.
32#
33# Since: 0.14
34#
35# Example:
36#
37# -> { "execute": "add_client", "arguments": { "protocol": "vnc",
38#                                              "fdname": "myclient" } }
39# <- { "return": {} }
40#
41##
42{ 'command': 'add_client',
43  'data': { 'protocol': 'str', 'fdname': 'str', '*skipauth': 'bool',
44            '*tls': 'bool' } }
45
46##
47# @NameInfo:
48#
49# Guest name information.
50#
51# @name: The name of the guest
52#
53# Since: 0.14
54##
55{ 'struct': 'NameInfo', 'data': {'*name': 'str'} }
56
57##
58# @query-name:
59#
60# Return the name information of a guest.
61#
62# Returns: @NameInfo of the guest
63#
64# Since: 0.14
65#
66# Example:
67#
68# -> { "execute": "query-name" }
69# <- { "return": { "name": "qemu-name" } }
70#
71##
72{ 'command': 'query-name', 'returns': 'NameInfo', 'allow-preconfig': true }
73
74##
75# @IOThreadInfo:
76#
77# Information about an iothread
78#
79# @id: the identifier of the iothread
80#
81# @thread-id: ID of the underlying host thread
82#
83# @poll-max-ns: maximum polling time in ns, 0 means polling is disabled
84#               (since 2.9)
85#
86# @poll-grow: how many ns will be added to polling time, 0 means that it's not
87#             configured (since 2.9)
88#
89# @poll-shrink: how many ns will be removed from polling time, 0 means that
90#               it's not configured (since 2.9)
91#
92# @aio-max-batch: maximum number of requests in a batch for the AIO engine,
93#                 0 means that the engine will use its default (since 6.1)
94#
95# Since: 2.0
96##
97{ 'struct': 'IOThreadInfo',
98  'data': {'id': 'str',
99           'thread-id': 'int',
100           'poll-max-ns': 'int',
101           'poll-grow': 'int',
102           'poll-shrink': 'int',
103           'aio-max-batch': 'int' } }
104
105##
106# @query-iothreads:
107#
108# Returns a list of information about each iothread.
109#
110# Note: this list excludes the QEMU main loop thread, which is not declared
111#       using the -object iothread command-line option.  It is always the main thread
112#       of the process.
113#
114# Returns: a list of @IOThreadInfo for each iothread
115#
116# Since: 2.0
117#
118# Example:
119#
120# -> { "execute": "query-iothreads" }
121# <- { "return": [
122#          {
123#             "id":"iothread0",
124#             "thread-id":3134
125#          },
126#          {
127#             "id":"iothread1",
128#             "thread-id":3135
129#          }
130#       ]
131#    }
132#
133##
134{ 'command': 'query-iothreads', 'returns': ['IOThreadInfo'],
135  'allow-preconfig': true }
136
137##
138# @stop:
139#
140# Stop all guest VCPU execution.
141#
142# Since: 0.14
143#
144# Notes: This function will succeed even if the guest is already in the stopped
145#        state.  In "inmigrate" state, it will ensure that the guest
146#        remains paused once migration finishes, as if the -S option was
147#        passed on the command line.
148#
149# Example:
150#
151# -> { "execute": "stop" }
152# <- { "return": {} }
153#
154##
155{ 'command': 'stop' }
156
157##
158# @cont:
159#
160# Resume guest VCPU execution.
161#
162# Since: 0.14
163#
164# Returns: If successful, nothing
165#
166# Notes: This command will succeed if the guest is currently running.  It
167#        will also succeed if the guest is in the "inmigrate" state; in
168#        this case, the effect of the command is to make sure the guest
169#        starts once migration finishes, removing the effect of the -S
170#        command line option if it was passed.
171#
172# Example:
173#
174# -> { "execute": "cont" }
175# <- { "return": {} }
176#
177##
178{ 'command': 'cont' }
179
180##
181# @x-exit-preconfig:
182#
183# Exit from "preconfig" state
184#
185# This command makes QEMU exit the preconfig state and proceed with
186# VM initialization using configuration data provided on the command line
187# and via the QMP monitor during the preconfig state. The command is only
188# available during the preconfig state (i.e. when the --preconfig command
189# line option was in use).
190#
191# Features:
192# @unstable: This command is experimental.
193#
194# Since: 3.0
195#
196# Returns: nothing
197#
198# Example:
199#
200# -> { "execute": "x-exit-preconfig" }
201# <- { "return": {} }
202#
203##
204{ 'command': 'x-exit-preconfig', 'allow-preconfig': true,
205  'features': [ 'unstable' ] }
206
207##
208# @human-monitor-command:
209#
210# Execute a command on the human monitor and return the output.
211#
212# @command-line: the command to execute in the human monitor
213#
214# @cpu-index: The CPU to use for commands that require an implicit CPU
215#
216# Features:
217# @savevm-monitor-nodes: If present, HMP command savevm only snapshots
218#                        monitor-owned nodes if they have no parents.
219#                        This allows the use of 'savevm' with
220#                        -blockdev. (since 4.2)
221#
222# Returns: the output of the command as a string
223#
224# Since: 0.14
225#
226# Notes: This command only exists as a stop-gap.  Its use is highly
227#        discouraged.  The semantics of this command are not
228#        guaranteed: this means that command names, arguments and
229#        responses can change or be removed at ANY time.  Applications
230#        that rely on long term stability guarantees should NOT
231#        use this command.
232#
233#        Known limitations:
234#
235#        * This command is stateless, this means that commands that depend
236#          on state information (such as getfd) might not work
237#
238#        * Commands that prompt the user for data don't currently work
239#
240# Example:
241#
242# -> { "execute": "human-monitor-command",
243#      "arguments": { "command-line": "info kvm" } }
244# <- { "return": "kvm support: enabled\r\n" }
245#
246##
247{ 'command': 'human-monitor-command',
248  'data': {'command-line': 'str', '*cpu-index': 'int'},
249  'returns': 'str',
250  'features': [ 'savevm-monitor-nodes' ] }
251
252##
253# @getfd:
254#
255# Receive a file descriptor via SCM rights and assign it a name
256#
257# @fdname: file descriptor name
258#
259# Returns: Nothing on success
260#
261# Since: 0.14
262#
263# Notes: If @fdname already exists, the file descriptor assigned to
264#        it will be closed and replaced by the received file
265#        descriptor.
266#
267#        The 'closefd' command can be used to explicitly close the
268#        file descriptor when it is no longer needed.
269#
270# Example:
271#
272# -> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
273# <- { "return": {} }
274#
275##
276{ 'command': 'getfd', 'data': {'fdname': 'str'}, 'if': 'CONFIG_POSIX' }
277
278##
279# @get-win32-socket:
280#
281# Add a socket that was duplicated to QEMU process with
282# WSADuplicateSocketW() via WSASocket() & WSAPROTOCOL_INFOW structure
283# and assign it a name (the SOCKET is associated with a CRT file
284# descriptor)
285#
286# @info: the WSAPROTOCOL_INFOW structure (encoded in base64)
287#
288# @fdname: file descriptor name
289#
290# Returns: Nothing on success
291#
292# Since: 8.0
293#
294# Notes: If @fdname already exists, the file descriptor assigned to
295#        it will be closed and replaced by the received file
296#        descriptor.
297#
298#        The 'closefd' command can be used to explicitly close the
299#        file descriptor when it is no longer needed.
300#
301# Example:
302#
303# -> { "execute": "get-win32-socket", "arguments": { "info": "abcd123..", fdname": "skclient" } }
304# <- { "return": {} }
305#
306##
307{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' }
308
309##
310# @closefd:
311#
312# Close a file descriptor previously passed via SCM rights
313#
314# @fdname: file descriptor name
315#
316# Returns: Nothing on success
317#
318# Since: 0.14
319#
320# Example:
321#
322# -> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
323# <- { "return": {} }
324#
325##
326{ 'command': 'closefd', 'data': {'fdname': 'str'} }
327
328##
329# @AddfdInfo:
330#
331# Information about a file descriptor that was added to an fd set.
332#
333# @fdset-id: The ID of the fd set that @fd was added to.
334#
335# @fd: The file descriptor that was received via SCM rights and
336#      added to the fd set.
337#
338# Since: 1.2
339##
340{ 'struct': 'AddfdInfo', 'data': {'fdset-id': 'int', 'fd': 'int'} }
341
342##
343# @add-fd:
344#
345# Add a file descriptor, that was passed via SCM rights, to an fd set.
346#
347# @fdset-id: The ID of the fd set to add the file descriptor to.
348#
349# @opaque: A free-form string that can be used to describe the fd.
350#
351# Returns: - @AddfdInfo on success
352#          - If file descriptor was not received, FdNotSupplied
353#          - If @fdset-id is a negative value, InvalidParameterValue
354#
355# Notes: The list of fd sets is shared by all monitor connections.
356#
357#        If @fdset-id is not specified, a new fd set will be created.
358#
359# Since: 1.2
360#
361# Example:
362#
363# -> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
364# <- { "return": { "fdset-id": 1, "fd": 3 } }
365#
366##
367{ 'command': 'add-fd',
368  'data': { '*fdset-id': 'int',
369            '*opaque': 'str' },
370  'returns': 'AddfdInfo' }
371
372##
373# @remove-fd:
374#
375# Remove a file descriptor from an fd set.
376#
377# @fdset-id: The ID of the fd set that the file descriptor belongs to.
378#
379# @fd: The file descriptor that is to be removed.
380#
381# Returns: - Nothing on success
382#          - If @fdset-id or @fd is not found, FdNotFound
383#
384# Since: 1.2
385#
386# Notes: The list of fd sets is shared by all monitor connections.
387#
388#        If @fd is not specified, all file descriptors in @fdset-id
389#        will be removed.
390#
391# Example:
392#
393# -> { "execute": "remove-fd", "arguments": { "fdset-id": 1, "fd": 3 } }
394# <- { "return": {} }
395#
396##
397{ 'command': 'remove-fd', 'data': {'fdset-id': 'int', '*fd': 'int'} }
398
399##
400# @FdsetFdInfo:
401#
402# Information about a file descriptor that belongs to an fd set.
403#
404# @fd: The file descriptor value.
405#
406# @opaque: A free-form string that can be used to describe the fd.
407#
408# Since: 1.2
409##
410{ 'struct': 'FdsetFdInfo',
411  'data': {'fd': 'int', '*opaque': 'str'} }
412
413##
414# @FdsetInfo:
415#
416# Information about an fd set.
417#
418# @fdset-id: The ID of the fd set.
419#
420# @fds: A list of file descriptors that belong to this fd set.
421#
422# Since: 1.2
423##
424{ 'struct': 'FdsetInfo',
425  'data': {'fdset-id': 'int', 'fds': ['FdsetFdInfo']} }
426
427##
428# @query-fdsets:
429#
430# Return information describing all fd sets.
431#
432# Returns: A list of @FdsetInfo
433#
434# Since: 1.2
435#
436# Note: The list of fd sets is shared by all monitor connections.
437#
438# Example:
439#
440# -> { "execute": "query-fdsets" }
441# <- { "return": [
442#        {
443#          "fds": [
444#            {
445#              "fd": 30,
446#              "opaque": "rdonly:/path/to/file"
447#            },
448#            {
449#              "fd": 24,
450#              "opaque": "rdwr:/path/to/file"
451#            }
452#          ],
453#          "fdset-id": 1
454#        },
455#        {
456#          "fds": [
457#            {
458#              "fd": 28
459#            },
460#            {
461#              "fd": 29
462#            }
463#          ],
464#          "fdset-id": 0
465#        }
466#      ]
467#    }
468#
469##
470{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
471
472##
473# @CommandLineParameterType:
474#
475# Possible types for an option parameter.
476#
477# @string: accepts a character string
478#
479# @boolean: accepts "on" or "off"
480#
481# @number: accepts a number
482#
483# @size: accepts a number followed by an optional suffix (K)ilo,
484#        (M)ega, (G)iga, (T)era
485#
486# Since: 1.5
487##
488{ 'enum': 'CommandLineParameterType',
489  'data': ['string', 'boolean', 'number', 'size'] }
490
491##
492# @CommandLineParameterInfo:
493#
494# Details about a single parameter of a command line option.
495#
496# @name: parameter name
497#
498# @type: parameter @CommandLineParameterType
499#
500# @help: human readable text string, not suitable for parsing.
501#
502# @default: default value string (since 2.1)
503#
504# Since: 1.5
505##
506{ 'struct': 'CommandLineParameterInfo',
507  'data': { 'name': 'str',
508            'type': 'CommandLineParameterType',
509            '*help': 'str',
510            '*default': 'str' } }
511
512##
513# @CommandLineOptionInfo:
514#
515# Details about a command line option, including its list of parameter details
516#
517# @option: option name
518#
519# @parameters: an array of @CommandLineParameterInfo
520#
521# Since: 1.5
522##
523{ 'struct': 'CommandLineOptionInfo',
524  'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } }
525
526##
527# @query-command-line-options:
528#
529# Query command line option schema.
530#
531# @option: option name
532#
533# Returns: list of @CommandLineOptionInfo for all options (or for the given
534#          @option).  Returns an error if the given @option doesn't exist.
535#
536# Since: 1.5
537#
538# Example:
539#
540# -> { "execute": "query-command-line-options",
541#      "arguments": { "option": "option-rom" } }
542# <- { "return": [
543#         {
544#             "parameters": [
545#                 {
546#                     "name": "romfile",
547#                     "type": "string"
548#                 },
549#                 {
550#                     "name": "bootindex",
551#                     "type": "number"
552#                 }
553#             ],
554#             "option": "option-rom"
555#         }
556#      ]
557#    }
558#
559##
560{'command': 'query-command-line-options',
561 'data': { '*option': 'str' },
562 'returns': ['CommandLineOptionInfo'],
563 'allow-preconfig': true }
564
565##
566# @RTC_CHANGE:
567#
568# Emitted when the guest changes the RTC time.
569#
570# @offset: offset in seconds between base RTC clock (as specified
571#          by -rtc base), and new RTC clock value
572#
573# @qom-path: path to the RTC object in the QOM tree
574#
575# Note: This event is rate-limited.
576#       It is not guaranteed that the RTC in the system implements
577#       this event, or even that the system has an RTC at all.
578#
579# Since: 0.13
580#
581# Example:
582#
583# <-   { "event": "RTC_CHANGE",
584#        "data": { "offset": 78 },
585#        "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
586#
587##
588{ 'event': 'RTC_CHANGE',
589  'data': { 'offset': 'int', 'qom-path': 'str' } }
590
591##
592# @VFU_CLIENT_HANGUP:
593#
594# Emitted when the client of a TYPE_VFIO_USER_SERVER closes the
595# communication channel
596#
597# @vfu-id: ID of the TYPE_VFIO_USER_SERVER object. It is the last component
598#          of @vfu-qom-path referenced below
599#
600# @vfu-qom-path: path to the TYPE_VFIO_USER_SERVER object in the QOM tree
601#
602# @dev-id: ID of attached PCI device
603#
604# @dev-qom-path: path to attached PCI device in the QOM tree
605#
606# Since: 7.1
607#
608# Example:
609#
610# <- { "event": "VFU_CLIENT_HANGUP",
611#      "data": { "vfu-id": "vfu1",
612#                "vfu-qom-path": "/objects/vfu1",
613#                "dev-id": "sas1",
614#                "dev-qom-path": "/machine/peripheral/sas1" },
615#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
616#
617##
618{ 'event': 'VFU_CLIENT_HANGUP',
619  'data': { 'vfu-id': 'str', 'vfu-qom-path': 'str',
620            'dev-id': 'str', 'dev-qom-path': 'str' } }
621