[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] failover: don't allow to migrate a paused VM that needs
From: |
Michael S. Tsirkin |
Subject: |
Re: [PATCH 2/2] failover: don't allow to migrate a paused VM that needs PCI unplug |
Date: |
Tue, 2 Nov 2021 11:04:55 -0400 |
On Wed, Sep 29, 2021 at 04:43:11PM +0200, Laurent Vivier wrote:
> As the guest OS is paused, we will never receive the unplug event
> from the kernel and the migration cannot continue.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Well ... what if user previously did
pause
start migration
unpause
we are breaking it now for no good reason.
Further, how about
start migration
pause
are we going to break this too? by failing pause?
> ---
> hw/net/virtio-net.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index f205331dcf8c..e54b6c8cd86c 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -37,8 +37,10 @@
> #include "qapi/qapi-events-migration.h"
> #include "hw/virtio/virtio-access.h"
> #include "migration/misc.h"
> +#include "migration/migration.h"
> #include "standard-headers/linux/ethtool.h"
> #include "sysemu/sysemu.h"
> +#include "sysemu/runstate.h"
> #include "trace.h"
> #include "monitor/qdev.h"
> #include "hw/pci/pci.h"
> @@ -3279,7 +3281,13 @@ static void
> virtio_net_handle_migration_primary(VirtIONet *n, MigrationState *s)
> should_be_hidden = qatomic_read(&n->failover_primary_hidden);
>
> if (migration_in_setup(s) && !should_be_hidden) {
> - if (failover_unplug_primary(n, dev)) {
> + if (!runstate_is_running()) {
> + Error *err = NULL;
> + error_setg(&err,
> + "cannot unplug primary device while VM is paused");
> + migration_cancel(err);
> + error_free(err);
> + } else if (failover_unplug_primary(n, dev)) {
> vmstate_unregister(VMSTATE_IF(dev), qdev_get_vmsd(dev), dev);
> qapi_event_send_unplug_primary(dev->id);
> qatomic_set(&n->failover_primary_hidden, true);
> --
> 2.31.1