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.
31 { 'struct': 'ObjectPropertyInfo',
32 'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
37 # This command will list any properties of a object given a path in the object
40 # @path: the path within the object model. See @qom-get for a description of
43 # Returns: a list of @ObjectPropertyInfo that describe the properties of the
50 # -> { "execute": "qom-list",
51 # "arguments": { "path": "/chardevs" } }
52 # <- { "return": [ { "name": "type", "type": "string" },
53 # { "name": "parallel0", "type": "child<chardev-vc>" },
54 # { "name": "serial0", "type": "child<chardev-vc>" },
55 # { "name": "mon0", "type": "child<chardev-stdio>" } ] }
58 { 'command': 'qom-list',
59 'data': { 'path': 'str' },
60 'returns': [ 'ObjectPropertyInfo' ],
61 'allow-preconfig': true }
66 # This command will get a property from a object model path and return the
69 # @path: The path within the object model. There are two forms of supported
70 # paths--absolute and partial paths.
72 # Absolute paths are derived from the root object and can follow child<>
73 # or link<> properties. Since they can follow link<> properties, they
74 # can be arbitrarily long. Absolute paths look like absolute filenames
75 # and are prefixed with a leading slash.
77 # Partial paths look like relative filenames. They do not begin
78 # with a prefix. The matching rules for partial paths are subtle but
79 # designed to make specifying objects easy. At each level of the
80 # composition tree, the partial path is matched as an absolute path.
81 # The first match is not returned. At least two matches are searched
82 # for. A successful result is only returned if only one match is
83 # found. If more than one match is found, a flag is return to
84 # indicate that the match was ambiguous.
86 # @property: The property name to read
88 # Returns: The property value. The type depends on the property
89 # type. child<> and link<> properties are returned as #str
90 # pathnames. All integer property types (u8, u16, etc) are
97 # 1. Use absolute path
99 # -> { "execute": "qom-get",
100 # "arguments": { "path": "/machine/unattached/device[0]",
101 # "property": "hotplugged" } }
102 # <- { "return": false }
104 # 2. Use partial path
106 # -> { "execute": "qom-get",
107 # "arguments": { "path": "unattached/sysbus",
108 # "property": "type" } }
109 # <- { "return": "System" }
112 { 'command': 'qom-get',
113 'data': { 'path': 'str', 'property': 'str' },
115 'allow-preconfig': true }
120 # This command will set a property from a object model path.
122 # @path: see @qom-get for a description of this parameter
124 # @property: the property name to set
126 # @value: a value who's type is appropriate for the property type. See @qom-get
127 # for a description of type mapping.
133 # -> { "execute": "qom-set",
134 # "arguments": { "path": "/machine",
135 # "property": "graphics",
137 # <- { "return": {} }
140 { 'command': 'qom-set',
141 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
142 'allow-preconfig': true }
147 # This structure describes a search result from @qom-list-types
149 # @name: the type name found in the search
151 # @abstract: the type is abstract and can't be directly instantiated.
152 # Omitted if false. (since 2.10)
154 # @parent: Name of parent type, if any (since 2.10)
158 { 'struct': 'ObjectTypeInfo',
159 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
164 # This command will return a list of types given search parameters
166 # @implements: if specified, only return types that implement this type name
168 # @abstract: if true, include abstract types in the results
170 # Returns: a list of @ObjectTypeInfo or an empty list if no results are found
174 { 'command': 'qom-list-types',
175 'data': { '*implements': 'str', '*abstract': 'bool' },
176 'returns': [ 'ObjectTypeInfo' ],
177 'allow-preconfig': true }
180 # @qom-list-properties:
182 # List properties associated with a QOM object.
184 # @typename: the type name of an object
186 # Note: objects can create properties at runtime, for example to describe
187 # links between different devices and/or objects. These properties
188 # are not included in the output of this command.
190 # Returns: a list of ObjectPropertyInfo describing object properties
194 { 'command': 'qom-list-properties',
195 'data': { 'typename': 'str'},
196 'returns': [ 'ObjectPropertyInfo' ],
197 'allow-preconfig': true }
202 # Create a QOM object.
204 # @qom-type: the class name for the object to be created
206 # @id: the name of the new object
208 # @props: a dictionary of properties to be passed to the backend
210 # Returns: Nothing on success
211 # Error if @qom-type is not a valid class name
217 # -> { "execute": "object-add",
218 # "arguments": { "qom-type": "rng-random", "id": "rng1",
219 # "props": { "filename": "/dev/hwrng" } } }
220 # <- { "return": {} }
223 { 'command': 'object-add',
224 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
229 # Remove a QOM object.
231 # @id: the name of the QOM object to remove
233 # Returns: Nothing on success
234 # Error if @id is not a valid id for a QOM object
240 # -> { "execute": "object-del", "arguments": { "id": "rng1" } }
241 # <- { "return": {} }
244 { 'command': 'object-del', 'data': {'id': 'str'} }