virtio-balloon: Unregister savevm section on device unplug

Migrating after unplugging a virtio-balloon device resulted in an error
message on the destination:

Unknown savevm section or instance '0000:00:04.0/virtio-balloon' 0
load of migration failed

Fix this by unregistering the section on device unplug.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Amit Shah 2011-07-28 11:36:26 +05:30 committed by Anthony Liguori
parent 855d7e259f
commit ac720400e1

View File

@ -45,6 +45,7 @@ typedef struct VirtIOBalloon
size_t stats_vq_offset;
MonitorCompletion *stats_callback;
void *stats_opaque_callback_data;
DeviceState *qdev;
} VirtIOBalloon;
static VirtIOBalloon *to_virtio_balloon(VirtIODevice *vdev)
@ -292,6 +293,7 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
reset_stats(s);
s->qdev = dev;
register_savevm(dev, "virtio-balloon", -1, 1,
virtio_balloon_save, virtio_balloon_load, s);
@ -300,5 +302,7 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev)
void virtio_balloon_exit(VirtIODevice *vdev)
{
VirtIOBalloon *s = DO_UPCAST(VirtIOBalloon, vdev, vdev);
unregister_savevm(s->qdev, "virtio-balloon", s);
virtio_cleanup(vdev);
}