[PATCH 2/2] libxl: set bootloader for PV domains if not specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 90d563b..8b76536 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 44ecd41..754fc40 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;
-- 
1.7.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]