forked from dwalleck/devstack-lxc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaio-lxc.sh
More file actions
executable file
·45 lines (33 loc) · 1.92 KB
/
aio-lxc.sh
File metadata and controls
executable file
·45 lines (33 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Installs an all in one devstack in an LXC container.
# ===================
# All In One Devstack
# ===================
# Install dependencies
apt-get update
apt-get install -qqy git
# ========================
# Create the lxc container
# ========================
~/devstack-lxc/setup-containers.sh devstack-node
# ===================
# All In One Devstack
# ===================
# Install dependencies
lxc-attach -n devstack-node -- bash -c "apt-get update; apt-get install -qqy bsdmainutils git ca-certificates"
# Create the "stack" user to use for installing devstack
node_inet=$( lxc-attach -n devstack-node -- bash -c "ip addr show eth0 | grep 'inet\b'" )
node_ip=$( echo $node_inet | awk '{print $2}' | cut -d/ -f1 )
lxc-attach -n devstack-node -- bash -c "git clone https://github.com/openstack-dev/devstack.git /root/devstack"
lxc-attach -n devstack-node -- bash -c "export HOST_IP=$node_ip; /root/devstack/tools/create-stack-user.sh"
# Configure devstack for an all in one
cp ~/devstack-lxc/controller-local.conf /var/lib/lxc/devstack-node/rootfs/root/devstack/local.conf
sed -ir "s|{ host_ip }|$node_ip|g" /var/lib/lxc/devstack-node/rootfs/root/devstack/local.conf
sed -i 's/MULTI_HOST=1/#MULTI_HOST=1/g' /var/lib/lxc/devstack-node/rootfs/root/devstack/local.conf
# This line below is to remove a line in devstack/functions so devstack
# does not fail when installing in a container
sed -i -e 's/sudo sysctl -w net.bridge.bridge-nf-call-${proto}tables=1/echo "Skipping. This breaks when run in a LXC container."/g' /var/lib/lxc/devstack-node/rootfs/root/devstack/functions
# Copy the devstack directory to opt/stack
lxc-attach -n devstack-node -- bash -c "cp -r /root/devstack /opt/stack"
lxc-attach -n devstack-node -- bash -c "sudo chown -R stack:stack /opt/stack/devstack"
# Run the script to install devstack
lxc-attach -n devstack-node -- bash -c "cd /opt/stack/devstack; sudo -u stack -H sh -c 'export HOST_IP=$node_ip; ./stack.sh' "