On 20/06/19 19:37, Stefan Hajnoczi wrote: > v5: > * Plumbing vm change state handlers into DeviceClass/BusClass is a rather > large bug fix. Instead I've combined the previous priorities approach with > the observation from Kevin and Paolo that we really want to order by qdev > tree depth. > > The new qdev_add_vm_change_state_handler() API lets DeviceStates register > callbacks that execute in qdev tree depth order. This solves the > virtio-scsi bug since the virtio-scsi device's callback must complete > before > its child scsi-disk's callback runs. > > Is this a good compromise for everyone?
Yes! Perhaps a bit of a hack, but it works and both the API and the implementation are very sane. Converting other devices to use qdev_add_vm_change_state_handler() is left as an exercise for the reviewer, I guess? :) Paolo