Browse code

XenServer: Allow static network config for install

Change-Id: Ief24e21fcd8d4cd61296e4b81051d3332314d45c

Renuka Apte authored on 2012/04/12 03:42:54
Showing 2 changed files
... ...
@@ -59,6 +59,11 @@ Of course, use real passwords if this machine is exposed.
59 59
     ACTIVE_TIMEOUT=45
60 60
     # Interface on which you would like to access services
61 61
     HOST_IP_IFACE=ethX
62
+    # First time Ubuntu network install params
63
+    NETINSTALLIP="dhcp"
64
+    NAMESERVERS=""
65
+    NETMASK=""
66
+    GATEWAY=""
62 67
     EOF
63 68
 
64 69
 Step 4: Run ./install_os_domU.sh from the tools/xen directory
... ...
@@ -5,6 +5,9 @@
5 5
 ## Author: Renuka Apte <renuka.apte@citrix.com>
6 6
 ## This is not an officially supported guest OS on XenServer 6.02
7 7
 
8
+BASE_DIR=$(cd $(dirname "$0") && pwd)
9
+source $BASE_DIR/../../../localrc
10
+
8 11
 LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal)
9 12
 
10 13
 if [[ -z $LENNY ]] ; then
... ...
@@ -22,11 +25,21 @@ for arch in ${arches[@]} ; do
22 22
     if [[ -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal) ]] ; then
23 23
         echo "$distro ($arch)" already exists, Skipping
24 24
     else
25
-
25
+        if [ -z $NETINSTALLIP ]
26
+        then
27
+            echo "NETINSTALLIP not set in localrc"
28
+            exit 1
29
+        fi
30
+        pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us netcfg/choose_interface=eth3 netcfg/get_hostname=os netcfg/get_domain=os auto url=${preseedurl}"
31
+        if [ "$NETINSTALLIP" != "dhcp" ]
32
+        then
33
+            netcfgargs="netcfg/disable_autoconfig=true netcfg/get_nameservers=${NAMESERVERS} netcfg/get_ipaddress=${NETINSTALLIP} netcfg/get_netmask=${NETMASK} netcfg/get_gateway=${GATEWAY} netcfg/confirm_static=true"
34
+            pvargs="${pvargs} ${netcfgargs}"
35
+        fi
26 36
         NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)")
27 37
         xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \
28 38
          other-config:install-repository=http://archive.ubuntu.net/ubuntu \
29
-         PV-args="-- quiet console=hvc0 partman/default_filesystem=ext3 locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us netcfg/choose_interface=eth3 netcfg/get_hostname=os netcfg/get_domain=os auto url=${preseedurl}" \
39
+         PV-args="$pvargs" \
30 40
          other-config:debian-release=oneiric \
31 41
          other-config:default_template=true
32 42