WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix HVM save/restore after upgrade to 0.90.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 May 2007 08:21:29 -0700
Delivery-date: Tue, 15 May 2007 08:23:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix HVM save/restore after upgrade to 0.90., Xen patchbot-unstable <=