summaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2016-09-21 16:52:20 +0100
committerMichael S. Tsirkin <mst@redhat.com>2016-09-23 19:03:55 +0300
commit791b1daf724ea835a32e90b2b15df1e20dae6f57 (patch)
tree265a2cdd9390d1c0045c13637a5100dc547c6e3e /hw/virtio
parentf5ed36635d8fa73feb66fe12b3b9c2ed90a1adbe (diff)
downloadqemu-791b1daf724ea835a32e90b2b15df1e20dae6f57.tar.gz
qemu-791b1daf724ea835a32e90b2b15df1e20dae6f57.tar.bz2
qemu-791b1daf724ea835a32e90b2b15df1e20dae6f57.zip
virtio: migrate vdev->broken flag
Send a subsection if the vdev->broken flag is set. This allows live migration of broken virtio devices. The subsection is only sent if vdev->broken has been set. In most cases the flag will be clear and no subsection will be sent. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 1671ea8451..bac6b51f7c 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1343,6 +1343,13 @@ static bool virtio_extra_state_needed(void *opaque)
k->has_extra_state(qbus->parent);
}
+static bool virtio_broken_needed(void *opaque)
+{
+ VirtIODevice *vdev = opaque;
+
+ return vdev->broken;
+}
+
static const VMStateDescription vmstate_virtqueue = {
.name = "virtqueue_state",
.version_id = 1,
@@ -1457,6 +1464,17 @@ static const VMStateDescription vmstate_virtio_64bit_features = {
}
};
+static const VMStateDescription vmstate_virtio_broken = {
+ .name = "virtio/broken",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = &virtio_broken_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_BOOL(broken, VirtIODevice),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static const VMStateDescription vmstate_virtio = {
.name = "virtio",
.version_id = 1,
@@ -1470,6 +1488,7 @@ static const VMStateDescription vmstate_virtio = {
&vmstate_virtio_64bit_features,
&vmstate_virtio_virtqueues,
&vmstate_virtio_ringsize,
+ &vmstate_virtio_broken,
&vmstate_virtio_extra_state,
NULL
}