aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-net.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-07 17:50:45 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-07 17:50:45 +0000
commite46cb38f13dda9b2b7754de521836c0c97bb09cd (patch)
tree9ea8e9740b57dc2b81931049275b8b6c4a22786d /hw/virtio-net.c
parent7a9f6e4a8db958caf10332f160ed04f175932d55 (diff)
virtio-net migration fix (Mark McLoughlin)
We are failing to save whether the guest will supply us rx buffers using the new mergeable format; this can cause a migrated guest to crash with: virtio-net header not in first element Bump the savevm version number and refuse to load v1 saves just to be on the safe side. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6221 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/virtio-net.c')
-rw-r--r--hw/virtio-net.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 4443ff574d..de1f7ceca3 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -275,19 +275,21 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
qemu_put_buffer(f, n->mac, 6);
qemu_put_be32(f, n->tx_timer_active);
+ qemu_put_be32(f, n->mergeable_rx_bufs);
}
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIONet *n = opaque;
- if (version_id != 1)
+ if (version_id != 2)
return -EINVAL;
virtio_load(&n->vdev, f);
qemu_get_buffer(f, n->mac, 6);
n->tx_timer_active = qemu_get_be32(f);
+ n->mergeable_rx_bufs = qemu_get_be32(f);
if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer,
@@ -324,7 +326,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
n->tx_timer_active = 0;
n->mergeable_rx_bufs = 0;
- register_savevm("virtio-net", virtio_net_id++, 1,
+ register_savevm("virtio-net", virtio_net_id++, 2,
virtio_net_save, virtio_net_load, n);
return (PCIDevice *)n;