]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: set bootloader for PV domains if not specified
authorJim Fehlig <jfehlig@suse.com>
Fri, 17 May 2013 15:30:08 +0000 (09:30 -0600)
committerJim Fehlig <jfehlig@suse.com>
Wed, 12 Jun 2013 14:42:15 +0000 (08:42 -0600)
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
src/libxl/libxl_conf.h

index 90d563b0f60106e2bb95d8f9368a9ea5f666cc17..8b765363dc6657d3a00f57b32ca88184e43e1826 100644 (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)))
index 44ecd4105eda768e7bfedd70acbfb4a6ccddd4ed..754fc404a6001e319ab238e41341a12651a33d51 100644 (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;