]> xenbits.xensource.com Git - xen.git/commitdiff
tools: Change the name of the qemu save file at restore time
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 21 Jan 2011 17:57:31 +0000 (17:57 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 21 Jan 2011 17:57:31 +0000 (17:57 +0000)
Change the name of the qemu save file to qemu-resume at restore time so
that it doesn't collide with the name of the next save file.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_domain_restore.c
tools/libxc/xenguest.h
tools/libxl/libxl_create.c
tools/libxl/libxl_internal.h
tools/python/xen/xend/image.py

index d895710a7bffcc4712a0aca3843ea9bb56b3656d..eb9eee3009c299fc3783c789a7a5a81416cce82f 100644 (file)
@@ -436,7 +436,7 @@ static int dump_qemu(xc_interface *xch, uint32_t dom, struct tailbuf_hvm *buf)
     char path[256];
     FILE *fp;
 
-    sprintf(path, "/var/lib/xen/qemu-save.%u", dom);
+    sprintf(path, XC_DEVICE_MODEL_RESTORE_FILE".%u", dom);
     fp = fopen(path, "wb");
     if ( !fp )
         return -1;
index dd0c4cf6e890a147103fca6e1a9a403a72e57f1b..9ed0ea41fe4d2306b75b6be5e183883f62be5d26 100644 (file)
@@ -77,6 +77,14 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
                       unsigned int store_evtchn, unsigned long *store_mfn,
                       unsigned int console_evtchn, unsigned long *console_mfn,
                       unsigned int hvm, unsigned int pae, int superpages);
+/**
+ * xc_domain_restore writes a file to disk that contains the device
+ * model saved state.
+ * The pathname of this file is XC_DEVICE_MODEL_RESTORE_FILE; The domid
+ * of the new domain is automatically appended to the filename,
+ * separated by a ".".
+ */
+#define XC_DEVICE_MODEL_RESTORE_FILE "/var/lib/xen/qemu-resume"
 
 /**
  * This function will create a domain for a paravirtualized Linux
index d61e48c3a54caa1dbb8ad2b46894712318466c68..e2bd8d062cd8f2d3e8ac699151313d93ab9e2bd1 100644 (file)
@@ -22,6 +22,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <xenctrl.h>
+#include <xc_dom.h>
+#include <xenguest.h>
 #include "libxl.h"
 #include "libxl_utils.h"
 #include "libxl_internal.h"
@@ -252,7 +255,7 @@ static int domain_restore(libxl_ctx *ctx, libxl_domain_build_info *info,
     dm_info->saved_state = NULL;
     if (info->hvm) {
         ret = asprintf(&dm_info->saved_state,
-                       "/var/lib/xen/qemu-save.%d", domid);
+                       XC_DEVICE_MODEL_RESTORE_FILE".%d", domid);
         ret = (ret < 0) ? ERROR_FAIL : 0;
     }
 
index 44b7e25d26652acced717bc241c9d7c24387cf1e..0271fcbad43f696a99a5acdecc80569bd878d000 100644 (file)
@@ -45,6 +45,7 @@
 #define LIBXL_HVM_EXTRA_MEMORY 2048
 #define LIBXL_MIN_DOM0_MEM (128*1024)
 #define QEMU_SIGNATURE "DeviceModelRecord0002"
+#define SAVEFILE "/var/lib/xen/qemu-save"
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
 
index 1983502a2e208392f5f12d89ab22be476504add4..f1464ac1f2c8a625d3780294e4e13646783c6900 100644 (file)
@@ -936,7 +936,7 @@ class HVMImageHandler(ImageHandler):
         args = ImageHandler.getDeviceModelArgs(self, restore)
         args = args + ([ "-M", "xenfv"])
         if restore:
-            args = args + ([ "-loadvm", "/var/lib/xen/qemu-save.%d" %
+            args = args + ([ "-loadvm", "/var/lib/xen/qemu-resume.%d" %
                              self.vm.getDomid() ])
         return args