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

[Xen-changelog] [xen-unstable] Fix HVM save/restore after upgrade to 0.90.



# HG changeset patch
# User Steven Hand <steven@xxxxxxxxxxxxx>
# Date 1179152386 -3600
# Node ID b6f9f1148273afed135332410d4cbd67edcad0e9
# Parent  9c2a616722da143f8abcd0eabb45159341f3cce0
Fix HVM save/restore after upgrade to 0.90.

Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>
---
 tools/ioemu/vl.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+)

diff -r 9c2a616722da -r b6f9f1148273 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Mon May 14 15:16:32 2007 +0100
+++ b/tools/ioemu/vl.c  Mon May 14 15:19:46 2007 +0100
@@ -4891,6 +4891,77 @@ static int bdrv_snapshot_find(BlockDrive
     return ret;
 }
 
+#ifdef CONFIG_DM
+/* We use simpler state save/load functions for Xen */
+void do_savevm(const char *name)
+{
+    QEMUFile *f;
+    int saved_vm_running, ret;
+
+    f = qemu_fopen(name, "wb");
+    
+    /* ??? Should this occur after vm_stop?  */
+    qemu_aio_flush();
+
+    saved_vm_running = vm_running;
+    vm_stop(0);
+
+    if (!f) {
+        fprintf(logfile, "Failed to open savevm file '%s'\n", name);
+        goto the_end;
+    }
+    
+    ret = qemu_savevm_state(f);
+    qemu_fclose(f);
+
+    if (ret < 0)
+        fprintf(logfile, "Error %d while writing VM to savevm file '%s'\n",
+                ret, name);
+
+ the_end:
+    if (saved_vm_running)
+        vm_start();
+
+    return;
+}
+void do_loadvm(const char *name)
+{
+    QEMUFile *f;
+    int saved_vm_running, ret;
+
+    /* Flush all IO requests so they don't interfere with the new state.  */
+    qemu_aio_flush();
+
+    saved_vm_running = vm_running;
+    vm_stop(0);
+
+    /* restore the VM state */
+    f = qemu_fopen(name, "rb");
+    if (!f) {
+        fprintf(logfile, "Could not open VM state file\n");
+        goto the_end;
+    }
+
+    ret = qemu_loadvm_state(f);
+    qemu_fclose(f);
+    if (ret < 0) {
+        fprintf(logfile, "Error %d while loading savevm file '%s'\n",
+                ret, name);
+        goto the_end; 
+    }
+
+#if 0 
+    /* del tmp file */
+    if (unlink(name) == -1)
+        fprintf(stderr, "delete tmp qemu state file failed.\n");
+#endif
+
+
+ the_end:
+    if (saved_vm_running)
+        vm_start();
+}
+#else 
 void do_savevm(const char *name)
 {
     BlockDriverState *bs, *bs1;
@@ -5064,6 +5135,7 @@ void do_loadvm(const char *name)
     if (saved_vm_running)
         vm_start();
 }
+#endif
 
 void do_delvm(const char *name)
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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