On Mon, 14 Apr 2014 18:02:32 +0200 Andreas Färber <afaer...@suse.de> wrote:
> Am 04.04.2014 15:36, schrieb Igor Mammedov: > > so that managment could detect via QOM interface if device was > > "management" Thanks, I'll fix it. > > > hotplugged > > > > Signed-off-by: Igor Mammedov <imamm...@redhat.com> > > --- > > hw/core/qdev.c | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > > index 50bb8f5..a278380 100644 > > --- a/hw/core/qdev.c > > +++ b/hw/core/qdev.c > > @@ -826,6 +826,20 @@ static bool device_get_hotpluggable(Object *obj, Error > > **err) > > dev->parent_bus->allow_hotplug); > > } > > > > +static bool device_get_hotplugged(Object *obj, Error **err) > > +{ > > + DeviceState *dev = DEVICE(obj); > > + > > + return dev->hotplugged; > > +} > > + > > +static void device_set_hotplugged(Object *obj, bool value, Error **err) > > +{ > > + DeviceState *dev = DEVICE(obj); > > + > > + dev->hotplugged = value; > > +} > > What is the use case of setting this from management side? In migration case, one needs to specify this on QEMU CLI for hotplugged DIMMs when starting target QEMU instance, something like this -device dimm,id=foo,hotplugged=true,memdev=moo It's not strictly necessary and only for benefit of management so it could differentiate between coldplugged/hotplugged devices. > > Otherwise looks good. > > Regards, > Andreas > > > + > > static void device_initfn(Object *obj) > > { > > DeviceState *dev = DEVICE(obj); > > @@ -844,6 +858,9 @@ static void device_initfn(Object *obj) > > device_get_realized, device_set_realized, > > NULL); > > object_property_add_bool(obj, "hotpluggable", > > device_get_hotpluggable, NULL, NULL); > > + object_property_add_bool(obj, "hotplugged", > > + device_get_hotplugged, device_set_hotplugged, > > + &error_abort); > > > > class = object_get_class(OBJECT(dev)); > > do { > > > >