From 16450d30fc646747334d1fdfd5c359a20d6a56e5 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 30 Aug 2007 09:35:39 +0000
Subject: [PATCH] Document kernel selection method

This changelist add:
  - documentation on how to select the kernel and initrd (if needed) for
    instances
  - support in hypervisor.py for the initrd
  - adds note about internet-connectivity and debootstrap requirements
    for the minimal etch os
  - documentation on the miminum xenvg size

Reviewed-by: roman.marxer,ultrotter
---
 docs/install.sgml | 64 +++++++++++++++++++++++++++++++++++++++++++----
 lib/hypervisor.py |  2 ++
 2 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/docs/install.sgml b/docs/install.sgml
index 789ee3770..ce9894ce9 100644
--- a/docs/install.sgml
+++ b/docs/install.sgml
@@ -88,8 +88,10 @@
         It is advised to start with a clean, minimal install of the
         operating system. The only requirement you need to be aware of
         at this stage is to partition leaving enough space for a big
-        LVM volume group which will then host your instance
-        filesystems. The volume group name Ganeti 1.2 uses is
+        (<emphasis role="strong">minimum
+        <constant>20GiB</constant></emphasis>) LVM volume group which
+        will then host your instance filesystems. The volume group
+        name Ganeti 1.2 uses (by default) is
         <emphasis>xenvg</emphasis>.
       </para>
 
@@ -101,7 +103,7 @@
       </note>
 
       <para>
-        While you can use an exiting system, please note that the
+        While you can use an existing system, please note that the
         Ganeti installation is intrusive in terms of changes to the
         system configuration, and it's best to use a newly-installed
         system without important data on it.
@@ -149,11 +151,42 @@
       <formalpara><title>Debian</title>
       <para>
         Under Debian Etch or Sarge+backports you can install the
-        relevant xen-linux-system package, which will pull in both the
-        hypervisor and the relevant kernel.
+        relevant <literal>xen-linux-system</literal> package, which
+        will pull in both the hypervisor and the relevant kernel.
       </para>
       </formalpara>
 
+      <sect3>
+        <title>Selecting the instance kernel</title>
+
+        <para>
+          After you have installed xen, you need to tell Ganeti
+          exactly what kernel to use for the instances it will
+          create. This is done by creating a
+          <emphasis>symlink</emphasis> from your actual kernel to
+          <filename>/boot/vmlinuz-2.6-xenU</filename>, and one from
+          your initrd to
+          <filename>/boot/initrd-2.6-xenU</filename>. Note that if you
+          don't use an initrd for the <literal>domU</literal> kernel,
+          you don't need to create the initrd symlink.
+        </para>
+
+        <formalpara>
+          <title>Debian</title>
+          <para>
+            After installation of the
+            <literal>xen-linux-system</literal> package, you need to
+            run (replace the exact version number with the one you
+            have):
+            <screen>
+cd /boot
+ln -s vmlinuz-2.6.18-5-xen-686 vmlinuz-2.6-xenU
+ln -s initrd.img-2.6.18-5-xen-686 initrd-2.6-xenU
+            </screen>
+          </para>
+        </formalpara>
+      </sect3>
+
     </sect2>
 
     <sect2>
@@ -366,6 +399,10 @@ xen-br0         8000.0020fc1ed55d       no              eth0
 
       <para><emphasis role="strong">Mandatory</emphasis> on all nodes.</para>
 
+      <note>
+        <simpara>The volume group is required to be at least
+        <constant>20GiB</constant>.</simpara>
+      </note>
       <para>
         If you haven't configured your LVM volume group at install
         time you need to do it before trying to initialize the Ganeti
@@ -448,6 +485,23 @@ tar xvf instance-debian-etch-0.1.tar
 mv instance-debian-etch-0.1 debian-etch
       </screen>
 
+      <para>
+        In order to use this OS definition, you need to have internet
+        access from your nodes and have <citerefentry>
+        <refentrytitle>debootstrap</refentrytitle>
+        <manvolnum>8</manvolnum> </citerefentry> installed on all the
+        nodes.
+      </para>
+      <formalpara>
+        <title>Debian</title>
+        <para>
+          Use this command on all nodes to install
+          <computeroutput>debootstrap</computeroutput>:
+
+          <screen>apt-get install debootstrap</screen>
+        </para>
+      </formalpara>
+
       <para>
         Alternatively, you can create your own OS definitions. See the
         manpage
diff --git a/lib/hypervisor.py b/lib/hypervisor.py
index 275050308..953eebf08 100644
--- a/lib/hypervisor.py
+++ b/lib/hypervisor.py
@@ -133,6 +133,8 @@ 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("memory = %d\n" % instance.memory)
     config.write("vcpus = %d\n" % instance.vcpus)
     config.write("name = '%s'\n" % instance.name)
-- 
GitLab