[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xl: fix migration failure with xl migrate --debug
commit d36a3734a6abccd36a8050e19633af1671a2083d Author: M A Young <m.a.young@xxxxxxxxxxxx> AuthorDate: Tue Dec 2 13:48:54 2014 +0000 Commit: Ian Campbell <ian.campbell@xxxxxxxxxx> CommitDate: Tue Dec 2 13:48:54 2014 +0000 xl: fix migration failure with xl migrate --debug Migrations with xl migrate --debug will fail because debugging information from the receiving process is written to the stdout channel. This channel is also used for status messages so the migration will fail as the sending process receives an unexpected message. This patch moves the debugging information to the stderr channel. Signed-off-by: Michael Young <m.a.young@xxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/xl.h | 2 +- tools/libxl/xl_cmdimpl.c | 22 +++-- tools/libxl/xl_sxp.c | 228 +++++++++++++++++++++++----------------------- 3 files changed, 129 insertions(+), 123 deletions(-) diff --git a/tools/libxl/xl.h b/tools/libxl/xl.h index c91de4f..5bc138c 100644 --- a/tools/libxl/xl.h +++ b/tools/libxl/xl.h @@ -186,7 +186,7 @@ enum output_format { }; extern enum output_format default_output_format; -extern void printf_info_sexp(int domid, libxl_domain_config *d_config); +extern void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh); #define XL_GLOBAL_CONFIG XEN_CONFIG_DIR "/xl.conf" #define XL_LOCK_FILE XEN_LOCK_DIR "/xl" diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 0e754e7..88a4d65 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -381,10 +381,10 @@ out: } static void printf_info(enum output_format output_format, int domid, - libxl_domain_config *d_config) + libxl_domain_config *d_config, FILE *fh) { if (output_format == OUTPUT_FORMAT_SXP) - return printf_info_sexp(domid, d_config); + return printf_info_sexp(domid, d_config, fh); const char *buf; libxl_yajl_length len = 0; @@ -405,7 +405,7 @@ static void printf_info(enum output_format output_format, if (s != yajl_gen_status_ok) goto out; - puts(buf); + fputs(buf, fh); out: yajl_gen_free(hand); @@ -414,7 +414,13 @@ out: fprintf(stderr, "unable to format domain config as JSON (YAJL:%d)\n", s); - if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); } + if (ferror(fh) || fflush(fh)) { + if (fh == stdout) + perror("stdout"); + else + perror("stderr"); + exit(-1); + } } static int do_daemonize(char *name) @@ -2436,7 +2442,7 @@ static uint32_t create_domain(struct domain_create *dom_info) } if (!dom_info->quiet) - printf("Parsing config from %s\n", config_source); + fprintf(stderr, "Parsing config from %s\n", config_source); if (config_in_json) { libxl_domain_config_from_json(ctx, &d_config, @@ -2464,7 +2470,7 @@ static uint32_t create_domain(struct domain_create *dom_info) } if (debug || dom_info->dryrun) - printf_info(default_output_format, -1, &d_config); + printf_info(default_output_format, -1, &d_config, stderr); ret = 0; if (dom_info->dryrun) @@ -3416,7 +3422,7 @@ static void list_domains_details(const libxl_dominfo *info, int nb_domain) if (default_output_format == OUTPUT_FORMAT_JSON) s = printf_info_one_json(hand, info[i].domid, &d_config); else - printf_info_sexp(info[i].domid, &d_config); + printf_info_sexp(info[i].domid, &d_config, stdout); libxl_domain_config_dispose(&d_config); if (s != yajl_gen_status_ok) goto out; @@ -4738,7 +4744,7 @@ int main_config_update(int argc, char **argv) parse_config_data(filename, config_data, config_len, &d_config); if (debug || dryrun_only) - printf_info(default_output_format, -1, &d_config); + printf_info(default_output_format, -1, &d_config, stdout); if (!dryrun_only) { fprintf(stderr, "setting dom%d configuration\n", domid); diff --git a/tools/libxl/xl_sxp.c b/tools/libxl/xl_sxp.c index 1c98352..a8c127b 100644 --- a/tools/libxl/xl_sxp.c +++ b/tools/libxl/xl_sxp.c @@ -30,7 +30,7 @@ /* In general you should not add new output to this function since it * is intended only for legacy use. */ -void printf_info_sexp(int domid, libxl_domain_config *d_config) +void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh) { int i; libxl_dominfo info; @@ -38,195 +38,195 @@ void printf_info_sexp(int domid, libxl_domain_config *d_config) libxl_domain_create_info *c_info = &d_config->c_info; libxl_domain_build_info *b_info = &d_config->b_info; - printf("(domain\n\t(domid %d)\n", domid); - printf("\t(create_info)\n"); - printf("\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM); - printf("\t(hap %s)\n", libxl_defbool_to_string(c_info->hap)); - printf("\t(oos %s)\n", libxl_defbool_to_string(c_info->oos)); - printf("\t(ssidref %d)\n", c_info->ssidref); - printf("\t(name %s)\n", c_info->name); + fprintf(fh, "(domain\n\t(domid %d)\n", domid); + fprintf(fh, "\t(create_info)\n"); + fprintf(fh, "\t(hvm %d)\n", c_info->type == LIBXL_DOMAIN_TYPE_HVM); + fprintf(fh, "\t(hap %s)\n", libxl_defbool_to_string(c_info->hap)); + fprintf(fh, "\t(oos %s)\n", libxl_defbool_to_string(c_info->oos)); + fprintf(fh, "\t(ssidref %d)\n", c_info->ssidref); + fprintf(fh, "\t(name %s)\n", c_info->name); /* retrieve the UUID from dominfo, since it is probably generated * during parsing and thus does not match the real one */ if (libxl_domain_info(ctx, &info, domid) == 0) { - printf("\t(uuid " LIBXL_UUID_FMT ")\n", LIBXL_UUID_BYTES(info.uuid)); + fprintf(fh, "\t(uuid " LIBXL_UUID_FMT ")\n", LIBXL_UUID_BYTES(info.uuid)); } else { - printf("\t(uuid <unknown>)\n"); + fprintf(fh, "\t(uuid <unknown>)\n"); } if (c_info->pool_name) - printf("\t(cpupool %s)\n", c_info->pool_name); + fprintf(fh, "\t(cpupool %s)\n", c_info->pool_name); if (c_info->xsdata) - printf("\t(xsdata contains data)\n"); + fprintf(fh, "\t(xsdata contains data)\n"); else - printf("\t(xsdata (null))\n"); + fprintf(fh, "\t(xsdata (null))\n"); if (c_info->platformdata) - printf("\t(platformdata contains data)\n"); + fprintf(fh, "\t(platformdata contains data)\n"); else - printf("\t(platformdata (null))\n"); + fprintf(fh, "\t(platformdata (null))\n"); - printf("\t(build_info)\n"); - printf("\t(max_vcpus %d)\n", b_info->max_vcpus); - printf("\t(tsc_mode %s)\n", libxl_tsc_mode_to_string(b_info->tsc_mode)); - printf("\t(max_memkb %"PRId64")\n", b_info->max_memkb); - printf("\t(target_memkb %"PRId64")\n", b_info->target_memkb); - printf("\t(nomigrate %s)\n", + fprintf(fh, "\t(build_info)\n"); + fprintf(fh, "\t(max_vcpus %d)\n", b_info->max_vcpus); + fprintf(fh, "\t(tsc_mode %s)\n", libxl_tsc_mode_to_string(b_info->tsc_mode)); + fprintf(fh, "\t(max_memkb %"PRId64")\n", b_info->max_memkb); + fprintf(fh, "\t(target_memkb %"PRId64")\n", b_info->target_memkb); + fprintf(fh, "\t(nomigrate %s)\n", libxl_defbool_to_string(b_info->disable_migrate)); if (c_info->type == LIBXL_DOMAIN_TYPE_PV && b_info->u.pv.bootloader) { - printf("\t(bootloader %s)\n", b_info->u.pv.bootloader); + fprintf(fh, "\t(bootloader %s)\n", b_info->u.pv.bootloader); if (b_info->u.pv.bootloader_args) { - printf("\t(bootloader_args"); + fprintf(fh, "\t(bootloader_args"); for (i=0; b_info->u.pv.bootloader_args[i]; i++) - printf(" %s", b_info->u.pv.bootloader_args[i]); - printf(")\n"); + fprintf(fh, " %s", b_info->u.pv.bootloader_args[i]); + fprintf(fh, ")\n"); } } - printf("\t(image\n"); + fprintf(fh, "\t(image\n"); switch (c_info->type) { case LIBXL_DOMAIN_TYPE_HVM: - printf("\t\t(hvm\n"); - printf("\t\t\t(firmware %s)\n", b_info->u.hvm.firmware); - printf("\t\t\t(video_memkb %"PRId64")\n", b_info->video_memkb); - printf("\t\t\t(shadow_memkb %"PRId64")\n", b_info->shadow_memkb); - printf("\t\t\t(pae %s)\n", libxl_defbool_to_string(b_info->u.hvm.pae)); - printf("\t\t\t(apic %s)\n", + fprintf(fh, "\t\t(hvm\n"); + fprintf(fh, "\t\t\t(firmware %s)\n", b_info->u.hvm.firmware); + fprintf(fh, "\t\t\t(video_memkb %"PRId64")\n", b_info->video_memkb); + fprintf(fh, "\t\t\t(shadow_memkb %"PRId64")\n", b_info->shadow_memkb); + fprintf(fh, "\t\t\t(pae %s)\n", libxl_defbool_to_string(b_info->u.hvm.pae)); + fprintf(fh, "\t\t\t(apic %s)\n", libxl_defbool_to_string(b_info->u.hvm.apic)); - printf("\t\t\t(acpi %s)\n", + fprintf(fh, "\t\t\t(acpi %s)\n", libxl_defbool_to_string(b_info->u.hvm.acpi)); - printf("\t\t\t(nx %s)\n", libxl_defbool_to_string(b_info->u.hvm.nx)); - printf("\t\t\t(viridian %s)\n", + fprintf(fh, "\t\t\t(nx %s)\n", libxl_defbool_to_string(b_info->u.hvm.nx)); + fprintf(fh, "\t\t\t(viridian %s)\n", libxl_defbool_to_string(b_info->u.hvm.viridian)); - printf("\t\t\t(hpet %s)\n", + fprintf(fh, "\t\t\t(hpet %s)\n", libxl_defbool_to_string(b_info->u.hvm.hpet)); - printf("\t\t\t(vpt_align %s)\n", + fprintf(fh, "\t\t\t(vpt_align %s)\n", libxl_defbool_to_string(b_info->u.hvm.vpt_align)); - printf("\t\t\t(timer_mode %s)\n", + fprintf(fh, "\t\t\t(timer_mode %s)\n", libxl_timer_mode_to_string(b_info->u.hvm.timer_mode)); - printf("\t\t\t(nestedhvm %s)\n", + fprintf(fh, "\t\t\t(nestedhvm %s)\n", libxl_defbool_to_string(b_info->u.hvm.nested_hvm)); - printf("\t\t\t(stdvga %s)\n", b_info->u.hvm.vga.kind == + fprintf(fh, "\t\t\t(stdvga %s)\n", b_info->u.hvm.vga.kind == LIBXL_VGA_INTERFACE_TYPE_STD ? "True" : "False"); - printf("\t\t\t(vnc %s)\n", + fprintf(fh, "\t\t\t(vnc %s)\n", libxl_defbool_to_string(b_info->u.hvm.vnc.enable)); - printf("\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen); - printf("\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display); - printf("\t\t\t(vncunused %s)\n", + fprintf(fh, "\t\t\t(vnclisten %s)\n", b_info->u.hvm.vnc.listen); + fprintf(fh, "\t\t\t(vncdisplay %d)\n", b_info->u.hvm.vnc.display); + fprintf(fh, "\t\t\t(vncunused %s)\n", libxl_defbool_to_string(b_info->u.hvm.vnc.findunused)); - printf("\t\t\t(keymap %s)\n", b_info->u.hvm.keymap); - printf("\t\t\t(sdl %s)\n", + fprintf(fh, "\t\t\t(keymap %s)\n", b_info->u.hvm.keymap); + fprintf(fh, "\t\t\t(sdl %s)\n", libxl_defbool_to_string(b_info->u.hvm.sdl.enable)); - printf("\t\t\t(opengl %s)\n", + fprintf(fh, "\t\t\t(opengl %s)\n", libxl_defbool_to_string(b_info->u.hvm.sdl.opengl)); - printf("\t\t\t(nographic %s)\n", + fprintf(fh, "\t\t\t(nographic %s)\n", libxl_defbool_to_string(b_info->u.hvm.nographic)); - printf("\t\t\t(spice %s)\n", + fprintf(fh, "\t\t\t(spice %s)\n", libxl_defbool_to_string(b_info->u.hvm.spice.enable)); - printf("\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port); - printf("\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port); - printf("\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host); - printf("\t\t\t(spicedisable_ticketing %s)\n", + fprintf(fh, "\t\t\t(spiceport %d)\n", b_info->u.hvm.spice.port); + fprintf(fh, "\t\t\t(spicetls_port %d)\n", b_info->u.hvm.spice.tls_port); + fprintf(fh, "\t\t\t(spicehost %s)\n", b_info->u.hvm.spice.host); + fprintf(fh, "\t\t\t(spicedisable_ticketing %s)\n", libxl_defbool_to_string(b_info->u.hvm.spice.disable_ticketing)); - printf("\t\t\t(spiceagent_mouse %s)\n", + fprintf(fh, "\t\t\t(spiceagent_mouse %s)\n", libxl_defbool_to_string(b_info->u.hvm.spice.agent_mouse)); - printf("\t\t\t(device_model %s)\n", b_info->device_model ? : "default"); - printf("\t\t\t(gfx_passthru %s)\n", + fprintf(fh, "\t\t\t(device_model %s)\n", b_info->device_model ? : "default"); + fprintf(fh, "\t\t\t(gfx_passthru %s)\n", libxl_defbool_to_string(b_info->u.hvm.gfx_passthru)); - printf("\t\t\t(serial %s)\n", b_info->u.hvm.serial); - printf("\t\t\t(boot %s)\n", b_info->u.hvm.boot); - printf("\t\t\t(usb %s)\n", libxl_defbool_to_string(b_info->u.hvm.usb)); - printf("\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice); - printf("\t\t)\n"); + fprintf(fh, "\t\t\t(serial %s)\n", b_info->u.hvm.serial); + fprintf(fh, "\t\t\t(boot %s)\n", b_info->u.hvm.boot); + fprintf(fh, "\t\t\t(usb %s)\n", libxl_defbool_to_string(b_info->u.hvm.usb)); + fprintf(fh, "\t\t\t(usbdevice %s)\n", b_info->u.hvm.usbdevice); + fprintf(fh, "\t\t)\n"); break; case LIBXL_DOMAIN_TYPE_PV: - printf("\t\t(linux %d)\n", 0); - printf("\t\t\t(kernel %s)\n", b_info->kernel); - printf("\t\t\t(cmdline %s)\n", b_info->cmdline); - printf("\t\t\t(ramdisk %s)\n", b_info->ramdisk); - printf("\t\t\t(e820_host %s)\n", + fprintf(fh, "\t\t(linux %d)\n", 0); + fprintf(fh, "\t\t\t(kernel %s)\n", b_info->kernel); + fprintf(fh, "\t\t\t(cmdline %s)\n", b_info->cmdline); + fprintf(fh, "\t\t\t(ramdisk %s)\n", b_info->ramdisk); + fprintf(fh, "\t\t\t(e820_host %s)\n", libxl_defbool_to_string(b_info->u.pv.e820_host)); - printf("\t\t)\n"); + fprintf(fh, "\t\t)\n"); break; default: fprintf(stderr, "Unknown domain type %d\n", c_info->type); exit(1); } - printf("\t)\n"); + fprintf(fh, "\t)\n"); for (i = 0; i < d_config->num_disks; i++) { - printf("\t(device\n"); - printf("\t\t(tap\n"); - printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid); - printf("\t\t\t(frontend_domid %d)\n", domid); - printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path); - printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend); - printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev); - printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable); - printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite); - printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom); - printf("\t\t)\n"); - printf("\t)\n"); + fprintf(fh, "\t(device\n"); + fprintf(fh, "\t\t(tap\n"); + fprintf(fh, "\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid); + fprintf(fh, "\t\t\t(frontend_domid %d)\n", domid); + fprintf(fh, "\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path); + fprintf(fh, "\t\t\t(phystype %d)\n", d_config->disks[i].backend); + fprintf(fh, "\t\t\t(virtpath %s)\n", d_config->disks[i].vdev); + fprintf(fh, "\t\t\t(unpluggable %d)\n", d_config->disks[i].removable); + fprintf(fh, "\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite); + fprintf(fh, "\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom); + fprintf(fh, "\t\t)\n"); + fprintf(fh, "\t)\n"); } for (i = 0; i < d_config->num_nics; i++) { - printf("\t(device\n"); - printf("\t\t(vif\n"); + fprintf(fh, "\t(device\n"); + fprintf(fh, "\t\t(vif\n"); if (d_config->nics[i].ifname) - printf("\t\t\t(vifname %s)\n", d_config->nics[i].ifname); - printf("\t\t\t(backend_domid %d)\n", d_config->nics[i].backend_domid); - printf("\t\t\t(frontend_domid %d)\n", domid); - printf("\t\t\t(devid %d)\n", d_config->nics[i].devid); - printf("\t\t\t(mtu %d)\n", d_config->nics[i].mtu); - printf("\t\t\t(model %s)\n", d_config->nics[i].model); - printf("\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n", + fprintf(fh, "\t\t\t(vifname %s)\n", d_config->nics[i].ifname); + fprintf(fh, "\t\t\t(backend_domid %d)\n", d_config->nics[i].backend_domid); + fprintf(fh, "\t\t\t(frontend_domid %d)\n", domid); + fprintf(fh, "\t\t\t(devid %d)\n", d_config->nics[i].devid); + fprintf(fh, "\t\t\t(mtu %d)\n", d_config->nics[i].mtu); + fprintf(fh, "\t\t\t(model %s)\n", d_config->nics[i].model); + fprintf(fh, "\t\t\t(mac %02x%02x%02x%02x%02x%02x)\n", d_config->nics[i].mac[0], d_config->nics[i].mac[1], d_config->nics[i].mac[2], d_config->nics[i].mac[3], d_config->nics[i].mac[4], d_config->nics[i].mac[5]); - printf("\t\t)\n"); - printf("\t)\n"); + fprintf(fh, "\t\t)\n"); + fprintf(fh, "\t)\n"); } for (i = 0; i < d_config->num_pcidevs; i++) { - printf("\t(device\n"); - printf("\t\t(pci\n"); - printf("\t\t\t(pci dev %04x:%02x:%02x.%01x@%02x)\n", + fprintf(fh, "\t(device\n"); + fprintf(fh, "\t\t(pci\n"); + fprintf(fh, "\t\t\t(pci dev %04x:%02x:%02x.%01x@%02x)\n", d_config->pcidevs[i].domain, d_config->pcidevs[i].bus, d_config->pcidevs[i].dev, d_config->pcidevs[i].func, d_config->pcidevs[i].vdevfn); - printf("\t\t\t(opts msitranslate %d power_mgmt %d)\n", + fprintf(fh, "\t\t\t(opts msitranslate %d power_mgmt %d)\n", d_config->pcidevs[i].msitranslate, d_config->pcidevs[i].power_mgmt); - printf("\t\t)\n"); - printf("\t)\n"); + fprintf(fh, "\t\t)\n"); + fprintf(fh, "\t)\n"); } for (i = 0; i < d_config->num_vfbs; i++) { - printf("\t(device\n"); - printf("\t\t(vfb\n"); - printf("\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid); - printf("\t\t\t(frontend_domid %d)\n", domid); - printf("\t\t\t(devid %d)\n", d_config->vfbs[i].devid); - printf("\t\t\t(vnc %s)\n", + fprintf(fh, "\t(device\n"); + fprintf(fh, "\t\t(vfb\n"); + fprintf(fh, "\t\t\t(backend_domid %d)\n", d_config->vfbs[i].backend_domid); + fprintf(fh, "\t\t\t(frontend_domid %d)\n", domid); + fprintf(fh, "\t\t\t(devid %d)\n", d_config->vfbs[i].devid); + fprintf(fh, "\t\t\t(vnc %s)\n", libxl_defbool_to_string(d_config->vfbs[i].vnc.enable)); - printf("\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen); - printf("\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display); - printf("\t\t\t(vncunused %s)\n", + fprintf(fh, "\t\t\t(vnclisten %s)\n", d_config->vfbs[i].vnc.listen); + fprintf(fh, "\t\t\t(vncdisplay %d)\n", d_config->vfbs[i].vnc.display); + fprintf(fh, "\t\t\t(vncunused %s)\n", libxl_defbool_to_string(d_config->vfbs[i].vnc.findunused)); - printf("\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap); - printf("\t\t\t(sdl %s)\n", + fprintf(fh, "\t\t\t(keymap %s)\n", d_config->vfbs[i].keymap); + fprintf(fh, "\t\t\t(sdl %s)\n", libxl_defbool_to_string(d_config->vfbs[i].sdl.enable)); - printf("\t\t\t(opengl %s)\n", + fprintf(fh, "\t\t\t(opengl %s)\n", libxl_defbool_to_string(d_config->vfbs[i].sdl.opengl)); - printf("\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display); - printf("\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority); - printf("\t\t)\n"); - printf("\t)\n"); + fprintf(fh, "\t\t\t(display %s)\n", d_config->vfbs[i].sdl.display); + fprintf(fh, "\t\t\t(xauthority %s)\n", d_config->vfbs[i].sdl.xauthority); + fprintf(fh, "\t\t)\n"); + fprintf(fh, "\t)\n"); } - printf(")\n"); + fprintf(fh, ")\n"); } -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |