From 668d9cb9fd6d476c4bdeb08ff3830073aa9223d9 Mon Sep 17 00:00:00 2001 From: Renuka Apte Date: Wed, 11 Apr 2012 11:42:54 -0700 Subject: [PATCH] XenServer: Allow static network config for install Change-Id: Ief24e21fcd8d4cd61296e4b81051d3332314d45c --- tools/xen/README.md | 5 +++++ tools/xen/scripts/xenoneirictemplate.sh | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/xen/README.md b/tools/xen/README.md index b77bbb51ea..d102b01dfa 100644 --- a/tools/xen/README.md +++ b/tools/xen/README.md @@ -59,6 +59,11 @@ Of course, use real passwords if this machine is exposed. ACTIVE_TIMEOUT=45 # Interface on which you would like to access services HOST_IP_IFACE=ethX + # First time Ubuntu network install params + NETINSTALLIP="dhcp" + NAMESERVERS="" + NETMASK="" + GATEWAY="" EOF Step 4: Run ./install_os_domU.sh from the tools/xen directory diff --git a/tools/xen/scripts/xenoneirictemplate.sh b/tools/xen/scripts/xenoneirictemplate.sh index 003acd5781..1d9ec5e258 100755 --- a/tools/xen/scripts/xenoneirictemplate.sh +++ b/tools/xen/scripts/xenoneirictemplate.sh @@ -5,6 +5,9 @@ ## Author: Renuka Apte ## This is not an officially supported guest OS on XenServer 6.02 +BASE_DIR=$(cd $(dirname "$0") && pwd) +source $BASE_DIR/../../../localrc + LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal) if [[ -z $LENNY ]] ; then @@ -22,11 +25,21 @@ for arch in ${arches[@]} ; do if [[ -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal) ]] ; then echo "$distro ($arch)" already exists, Skipping else - + if [ -z $NETINSTALLIP ] + then + echo "NETINSTALLIP not set in localrc" + exit 1 + fi + 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}" + if [ "$NETINSTALLIP" != "dhcp" ] + then + 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" + pvargs="${pvargs} ${netcfgargs}" + fi NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)") xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \ other-config:install-repository=http://archive.ubuntu.net/ubuntu \ - 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}" \ + PV-args="$pvargs" \ other-config:debian-release=oneiric \ other-config:default_template=true