debuggers.hg

changeset 22842:8b6e7f43683e

tools: Change the name of the qemu save file at restore time

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>
author Stefano Stabellini <stefano.stabellini@eu.citrix.com>
date Fri Jan 21 17:57:31 2011 +0000 (2011-01-21)
parents 17181eaedb78
children 94b4361852ba
files 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
line diff
     1.1 --- a/tools/libxc/xc_domain_restore.c	Fri Jan 21 17:45:56 2011 +0000
     1.2 +++ b/tools/libxc/xc_domain_restore.c	Fri Jan 21 17:57:31 2011 +0000
     1.3 @@ -436,7 +436,7 @@ static int dump_qemu(xc_interface *xch, 
     1.4      char path[256];
     1.5      FILE *fp;
     1.6  
     1.7 -    sprintf(path, "/var/lib/xen/qemu-save.%u", dom);
     1.8 +    sprintf(path, XC_DEVICE_MODEL_RESTORE_FILE".%u", dom);
     1.9      fp = fopen(path, "wb");
    1.10      if ( !fp )
    1.11          return -1;
     2.1 --- a/tools/libxc/xenguest.h	Fri Jan 21 17:45:56 2011 +0000
     2.2 +++ b/tools/libxc/xenguest.h	Fri Jan 21 17:57:31 2011 +0000
     2.3 @@ -77,6 +77,14 @@ int xc_domain_restore(xc_interface *xch,
     2.4                        unsigned int store_evtchn, unsigned long *store_mfn,
     2.5                        unsigned int console_evtchn, unsigned long *console_mfn,
     2.6                        unsigned int hvm, unsigned int pae, int superpages);
     2.7 +/**
     2.8 + * xc_domain_restore writes a file to disk that contains the device
     2.9 + * model saved state.
    2.10 + * The pathname of this file is XC_DEVICE_MODEL_RESTORE_FILE; The domid
    2.11 + * of the new domain is automatically appended to the filename,
    2.12 + * separated by a ".".
    2.13 + */
    2.14 +#define XC_DEVICE_MODEL_RESTORE_FILE "/var/lib/xen/qemu-resume"
    2.15  
    2.16  /**
    2.17   * This function will create a domain for a paravirtualized Linux
     3.1 --- a/tools/libxl/libxl_create.c	Fri Jan 21 17:45:56 2011 +0000
     3.2 +++ b/tools/libxl/libxl_create.c	Fri Jan 21 17:57:31 2011 +0000
     3.3 @@ -22,6 +22,9 @@
     3.4  #include <stdlib.h>
     3.5  #include <unistd.h>
     3.6  #include <fcntl.h>
     3.7 +#include <xenctrl.h>
     3.8 +#include <xc_dom.h>
     3.9 +#include <xenguest.h>
    3.10  #include "libxl.h"
    3.11  #include "libxl_utils.h"
    3.12  #include "libxl_internal.h"
    3.13 @@ -252,7 +255,7 @@ static int domain_restore(libxl_ctx *ctx
    3.14      dm_info->saved_state = NULL;
    3.15      if (info->hvm) {
    3.16          ret = asprintf(&dm_info->saved_state,
    3.17 -                       "/var/lib/xen/qemu-save.%d", domid);
    3.18 +                       XC_DEVICE_MODEL_RESTORE_FILE".%d", domid);
    3.19          ret = (ret < 0) ? ERROR_FAIL : 0;
    3.20      }
    3.21  
     4.1 --- a/tools/libxl/libxl_internal.h	Fri Jan 21 17:45:56 2011 +0000
     4.2 +++ b/tools/libxl/libxl_internal.h	Fri Jan 21 17:57:31 2011 +0000
     4.3 @@ -45,6 +45,7 @@
     4.4  #define LIBXL_HVM_EXTRA_MEMORY 2048
     4.5  #define LIBXL_MIN_DOM0_MEM (128*1024)
     4.6  #define QEMU_SIGNATURE "DeviceModelRecord0002"
     4.7 +#define SAVEFILE "/var/lib/xen/qemu-save"
     4.8  
     4.9  #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    4.10  
     5.1 --- a/tools/python/xen/xend/image.py	Fri Jan 21 17:45:56 2011 +0000
     5.2 +++ b/tools/python/xen/xend/image.py	Fri Jan 21 17:57:31 2011 +0000
     5.3 @@ -936,7 +936,7 @@ class HVMImageHandler(ImageHandler):
     5.4          args = ImageHandler.getDeviceModelArgs(self, restore)
     5.5          args = args + ([ "-M", "xenfv"])
     5.6          if restore:
     5.7 -            args = args + ([ "-loadvm", "/var/lib/xen/qemu-save.%d" %
     5.8 +            args = args + ([ "-loadvm", "/var/lib/xen/qemu-resume.%d" %
     5.9                               self.vm.getDomid() ])
    5.10          return args
    5.11