From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Kunkun Jiang <jiangkunkun@huawei.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>,
"Markus Armbruster" <armbru@redhat.com>,
wanghaibin.wang@huawei.com, "Paolo Bonzini" <pbonzini@redhat.com>,
"Eric Blake" <eblake@redhat.com>
Subject: Re: [PATCH 1/2] qapi/run-state: Add a new shutdown cause 'migration-completed'
Date: Wed, 14 Jul 2021 19:39:46 +0100 [thread overview]
Message-ID: <YO8vcoJcRfyCqj54@work-vm> (raw)
In-Reply-To: <b089db57-486b-fb6f-0b90-8275b0165361@huawei.com>
* Kunkun Jiang (jiangkunkun@huawei.com) wrote:
> On 2021/7/6 18:27, Dr. David Alan Gilbert wrote:
> > * Kunkun Jiang (jiangkunkun@huawei.com) wrote:
> > > Hi Daniel,
> > >
> > > On 2021/7/5 20:48, Daniel P. Berrangé wrote:
> > > > On Mon, Jul 05, 2021 at 08:36:52PM +0800, Kunkun Jiang wrote:
> > > > > In the current version, the source QEMU process does not automatic
> > > > > exit after a successful migration. Additional action is required,
> > > > > such as sending { "execute": "quit" } or ctrl+c. For simplify, add
> > > > > a new shutdown cause 'migration-completed' to exit the source QEMU
> > > > > process after a successful migration.
> > > > IIUC, 'STATUS_COMPLETED' state is entered on the source host
> > > > once it has finished sending all VM state, and thus does not
> > > > guarantee that the target host has successfully received and
> > > > loaded all VM state.
> > > Thanks for your reply.
> > >
> > > If the target host doesn't successfully receive and load all VM state,
> > > we can send { "execute": "cont" } to resume the soruce in time to
> > > ensure that VM will not lost?
> > Yes, that's pretty common at the moment; the failed migration can
> > happen at lots of different points:
> > a) The last part of the actual migration stream/loading the devices
> > - that's pretty easy, since the destination hasn't actually got
> > the full migration stream.
> >
> > b) If the migration itself completes, but then the management system
> > then tries to reconfigure the networking/storage on the destination,
> > and something goes wrong in that, then it can roll that back and
> > cont on the source.
> >
> > So, it's a pretty common type of failure/recovery - the management
> > application has to be a bit careful not to do anything destructive
> > until as late as possible, so it knows it can switch back.
> Okay, I see.
> > > > Typically a mgmt app will need to directly confirm that the
> > > > target host QEMU has succesfully started running, before it
> > > > will tell the source QEMU to quit.
> > > 'a mgmt app', such as libvirt?
> > Yes, it's currently libvirt that does that; but any of the control
> > things could (it's just libvirt has been going long enough so it knows
> > about lots and lots of nasty cases of migration failure, and recovering
> > properly).
> >
> > Can you explain why did you want to get the source to automatically
> > quit? In a real setup where does it help?
> Sorry, my thoughts on live migration scenarios are not comprehensive enough.
That's OK; it takes a little while to understand all of the recovery and
error cases; people *really* want to recover from a failed migration;
so we try and be very careful about not throwing away the source.
Dave
> Thanks,
> Kunkun Jiang
> > Dave
> >
> >
> > > Thanks,
> > > Kunkun Jiang
> > > > So, AFAICT, this automatic exit after STATUS_COMPLETED is
> > > > not safe and could lead to total loss of the running VM in
> > > > error scenarios.
> > > >
> > > >
> > > >
> > > > > Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
> > > > > ---
> > > > > migration/migration.c | 1 +
> > > > > qapi/run-state.json | 4 +++-
> > > > > 2 files changed, 4 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/migration/migration.c b/migration/migration.c
> > > > > index 4228635d18..16782c93c2 100644
> > > > > --- a/migration/migration.c
> > > > > +++ b/migration/migration.c
> > > > > @@ -3539,6 +3539,7 @@ static void migration_iteration_finish(MigrationState *s)
> > > > > case MIGRATION_STATUS_COMPLETED:
> > > > > migration_calculate_complete(s);
> > > > > runstate_set(RUN_STATE_POSTMIGRATE);
> > > > > + qemu_system_shutdown_request(SHUTDOWN_CAUSE_MIGRATION_COMPLETED);
> > > > > break;
> > > > > case MIGRATION_STATUS_ACTIVE:
> > > > > diff --git a/qapi/run-state.json b/qapi/run-state.json
> > > > > index 43d66d700f..66aaef4e2b 100644
> > > > > --- a/qapi/run-state.json
> > > > > +++ b/qapi/run-state.json
> > > > > @@ -86,12 +86,14 @@
> > > > > # ignores --no-reboot. This is useful for sanitizing
> > > > > # hypercalls on s390 that are used during kexec/kdump/boot
> > > > > #
> > > > > +# @migration-completed: Reaction to the successful migration
> > > > > +#
> > > > > ##
> > > > > { 'enum': 'ShutdownCause',
> > > > > # Beware, shutdown_caused_by_guest() depends on enumeration order
> > > > > 'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
> > > > > 'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
> > > > > - 'guest-panic', 'subsystem-reset'] }
> > > > > + 'guest-panic', 'subsystem-reset', 'migration-completed'] }
> > > > > ##
> > > > > # @StatusInfo:
> > > > > --
> > > > > 2.23.0
> > > > >
> > > > >
> > > > Regards,
> > > > Daniel
> > >
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2021-07-14 18:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 12:36 [PATCH 0/2] Auto exit source QEMU process after a successful migration Kunkun Jiang
2021-07-05 12:36 ` [PATCH 1/2] qapi/run-state: Add a new shutdown cause 'migration-completed' Kunkun Jiang
2021-07-05 12:48 ` Daniel P. Berrangé
2021-07-05 13:22 ` Kunkun Jiang
2021-07-06 10:27 ` Dr. David Alan Gilbert
2021-07-07 2:34 ` Kunkun Jiang
2021-07-14 18:39 ` Dr. David Alan Gilbert [this message]
2021-07-05 12:36 ` [PATCH 2/2] qapi/migration: Add a new migration capability 'auto-quit' Kunkun Jiang
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=YO8vcoJcRfyCqj54@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=jiangkunkun@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=wanghaibin.wang@huawei.com \
/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).