Browse code

xenapi: Ubuntu installation repository/proxy fix

Get rid of UBUNTU_INST_REPOSITORY, use UBUNTU_INST_HTTP_HOSTNAME and
UBUNTU_INST_HTTP_DIRECTORY instead. User can also specify
UBUNTU_INST_HTTP_PROXY to utilize a proxy for the OpenStack VM
installation. The answer file will be edited to contain the specified
values. Also get rid of the magic, undocumented MIRROR variable.

This is related to blueprint xenapi-devstack-cleanup

Change-Id: Ic9fc564c4ad0f43e2e536854335ebe14791d0255

Mate Lakat authored on 2013/05/09 23:02:21
Showing 3 changed files
... ...
@@ -250,11 +250,12 @@ if [ -z "$templateuuid" ]; then
250 250
             mkdir -p $HTTP_SERVER_LOCATION
251 251
         fi
252 252
         cp -f $THIS_DIR/devstackubuntupreseed.cfg $HTTP_SERVER_LOCATION
253
-        MIRROR=${MIRROR:-""}
254
-        if [ -n "$MIRROR" ]; then
255
-            sed -e "s,d-i mirror/http/hostname string .*,d-i mirror/http/hostname string $MIRROR," \
256
-                -i "${HTTP_SERVER_LOCATION}/devstackubuntupreseed.cfg"
257
-        fi
253
+
254
+        sed \
255
+            -e "s,\(d-i mirror/http/hostname string\).*,\1 $UBUNTU_INST_HTTP_HOSTNAME,g" \
256
+            -e "s,\(d-i mirror/http/directory string\).*,\1 $UBUNTU_INST_HTTP_DIRECTORY,g" \
257
+            -e "s,\(d-i mirror/http/proxy string\).*,\1 $UBUNTU_INST_HTTP_PROXY,g" \
258
+            -i "${HTTP_SERVER_LOCATION}/devstackubuntupreseed.cfg"
258 259
     fi
259 260
 
260 261
     # Update the template
... ...
@@ -69,11 +69,16 @@ fi
69 69
 
70 70
 xe template-param-set uuid=$new_uuid \
71 71
     other-config:install-methods=http \
72
-    other-config:install-repository="$UBUNTU_INST_REPOSITORY" \
72
+    other-config:install-repository="http://${UBUNTU_INST_HTTP_HOSTNAME}${UBUNTU_INST_HTTP_DIRECTORY}" \
73 73
     PV-args="$pvargs" \
74 74
     other-config:debian-release="$UBUNTU_INST_RELEASE" \
75 75
     other-config:default_template=true \
76 76
     other-config:disks='<provision><disk device="0" size="'$disk_size'" sr="" bootable="true" type="system"/></provision>' \
77 77
     other-config:install-arch="$UBUNTU_INST_ARCH"
78 78
 
79
+if ! [ -z "$UBUNTU_INST_HTTP_PROXY" ]; then
80
+    xe template-param-set uuid=$new_uuid \
81
+        other-config:install-proxy="$UBUNTU_INST_HTTP_PROXY"
82
+fi
83
+
79 84
 echo "Ubuntu template installed uuid:$new_uuid"
... ...
@@ -64,7 +64,9 @@ UBUNTU_INST_TEMPLATE_NAME="Ubuntu 11.10 (64-bit) for DevStack"
64 64
 # XenServer 6.1 and later or XCP 1.6 or later
65 65
 # 11.10 is only really supported with XenServer 6.0.2 and later
66 66
 UBUNTU_INST_ARCH="amd64"
67
-UBUNTU_INST_REPOSITORY="http://archive.ubuntu.net/ubuntu"
67
+UBUNTU_INST_HTTP_HOSTNAME="archive.ubuntu.net"
68
+UBUNTU_INST_HTTP_DIRECTORY="/ubuntu"
69
+UBUNTU_INST_HTTP_PROXY=""
68 70
 UBUNTU_INST_LOCALE="en_US"
69 71
 UBUNTU_INST_KEYBOARD="us"
70 72
 # network configuration for ubuntu netinstall