Skip to content

-object/object-add add 2nd stage initialization

Igor Mammedov qemu-devel 1 version Applied

Status from this message: Applied to the qmp branch, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesApplied

Changes since RFC from the cover letter

* rename object_realize interface to UserCreatable
* make UserCreatable interface mandatory for -object/object-add
* drop custom location patch

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4object_add: consolidate error handlingqmp.c+6 -40 replies
2/4vl.c: -object: don't ingnore duplicate 'id'vl.c+8 -11 reply
3/4add optional 2nd stage initialization to -object/object-add commandsbackends/rng.c include/qom/object_interfaces.h qmp.c +3 more+125 -00 replies
4/4virtio_rng: replace custom backend API with UserCreatable.complete() callbackbackends/rng.c hw/virtio/virtio-rng.c include/sysemu/rng.h+19 -191 reply

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEric BlakeStefan Hajnoczi
SeriesR-b
1/4
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH v1 0/4] -object/object-add add 2nd stage initialization

Adds UserCreatable interface that objects must inherit from If they need to be created with help of -object/object-add commands.

Interface also provides an optional complete() callback, that is called after object properties are set. Which allows
* replace custom backend APIs to initialize them with generic object_new(); set object properties; object.complete(); sequence.
* bail out/report error early (at backend creation time) instead of failing later when adding device that uses that backend.

Reference to RFC:
https://lists.gnu.org/archive/html/qemu-devel/2014-01/msg00877.html

Changes since RFC:
* rename object_realize interface to UserCreatable
* make UserCreatable interface mandatory for -object/object-add
* drop custom location patch

Git tree for testing:
https://github.com/imammedo/qemu/commits/extend-object-add-v1

Igor Mammedov (4):
object_add: consolidate error handling
vl.c: -object: don't ingnore duplicate 'id'
add optional 2nd stage initialization to -object/object-add commands
virtio_rng: replace custom backend API with UserCreatable.complete()
callback

 backends/rng.c                  |   17 +++++++++-
 hw/virtio/virtio-rng.c          |   15 +++++----
 include/qom/object_interfaces.h |   62 +++++++++++++++++++++++++++++++++++++++
 include/sysemu/rng.h            |   11 -------
 qmp.c                           |   22 +++++++++++--
 qom/Makefile.objs               |    1 +
 qom/object_interfaces.c         |   32 ++++++++++++++++++++
 vl.c                            |   22 +++++++++++++-
 8 files changed, 158 insertions(+), 24 deletions(-)
 create mode 100644 include/qom/object_interfaces.h
 create mode 100644 qom/object_interfaces.c