15
15
export OS_REGION_NAME=...
16
16
export OS_TENANT_NAME=...
17
17
export OS_AUTH_URL=...
18
export OS_USERNAME=...
18
export OS_USERNAME=...
19
19
export OS_PASSWORD=...
21
export IMAGE_USER=fedora
21
23
Allocate 5 floating IPs. For the purposes of the setup instructions
22
(and probably your sanity), they need to be consecutive and should
23
ideally start with a multiple of 10. Below we will assume
24
(and probably your sanity), they need to be consecutive and to remain
25
sane, should ideally start with a multiple of 10. Below we will assume
26
for n in 1 2 3 4 5; do nova floating-ip-create; done
28
for n in `seq 1 5`; do nova floating-ip-create; done
28
30
Create some variables based on the IP addresses nova created for you:
54
69
Create helper scripts on a local host
56
71
cat << END > ./master.sh
58
73
echo export OS_REGION_NAME=$OS_REGION_NAME >> ~/.bashrc
59
74
echo export OS_TENANT_NAME=$OS_TENANT_NAME >> ~/.bashrc
60
75
echo export OS_AUTH_URL=$OS_AUTH_URL >> ~/.bashrc
61
76
echo export OS_USERNAME=$OS_USERNAME >> ~/.bashrc
62
77
echo export OS_PASSWORD=$OS_PASSWORD >> ~/.bashrc
64
79
function nth_ipaddr() {
65
echo $IP_BASE | awk -F. -v offset=\$1 '{ printf "%s.%s.%s.%s\n", \$1, \$2, \$3, \$4 + offset }'
80
echo $IP_BASE | awk -F. -v offset=\$1 '{ printf "%s.%s.%s.%s\n", \$1, \$2, \$3, \$4 + offset }'
68
83
yum install -y python-novaclient git screen pdsh pdsh-mod-dshgroup
70
git clone git://github.com/beekhof/fence_openstack.git
85
git clone --depth 0 git://github.com/beekhof/fence_openstack.git
71
86
ln -s /root/fence_openstack/fence_openstack /sbin
73
88
mkdir -p /root/.dsh/group/
74
89
echo export cluster_name=openstack >> ~/.bashrc
76
91
rm -f /root/.dsh/group/openstack
92
for n in `seq 1 4`; do
78
93
echo "cluster-\$n" >> /root/.dsh/group/openstack
79
94
echo \`nth_ipaddr \$n\` cluster-\$n >> /etc/hosts
82
97
cat << EOF >> /root/.ssh/config
83
Host \`echo $IP_BASE | awk -F. '{ printf "%s.%s.%s.*", \$1, \$2, \$3 }'\`
98
Host cts-master \`echo $IP_BASE | awk -F. '{ printf "%s.%s.%s.*", \$1, \$2, \$3 }'\`
85
100
IdentityFile ~/.ssh/cluster
89
IdentityFile ~/.ssh/cluster
105
Some images do not allow root to log in by default and insist on a
106
'fedora' user. Create a script to disable this "feature":
96
108
cat << EOF > fix-guest.sh
98
110
# Re-allow root to log in
99
111
sudo sed -i s/.*ssh-/ssh-/ /root/.ssh/authorized_keys
102
## CTS master (Fedora-17)
114
## CTS master (Fedora-18)
104
116
Create and update the master
106
nova boot --poll --image "Fedora 17" --key_name Cluster --flavor m1.tiny cts-master
118
nova boot --poll --image "Fedora 18" --key_name Cluster --flavor m1.tiny cts-master
107
119
nova add-floating-ip cts-master `nth_ipaddr 0`
109
Some images do not allow root to log in by default and insist on a 'stack' user.
110
Disable this "feature".
121
If your image does not allow root to log in by default, disable this
122
"feature" with the script we created earlier:
112
scp fix-guest.sh stack@cts-master:
113
ssh -l stack -t cts-master -- bash ./fix-guest.sh
124
scp fix-guest.sh $IMAGE_USER@cts-master:
125
ssh -l $IMAGE_USER -t cts-master -- bash ./fix-guest.sh
115
127
Now we can set up the CTS master with the script we created earlier:
117
scp ~/.ssh/cluster root@cts-master:.ssh/id_rsa
118
scp master.sh root@cts-master:
119
ssh root@cts-master -- bash ./master.sh
121
## Create Guest Base Image
123
Create a guest that we can tweak
125
nova boot --poll --image "Fedora 18 Alpha" --key_name Cluster --flavor m1.tiny TempGuest
126
nova add-floating-ip TempGuest `nth_ipaddr 1`
127
scp fix-guest.sh stack@`nth_ipaddr 1`:
129
Create snapshot with our changes called Fedora-18-base
131
nova image-create --poll TempGuest Fedora-18-base
133
Release the IP and delete the temporary guest
135
nova remove-floating-ip TempGuest `nth_ipaddr 1`
136
nova delete TempGuest
129
scp ~/.ssh/cluster cts-master:.ssh/id_rsa
130
scp master.sh cts-master:
131
ssh cts-master -- bash ./master.sh
133
### Create the Guests
140
135
First create the guests
143
nova boot --poll --image Fedora-18-base --key_name Cluster --flavor m1.tiny cluster-$n;
137
for n in `seq 1 4`; do
138
nova boot --poll --image "Fedora 18" --key_name Cluster --flavor m1.tiny cluster-$n;
144
139
nova add-floating-ip cluster-$n `nth_ipaddr $n`
162
160
Switch to the CTS master
164
ssh -l root cts-master
166
164
Clone Pacemaker for the latest version of CTS:
168
git clone git://github.com/ClusterLabs/pacemaker.git
169
echo 'export PATH=\$PATH:/root/pacemaker/extra::/root/pacemaker/cts' >> ~/.bashrc
166
git clone --depth 0 git://github.com/ClusterLabs/pacemaker.git
167
echo 'export PATH=$PATH:/root/pacemaker/extra:/root/pacemaker/cts' >> ~/.bashrc
168
echo alias c=\'cluster-helper\' >> ~/.bashrc
171
Now set up CTS to run from the local source tree
171
Now set up CTS to run from the local source tree
175
175
Configure a cluster (this will install all needed packages and configure corosync on the guests in the $cluster_name group)
177
cluster-init -g openstack --yes --unicast fedora-17
177
cluster-init -g openstack --yes --unicast --hosts fedora-18