| ... | ... |
@@ -18,7 +18,7 @@ python-mysqldb |
| 18 | 18 |
python-pyudev |
| 19 | 19 |
python-qpid # dist:precise |
| 20 | 20 |
dnsmasq-base |
| 21 |
-dnsmasq-utils # for dhcp_release only available in dist:oneiric,precise,quantal |
|
| 21 |
+dnsmasq-utils # for dhcp_release only available in dist:precise |
|
| 22 | 22 |
rabbitmq-server # NOPRIME |
| 23 | 23 |
qpidd # NOPRIME |
| 24 | 24 |
sqlite3 |
| ... | ... |
@@ -192,9 +192,8 @@ function qpid_is_supported() {
|
| 192 | 192 |
GetDistro |
| 193 | 193 |
fi |
| 194 | 194 |
|
| 195 |
- # Qpid was introduced to Ubuntu in precise, disallow it on oneiric; it is |
|
| 196 |
- # not in openSUSE either right now. |
|
| 197 |
- ( ! ([[ "$DISTRO" = "oneiric" ]] || is_suse) ) |
|
| 195 |
+ # Qpid is not in openSUSE |
|
| 196 |
+ ( ! is_suse ) |
|
| 198 | 197 |
} |
| 199 | 198 |
|
| 200 | 199 |
|
| ... | ... |
@@ -131,7 +131,7 @@ disable_negated_services |
| 131 | 131 |
|
| 132 | 132 |
# Warn users who aren't on an explicitly supported distro, but allow them to |
| 133 | 133 |
# override check and attempt installation with ``FORCE=yes ./stack`` |
| 134 |
-if [[ ! ${DISTRO} =~ (oneiric|precise|quantal|raring|saucy|trusty|7.0|wheezy|sid|testing|jessie|f18|f19|f20|opensuse-12.2|rhel6) ]]; then
|
|
| 134 |
+if [[ ! ${DISTRO} =~ (precise|raring|saucy|trusty|7.0|wheezy|sid|testing|jessie|f18|f19|f20|opensuse-12.2|rhel6) ]]; then
|
|
| 135 | 135 |
echo "WARNING: this script has not been tested on $DISTRO" |
| 136 | 136 |
if [[ "$FORCE" != "yes" ]]; then |
| 137 | 137 |
die $LINENO "If you wish to run this script anyway run with FORCE=yes" |
| ... | ... |
@@ -1203,7 +1203,6 @@ fi |
| 1203 | 1203 |
# See https://help.ubuntu.com/community/CloudInit for more on cloud-init |
| 1204 | 1204 |
# |
| 1205 | 1205 |
# Override ``IMAGE_URLS`` with a comma-separated list of UEC images. |
| 1206 |
-# * **oneiric**: http://uec-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64.tar.gz |
|
| 1207 | 1206 |
# * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz |
| 1208 | 1207 |
|
| 1209 | 1208 |
if is_service_enabled g-reg; then |
| 1210 | 1209 |
deleted file mode 100755 |
| ... | ... |
@@ -1,302 +0,0 @@ |
| 1 |
-#!/usr/bin/env bash |
|
| 2 |
- |
|
| 3 |
-# **build_uec.sh** |
|
| 4 |
- |
|
| 5 |
-# Make sure that we have the proper version of ubuntu (only works on oneiric) |
|
| 6 |
-if ! egrep -q "oneiric" /etc/lsb-release; then |
|
| 7 |
- echo "This script only works with ubuntu oneiric." |
|
| 8 |
- exit 1 |
|
| 9 |
-fi |
|
| 10 |
- |
|
| 11 |
-# Keep track of the current directory |
|
| 12 |
-TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
|
| 13 |
-TOP_DIR=$(cd $TOOLS_DIR/..; pwd) |
|
| 14 |
- |
|
| 15 |
-# Import common functions |
|
| 16 |
-. $TOP_DIR/functions |
|
| 17 |
- |
|
| 18 |
-cd $TOP_DIR |
|
| 19 |
- |
|
| 20 |
-# Source params |
|
| 21 |
-source ./stackrc |
|
| 22 |
- |
|
| 23 |
-# Ubuntu distro to install |
|
| 24 |
-DIST_NAME=${DIST_NAME:-oneiric}
|
|
| 25 |
- |
|
| 26 |
-# Configure how large the VM should be |
|
| 27 |
-GUEST_SIZE=${GUEST_SIZE:-10G}
|
|
| 28 |
- |
|
| 29 |
-# exit on error to stop unexpected errors |
|
| 30 |
-set -o errexit |
|
| 31 |
-set -o xtrace |
|
| 32 |
- |
|
| 33 |
-# Abort if localrc is not set |
|
| 34 |
-if [ ! -e $TOP_DIR/localrc ]; then |
|
| 35 |
- echo "You must have a localrc with ALL necessary passwords defined before proceeding." |
|
| 36 |
- echo "See stack.sh for required passwords." |
|
| 37 |
- exit 1 |
|
| 38 |
-fi |
|
| 39 |
- |
|
| 40 |
-# Install deps if needed |
|
| 41 |
-DEPS="kvm libvirt-bin kpartx cloud-utils curl" |
|
| 42 |
-apt_get install -y --force-yes $DEPS || true # allow this to fail gracefully for concurrent builds |
|
| 43 |
- |
|
| 44 |
-# Where to store files and instances |
|
| 45 |
-WORK_DIR=${WORK_DIR:-/opt/uecstack}
|
|
| 46 |
- |
|
| 47 |
-# Where to store images |
|
| 48 |
-image_dir=$WORK_DIR/images/$DIST_NAME |
|
| 49 |
-mkdir -p $image_dir |
|
| 50 |
- |
|
| 51 |
-# Start over with a clean base image, if desired |
|
| 52 |
-if [ $CLEAN_BASE ]; then |
|
| 53 |
- rm -f $image_dir/disk |
|
| 54 |
-fi |
|
| 55 |
- |
|
| 56 |
-# Get the base image if it does not yet exist |
|
| 57 |
-if [ ! -e $image_dir/disk ]; then |
|
| 58 |
- $TOOLS_DIR/get_uec_image.sh -r $GUEST_SIZE $DIST_NAME $image_dir/disk $image_dir/kernel |
|
| 59 |
-fi |
|
| 60 |
- |
|
| 61 |
-# Copy over dev environment if COPY_ENV is set. |
|
| 62 |
-# This will also copy over your current devstack. |
|
| 63 |
-if [ $COPY_ENV ]; then |
|
| 64 |
- cd $TOOLS_DIR |
|
| 65 |
- ./copy_dev_environment_to_uec.sh $image_dir/disk |
|
| 66 |
-fi |
|
| 67 |
- |
|
| 68 |
-# Option to warm the base image with software requirements. |
|
| 69 |
-if [ $WARM_CACHE ]; then |
|
| 70 |
- cd $TOOLS_DIR |
|
| 71 |
- ./warm_apts_for_uec.sh $image_dir/disk |
|
| 72 |
-fi |
|
| 73 |
- |
|
| 74 |
-# Name of our instance, used by libvirt |
|
| 75 |
-GUEST_NAME=${GUEST_NAME:-devstack}
|
|
| 76 |
- |
|
| 77 |
-# Mop up after previous runs |
|
| 78 |
-virsh destroy $GUEST_NAME || true |
|
| 79 |
- |
|
| 80 |
-# Where this vm is stored |
|
| 81 |
-vm_dir=$WORK_DIR/instances/$GUEST_NAME |
|
| 82 |
- |
|
| 83 |
-# Create vm dir and remove old disk |
|
| 84 |
-mkdir -p $vm_dir |
|
| 85 |
-rm -f $vm_dir/disk |
|
| 86 |
- |
|
| 87 |
-# Create a copy of the base image |
|
| 88 |
-qemu-img create -f qcow2 -b $image_dir/disk $vm_dir/disk |
|
| 89 |
- |
|
| 90 |
-# Back to devstack |
|
| 91 |
-cd $TOP_DIR |
|
| 92 |
- |
|
| 93 |
-GUEST_NETWORK=${GUEST_NETWORK:-1}
|
|
| 94 |
-GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
|
|
| 95 |
-GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
|
|
| 96 |
-GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
|
|
| 97 |
-GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
|
|
| 98 |
-GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
|
|
| 99 |
-GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
|
|
| 100 |
-GUEST_RAM=${GUEST_RAM:-1524288}
|
|
| 101 |
-GUEST_CORES=${GUEST_CORES:-1}
|
|
| 102 |
- |
|
| 103 |
-# libvirt.xml configuration |
|
| 104 |
-NET_XML=$vm_dir/net.xml |
|
| 105 |
-NET_NAME=${NET_NAME:-devstack-$GUEST_NETWORK}
|
|
| 106 |
-cat > $NET_XML <<EOF |
|
| 107 |
-<network> |
|
| 108 |
- <name>$NET_NAME</name> |
|
| 109 |
- <bridge name="stackbr%d" /> |
|
| 110 |
- <forward/> |
|
| 111 |
- <ip address="$GUEST_GATEWAY" netmask="$GUEST_NETMASK"> |
|
| 112 |
- <dhcp> |
|
| 113 |
- <range start='192.168.$GUEST_NETWORK.2' end='192.168.$GUEST_NETWORK.127' /> |
|
| 114 |
- </dhcp> |
|
| 115 |
- </ip> |
|
| 116 |
-</network> |
|
| 117 |
-EOF |
|
| 118 |
- |
|
| 119 |
-if [[ "$GUEST_RECREATE_NET" == "yes" ]]; then |
|
| 120 |
- virsh net-destroy $NET_NAME || true |
|
| 121 |
- # destroying the network isn't enough to delete the leases |
|
| 122 |
- rm -f /var/lib/libvirt/dnsmasq/$NET_NAME.leases |
|
| 123 |
- virsh net-create $vm_dir/net.xml |
|
| 124 |
-fi |
|
| 125 |
- |
|
| 126 |
-# libvirt.xml configuration |
|
| 127 |
-LIBVIRT_XML=$vm_dir/libvirt.xml |
|
| 128 |
-cat > $LIBVIRT_XML <<EOF |
|
| 129 |
-<domain type='kvm'> |
|
| 130 |
- <name>$GUEST_NAME</name> |
|
| 131 |
- <memory>$GUEST_RAM</memory> |
|
| 132 |
- <os> |
|
| 133 |
- <type>hvm</type> |
|
| 134 |
- <kernel>$image_dir/kernel</kernel> |
|
| 135 |
- <cmdline>root=/dev/vda ro console=ttyS0 init=/usr/lib/cloud-init/uncloud-init ds=nocloud-net;s=http://192.168.$GUEST_NETWORK.1:4567/ ubuntu-pass=ubuntu</cmdline> |
|
| 136 |
- </os> |
|
| 137 |
- <features> |
|
| 138 |
- <acpi/> |
|
| 139 |
- </features> |
|
| 140 |
- <clock offset='utc'/> |
|
| 141 |
- <vcpu>$GUEST_CORES</vcpu> |
|
| 142 |
- <devices> |
|
| 143 |
- <disk type='file'> |
|
| 144 |
- <driver type='qcow2'/> |
|
| 145 |
- <source file='$vm_dir/disk'/> |
|
| 146 |
- <target dev='vda' bus='virtio'/> |
|
| 147 |
- </disk> |
|
| 148 |
- |
|
| 149 |
- <interface type='network'> |
|
| 150 |
- <source network='$NET_NAME'/> |
|
| 151 |
- </interface> |
|
| 152 |
- |
|
| 153 |
- <!-- The order is significant here. File must be defined first --> |
|
| 154 |
- <serial type="file"> |
|
| 155 |
- <source path='$vm_dir/console.log'/> |
|
| 156 |
- <target port='1'/> |
|
| 157 |
- </serial> |
|
| 158 |
- |
|
| 159 |
- <console type='pty' tty='/dev/pts/2'> |
|
| 160 |
- <source path='/dev/pts/2'/> |
|
| 161 |
- <target port='0'/> |
|
| 162 |
- </console> |
|
| 163 |
- |
|
| 164 |
- <serial type='pty'> |
|
| 165 |
- <source path='/dev/pts/2'/> |
|
| 166 |
- <target port='0'/> |
|
| 167 |
- </serial> |
|
| 168 |
- |
|
| 169 |
- <graphics type='vnc' port='-1' autoport='yes' keymap='en-us' listen='0.0.0.0'/> |
|
| 170 |
- </devices> |
|
| 171 |
-</domain> |
|
| 172 |
-EOF |
|
| 173 |
- |
|
| 174 |
- |
|
| 175 |
-rm -rf $vm_dir/uec |
|
| 176 |
-cp -r $TOOLS_DIR/uec $vm_dir/uec |
|
| 177 |
- |
|
| 178 |
-# set metadata |
|
| 179 |
-cat > $vm_dir/uec/meta-data<<EOF |
|
| 180 |
-hostname: $GUEST_NAME |
|
| 181 |
-instance-id: i-hop |
|
| 182 |
-instance-type: m1.ignore |
|
| 183 |
-local-hostname: $GUEST_NAME.local |
|
| 184 |
-EOF |
|
| 185 |
- |
|
| 186 |
-# set user-data |
|
| 187 |
-cat > $vm_dir/uec/user-data<<EOF |
|
| 188 |
-#!/bin/bash |
|
| 189 |
-# hostname needs to resolve for rabbit |
|
| 190 |
-sed -i "s/127.0.0.1/127.0.0.1 \`hostname\`/" /etc/hosts |
|
| 191 |
-apt-get update |
|
| 192 |
-apt-get install git sudo -y |
|
| 193 |
-# Disable byobu |
|
| 194 |
-sudo apt-get remove -y byobu |
|
| 195 |
-EOF |
|
| 196 |
- |
|
| 197 |
-# Setup stack user with our key |
|
| 198 |
-if [[ -e ~/.ssh/id_rsa.pub ]]; then |
|
| 199 |
- PUB_KEY=`cat ~/.ssh/id_rsa.pub` |
|
| 200 |
- cat >> $vm_dir/uec/user-data<<EOF |
|
| 201 |
-mkdir -p /opt/stack |
|
| 202 |
-if [ ! -d /opt/stack/devstack ]; then |
|
| 203 |
- git clone https://github.com/cloudbuilders/devstack.git /opt/stack/devstack |
|
| 204 |
- cd /opt/stack/devstack |
|
| 205 |
- cat > localrc <<LOCAL_EOF |
|
| 206 |
-ROOTSLEEP=0 |
|
| 207 |
-`cat $TOP_DIR/localrc` |
|
| 208 |
-LOCAL_EOF |
|
| 209 |
-fi |
|
| 210 |
-useradd -U -G sudo -s /bin/bash -d /opt/stack -m $STACK_USER |
|
| 211 |
-echo $STACK_USER:pass | chpasswd |
|
| 212 |
-mkdir -p /opt/stack/.ssh |
|
| 213 |
-echo "$PUB_KEY" > /opt/stack/.ssh/authorized_keys |
|
| 214 |
-chown -R $STACK_USER /opt/stack |
|
| 215 |
-chmod 700 /opt/stack/.ssh |
|
| 216 |
-chmod 600 /opt/stack/.ssh/authorized_keys |
|
| 217 |
- |
|
| 218 |
-grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || |
|
| 219 |
- echo "#includedir /etc/sudoers.d" >> /etc/sudoers |
|
| 220 |
-( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" \ |
|
| 221 |
- > /etc/sudoers.d/50_stack_sh ) |
|
| 222 |
-EOF |
|
| 223 |
-fi |
|
| 224 |
- |
|
| 225 |
-# Run stack.sh |
|
| 226 |
-cat >> $vm_dir/uec/user-data<<EOF |
|
| 227 |
-sudo -u $STACK_USER bash -l -c "cd /opt/stack/devstack && ./stack.sh" |
|
| 228 |
-EOF |
|
| 229 |
- |
|
| 230 |
-# (re)start a metadata service |
|
| 231 |
-( |
|
| 232 |
- pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1`
|
|
| 233 |
- [ -z "$pid" ] || kill -9 $pid |
|
| 234 |
-) |
|
| 235 |
-cd $vm_dir/uec |
|
| 236 |
-python meta.py 192.168.$GUEST_NETWORK.1:4567 & |
|
| 237 |
- |
|
| 238 |
-# Create the instance |
|
| 239 |
-virsh create $vm_dir/libvirt.xml |
|
| 240 |
- |
|
| 241 |
-# Tail the console log till we are done |
|
| 242 |
-WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
|
|
| 243 |
-if [ "$WAIT_TILL_LAUNCH" = "1" ]; then |
|
| 244 |
- set +o xtrace |
|
| 245 |
- # Done creating the container, let's tail the log |
|
| 246 |
- echo |
|
| 247 |
- echo "=============================================================" |
|
| 248 |
- echo " -- YAY! --" |
|
| 249 |
- echo "=============================================================" |
|
| 250 |
- echo |
|
| 251 |
- echo "We're done launching the vm, about to start tailing the" |
|
| 252 |
- echo "stack.sh log. It will take a second or two to start." |
|
| 253 |
- echo |
|
| 254 |
- echo "Just CTRL-C at any time to stop tailing." |
|
| 255 |
- echo |
|
| 256 |
- |
|
| 257 |
- if ! timeout 60 sh -c "while [ ! -s /var/lib/libvirt/dnsmasq/$NET_NAME.leases ]; do sleep 1; done"; then |
|
| 258 |
- echo "Your instance failed to acquire an IP address" |
|
| 259 |
- exit 1 |
|
| 260 |
- fi |
|
| 261 |
- |
|
| 262 |
- ip=`cat /var/lib/libvirt/dnsmasq/$NET_NAME.leases | cut -d " " -f3` |
|
| 263 |
- echo "#############################################################" |
|
| 264 |
- echo " -- This is your instance's IP: --" |
|
| 265 |
- echo " $ip" |
|
| 266 |
- echo "#############################################################" |
|
| 267 |
- |
|
| 268 |
- sleep 2 |
|
| 269 |
- |
|
| 270 |
- while [ ! -e "$vm_dir/console.log" ]; do |
|
| 271 |
- sleep 1 |
|
| 272 |
- done |
|
| 273 |
- |
|
| 274 |
- tail -F $vm_dir/console.log & |
|
| 275 |
- |
|
| 276 |
- TAIL_PID=$! |
|
| 277 |
- |
|
| 278 |
- function kill_tail() {
|
|
| 279 |
- kill $TAIL_PID |
|
| 280 |
- exit 1 |
|
| 281 |
- } |
|
| 282 |
- |
|
| 283 |
- # Let Ctrl-c kill tail and exit |
|
| 284 |
- trap kill_tail SIGINT |
|
| 285 |
- |
|
| 286 |
- echo "Waiting stack.sh to finish..." |
|
| 287 |
- while ! egrep -q '^stack.sh (completed|failed)' $vm_dir/console.log ; do |
|
| 288 |
- sleep 1 |
|
| 289 |
- done |
|
| 290 |
- |
|
| 291 |
- set -o xtrace |
|
| 292 |
- |
|
| 293 |
- kill $TAIL_PID |
|
| 294 |
- |
|
| 295 |
- if ! grep -q "^stack.sh completed in" $vm_dir/console.log; then |
|
| 296 |
- exit 1 |
|
| 297 |
- fi |
|
| 298 |
- |
|
| 299 |
- set +o xtrace |
|
| 300 |
- echo "" |
|
| 301 |
- echo "Finished - Zip-a-dee Doo-dah!" |
|
| 302 |
-fi |
| ... | ... |
@@ -64,12 +64,10 @@ IMG_FILE_TMP=`mktemp $IMG_FILE.XXXXXX` |
| 64 | 64 |
KERNEL=$3 |
| 65 | 65 |
|
| 66 | 66 |
case $DIST_NAME in |
| 67 |
+ saucy) ;; |
|
| 68 |
+ raring) ;; |
|
| 67 | 69 |
quantal) ;; |
| 68 | 70 |
precise) ;; |
| 69 |
- oneiric) ;; |
|
| 70 |
- natty) ;; |
|
| 71 |
- maverick) ;; |
|
| 72 |
- lucid) ;; |
|
| 73 | 71 |
*) echo "Unknown release: $DIST_NAME" |
| 74 | 72 |
usage |
| 75 | 73 |
;; |