3 # This work is licensed under the terms of the GNU GPL, version 2 or later.
4 # See the COPYING file in the top-level directory.
7 # = QEMU Object Model (QOM)
11 # @ObjectPropertyInfo:
13 # @name: the name of the property
15 # @type: the type of the property. This will typically come in one of four
18 # 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
19 # These types are mapped to the appropriate JSON type.
21 # 2) A child type in the form 'child<subtype>' where subtype is a qdev
22 # device type name. Child properties create the composition tree.
24 # 3) A link type in the form 'link<subtype>' where subtype is a qdev
25 # device type name. Link properties form the device model graph.
27 # @description: if specified, the description of the property.
29 # @default-value: the default value, if any (since 5.0)
33 { 'struct': 'ObjectPropertyInfo',
34 'data': { 'name': 'str',
36 '*description': 'str',
37 '*default-value': 'any' } }
42 # This command will list any properties of a object given a path in the object
45 # @path: the path within the object model. See @qom-get for a description of
48 # Returns: a list of @ObjectPropertyInfo that describe the properties of the
55 # -> { "execute": "qom-list",
56 # "arguments": { "path": "/chardevs" } }
57 # <- { "return": [ { "name": "type", "type": "string" },
58 # { "name": "parallel0", "type": "child<chardev-vc>" },
59 # { "name": "serial0", "type": "child<chardev-vc>" },
60 # { "name": "mon0", "type": "child<chardev-stdio>" } ] }
63 { 'command': 'qom-list',
64 'data': { 'path': 'str' },
65 'returns': [ 'ObjectPropertyInfo' ],
66 'allow-preconfig': true }
71 # This command will get a property from a object model path and return the
74 # @path: The path within the object model. There are two forms of supported
75 # paths--absolute and partial paths.
77 # Absolute paths are derived from the root object and can follow child<>
78 # or link<> properties. Since they can follow link<> properties, they
79 # can be arbitrarily long. Absolute paths look like absolute filenames
80 # and are prefixed with a leading slash.
82 # Partial paths look like relative filenames. They do not begin
83 # with a prefix. The matching rules for partial paths are subtle but
84 # designed to make specifying objects easy. At each level of the
85 # composition tree, the partial path is matched as an absolute path.
86 # The first match is not returned. At least two matches are searched
87 # for. A successful result is only returned if only one match is
88 # found. If more than one match is found, a flag is return to
89 # indicate that the match was ambiguous.
91 # @property: The property name to read
93 # Returns: The property value. The type depends on the property
94 # type. child<> and link<> properties are returned as #str
95 # pathnames. All integer property types (u8, u16, etc) are
102 # 1. Use absolute path
104 # -> { "execute": "qom-get",
105 # "arguments": { "path": "/machine/unattached/device[0]",
106 # "property": "hotplugged" } }
107 # <- { "return": false }
109 # 2. Use partial path
111 # -> { "execute": "qom-get",
112 # "arguments": { "path": "unattached/sysbus",
113 # "property": "type" } }
114 # <- { "return": "System" }
117 { 'command': 'qom-get',
118 'data': { 'path': 'str', 'property': 'str' },
120 'allow-preconfig': true }
125 # This command will set a property from a object model path.
127 # @path: see @qom-get for a description of this parameter
129 # @property: the property name to set
131 # @value: a value who's type is appropriate for the property type. See @qom-get
132 # for a description of type mapping.
138 # -> { "execute": "qom-set",
139 # "arguments": { "path": "/machine",
140 # "property": "graphics",
142 # <- { "return": {} }
145 { 'command': 'qom-set',
146 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
147 'allow-preconfig': true }
152 # This structure describes a search result from @qom-list-types
154 # @name: the type name found in the search
156 # @abstract: the type is abstract and can't be directly instantiated.
157 # Omitted if false. (since 2.10)
159 # @parent: Name of parent type, if any (since 2.10)
163 { 'struct': 'ObjectTypeInfo',
164 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
169 # This command will return a list of types given search parameters
171 # @implements: if specified, only return types that implement this type name
173 # @abstract: if true, include abstract types in the results
175 # Returns: a list of @ObjectTypeInfo or an empty list if no results are found
179 { 'command': 'qom-list-types',
180 'data': { '*implements': 'str', '*abstract': 'bool' },
181 'returns': [ 'ObjectTypeInfo' ],
182 'allow-preconfig': true }
185 # @qom-list-properties:
187 # List properties associated with a QOM object.
189 # @typename: the type name of an object
191 # Note: objects can create properties at runtime, for example to describe
192 # links between different devices and/or objects. These properties
193 # are not included in the output of this command.
195 # Returns: a list of ObjectPropertyInfo describing object properties
199 { 'command': 'qom-list-properties',
200 'data': { 'typename': 'str'},
201 'returns': [ 'ObjectPropertyInfo' ],
202 'allow-preconfig': true }
207 # Create a QOM object.
209 # @qom-type: the class name for the object to be created
211 # @id: the name of the new object
213 # @props: a dictionary of properties to be passed to the backend
215 # Returns: Nothing on success
216 # Error if @qom-type is not a valid class name
222 # -> { "execute": "object-add",
223 # "arguments": { "qom-type": "rng-random", "id": "rng1",
224 # "props": { "filename": "/dev/hwrng" } } }
225 # <- { "return": {} }
228 { 'command': 'object-add',
229 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
234 # Remove a QOM object.
236 # @id: the name of the QOM object to remove
238 # Returns: Nothing on success
239 # Error if @id is not a valid id for a QOM object
245 # -> { "execute": "object-del", "arguments": { "id": "rng1" } }
246 # <- { "return": {} }
249 { 'command': 'object-del', 'data': {'id': 'str'} }