Leave the domain on the receive side paused after migration.
+=item B<-D>
+
+Preserve the B<domain-id> in the domain coniguration that is transferred
+such that it will be identical on the destination host, unless that
+configuration is overridden using the B<-C> option. Note that it is not
+possible to use this option for a 'localhost' migration.
+
=back
=item B<remus> [I<OPTIONS>] I<domain-id> I<host>
Leave the domain paused after creating the snapshot.
+=item B<-D>
+
+Preserve the B<domain-id> in the domain coniguration that is embedded in
+the state file such that it will be identical when the domain is restored,
+unless that configuration is overridden. (See the B<restore> operation
+above).
+
=back
=item B<sharing> [I<domain-id>]
#define SAVEFILE_BYTEORDER_VALUE ((uint32_t)0x01020304UL)
void save_domain_core_begin(uint32_t domid,
+ int preserve_domid,
const char *override_config_file,
uint8_t **config_data_r,
int *config_len_r);
"[options] <Domain> <CheckpointFile> [<ConfigFile>]",
"-h Print this help.\n"
"-c Leave domain running after creating the snapshot.\n"
- "-p Leave domain paused after creating the snapshot."
+ "-p Leave domain paused after creating the snapshot.\n"
+ "-D Store the domain id in the configration."
},
{ "migrate",
&main_migrate, 0, 1,
"-e Do not wait in the background (on <host>) for the death\n"
" of the domain.\n"
"--debug Print huge (!) amount of debug during the migration process.\n"
- "-p Do not unpause domain after migrating it."
+ "-p Do not unpause domain after migrating it.\n"
+ "-D Preserve the domain id"
},
{ "restore",
&main_restore, 0, 1,
}
-static void migrate_domain(uint32_t domid, const char *rune, int debug,
+static void migrate_domain(uint32_t domid, int preserve_domid,
+ const char *rune, int debug,
const char *override_config_file)
{
pid_t child = -1;
uint8_t *config_data;
int config_len, flags = LIBXL_SUSPEND_LIVE;
- save_domain_core_begin(domid, override_config_file,
+ save_domain_core_begin(domid, preserve_domid, override_config_file,
&config_data, &config_len);
if (!config_len) {
char *rune = NULL;
char *host;
int opt, daemonize = 1, monitor = 1, debug = 0, pause_after_migration = 0;
+ int preserve_domid = 0;
static struct option opts[] = {
{"debug", 0, 0, 0x100},
{"live", 0, 0, 0x200},
COMMON_LONG_OPTS
};
- SWITCH_FOREACH_OPT(opt, "FC:s:ep", opts, "migrate", 2) {
+ SWITCH_FOREACH_OPT(opt, "FC:s:epD", opts, "migrate", 2) {
case 'C':
config_filename = optarg;
break;
case 'p':
pause_after_migration = 1;
break;
+ case 'D':
+ preserve_domid = 1;
+ break;
case 0x100: /* --debug */
debug = 1;
break;
pause_after_migration ? " -p" : "");
}
- migrate_domain(domid, rune, debug, config_filename);
+ migrate_domain(domid, preserve_domid, rune, debug, config_filename);
return EXIT_SUCCESS;
}
}
}
- save_domain_core_begin(domid, NULL, &config_data, &config_len);
+ save_domain_core_begin(domid, 0, NULL, &config_data, &config_len);
if (!config_len) {
fprintf(stderr, "No config file stored for running domain and "
#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
void save_domain_core_begin(uint32_t domid,
+ int preserve_domid,
const char *override_config_file,
uint8_t **config_data_r,
int *config_len_r)
fprintf(stderr, "unable to retrieve domain configuration\n");
exit(EXIT_FAILURE);
}
+
+ d_config.c_info.domid = preserve_domid ? domid : 0;
}
config_c = libxl_domain_config_to_json(ctx, &d_config);
hdr.optional_data_len);
}
-static int save_domain(uint32_t domid, const char *filename, int checkpoint,
- int leavepaused, const char *override_config_file)
+static int save_domain(uint32_t domid, int preserve_domid,
+ const char *filename, int checkpoint,
+ int leavepaused, const char *override_config_file)
{
int fd;
uint8_t *config_data;
int config_len;
- save_domain_core_begin(domid, override_config_file,
+ save_domain_core_begin(domid, preserve_domid, override_config_file,
&config_data, &config_len);
if (!config_len) {
const char *config_filename = NULL;
int checkpoint = 0;
int leavepaused = 0;
+ int preserve_domid = 0;
int opt;
- SWITCH_FOREACH_OPT(opt, "cp", NULL, "save", 2) {
+ SWITCH_FOREACH_OPT(opt, "cpD", NULL, "save", 2) {
case 'c':
checkpoint = 1;
break;
case 'p':
leavepaused = 1;
break;
+ case 'D':
+ preserve_domid = 1;
+ break;
}
if (argc-optind > 3) {
if ( argc - optind >= 3 )
config_filename = argv[optind + 2];
- save_domain(domid, filename, checkpoint, leavepaused, config_filename);
+ save_domain(domid, preserve_domid, filename, checkpoint, leavepaused,
+ config_filename);
return EXIT_SUCCESS;
}
autoconnect_console_how = 0;
}
- d_config.c_info.domid = domid_policy;
+ if (!libxl_domid_valid_guest(d_config.c_info.domid))
+ d_config.c_info.domid = domid_policy;
if ( restoring ) {
libxl_domain_restore_params params;