4 # This work is licensed under the terms of the GNU GPL, version 2 or later.
5 # See the COPYING file in the top-level directory.
8 # = QEMU Object Model (QOM)
12 # @ObjectPropertyInfo:
14 # @name: the name of the property
16 # @type: the type of the property. This will typically come in one of four
19 # 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
20 # These types are mapped to the appropriate JSON type.
22 # 2) A child type in the form 'child<subtype>' where subtype is a qdev
23 # device type name. Child properties create the composition tree.
25 # 3) A link type in the form 'link<subtype>' where subtype is a qdev
26 # device type name. Link properties form the device model graph.
28 # @description: if specified, the description of the property.
30 # @default-value: the default value, if any (since 5.0)
34 { 'struct': 'ObjectPropertyInfo',
35 'data': { 'name': 'str',
37 '*description': 'str',
38 '*default-value': 'any' } }
43 # This command will list any properties of a object given a path in the object
46 # @path: the path within the object model. See @qom-get for a description of
49 # Returns: a list of @ObjectPropertyInfo that describe the properties of the
56 # -> { "execute": "qom-list",
57 # "arguments": { "path": "/chardevs" } }
58 # <- { "return": [ { "name": "type", "type": "string" },
59 # { "name": "parallel0", "type": "child<chardev-vc>" },
60 # { "name": "serial0", "type": "child<chardev-vc>" },
61 # { "name": "mon0", "type": "child<chardev-stdio>" } ] }
64 { 'command': 'qom-list',
65 'data': { 'path': 'str' },
66 'returns': [ 'ObjectPropertyInfo' ],
67 'allow-preconfig': true }
72 # This command will get a property from a object model path and return the
75 # @path: The path within the object model. There are two forms of supported
76 # paths--absolute and partial paths.
78 # Absolute paths are derived from the root object and can follow child<>
79 # or link<> properties. Since they can follow link<> properties, they
80 # can be arbitrarily long. Absolute paths look like absolute filenames
81 # and are prefixed with a leading slash.
83 # Partial paths look like relative filenames. They do not begin
84 # with a prefix. The matching rules for partial paths are subtle but
85 # designed to make specifying objects easy. At each level of the
86 # composition tree, the partial path is matched as an absolute path.
87 # The first match is not returned. At least two matches are searched
88 # for. A successful result is only returned if only one match is
89 # found. If more than one match is found, a flag is return to
90 # indicate that the match was ambiguous.
92 # @property: The property name to read
94 # Returns: The property value. The type depends on the property
95 # type. child<> and link<> properties are returned as #str
96 # pathnames. All integer property types (u8, u16, etc) are
103 # 1. Use absolute path
105 # -> { "execute": "qom-get",
106 # "arguments": { "path": "/machine/unattached/device[0]",
107 # "property": "hotplugged" } }
108 # <- { "return": false }
110 # 2. Use partial path
112 # -> { "execute": "qom-get",
113 # "arguments": { "path": "unattached/sysbus",
114 # "property": "type" } }
115 # <- { "return": "System" }
118 { 'command': 'qom-get',
119 'data': { 'path': 'str', 'property': 'str' },
121 'allow-preconfig': true }
126 # This command will set a property from a object model path.
128 # @path: see @qom-get for a description of this parameter
130 # @property: the property name to set
132 # @value: a value who's type is appropriate for the property type. See @qom-get
133 # for a description of type mapping.
139 # -> { "execute": "qom-set",
140 # "arguments": { "path": "/machine",
141 # "property": "graphics",
143 # <- { "return": {} }
146 { 'command': 'qom-set',
147 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
148 'allow-preconfig': true }
153 # This structure describes a search result from @qom-list-types
155 # @name: the type name found in the search
157 # @abstract: the type is abstract and can't be directly instantiated.
158 # Omitted if false. (since 2.10)
160 # @parent: Name of parent type, if any (since 2.10)
164 { 'struct': 'ObjectTypeInfo',
165 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
170 # This command will return a list of types given search parameters
172 # @implements: if specified, only return types that implement this type name
174 # @abstract: if true, include abstract types in the results
176 # Returns: a list of @ObjectTypeInfo or an empty list if no results are found
180 { 'command': 'qom-list-types',
181 'data': { '*implements': 'str', '*abstract': 'bool' },
182 'returns': [ 'ObjectTypeInfo' ],
183 'allow-preconfig': true }
186 # @qom-list-properties:
188 # List properties associated with a QOM object.
190 # @typename: the type name of an object
192 # Note: objects can create properties at runtime, for example to describe
193 # links between different devices and/or objects. These properties
194 # are not included in the output of this command.
196 # Returns: a list of ObjectPropertyInfo describing object properties
200 { 'command': 'qom-list-properties',
201 'data': { 'typename': 'str'},
202 'returns': [ 'ObjectPropertyInfo' ],
203 'allow-preconfig': true }
208 # Create a QOM object.
210 # @qom-type: the class name for the object to be created
212 # @id: the name of the new object
214 # @props: a dictionary of properties to be passed to the backend. Deprecated
215 # since 5.0, specify the properties on the top level instead. It is an
216 # error to specify the same option both on the top level and in @props.
218 # Additional arguments depend on qom-type and are passed to the backend
221 # Returns: Nothing on success
222 # Error if @qom-type is not a valid class name
228 # -> { "execute": "object-add",
229 # "arguments": { "qom-type": "rng-random", "id": "rng1",
230 # "filename": "/dev/hwrng" } }
231 # <- { "return": {} }
234 { 'command': 'object-add',
235 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'},
236 'gen': false } # so we can get the additional arguments
241 # Remove a QOM object.
243 # @id: the name of the QOM object to remove
245 # Returns: Nothing on success
246 # Error if @id is not a valid id for a QOM object
252 # -> { "execute": "object-del", "arguments": { "id": "rng1" } }
253 # <- { "return": {} }
256 { 'command': 'object-del', 'data': {'id': 'str'} }