[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] xl: add target cpupool parameter to xl migrate
Add an option to specify the cpupool on the target machine when doing a migration of a domain. Currently a domain is always migrated to the cpupool with the same name as on the source machine. Specifying "-c <cpupool>" will migrate the domain to the specified cpupool on the target machine. Specifying an empty string for <cpupool> will use the default cpupool (normally "Pool-0") on the target machine. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- docs/man/xl.pod.1.in | 5 +++++ tools/xl/xl.h | 1 + tools/xl/xl_cmdtable.c | 3 +++ tools/xl/xl_migrate.c | 15 ++++++++++----- tools/xl/xl_saverestore.c | 10 +++++++++- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/docs/man/xl.pod.1.in b/docs/man/xl.pod.1.in index b74764dcd3..62f7c0f039 100644 --- a/docs/man/xl.pod.1.in +++ b/docs/man/xl.pod.1.in @@ -451,6 +451,11 @@ domain. See the corresponding option of the I<create> subcommand. Send the specified <config> file instead of the file used on creation of the domain. +=item B<-c> I<cpupool> + +Migrate the domain to the specified <cpupool> on the target host. Specifying +an empty string for <cpupool> will use the default cpupool on <host>. + =item B<--debug> Display huge (!) amount of debug information during the migration process. diff --git a/tools/xl/xl.h b/tools/xl/xl.h index cf4202bc89..a7d4910f9a 100644 --- a/tools/xl/xl.h +++ b/tools/xl/xl.h @@ -100,6 +100,7 @@ struct save_file_header { void save_domain_core_begin(uint32_t domid, const char *override_config_file, + const char *override_cpupool, uint8_t **config_data_r, int *config_len_r); void save_domain_core_writeconfig(int fd, const char *source, diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 89716badcb..93aab5130d 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -161,6 +161,9 @@ struct cmd_spec cmd_table[] = { "[options] <Domain> <host>", "-h Print this help.\n" "-C <config> Send <config> instead of config file from creation.\n" + "-c <cpupool> Specify the cpupool on the target host the domain should\n" + " be migrated to. Specifying an empty string for <cpupool>\n" + " will use the default cpupool on the target host.\n" "-s <sshcommand> Use <sshcommand> instead of ssh. String will be passed\n" " to sh. If empty, run <host> instead of ssh <host> xl\n" " migrate-receive [-d -e]\n" diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c index 1f0e87df50..66f0a0958d 100644 --- a/tools/xl/xl_migrate.c +++ b/tools/xl/xl_migrate.c @@ -177,7 +177,8 @@ static void migrate_do_preamble(int send_fd, int recv_fd, pid_t child, } static void migrate_domain(uint32_t domid, const char *rune, int debug, - const char *override_config_file) + const char *override_config_file, + const char *override_cpupool) { pid_t child = -1; int rc; @@ -187,7 +188,7 @@ static void migrate_domain(uint32_t domid, const char *rune, int debug, uint8_t *config_data; int config_len, flags = LIBXL_SUSPEND_LIVE; - save_domain_core_begin(domid, override_config_file, + save_domain_core_begin(domid, override_config_file, override_cpupool, &config_data, &config_len); if (!config_len) { @@ -533,6 +534,7 @@ int main_migrate(int argc, char **argv) { uint32_t domid; const char *config_filename = NULL; + const char *cpupool = NULL; const char *ssh_command = "ssh"; char *rune = NULL; char *host; @@ -543,10 +545,13 @@ int main_migrate(int argc, char **argv) COMMON_LONG_OPTS }; - SWITCH_FOREACH_OPT(opt, "FC:s:ep", opts, "migrate", 2) { + SWITCH_FOREACH_OPT(opt, "FC:c:s:ep", opts, "migrate", 2) { case 'C': config_filename = optarg; break; + case 'c': + cpupool = optarg; + break; case 's': ssh_command = optarg; break; @@ -596,7 +601,7 @@ int main_migrate(int argc, char **argv) pause_after_migration ? " -p" : ""); } - migrate_domain(domid, rune, debug, config_filename); + migrate_domain(domid, rune, debug, config_filename, cpupool); return EXIT_SUCCESS; } @@ -716,7 +721,7 @@ int main_remus(int argc, char **argv) } } - save_domain_core_begin(domid, NULL, &config_data, &config_len); + save_domain_core_begin(domid, NULL, NULL, &config_data, &config_len); if (!config_len) { fprintf(stderr, "No config file stored for running domain and " diff --git a/tools/xl/xl_saverestore.c b/tools/xl/xl_saverestore.c index 9afeadeeb2..2583b6c800 100644 --- a/tools/xl/xl_saverestore.c +++ b/tools/xl/xl_saverestore.c @@ -33,6 +33,7 @@ void save_domain_core_begin(uint32_t domid, const char *override_config_file, + const char *override_cpupool, uint8_t **config_data_r, int *config_len_r) { @@ -63,6 +64,13 @@ void save_domain_core_begin(uint32_t domid, } } + if (override_cpupool) { + free(d_config.c_info.pool_name); + d_config.c_info.pool_name = NULL; + if (override_cpupool[0]) + d_config.c_info.pool_name = strdup(override_cpupool); + } + config_c = libxl_domain_config_to_json(ctx, &d_config); if (!config_c) { fprintf(stderr, "unable to convert config file to JSON\n"); @@ -126,7 +134,7 @@ static int save_domain(uint32_t domid, const char *filename, int checkpoint, uint8_t *config_data; int config_len; - save_domain_core_begin(domid, override_config_file, + save_domain_core_begin(domid, override_config_file, NULL, &config_data, &config_len); if (!config_len) { -- 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |