Skip to contentSkip to conversation

[5434] Introduce v3 of savevm protocol

Qemu-devel Anthony Liguori 1 participant 1 message Oct 6, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5434

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5434
Author:   aliguori
Date:     2008-10-06 14:53:52 +0000 (Mon, 06 Oct 2008)

Log Message:
-----------
Introduce v3 of savevm protocol

The current savevm/loadvm protocol has some draw backs. It does not support the ability to do progressive saving which means it cannot be used for live checkpointing or migration. The sections sizes are 32-bit integers which means that it will not function when using more than 4GB of memory for a guest. It attempts to seek within the output file which means it cannot be streamed. The current protocol also is pretty lax about how it supports forward compatibility. If a saved section version is greater than what the restore code support, the restore code generally treats the saved data as being in whatever version it supports. This means that restoring a saved VM on an older version of QEMU will likely result in silent guest failure.

This patch introduces a new version of the savevm protocol. It has the following features:

* Support for progressive save of sections (for live checkpoint/migration)
* An asynchronous API for doing save
* Support for interleaving multiple progressive save sections (for future support of memory hot-add/storage migration)
* Fully streaming format
* Strong section version checking

Modified Paths:
--------------
trunk/hw/hw.h
trunk/sysemu.h
trunk/vl.c

Modified: trunk/hw/hw.h
===================================================================

hw/hw.h +9 -0
@@ -217,6 +217,7 @@
 int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
 
 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int SaveLiveStateHandler(QEMUFile *f, int stage, void *opaque);
 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
 int register_savevm(const char *idstr,
@@ -226,6 +227,14 @@
                     LoadStateHandler *load_state,
                     void *opaque);
 
+int register_savevm_live(const char *idstr,
+                         int instance_id,
+                         int version_id,
+                         SaveLiveStateHandler *save_live_state,
+                         SaveStateHandler *save_state,
+                         LoadStateHandler *load_state,
+                         void *opaque);
+
 typedef void QEMUResetHandler(void *opaque);
 
 void qemu_register_reset(QEMUResetHandler *func, void *opaque);

Modified: trunk/sysemu.h
===================================================================

sysemu.h +6 -0
@@ -50,6 +50,12 @@
 
 void main_loop_wait(int timeout);
 
+int qemu_savevm_state_begin(QEMUFile *f);
+int qemu_savevm_state_iterate(QEMUFile *f);
+int qemu_savevm_state_complete(QEMUFile *f);
+int qemu_savevm_state(QEMUFile *f);
+int qemu_loadvm_state(QEMUFile *f);
+
 /* Polling handling */
 
 /* return TRUE if no sleep should be done afterwards */

Modified: trunk/vl.c
===================================================================

vl.c +233 -45

349 lines not on this page · raw message