From: Paolo Bonzini <pbonzini@redhat.com>
To: Paul Durrant <Paul.Durrant@citrix.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Olaf Hering <olaf@aepfle.de>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
Stefan Weil <sw@weilnetz.de>, Michael Tokarev <mjt@tls.msk.ru>,
QEMU Developers <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>,
Stefano Stabellini <Stefano.Stabellini@citrix.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available
Date: Thu, 16 Oct 2014 12:23:07 +0200 [thread overview]
Message-ID: <543F9C8B.5090009@redhat.com> (raw)
In-Reply-To: <9AAE0902D5BC7E449B7C8E4E778ABCD0111052F4@AMSPEX01CL01.citrite.net>
Il 16/10/2014 12:16, Paul Durrant ha scritto:
>> What exactly is the right semantics? Note that save _can_ fail,
>> so you need the ability to roll back to the source machine. I
>> think this is missing from your patch, and there is no post_save
>> hook that you can use.
>
> I need something that will be called prior to the VM memory image
> being saved, but if save can fail I will also need something to be
> called if that occurs too.
Can you check the runstate in the vmstate change callback? The runstate
to use is RUN_STATE_FINISH_MIGRATE (and then you revert if you get from
there to anything but RUN_STATE_POSTMIGRATE).
...
oh wait, those are the runstate for migration, xen's save-devices-state
command uses something else. Luckily, the command is synchronous, so
management cannot "poll" the state as is the case for regular migration.
So a patch like this could provide the right runstates:
diff --git a/savevm.c b/savevm.c
index 2d8eb96..f9a8e27 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1144,7 +1144,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
int ret;
saved_vm_running = runstate_is_running();
- vm_stop(RUN_STATE_SAVE_VM);
+ vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
f = qemu_fopen(filename, "wb");
if (!f) {
@@ -1155,8 +1155,12 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
qemu_fclose(f);
if (ret < 0) {
error_set(errp, QERR_IO_ERROR);
+ goto the_end;
}
+ runstate_set(RUN_STATE_POSTMIGRATE);
+ return;
+
the_end:
if (saved_vm_running) {
vm_start();
(feel free to include it in your patches with Signed-off-by: Paolo
Bonzini <pbonzini@redhat.com>).
Alternatively, can you stop/restart emulation always (even on stop/cont
monitor commands) rather than just on migration? That would make things
even simpler and not need anything like the above savevm.c change.
Paolo
next prev parent reply other threads:[~2014-10-16 10:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 9:16 [Qemu-devel] [PATCH v3 0/2] Xen: Use ioreq-server API Paul Durrant
2014-10-15 9:16 ` [Qemu-devel] [PATCH v3 1/2] Add device listener interface Paul Durrant
2014-10-15 9:54 ` Igor Mammedov
2014-10-15 10:05 ` Paul Durrant
2014-10-16 12:41 ` Igor Mammedov
2014-10-16 12:54 ` Paul Durrant
2014-10-15 9:16 ` [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available Paul Durrant
2014-10-15 14:37 ` Stefano Stabellini
2014-10-15 14:51 ` Paul Durrant
2014-10-15 15:04 ` [Qemu-devel] [Xen-devel] " Andrew Cooper
2014-10-15 15:04 ` Stefano Stabellini
2014-10-16 9:51 ` [Qemu-devel] " Paul Durrant
2014-10-16 10:44 ` Stefano Stabellini
2014-10-15 17:30 ` Peter Maydell
2014-10-16 7:37 ` Paolo Bonzini
2014-10-16 8:25 ` Paul Durrant
2014-10-16 10:09 ` Paolo Bonzini
2014-10-16 10:16 ` Paul Durrant
2014-10-16 10:23 ` Paolo Bonzini [this message]
2014-10-16 10:25 ` Paul Durrant
2014-10-16 8:23 ` Paul Durrant
2014-10-16 11:29 ` Stefano Stabellini
2014-10-16 12:31 ` Peter Maydell
2014-10-16 15:25 ` Stefano Stabellini
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=543F9C8B.5090009@redhat.com \
--to=pbonzini@redhat.com \
--cc=Paul.Durrant@citrix.com \
--cc=Stefano.Stabellini@citrix.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=kraxel@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=olaf@aepfle.de \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
--cc=xen-devel@lists.xenproject.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).