22
33# set release branch to retrieve from git
44RELEASE_BRANCH=${1:- master}
5+ MTU=${2:- 1500}
56
67echo " "
78echo " "
@@ -34,7 +35,7 @@ sudo add-apt-repository cloud-archive:liberty
3435# comment above ppa and uncomment below to get development lxd builds
3536sudo add-apt-repository ppa:ubuntu-lxc/lxd-git-master
3637sudo apt-get -qqy update
37- sudo apt-get -qqy install python-pip python-dev git # cgroup-lite cgmanager libpam-cgm
38+ sudo apt-get -qqy install python-pip python-dev git libvirt-bin # cgroup-lite cgmanager libpam-cgm
3839sudo pip install -U pbr
3940sudo pip install -U pip
4041# sudo pip install -U requests==2.5.3
@@ -44,23 +45,40 @@ sudo pip install -U requests==2.8.1
4445sudo pip install ' uwsgi'
4546sudo chmod +x /usr/local/bin/uwsgi
4647
48+ sudo update-alternatives --install /bin/sh sh /bin/bash 100
49+
50+ # We need swap space to do any sort of scale testing with the Vagrant config.
51+ # Without this, we quickly run out of RAM and the kernel starts whacking things.
52+ sudo rm -f /swapfile1
53+ sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=8388608
54+ sudo chown root:root /swapfile1
55+ sudo chmod 0600 /swapfile1
56+ sudo mkswap /swapfile1
57+ sudo swapon /swapfile1
58+
4759# Disable firewall (this is not production)
4860sudo ufw disable
4961
62+ # To permit IP packets pass through different networks,
63+ # the network card should be configured with routing capability.
64+ sudo echo " net.ipv4.ip_forward = 1" | sudo tee --append /etc/sysctl.conf > /dev/null
65+ sudo echo " net.ipv4.conf.all.rp_filter=0" | sudo tee --append /etc/sysctl.conf > /dev/null
66+ sudo echo " net.ipv4.conf.default.rp_filter=0" | sudo tee --append /etc/sysctl.conf > /dev/null
67+ sudo echo " net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee --append /etc/sysctl.conf > /dev/null
68+ sudo echo " net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee --append /etc/sysctl.conf > /dev/null
69+ sudo echo " net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee --append /etc/sysctl.conf > /dev/null
70+ sudo sysctl -p
71+
72+ # allow OpenStack nodes to route packets out through NATed network on HOST (this is the vagrant managed nic)
73+ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
74+
5075# Update host configuration
51- sudo hostname " stackinabox"
52- sudo bash -c " echo 'stackinabox' > /etc/hostname "
76+ sudo bash -c " echo 'openstack. stackinabox.io' > /etc/hostname "
77+ # export eth1=`ifconfig eth1 | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
5378sudo bash -c ' cat > /etc/hosts' << EOF
54- 127.0.1.1 stackinabox stackinabox
55- 127.0.0.1 localhost localdomain
56-
57- # The following lines are desirable for IPv6 capable hosts
58- ::1 ip6-localhost ip6-loopback
59- fe00::0 ip6-localnet
60- ff00::0 ip6-mcastprefix
61- ff02::1 ip6-allnodes
62- ff02::2 ip6-allrouters
63- ff02::3 ip6-allhosts
79+ 127.0.0.1 localhost.localdomain localhost openstack.stackinabox.io openstack
80+ 192.168.27.100 openstack.stackinabox.io openstack
81+
6482EOF
6583
6684# speed up DNS resolution
@@ -74,9 +92,9 @@ backoff-cutoff 2;
7492link-timeout 10;
7593interface "eth0"
7694{
77- supersede host-name "stackinabox";
78- supersede domain-name "";
79- prepend domain-name-servers 127.0.0.1 ;
95+ supersede host-name "openstack. stackinabox.io ";
96+ supersede domain-name "stackinabox.io ";
97+ prepend domain-name-servers 192.168.27.1, 8.8.8.8, 8.8.4.4 ;
8098 request subnet-mask,
8199 broadcast-address,
82100 routers,
@@ -89,18 +107,6 @@ interface "eth0"
89107}
90108EOF
91109
92- sudo service hostname restart
93-
94- # To permit IP packets pass through different networks,
95- # the network card should be configured with routing capability.
96- sudo echo " net.ipv4.ip_forward = 1" | sudo tee --append /etc/sysctl.conf > /dev/null
97- sudo echo " net.ipv4.conf.all.rp_filter=0" | sudo tee --append /etc/sysctl.conf > /dev/null
98- sudo echo " net.ipv4.conf.default.rp_filter=0" | sudo tee --append /etc/sysctl.conf > /dev/null
99- sudo sysctl -p
100-
101- # allow OpenStack nodes to route packets out through NATed network on HOST (this is the vagrant managed nic)
102- sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
103-
104110# Restart networking
105111sudo /etc/init.d/networking restart
106112
@@ -159,24 +165,20 @@ EOF
159165# Install NTP
160166sudo apt-get install -y ntp
161167
162- # Set ntp.ubuntu.com as the direct source of time.
163- # Also provide local time source in case of network interruption.
164- sudo sed -i ' s/server ntp.ubuntu.com/ \
165- server ntp.ubuntu.com \
166- server 0.pool.ntp.org \
167- server 1.pool.ntp.org \
168- server 2.pool.ntp.org \
169- server 127.127.1.0 \
170- fudge 127.127.1.0 stratum 10/g' /etc/ntp.conf
171-
168+ # stop ntp service so we can set the pool to use
172169sudo service ntp stop
173170
174- # initialize local time with value from pool.ntp.org
175- sudo ntpdate pool.ntp.org
171+ # Set ntp.ubuntu.com as the direct source of time.
172+ sudo ntpdate us. pool.ntp.org
176173
177174# restart the NTP service
178175sudo service ntp restart
179176
177+ # Configure MTU on VM interfaces. Also requires manually configuring the same MTU on
178+ # the equivalent 'vboxnet' interfaces on the host. i.e. sudo ip link set dev vboxnet0 mtu $MTU
179+ # sudo ip link set dev eth1 mtu $MTU
180+ # sudo ip link set dev eth2 mtu $MTU
181+
180182# Restart networking
181183sudo /etc/init.d/networking restart
182184
@@ -229,16 +231,18 @@ sudo update-rc.d devstack start 98 2 3 4 5 . stop 02 0 1 6 .
229231
230232# install 'shellinabox' to make using this image on windows easier
231233# shellinabox will be available at http://192.168.27.100:4200
232- sudo apt-get install -y shellinabox
233- sudo sed -i ' s/--no-beep/--no-beep --disable-ssl/g' /etc/default/shellinabox
234- sudo /etc/init.d/shellinabox restart
234+ # sudo apt-get install -y shellinabox
235+ # sudo sed -i 's/--no-beep/--no-beep --disable-ssl/g' /etc/default/shellinabox
236+ # sudo /etc/init.d/shellinabox restart
235237
236238# wait for openstack to startup
237239sleep 60
238240
239241# clean up after ourselves
240242/vagrant/scripts/minimize/clean.sh
241243
244+ sudo rm -rf /var/lib/apt/lists/*
245+
242246sudo btrfs quota enable /var/lib/lxd
243247
244248# restart
0 commit comments