aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-06-02 11:40:54 +0300
committerMichael S. Tsirkin <mst@redhat.com>2010-06-02 11:54:45 +0300
commit7f9744812291853425b614f68668f48d49882a1f (patch)
tree69489b78d606fda86a1be5076b454beb49173413 /hw/virtio-net.c
parente075e788c9e882f5bebfb350f725ee7e4273033f (diff)
virtio-net: stop vhost backend on vmstop
vhost net currently keeps running after vmstop, which causes trouble as qemy does not check for dirty pages anymore. The fix is to simply keep vm and vhost running/stopped status in sync. Tested-by: David L Stevens <dlstevens@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio-net.c')
-rw-r--r--hw/virtio-net.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index cb664e6207..6a9d560a9b 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -877,12 +877,11 @@ static void virtio_net_set_status(struct VirtIODevice *vdev, uint8_t status)
static void virtio_net_vmstate_change(void *opaque, int running, int reason)
{
VirtIONet *n = opaque;
- if (!running) {
- return;
- }
- /* This is called when vm is started, it will start vhost backend if
- * appropriate e.g. after migration. */
- virtio_net_set_status(&n->vdev, n->vdev.status);
+ uint8_t status = running ? VIRTIO_CONFIG_S_DRIVER_OK : 0;
+ /* This is called when vm is started/stopped,
+ * it will start/stop vhost backend if * appropriate
+ * e.g. after migration. */
+ virtio_net_set_status(&n->vdev, n->vdev.status & status);
}
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)