[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when avail
From: |
Paolo Bonzini |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 |
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 <address@hidden>).
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
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available, Peter Maydell, 2014/10/15
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available, Paul Durrant, 2014/10/16
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available, Paul Durrant, 2014/10/16
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available, Stefano Stabellini, 2014/10/16
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available, Peter Maydell, 2014/10/16
Re: [Qemu-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available, Stefano Stabellini, 2014/10/16