Make Xen DomU kernel and initrd configurable at build time.
authorMichael Hanselmann <hansmi@google.com>
Wed, 10 Oct 2007 10:58:48 +0000 (10:58 +0000)
committerMichael Hanselmann <hansmi@google.com>
Wed, 10 Oct 2007 10:58:48 +0000 (10:58 +0000)
Reviewed-by: iustinp

configure.ac
lib/Makefile.am
lib/constants.py
lib/hypervisor.py

index 1ed1110..c1bcd56 100644 (file)
@@ -17,7 +17,8 @@ AC_SUBST(SSH_INITD_SCRIPT, $ssh_initd_script)
 # --with-export-dir=...
 AC_ARG_WITH([export-dir],
   [AS_HELP_STRING([--with-export-dir=DIR],
-    [directory to use by default for instance image exports (default is /srv/ganeti/export)]
+    [directory to use by default for instance image]
+    [ exports (default is /srv/ganeti/export)]
   )],
   [export_dir="$withval"],
   [export_dir="/srv/ganeti/export"])
@@ -27,12 +28,31 @@ AC_SUBST(EXPORT_DIR, $export_dir)
 # do a bit of black sed magic to for quoting of the strings in the list
 AC_ARG_WITH([os-search-path],
   [AS_HELP_STRING([--with-os-search-path=LIST],
-    [comma separated list of directories to search for OS images (default is /srv/ganeti/os)]
+    [comma separated list of directories to]
+    [ search for OS images (default is /srv/ganeti/os)]
   )],
   [os_search_path=`echo -n "$withval" | sed -e "s/\([[^,]]*\)/'\1'/g"`],
   [os_search_path="'/srv/ganeti/os'"])
 AC_SUBST(OS_SEARCH_PATH, $os_search_path)
 
+# --with-xen-kernel=...
+AC_ARG_WITH([xen-kernel],
+  [AS_HELP_STRING([--with-xen-kernel=PATH],
+    [DomU kernel image for Xen hypervisor (default is /boot/vmlinuz-2.6-xenU)]
+  )],
+  [xen_kernel="$withval"],
+  [xen_kernel="/boot/vmlinuz-2.6-xenU"])
+AC_SUBST(XEN_KERNEL, $xen_kernel)
+
+# --with-xen-initrd=...
+AC_ARG_WITH([xen-initrd],
+  [AS_HELP_STRING([--with-xen-initrd=PATH],
+    [DomU initrd image for Xen hypervisor (default is /boot/initrd-2.6-xenU)]
+  )],
+  [xen_initrd="$withval"],
+  [xen_initrd="/boot/initrd-2.6-xenU"])
+AC_SUBST(XEN_INITRD, $xen_initrd)
+
 # Check common programs
 AC_PROG_INSTALL
 AC_PROG_LN_S
index 0c249c6..1827130 100644 (file)
@@ -1,5 +1,3 @@
-SSH_INITD_SCRIPT = @SSH_INITD_SCRIPT@
-
 CLEANFILES = $(nodist_pkgpython_PYTHON) *.py[oc]
 
 nodist_pkgpython_PYTHON = _autoconf.py
@@ -19,6 +17,8 @@ _autoconf.py: Makefile
          echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
          echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
          echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
+         echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
+         echo "XEN_INITRD = '$(XEN_INITRD)'"; \
        } > $@
 
 pre-check: all
index dc06a03..9516d4d 100644 (file)
@@ -55,6 +55,9 @@ EXPORT_DIR = _autoconf.EXPORT_DIR
 
 EXPORT_CONF_FILE = "config.ini"
 
+XEN_KERNEL = _autoconf.XEN_KERNEL
+XEN_INITRD = _autoconf.XEN_INITRD
+
 # hooks-related constants
 HOOKS_BASE_DIR = _autoconf.SYSCONFDIR + "/ganeti/hooks"
 HOOKS_PHASE_PRE = "pre"
index adf84aa..4669c62 100644 (file)
@@ -30,6 +30,7 @@ from cStringIO import StringIO
 from ganeti import utils
 from ganeti import logger
 from ganeti import ssconf
+from ganeti import constants
 from ganeti.errors import HypervisorError
 
 _HT_XEN30 = "xen-3.0"
@@ -132,9 +133,9 @@ class XenHypervisor(BaseHypervisor):
     """
     config = StringIO()
     config.write("# this is autogenerated by Ganeti, please do not edit\n#\n")
-    config.write("kernel = '/boot/vmlinuz-2.6-xenU'\n")
-    if os.path.exists("/boot/initrd-2.6-xenU"):
-      config.write("ramdisk = '/boot/initrd-2.6-xenU'\n")
+    config.write("kernel = '%s'\n" % constants.XEN_KERNEL)
+    if os.path.exists(constants.XEN_INITRD):
+      config.write("ramdisk = '%s'\n" % constants.XEN_INITRD)
     config.write("memory = %d\n" % instance.memory)
     config.write("vcpus = %d\n" % instance.vcpus)
     config.write("name = '%s'\n" % instance.name)