Skip to content

Commit 0f6e037

Browse files
authored
Merge pull request #6 from stackinabox/xenial-mitaka
Xenial and mitaka updates
2 parents 4ca7fb6 + 4283f90 commit 0f6e037

File tree

10 files changed

+212
-251
lines changed

10 files changed

+212
-251
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# To use an OpenStack cloud you need to authenticate against the Identity
4+
# service named keystone, which returns a **Token** and **Service Catalog**.
5+
# The catalog contains the endpoints for all services the user/tenant has
6+
# access to - such as Compute, Image Service, Identity, Object Storage, Block
7+
# Storage, and Networking (code-named nova, glance, keystone, swift,
8+
# cinder, and neutron).
9+
#
10+
# *NOTE*: Using the 2.0 *Identity API* does not necessarily mean any other
11+
# OpenStack API is version 2.0. For example, your cloud provider may implement
12+
# Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is
13+
# only for the Identity API served through keystone.
14+
export OS_AUTH_URL=http://192.168.27.100:5000/v2.0
15+
16+
# With the addition of Keystone we have standardized on the term **tenant**
17+
# as the entity that owns the resources.
18+
export OS_TENANT_NAME="admin"
19+
20+
# unsetting v3 items in case set
21+
unset OS_PROJECT_ID
22+
unset OS_PROJECT_NAME
23+
unset OS_USER_DOMAIN_NAME
24+
25+
# In addition to the owning entity (tenant), OpenStack stores the entity
26+
# performing the action as the **user**.
27+
export OS_USERNAME="admin"
28+
29+
# With Keystone you pass the keystone password.
30+
export OS_PASSWORD=$1
31+
32+
# If your configuration has multiple regions, we set that information here.
33+
# OS_REGION_NAME is optional and only valid in certain environments.
34+
export OS_REGION_NAME="RegionOne"
35+
# Don't leave a blank variable, unset it if it was empty
36+
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi

scripts/stackinabox/demo-openrc.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
# To use an OpenStack cloud you need to authenticate against the Identity
4+
# service named keystone, which returns a **Token** and **Service Catalog**.
5+
# The catalog contains the endpoints for all services the user/tenant has
6+
# access to - such as Compute, Image Service, Identity, Object Storage, Block
7+
# Storage, and Networking (code-named nova, glance, keystone, swift,
8+
# cinder, and neutron).
9+
#
10+
# *NOTE*: Using the 2.0 *Identity API* does not necessarily mean any other
11+
# OpenStack API is version 2.0. For example, your cloud provider may implement
12+
# Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is
13+
# only for the Identity API served through keystone.
14+
export OS_AUTH_URL=http://192.168.27.100:5000/v2.0
15+
16+
# With the addition of Keystone we have standardized on the term **tenant**
17+
# as the entity that owns the resources.
18+
#export OS_TENANT_ID=c1e0fda04ee84148aa916ec32ca4ecca
19+
export OS_TENANT_NAME="demo"
20+
21+
# unsetting v3 items in case set
22+
unset OS_PROJECT_ID
23+
unset OS_PROJECT_NAME
24+
unset OS_USER_DOMAIN_NAME
25+
26+
# In addition to the owning entity (tenant), OpenStack stores the entity
27+
# performing the action as the **user**.
28+
export OS_USERNAME="demo"
29+
30+
# With Keystone you pass the keystone password.
31+
export OS_PASSWORD=$1
32+
33+
# If your configuration has multiple regions, we set that information here.
34+
# OS_REGION_NAME is optional and only valid in certain environments.
35+
export OS_REGION_NAME="RegionOne"
36+
# Don't leave a blank variable, unset it if it was empty
37+
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi

scripts/stackinabox/devstack2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
start() {
1212

1313
# allow OpenStack nodes to route packets out to NATed network on HOST
14-
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
14+
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
1515

1616
# attach stack-volumes
1717
losetup /dev/loop0 /opt/stack/data/stack-volumes-default-backing-file

scripts/stackinabox/init.sh

Lines changed: 52 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,22 @@ export DEBIAN_FRONTEND=noninteractive
1919
echo export LC_ALL=en_US.UTF-8 >> ~/.bash_profile
2020
echo 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.
5240
sudo 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)
6250
sudo 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.
6655
sudo 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
7261
sudo 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
7867
sudo bash -c "echo 'openstack' > /etc/hostname"
@@ -92,25 +81,22 @@ reboot 0;
9281
select-timeout 0;
9382
initial-interval 1;
9483
backoff-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
}
11197
EOF
11298

113-
# enable cgroup memory limits
99+
echo enable cgroup memory limits
114100
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 /g' /etc/default/grub
115101
sudo sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1 /g' /etc/default/grub
116102
sudo update-grub
@@ -120,135 +106,64 @@ echo "Cloning DevStack repo from branch \"${RELEASE_BRANCH}\""
120106
sudo mkdir -p /opt/stack
121107
sudo chown -R vagrant:vagrant /opt/stack
122108
git 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
125114
cp /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 '/')
129118
sed -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
137125
echo "Installing DevStack"
138126
cd /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
144138
sudo ifconfig br-ex promisc up
145139

146140
# assign ip from public network to bridge (br-ex)
147141
sudo 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
163156
EOF
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
218161
cp /vagrant/scripts/stackinabox/stack-noscreenrc /opt/stack/devstack/stack-noscreenrc
219162
chmod 755 /opt/stack/devstack/stack-noscreenrc
220163
sudo cp /vagrant/scripts/stackinabox/devstack2 /etc/init.d/devstack
221164
sudo chmod +x /etc/init.d/devstack
222165
sudo 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

scripts/stackinabox/local.conf

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
IP_VERSION=4
77
SERVICE_IP_VERSION=4
88
SERVICE_HOST=192.168.27.100
9-
HOST_IP_IFACE=eth1
9+
HOST_IP_IFACE=enp0s8
1010
HOST_IP=192.168.27.100
1111
PUBLIC_NETWORK_GATEWAY=172.24.4.2
1212
FLOATING_RANGE=172.24.4.0/24
1313
Q_FLOATING_ALLOCATION_POOL=start=172.24.4.3,end=172.24.4.254
1414

15+
1516
FORCE=yes
1617
RECLONE=False
1718
OFFLINE=False
@@ -36,9 +37,7 @@ STACK_USER=vagrant
3637
#
3738
# Use LXD Virtualization Driver
3839
#
39-
enable_plugin nova-lxd https://github.com/tpouyer/nova-lxd.git merging
40-
#PYLXD_BRANCH=0.19
41-
#enable_plugin nova-lxd https://github.com/lxc/nova-lxd.git
40+
enable_plugin nova-lxd https://github.com/openstack/nova-lxd "stable/mitaka"
4241

4342
GIT_BASE=https://github.com
4443
DEVSTACK_INSTALL_DIR=/opt/stack/devstack
@@ -179,13 +178,6 @@ enable_service horizon
179178
#
180179
disable_service tempest
181180

182-
#enable_plugin designate https://git.openstack.org/openstack/designate
183-
184-
#enable_plugin kuryr http://git.openstack.org/openstack/kuryr
185-
#enable_service kuryr
186-
#enable_service etcd-server
187-
#enable_service docker-engine
188-
189181
#
190182
# set current branch
191183
#

0 commit comments

Comments
 (0)