Paolo Bonzini 352e8da743 qdev: correctly send DEVICE_DELETED for recursively-deleted devices
When a device is unparented (i.e. made completely hidden from management)
we want to send a DEVICE_DELETED event only if the device actually was
realized.  This avoids raising DEVICE_DELETED events when device_add
fails.

However, this does not work right for recursively-deleted
devices: the whole tree is _first_ unrealized, _then_ unparented.
Then device_unparent sees realized==false and fails to trigger
the event.  The solution is simply to move have_realized into
the DeviceState struct.  If device_add fails, we never set the
new field to true and DEVICE_DELETED is not sent.

Fixes qemu-iotests testcase 067 (broken by commit 5942a19, though that
commit in turn fixed a possible segfault in the same test).

Reported-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-01 10:20:42 +02:00
..
2014-06-19 18:44:22 +03:00
2014-02-14 16:22:31 +01:00
2013-06-07 14:55:33 +02:00
2013-12-17 20:12:51 +00:00
2013-12-24 18:02:18 +01:00
2014-02-03 14:04:00 +00:00
2014-02-26 17:20:00 +00:00
2014-02-14 16:22:31 +01:00
2013-04-08 18:13:10 +02:00
2013-07-29 21:06:27 +02:00
2013-04-08 18:13:10 +02:00
2014-06-19 18:44:22 +03:00
2014-06-27 13:48:23 +02:00
2014-02-27 10:01:40 +00:00
2013-04-08 18:13:10 +02:00
2014-03-05 03:06:46 +01:00
2013-04-08 18:13:10 +02:00
2014-02-10 10:23:35 +02:00
2013-06-27 15:38:35 -05:00
2014-03-11 13:25:48 +02:00
2013-04-08 18:13:10 +02:00
2013-04-08 18:13:10 +02:00
2014-05-28 17:36:21 +02:00
2013-05-01 20:55:21 +04:00
2014-06-02 16:29:00 +02:00