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.
This commit is contained in:
Jim Fehlig 2013-05-17 09:30:08 -06:00
parent 47d14c3791
commit e1f31f5ae1
2 changed files with 12 additions and 2 deletions

View File

@ -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)))

View File

@ -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;