forked from dwalleck/devstack-lxc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultinode-vm-lxc.sh
More file actions
executable file
·64 lines (48 loc) · 2.61 KB
/
Copy pathmultinode-vm-lxc.sh
File metadata and controls
executable file
·64 lines (48 loc) · 2.61 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
# Prepare the Devstack config files for the controller and the node
# and copy them to the devstack directory
# ========================
# Create the lxc container
# ========================
~/devstack-lxc/setup-containers.sh devstack-node
# ===============
# Controller Node
# ===============
# 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
container_inet=$( lxc-attach -n devstack-node -- bash -c "ip addr show eth0 | grep 'inet\b'" )
container_ip=$( echo $container_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=$container_ip; /root/devstack/tools/create-stack-user.sh"
# Configure devstack for a controller node
cp ~/devstack-lxc/controller-local.conf /var/lib/lxc/devstack-node/rootfs/root/devstack/local.conf
sed -ir "s|{ host_ip }|$container_ip|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=$container_ip; ./stack.sh' "
# ===============
# Compute Node
# ===============
# Install dependencies
apt-get update
apt-get install -qqy git
# Create the "stack" user used to install devstack
vm_ip=$( ip addr show ens3 | grep 'inet\b' | awk '{print $2}' | cut -d/ -f1 )
git clone https://github.com/openstack-dev/devstack.git /root/devstack
export HOST_IP=$vm_ip
/root/devstack/tools/create-stack-user.sh
# Configure devstack for the compute node
cp ~/devstack-lxc/compute-local.conf /root/devstack/local.conf
sed -ir "s|{ host_ip }|$vm_ip|g" /root/devstack/local.conf
sed -ir "s|{ service_host }|$container_ip|g" /root/devstack/local.conf
# Copy the devstack directory to opt/stack
cp -r /root/devstack /opt/stack
sudo chown -R stack:stack /opt/stack/devstack
# Run the script to install devstack
cd /opt/stack/devstack
sudo -u stack -H sh -c "export HOST_IP=$vm_ip; ./stack.sh"