From e1f31f5ae120295ba21ec866da2da56f217f38bf Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Fri, 17 May 2013 09:30:08 -0600 Subject: [PATCH] libxl: set bootloader for PV domains if not specified The legacy xen toolstack will set pygrub as the bootloader if not specified. For compatibility, do the same in the libxl driver iff not using direct kernel boot. --- src/libxl/libxl_conf.c | 13 +++++++++++-- src/libxl/libxl_conf.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 90d563b0f6..8b765363dc 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -414,8 +414,17 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config) b_info->shadow_memkb = 4 * (256 * libxl_bitmap_count_set(&b_info->avail_vcpus) + 2 * (b_info->max_memkb / 1024)); } else { - if (VIR_STRDUP(b_info->u.pv.bootloader, def->os.bootloader) < 0) - goto error; + /* + * For compatibility with the legacy xen toolstack, default to pygrub + * if bootloader is not specified AND direct kernel boot is not specified. + */ + if (def->os.bootloader) { + if (VIR_STRDUP(b_info->u.pv.bootloader, def->os.bootloader) < 0) + goto error; + } else if (def->os.kernel == NULL) { + if (VIR_STRDUP(b_info->u.pv.bootloader, LIBXL_BOOTLOADER_PATH) < 0) + goto error; + } if (def->os.bootloaderArgs) { if (!(b_info->u.pv.bootloader_args = virStringSplit(def->os.bootloaderArgs, " \t\n", 0))) diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 44ecd4105e..754fc404a6 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -45,6 +45,7 @@ # define LIBXL_LOG_DIR LOCALSTATEDIR "/log/libvirt/libxl" # define LIBXL_LIB_DIR LOCALSTATEDIR "/lib/libvirt/libxl" # define LIBXL_SAVE_DIR LIBXL_LIB_DIR "/save" +# define LIBXL_BOOTLOADER_PATH BINDIR "/pygrub" typedef struct _libxlDriverPrivate libxlDriverPrivate; -- 2.39.5