On Wed, 27 Nov 2013 16:21:23 +0100 Paolo Bonzini <pbonz...@redhat.com> wrote:
> Il 27/11/2013 15:37, Igor Mammedov ha scritto: > > It looks like "realize" for -object / object-add implemented via > > an interface. > > It does---but without unrealize and with the additional get_base_path. > > > Maybe it should be renamed from QOMCommandLineIface to QOMRealizeIface > > and s/complete/realize/ so anyone who knows about Device.realize would > > get meaning without digging in complete() implementations. > > There is an important difference; realize is an internal method in > Device, the external interface is the property. So perhaps it's the > other way round; if Device implements QOMCommandLineIface you could > start creating devices with -object. > > > Alternative would be to behave just like Rng/Tpm do, i.e. use -object > > to do late initialization in a backend user (DimmDevice.realize). > > Draw back of it would be user won't get error during the first command > > "object-add" and only will get error when creating DimmDevice calling > > "device_add". > > That's also a possibility. But again, maybe it's the other way round > and Rng/Tpm could enjoy better error handling if we add the interface. Sure, I'll try to do as you described, it's much better to get error earlier and from command/object that throws it than via proxy. Thanks for suggestion, looking at netdev-add I even haven't thought about using -object. > Paolo