qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Eric Blake <eblake@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH] failover: allow to pause the VM during the migration
Date: Fri, 29 Oct 2021 15:56:17 +0200	[thread overview]
Message-ID: <87ilxgrl32.fsf@secure.mitica> (raw)
In-Reply-To: <20210930170926.1298118-1-lvivier@redhat.com> (Laurent Vivier's message of "Thu, 30 Sep 2021 19:09:26 +0200")

Laurent Vivier <lvivier@redhat.com> wrote:
> If we want to save a snapshot of a VM to a file, we used to follow the
> following steps:
>
> 1- stop the VM:
>    (qemu) stop
>
> 2- migrate the VM to a file:
>    (qemu) migrate "exec:cat > snapshot"
>
> 3- resume the VM:
>    (qemu) cont
>
> After that we can restore the snapshot with:
>   qemu-system-x86_64 ... -incoming "exec:cat snapshot"
>   (qemu) cont
>
> But when failover is configured, it doesn't work anymore.
>
> As the failover needs to ask the guest OS to unplug the card
> the machine cannot be paused.
>
> This patch introduces a new migration parameter, "pause-vm", that
> asks the migration to pause the VM during the migration startup
> phase after the the card is unplugged.
>
> Once the migration is done, we only need to resume the VM with
> "cont" and the card is plugged back:
>
> 1- set the parameter:
>    (qemu) migrate_set_parameter pause-vm on
>
> 2- migrate the VM to a file:
>    (qemu) migrate "exec:cat > snapshot"
>
>    The primary failover card (VFIO) is unplugged and the VM is paused.
>
> 3- resume the VM:
>    (qemu) cont
>
>    The VM restarts and the primary failover card is plugged back
>
> The VM state sent in the migration stream is "paused", it means
> when the snapshot is loaded or if the stream is sent to a destination
> QEMU, the VM needs to be resumed manually.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

I agree with Dave that you should use a capability instead of a
parameter.

Other than that, the code for the new parameter looks ok.
> @@ -3734,13 +3752,27 @@ static void qemu_savevm_wait_unplug(MigrationState *s, int old_state,
>                              "failure");
>              }
>          }
> -
>          migrate_set_state(&s->state, MIGRATION_STATUS_WAIT_UNPLUG, new_state);
>      } else {
>          migrate_set_state(&s->state, old_state, new_state);
>      }
>  }


This change is spurious.

And to make this more generic, I think you can consider changing the
name to pause_during_migration.

Because that is basically what managedsave needs (If I understood Laine
correctly).

Later, Juan.



      parent reply	other threads:[~2021-10-29 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 17:09 [PATCH] failover: allow to pause the VM during the migration Laurent Vivier
2021-09-30 20:17 ` Laine Stump
2021-10-01  6:48   ` Laurent Vivier
2021-10-01  7:37   ` Peter Krempa
2021-10-01  9:01   ` Daniel P. Berrangé
2021-10-14 13:20 ` Dr. David Alan Gilbert
2021-10-29 13:49   ` Juan Quintela
2021-10-29 13:56 ` Juan Quintela [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilxgrl32.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).