-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup_openstack.sh
executable file
·110 lines (87 loc) · 4.93 KB
/
setup_openstack.sh
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
. config.sh
set -x
set -e
if [ ! -f /root/.ssh/id_rsa ]; then
ssh-keygen -f /root/.ssh/id_rsa -t rsa -N ''
fi
#echo $controller_pub_key >> /root/.ssh/authorized_keys
xe network-param-set uuid=$(xe network-list bridge=xenbr0 --minimal) MTU=$host_mtu
ifconfig eth0 mtu $host_mtu
ifconfig xenbr0 mtu $host_mtu
xe pif-reconfigure-ip mode=static uuid=$(xe pif-list device=vif1.4 --minimal) IP=10.8.1.$IPSUFFIX netmask=255.255.255.0
xe network-param-set uuid=$(xe network-list bridge=brvif1.4 --minimal) MTU=$guest_mtu
xe pif-unplug uuid=$(xe pif-list device=vif1.4 --minimal)
xe pif-plug uuid=$(xe pif-list device=vif1.4 --minimal)
xe pif-reconfigure-ip mode=static uuid=$(xe pif-list device=vif1.5 --minimal) IP=10.8.8.$IPSUFFIX netmask=255.255.255.0
xe network-param-set uuid=$(xe network-list bridge=brvif1.5 --minimal) MTU=$guest_mtu
xe pif-unplug uuid=$(xe pif-list device=vif1.5 --minimal)
xe pif-plug uuid=$(xe pif-list device=vif1.5 --minimal)
xe pif-reconfigure-ip mode=static uuid=$(xe pif-list device=vif1.6 --minimal) IP=10.8.9.$IPSUFFIX netmask=255.255.255.0
xe network-param-set uuid=$(xe network-list bridge=brvif1.6 --minimal) MTU=$guest_mtu
xe pif-unplug uuid=$(xe pif-list device=vif1.6 --minimal)
xe pif-plug uuid=$(xe pif-list device=vif1.6 --minimal)
xe host-management-reconfigure pif-uuid=$(xe pif-list device=vif1.4 --minimal)
xe vm-destroy uuid=$(xe vm-list name-label=dummy --minimal)
iptables -t nat -I POSTROUTING -o xenbr0 -j MASQUERADE
iptables -I FORWARD -i xenbr0 -o brvif1.4 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -i brvif1.4 -j ACCEPT
iptables -I FORWARD -i xenbr0 -o brvif1.5 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -i brvif1.5 -j ACCEPT
iptables -I FORWARD -i xenbr0 -o brvif1.6 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -i brvif1.6 -j ACCEPT
service iptables save
#setup tunnels
cd $BASE
python build_bridges.py
if [ "$is_gateway" = true ]; then
python build_gateway_bridges.py
fi
#python set_tunnels.py $local_ip tunnels.txt
echo -e "$host_passwd\n$host_passwd" | (passwd --stdin root)
cd $TEMP
#git clone --depth=1 $GIT_OPENSTACK
#cd devstack
#git apply $BASE/supercloud.patch
wget http://supercloud.cs.cornell.edu/downloads/devstack-stable-newton.zip
unzip devstack-stable-newton.zip
cd devstack-stable-newton
patch -p1 <$BASE/supercloud.patch
dom0_key=$(cat /root/.ssh/id_rsa.pub)
sed -c -i "s:ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2e7W2aCIC4DXyA3buZb32QnsVl45PCFmwESfCBkD8rubtF7ySCZ7V7r3tyMaYuFVpnzp5QjZnlKvUuOhrm1UWDBh+QbsU5pMNTPdv0HCd/4fyNYzh39CQfCCSThhbDCwjl7WKhaZXkSft2DLcegjGx7f+R1GUSYO0ZH0iuRwi56ZHuqTjBnsoNER6LRArkN/AoCTDWPJJLtaKyRZUpnSt5l7fReHhPhN/S8nQ6snkrgN6lirC1NFTYPmtm4AerTjFc4dH4pY96Gc1GK1IJwpca9FSC/KVkqx9XynOOhtt2Ek4PKUZiL1R2Oj3+pSz/BpVmu2aZJUhb7KEpAigpWSMQ== root@xenserver243:$dom0_key:" tools/xen/prepare_guest.sh
sed -c -i "s/10.8.1.100/10.8.1.$IPSUFFIX/" local.conf
sed -c -i "s/OPENSTACK_PASSWD/$openstack_passwd/" local.conf
sed -c -i "s/GUEST_PASSWD/$guest_passwd/" local.conf
sed -c -i "s/HOST_PASSWD/$host_passwd/" local.conf
if [ "$is_compute" = true ]; then
sed -c -i 's/#DATABASE_TYPE=mysql/DATABASE_TYPE=mysql/' local.conf
sed -c -i 's/#SERVICE_HOST=10.8.1.150/SERVICE_HOST=10.8.1.150/' local.conf
sed -c -i 's/#MYSQL_HOST=10.8.1.150/MYSQL_HOST=10.8.1.150/' local.conf
sed -c -i 's/#RABBIT_HOST=10.8.1.150/RABBIT_HOST=10.8.1.150/' local.conf
sed -c -i 's/#GLANCE_HOSTPORT=10.8.1.150:9292/GLANCE_HOSTPORT=10.8.1.150:9292/' local.conf
sed -c -i 's/#ENABLED_SERVICES/ENABLED_SERVICES/' local.conf
sed -c -i 's/#NOVA_VNC_ENABLED=True/NOVA_VNC_ENABLED=True/' local.conf
sed -c -i 's/#NOVNCPROXY_URL/NOVNCPROXY_URL/' local.conf
sed -c -i 's/#VNCSERVER_LISTEN/VNCSERVER_LISTEN/' local.conf
fi
sed -c -i "s/DevStack-master/$GUEST_NAME/" tools/xen/xenrc
if [ "$is_compute" = true ]; then
sed -c -i "s/OSDOMU_MEM_MB=6144/OSDOMU_MEM_MB=2048/" tools/xen/xenrc
sed -c -i "s/OSDOMU_VDI_GB=15/OSDOMU_VDI_GB=8/" tools/xen/xenrc
#else
# sed -c -i "s/OSDOMU_VDI_GB=15/OSDOMU_VDI_GB=20/" tools/xen/xenrc
fi
sed -c -i "s/.150/.$GUEST_IPSUFFIX/" tools/xen/xenrc
sed -c -i "s/128.253.180.2/$NAMESERVER/" tools/xen/xenrc
sed -c -i "s/\"GATEWAY\"/\"10.8.1.$IPSUFFIX\"/" tools/xen/xenrc
sed -c -i "s/\"GUEST_MTU\"/\"$guest_mtu\"/" tools/xen/xenrc
sed -c -i "s/GATEWAY/10.8.1.$IPSUFFIX/" tools/xen/build_xva.sh
sed -c -i "s/128.253.180.2/$NAMESERVER/" tools/xen/build_xva.sh
sed -c -i "s/mtu 1400/mtu $guest_mtu/" tools/xen/build_xva.sh
#cd tools/xen/
#./install_os_domU.sh
cp -np $BASE/xenserver-core/plugins/* /usr/lib/xapi/plugins/
set +x
#echo "Check default gateway, mtu and nameserver in xenrc and build_xva.sh. You may want to adjust the disk size of the VM. Then run cd $TEMP/devstack-stable-newton/tools/xen/; ./install_os_domU.sh"
echo "Check default gateway, mtu and nameserver in xenrc and build_xva.sh. You may want to adjust the disk size of the VM. Then run import_master.sh or import_compute.sh"
echo "Stage 3 finished."