[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] xl save but leave domain paused
All,I have long desired an ability to execute a domain save and leave the domain in a paused state. This is so that I can initiate an LVM snapshot to go with the checkpoint file. I know I can achieve this via a non-checkpoint save and a restore, but it seems a bit silly to reload the domain's memory from disk and doubles the "suspension" time of the domain. So, ideally, I would like xl save -p that leaves the domain paused. I did put it in a feature request a long time ago, but it never made the cut. To this end and as more of a starting point, I have written my own basic patch. While this appears to work, I see a (very small) opportunity for the domU to run for a short time between the libxl_domain_resume and libxl_domain_pause calls. This defeats the object as I am trying to maintain a disk snapshot that is exactly in synch with the save state. Can anyone please offer some thoughts on how I can implement this properly. I have looked at the corresponding xc calls but meddling with those is way beyond my knowledge. Another way of looking at the problem would be able to perform an xl save on a paused domain, as this would achieve the same result. Thanks for reading and thanks for any suggestions that are forthcoming. I am not a C guru and even less of a Xen dev guru, so please treat me somewhat like an idiot. :) Thanks, Ian. (Against RELEASE-4.2.2) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 7780426..d0394df 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c@@ -2976,7 +2976,7 @@ static void save_domain_core_writeconfig(int fd, const char *source, hdr.optional_data_len); } -static int save_domain(const char *p, const char *filename, int checkpoint,+static int save_domain(const char *p, const char *filename, int checkpoint, int leavepaused, const char *override_config_file) { int fd;@@ -3003,10 +3003,13 @@ static int save_domain(const char *p, const char *filename, int checkpoint, if (rc < 0) fprintf(stderr, "Failed to save domain, resuming domain\n"); - if (checkpoint || rc < 0) - libxl_domain_resume(ctx, domid, 1, 0); + if (leavepaused || checkpoint || rc < 0) { + libxl_domain_resume(ctx, domid, 1, 0); + if (leavepaused && ! (rc < 0)) + libxl_domain_pause(ctx, domid); + } else - libxl_domain_destroy(ctx, domid, 0); + libxl_domain_destroy(ctx, domid, 0); exit(rc < 0 ? 1 : 0); } diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 7780426..d0394df 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c@@ -2976,7 +2976,7 @@ static void save_domain_core_writeconfig(int fd, const char *source, hdr.optional_data_len); } -static int save_domain(const char *p, const char *filename, int checkpoint,+static int save_domain(const char *p, const char *filename, int checkpoint, int leavepaused, const char *override_config_file) { int fd;@@ -3003,10 +3003,13 @@ static int save_domain(const char *p, const char *filename, int checkpoint, if (rc < 0) fprintf(stderr, "Failed to save domain, resuming domain\n"); - if (checkpoint || rc < 0) - libxl_domain_resume(ctx, domid, 1, 0); + if (leavepaused || checkpoint || rc < 0) { + libxl_domain_resume(ctx, domid, 1, 0); + if (leavepaused && ! (rc < 0)) + libxl_domain_pause(ctx, domid); + } else - libxl_domain_destroy(ctx, domid, 0); + libxl_domain_destroy(ctx, domid, 0); exit(rc < 0 ? 1 : 0); } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |