Saves a running domain to a state file so that it can be restored
later. Once saved, the domain will no longer be running on the
-system, unless the -c option is used.
+system, unless the -c or -p options are used.
B<xl restore> restores from this checkpoint file.
Passing a config file argument allows the user to manually select the VM config
file used to create the domain.
Leave domain running after creating the snapshot.
+=item B<-p>
+
+Leave domain paused after creating the snapshot.
+
=back
=item B<sharing> [I<domain-id>]
}
static int save_domain(uint32_t domid, const char *filename, int checkpoint,
- const char *override_config_file)
+ int leavepaused, const char *override_config_file)
{
int fd;
uint8_t *config_data;
int rc = libxl_domain_suspend(ctx, domid, fd, 0, NULL);
close(fd);
- if (rc < 0)
+ if (rc < 0) {
fprintf(stderr, "Failed to save domain, resuming domain\n");
-
- if (checkpoint || rc < 0)
libxl_domain_resume(ctx, domid, 1, 0);
+ }
+ else if (leavepaused || checkpoint) {
+ if (leavepaused)
+ libxl_domain_pause(ctx, domid);
+ libxl_domain_resume(ctx, domid, 1, 0);
+ }
else
libxl_domain_destroy(ctx, domid, 0);
const char *filename;
const char *config_filename = NULL;
int checkpoint = 0;
+ int leavepaused = 0;
int opt;
- SWITCH_FOREACH_OPT(opt, "c", NULL, "save", 2) {
+ SWITCH_FOREACH_OPT(opt, "cp", NULL, "save", 2) {
case 'c':
checkpoint = 1;
break;
+ case 'p':
+ leavepaused = 1;
+ break;
}
if (argc-optind > 3) {
if ( argc - optind >= 3 )
config_filename = argv[optind + 2];
- save_domain(domid, filename, checkpoint, config_filename);
+ save_domain(domid, filename, checkpoint, leavepaused, config_filename);
return 0;
}
"Save a domain state to restore later",
"[options] <Domain> <CheckpointFile> [<ConfigFile>]",
"-h Print this help.\n"
- "-c Leave domain running after creating the snapshot."
+ "-c Leave domain running after creating the snapshot.\n"
+ "-p Leave domain paused after creating the snapshot."
},
{ "migrate",
&main_migrate, 0, 1,