forked from dwalleck/devstack-lxc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultinode-lxc.sh
More file actions
executable file
·66 lines (49 loc) · 3.39 KB
/
multinode-lxc.sh
File metadata and controls
executable file
·66 lines (49 loc) · 3.39 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Prepare the Devstack config files for the controller and Compute nodes
# and copy them to the devstack directory
# =========================
# Create the lxc containers
# =========================
~/devstack-lxc/setup-containers.sh
# ===============
# Controller Node
# ===============
# Install dependencies
lxc-attach -n controller-node -- bash -c "apt-get update; apt-get install -qqy bsdmainutils git ca-certificates"
# Create the "stack" user to use for installing devstack
controller_inet=$( lxc-attach -n controller-node -- bash -c "ip addr show eth0 | grep 'inet\b'" )
controller_ip=$( echo $controller_inet | awk '{print $2}' | cut -d/ -f1 )
lxc-attach -n controller-node -- bash -c "git clone https://github.com/openstack-dev/devstack.git /root/devstack"
lxc-attach -n controller-node -- bash -c "export HOST_IP=$controller_ip; /root/devstack/tools/create-stack-user.sh"
# Configure devstack for a controller node
cp ~/devstack-lxc/controller-local.conf /var/lib/lxc/controller-node/rootfs/root/devstack/local.conf
sed -ir "s|{ host_ip }|$controller_ip|g" /var/lib/lxc/controller-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/controller-node/rootfs/root/devstack/functions
# Copy the devstack directory to opt/stack
lxc-attach -n controller-node -- bash -c "cp -r /root/devstack /opt/stack"
lxc-attach -n controller-node -- bash -c "sudo chown -R stack:stack /opt/stack/devstack"
# Run the script to install devstack
lxc-attach -n controller-node -- bash -c "cd /opt/stack/devstack; sudo -u stack -H sh -c 'export HOST_IP=$controller_ip; ./stack.sh' "
# ===============
# Compute Node
# ===============
# Install dependencies
lxc-attach -n compute-node -- bash -c "apt-get update; apt-get install -qqy bsdmainutils git ca-certificates"
# Create the "stack" user to use for installing devstack
compute_inet=$( lxc-attach -n compute-node -- bash -c "ip addr show eth0 | grep 'inet\b'" )
compute_ip=$( echo $compute_inet | awk '{print $2}' | cut -d/ -f1 )
lxc-attach -n compute-node -- bash -c "git clone https://github.com/openstack-dev/devstack.git /root/devstack"
lxc-attach -n compute-node -- bash -c "export HOST_IP=$compute_ip; /root/devstack/tools/create-stack-user.sh"
# Configure devstack for a compute node
cp ~/devstack-lxc/compute-local.conf /var/lib/lxc/compute-node/rootfs/root/devstack/local.conf
sed -ir "s|{ service_host }|$controller_ip|g" /var/lib/lxc/compute-node/rootfs/root/devstack/local.conf
sed -ir "s|{ host_ip }|$compute_ip|g" /var/lib/lxc/compute-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/compute-node/rootfs/root/devstack/functions
# Copy the devstack directory to opt/stack
lxc-attach -n compute-node -- bash -c "cp -r /root/devstack /opt/stack"
lxc-attach -n compute-node -- bash -c "sudo chown -R stack:stack /opt/stack/devstack"
# Run the script to install devstack
lxc-attach -n compute-node -- bash -c "cd /opt/stack/devstack; sudo -u stack -H sh -c 'export HOST_IP=$compute_ip; ./stack.sh' "