3 if [[ "congress " == "$INSPECTOR_TYPE" ]]; then
4 die $LINENO "fuel does not support congress yet..."
7 function get_installer_ip {
8 ssh_opts_cpu="$ssh_opts -i instack_key"
9 is_set INSTALLER_IP && return
10 local instack_mac=$(sudo virsh domiflist fuel-master | awk '/fuel1/{print $5}')
11 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk '{print $1}')
12 die_if_not_set $LINENO $INSTALLER_IP "No installer IP"
15 function get_controller_ips {
16 is_set CONTROLLER_IPS && return
18 CONTROLLER_IPS=$(ssh $ssh_opts_cpu root@$INSTALLER_IP \
19 "fuel node | grep controller | cut -d '|' -f 5|xargs")
20 die_if_not_set $LINENO $CONTROLLER_IPS "No controller IPs"
23 function installer_get_ssh_keys {
24 if [[ -e instack_key ]]; then
25 echo "test existing instack_key..."
26 ssh $ssh_opts_cpu root@${INSTALLER_IP} "hostname" && return
28 echo "getting instack_key from fuel node..."
29 sshpass -p r00tme scp $ssh_opts root@${INSTALLER_IP}:.ssh/id_rsa instack_key
30 sudo chown $(whoami):$(whoami) instack_key
34 function installer_apply_patches {
35 if ! openstack flavor show $VM_FLAVOR ; then
36 openstack flavor create --ram 512 --disk 1 $VM_FLAVOR \
37 && touch created_doctor_flavor
40 # TODO(r-mibu): fix the followings in upstream (fuel)
42 for node in $CONTROLLER_IPS;do
43 echo "check controller configuration for doctor ($node)"
44 ssh $ssh_opts_cpu "root@$node" '
47 echo "### apply patches (installer=fuel)"
49 ep_conf=/etc/ceilometer/event_pipeline.yaml
50 entry="- notifier://?topic=alarm.all"
51 if ! grep -q -e "$entry" $ep_conf; then
52 echo "modify the ceilometer config"
53 echo " $entry # added by doctor script" >> $ep_conf
54 service ceilometer-agent-notification restart
57 # TODO(r-mibu): enable this section once congress 4.0.0 is available
59 co_conf=/etc/congress/congress.conf
60 entry="congress.datasources.doctor_driver.DoctorDriver"
61 if ! grep -q -e "^drivers.*$entry" $co_conf; then
62 echo "modify the congress config"
63 sed -i -e "/^drivers/s/$/,$entry # added by doctor script/" \
65 service congress-server restart
68 rule="-m multiport -p tcp --dports 1789"
69 rule+=" -m comment --comment doctor-congress"
71 if ! iptables -C INPUT $rule; then
72 iptables -I INPUT $rule
75 ha_conf=/etc/haproxy/conf.d/180-congress.cfg
76 if [[ ! -e $ha_conf ]]; then
77 sed -e "1i# generated by doctor script" \
79 -e "s/neutron/congress/" \
80 /etc/haproxy/conf.d/085-neutron.cfg > $ha_conf
81 ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart
84 ' > installer_apply_patches_$node.log 2>&1
88 function cleanup_installer_fuel {
89 if [[ -e created_doctor_flavor ]] && openstack flavor show $VM_FLAVOR ; then
90 openstack flavor delete $VM_FLAVOR && rm -f created_doctor_flavor
93 # TODO(r-mibu): fix the followings in upstream (fuel)
95 for node in $CONTROLLER_IPS;do
96 echo "restore controller configuration if touched ($node)"
97 ssh $ssh_opts_cpu "root@$node" '
99 echo "### revert patches (installer=fuel)"
102 # TODO(r-mibu): enable this section once congress 4.0.0 is available
104 ha_conf=/etc/haproxy/conf.d/180-congress.cfg
105 if grep -q "# generated by doctor script" $ha_conf; then
107 ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart
110 rule="-m multiport -p tcp --dports 1789"
111 rule+=" -m comment --comment doctor-congress"
113 if iptables -C INPUT $rule; then
114 iptables -D INPUT $rule
117 co_conf=/etc/congress/congress.conf
118 entry="congress.datasources.doctor_driver.DoctorDriver"
119 if grep -q -e "^drivers.*$entry # added by doctor script" $co_conf; then
120 echo "modify the congress config"
121 sed -i -e "/^drivers/s/^\(.*\),$entry/\1/" $co_conf
122 service congress-server restart
126 ep_conf=/etc/ceilometer/event_pipeline.yaml
127 if grep -q "# added by doctor script" $ep_conf; then
128 sed -ie "/# added by doctor script/d" $ep_conf
129 service ceilometer-agent-notification restart
131 ' >> installer_apply_patches_$node.log 2>&1