@@ -19,34 +19,22 @@ export DEBIAN_FRONTEND=noninteractive
1919echo export LC_ALL=en_US.UTF-8 >> ~ /.bash_profile
2020echo export LANG=en_US.UTF-8 >> ~ /.bash_profile
2121
22- # Don't automatically install recommended or suggested packages
23- sudo mkdir -p /etc/apt/apt.config.d
24- sudo echo ' APT::Install-Recommends "0";' | sudo tee --append /etc/apt/apt.config.d/99local > /dev/null
25- sudo echo ' APT::Install-Suggests "0";' | sudo tee --append /etc/apt/apt.config.d/99local > /dev/null
26-
27- # Add software repository
28- which add-apt-repository || (sudo apt-get -qqy update ; sudo apt-get -qqy install software-properties-common)
29- # sudo add-apt-repository ppa:ubuntu-cloud-archive/liberty-staging
30- sudo add-apt-repository cloud-archive:liberty
31- # sudo add-apt-repository ppa:ubuntu-lxc/stable
32- # sudo add-apt-repository ppa:ubuntu-lxc/lxcfs-stable
33- # sudo add-apt-repository ppa:ubuntu-lxc/cgmanager-stable
34- # sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
35- # comment above ppa and uncomment below to get development lxd builds
36- sudo add-apt-repository ppa:ubuntu-lxc/lxd-git-master
37- sudo apt-get -qqy update
38- sudo apt-get -qqy install python-pip python-dev git libvirt-bin # cgroup-lite cgmanager libpam-cgm
39- sudo pip install -U pbr
40- sudo pip install -U pip
41- # sudo pip install -U requests==2.5.3
42- sudo pip install -U requests==2.8.1
22+ echo Updating...
23+ sudo apt-get -y update
24+ sudo apt-get install -y zfsutils-linux git
4325
44- # for barbican support
45- sudo pip install ' uwsgi'
46- sudo chmod +x /usr/local/bin/uwsgi
26+ echo Creating ZFS for lxd
27+ sudo zpool create -m /lxd -f lxd sdb
28+ sudo apt-get install -y lxd
29+ sudo lxd init --auto --storage-backend zfs --storage-pool lxd
4730
48- sudo update-alternatives --install /bin/sh sh /bin/bash 100
31+ sudo apt-get install -y python-pip
32+ sudo pip install -U os-testr
33+ sudo pip install -U pbr
34+ sudo apt-get install python-setuptools
35+ sudo easy_install pip
4936
37+ echo configuring swap...
5038# We need swap space to do any sort of scale testing with the Vagrant config.
5139# Without this, we quickly run out of RAM and the kernel starts whacking things.
5240sudo rm -f /swapfile
@@ -61,6 +49,7 @@ sudo echo "/swapfile none swap sw 0 0" | sudo tee --append /etc/fst
6149# Disable firewall (this is not production)
6250sudo ufw disable
6351
52+ echo Configuring networking....
6453# To permit IP packets pass through different networks,
6554# the network card should be configured with routing capability.
6655sudo echo " net.ipv4.ip_forward = 1" | sudo tee --append /etc/sysctl.conf > /dev/null
@@ -72,7 +61,7 @@ sudo echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee --append /etc/sysctl.co
7261sudo sysctl -p
7362
7463# allow OpenStack nodes to route packets out through NATed network on HOST (this is the vagrant managed nic)
75- sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
64+ sudo iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
7665
7766# Update host configuration
7867sudo bash -c " echo 'openstack' > /etc/hostname"
@@ -92,25 +81,22 @@ reboot 0;
9281select-timeout 0;
9382initial-interval 1;
9483backoff-cutoff 2;
95- link-timeout 10;
96- interface "eth0"
84+ interface "enp0s3"
9785{
98- #supersede host-name "openstack";
99- #supersede domain-name "stackinabox.io";
10086 prepend domain-name-servers 192.168.27.1, 8.8.8.8, 8.8.4.4;
101- request subnet-mask,
102- broadcast-address,
103- time-offset,
87+ request subnet-mask,
88+ broadcast-address,
89+ time-offset,
10490 routers,
105- domain-name,
106- domain-name-servers,
91+ domain-name,
92+ domain-name-servers,
10793 host-name,
108- netbios-name-servers,
94+ netbios-name-servers,
10995 netbios-scope;
11096}
11197EOF
11298
113- # enable cgroup memory limits
99+ echo enable cgroup memory limits
114100sudo sed -i ' s/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 /g' /etc/default/grub
115101sudo sed -i ' s/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1 /g' /etc/default/grub
116102sudo update-grub
@@ -120,135 +106,64 @@ echo "Cloning DevStack repo from branch \"${RELEASE_BRANCH}\""
120106sudo mkdir -p /opt/stack
121107sudo chown -R vagrant:vagrant /opt/stack
122108git clone https://git.openstack.org/openstack-dev/devstack.git /opt/stack/devstack -b " ${RELEASE_BRANCH} "
123-
109+ # need to do below to stop devstack failing on test-requirements for lxd
110+ echo " Cloning nova-lxd repo from branch \" ${RELEASE_BRANCH} \" "
111+ git clone https://github.com/openstack/nova-lxd /opt/stack/nova-lxd -b " ${RELEASE_BRANCH} "
112+ rm -f /opt/stack/nova-lxd/test-requirements.txt
124113# add local.conf to /opt/devstack folder
125114cp /vagrant/scripts/stackinabox/local.conf /opt/stack/devstack/
126115
127- # update RELEASE_BRANCH variable in local.conf to match existing
116+ # update RELEASE_BRANCH variable in local.conf to match existing
128117# (use '@' as delim in sed b/c $RELEASE_BRANCH may contain '/')
129118sed -i " s@RELEASE_BRANCH=@RELEASE_BRANCH=$RELEASE_BRANCH @" /opt/stack/devstack/local.conf
130119
131120# don't assign IP to eth2 yet
132- sudo ifconfig eth2 0.0.0.0
133- sudo ifconfig eth2 promisc
134- sudo ip link set dev eth2 up
135-
121+ sudo ifconfig enp0s9 0.0.0.0
122+ sudo ifconfig enp0s9 promisc
123+ sudo ip link set dev enp0s9 up
136124# gentelmen start your engines
137125echo " Installing DevStack"
138126cd /opt/stack/devstack
139127./stack.sh
140- echo " Finished installing DevStack"
128+ if [ $? -eq 0 ]
129+ then
130+ echo " Finished installing DevStack"
131+ else
132+ echo " Error installing DevStack"
133+ exit $?
134+ fi
141135
142136# bridge eth2 to ovs for our public network
143- sudo ovs-vsctl add-port br-ex eth2
137+ sudo ovs-vsctl add-port br-ex enp0s9
144138sudo ifconfig br-ex promisc up
145139
146140# assign ip from public network to bridge (br-ex)
147141sudo bash -c ' cat >> /etc/network/interfaces' << 'EOF '
148-
149- auto eth2
150- iface eth2 inet manual
142+ auto enp0s9
143+ iface enp0s9 inet manual
151144 address 0.0.0.0
152145 up ifconfig $IFACE 0.0.0.0 up
153146 up ip link set $IFACE promisc on
154147 down ip link set $IFACE promisc off
155148 down ifconfig $IFACE down
156149
157- auto br-ex
158- iface br-ex inet static
159- address 172.24.4.2
160- netmask 255.255.255.0
161- up ip link set $IFACE promisc on
162- down ip link set $IFACE promisc off
150+ auto br-ex
151+ iface br-ex inet static
152+ address 172.24.4.2
153+ netmask 255.255.255.0
154+ up ip link set $IFACE promisc on
155+ down ip link set $IFACE promisc off
163156EOF
164157
165- # Install NTP
166- # disabling b/c slow seed times at system startup are causing problems
167- # sudo apt-get install -qqy ntp
168-
169- # Configure MTU on VM interfaces. Also requires manually configuring the same MTU on
170- # the equivalent 'vboxnet' interfaces on the host. i.e. sudo ip link set dev vboxnet0 mtu $MTU
171- sudo ip link set dev eth1 mtu $MTU
172- sudo ip link set dev eth2 mtu $MTU
173-
174- # Restart networking
175- sudo /etc/init.d/networking restart
176-
177- # source openrc for openstack connection variables
178- source /opt/stack/devstack/openrc demo demo
179-
180- # add DNS nameserver entries to "private" subnet in 'demo' tenant
181- echo " Updating dns_nameservers on the 'demo' tenant's private subnet"
182- neutron subnet-update private-subnet --dns_nameservers list=true 8.8.8.8 8.8.4.4
183-
184- # Heat needs to launch instances with a keypair, lets generate a 'default' keypair
185- echo " Generating new keypair for the 'demo' tenant in /home/vagrant"
186- nova keypair-add demo_key > ~ /demo_key.priv
187- chmod 400 ~ /demo_key.priv
188-
189- # source openrc with admin privledges
190- source /opt/stack/devstack/openrc admin admin
158+ sudo ip link set dev enp0s3 mtu $MTU
159+ sudo ip link set dev enp0s8 mtu $MTU
191160
192- # allow ssh access to instances deployed with the 'default' security group
193- nova secgroup-add-group-rule default default tcp 22 22
194-
195- # delete the invisible_to_admin tenant (not needed)
196- keystone tenant-delete invisible_to_admin
197-
198- # add lxd compatible images to openstack
199- echo " Adding LXD compatible images to OpenStack"
200-
201- mkdir -p /vagrant/images
202- cd /vagrant/images
203- # rm -rf ./*
204-
205- # wget -nv https://github.com/tpouyer/lxc-cloud-images/releases/download/stable%2Fliberty/lxc-cloud-images.tar.xz
206- # tar -xf lxc-cloud-images.tar.xz
207-
208- chmod 755 import-images.sh
209- ./import-images.sh
210-
211- # give vagrant user lxd permissions
212- sudo chown -R lxd:lxd /var/lib/lxd
213- sudo chmod -R go+rwxt /var/lib/lxd
214- sudo usermod -a -G lxd vagrant
215- newgrp lxd
216-
217- # add devstack to init.d so it will automatically start/stop with the machine
218161cp /vagrant/scripts/stackinabox/stack-noscreenrc /opt/stack/devstack/stack-noscreenrc
219162chmod 755 /opt/stack/devstack/stack-noscreenrc
220163sudo cp /vagrant/scripts/stackinabox/devstack2 /etc/init.d/devstack
221164sudo chmod +x /etc/init.d/devstack
222165sudo update-rc.d devstack start 98 2 3 4 5 . stop 02 0 1 6 .
223166
224- # install 'shellinabox' to make using this image on windows easier
225- # shellinabox will be available at http://192.168.27.100:4200
226- sudo apt-get install -y shellinabox
227- sudo sed -i ' s/--no-beep/--no-beep --disable-ssl/g' /etc/default/shellinabox
228- sudo /etc/init.d/shellinabox restart
229-
230- # install java (for use with udclient)
231- wget http://artifacts.stackinabox.io/ibm/java-jre/latest.txt
232- ARTIFACT_VERSION=$( cat latest.txt)
233- ARTIFACT_DOWNLOAD_URL=http://artifacts.stackinabox.io/ibm/java-jre/$ARTIFACT_VERSION /ibm-java-jre-$ARTIFACT_VERSION -linux-x86_64.tgz
234-
235- sudo mkdir -p /opt/java
236- sudo wget $ARTIFACT_DOWNLOAD_URL
237- sudo tar -zxf ibm-java-jre-$ARTIFACT_VERSION -linux-x86_64.tgz -C /opt/java/
238- sudo touch /etc/profile.d/java_home.sh
239- sudo bash -c ' cat >> /etc/profile.d/java_home.sh' << 'EOF '
240- export JAVA_HOME=/opt/java/ibm-java-x86_64-71/jre
241- export PATH=$JAVA_HOME/bin:$PATH
242- EOF
243- sudo chmod 755 /etc/profile.d/java_home.sh
244-
245- sudo btrfs quota enable /var/lib/lxd
246-
247- # wait for openstack to startup
248- sleep 60
249-
250- # clean up after ourselves
251- /vagrant/scripts/minimize/clean.sh
252-
253- # restart
254- # sudo shutdown -P now
167+ cp /vagrant/scripts/stackinabox/admin-openrc.sh /home/vagrant
168+ cp /vagrant/scripts/stackinabox/demo-openrc.sh /home/vagrant
169+ exit 0
0 commit comments