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>
This commit is contained in:
parent
e075e788c9
commit
7f97448122
|
@ -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)
|
static void virtio_net_vmstate_change(void *opaque, int running, int reason)
|
||||||
{
|
{
|
||||||
VirtIONet *n = opaque;
|
VirtIONet *n = opaque;
|
||||||
if (!running) {
|
uint8_t status = running ? VIRTIO_CONFIG_S_DRIVER_OK : 0;
|
||||||
return;
|
/* This is called when vm is started/stopped,
|
||||||
}
|
* it will start/stop vhost backend if * appropriate
|
||||||
/* This is called when vm is started, it will start vhost backend if
|
* e.g. after migration. */
|
||||||
* appropriate e.g. after migration. */
|
virtio_net_set_status(&n->vdev, n->vdev.status & status);
|
||||||
virtio_net_set_status(&n->vdev, n->vdev.status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
|
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)
|
||||||
|
|
Loading…
Reference in a new issue