aboutsummaryrefslogtreecommitdiff
path: root/qom/object.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2019-01-10 16:04:57 -0200
committerMichael S. Tsirkin <mst@redhat.com>2019-01-17 21:10:57 -0500
commitd7741743f4f3d2683d1bb6938f88dc0167c21afa (patch)
tree26d7b5126284169d4cd3a4b9d467927af47cb6ef /qom/object.c
parentecd3b89b0549d6b82bed5e25a0a2fb153d5df4d4 (diff)
globals: Allow global properties to be optional
Making some global properties optional will let us simplify compat code when a given property works on most (but not all) subclasses of a given type. Device types will be able to opt out from optional compat properties by simply not registering those properties. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index 4e5226ca12..b8c732063b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -385,6 +385,9 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp
if (object_dynamic_cast(obj, p->driver) == NULL) {
continue;
}
+ if (p->optional && !object_property_find(obj, p->property, NULL)) {
+ continue;
+ }
p->used = true;
object_property_parse(obj, p->value, p->property, &err);
if (err != NULL) {