[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 2/2] Xen: Use the ioreq-server API when available



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@xxxxxxxxxx>).

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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.