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
11 instack_mac=$(sudo virsh domiflist fuel-master | awk '/fuel1/{print $5}')
12 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk '{print $1}')
13 die_if_not_set $LINENO INSTALLER_IP "No installer IP"
16 function get_controller_ips {
17 is_set CONTROLLER_IPS && return
19 CONTROLLER_IPS=$(ssh $ssh_opts_cpu root@$INSTALLER_IP \
20 "fuel node | grep controller | cut -d '|' -f 5|xargs")
21 die_if_not_set $LINENO CONTROLLER_IPS "No controller IPs"
24 function installer_get_ssh_keys {
25 if [[ -e instack_key ]]; then
26 echo "test existing instack_key..."
27 ssh $ssh_opts_cpu root@${INSTALLER_IP} "hostname" && return
29 echo "getting instack_key from fuel node..."
30 sshpass -p r00tme scp $ssh_opts root@${INSTALLER_IP}:.ssh/id_rsa instack_key
31 sudo chown $(whoami):$(whoami) instack_key
35 function installer_apply_patches {
36 if ! openstack flavor show $VM_FLAVOR ; then
37 openstack flavor create --ram 512 --disk 1 $VM_FLAVOR \
38 && touch created_doctor_flavor
41 # TODO(r-mibu): fix the followings in upstream (fuel)
43 for node in $CONTROLLER_IPS;do
44 echo "check controller configuration for doctor ($node)"
45 ssh $ssh_opts_cpu "root@$node" '
48 echo "### apply patches (installer=fuel)"
50 ep_conf=/etc/ceilometer/event_pipeline.yaml
51 entry="- notifier://?topic=alarm.all"
52 if ! grep -q -e "$entry" $ep_conf; then
53 echo "modify the ceilometer config"
54 echo " $entry # added by doctor script" >> $ep_conf
55 service ceilometer-agent-notification restart
58 # TODO(r-mibu): enable this section once congress 4.0.0 is available
60 co_conf=/etc/congress/congress.conf
61 entry="congress.datasources.doctor_driver.DoctorDriver"
62 if ! grep -q -e "^drivers.*$entry" $co_conf; then
63 echo "modify the congress config"
64 sed -i -e "/^drivers/s/$/,$entry # added by doctor script/" \
66 service congress-server restart
69 rule="-m multiport -p tcp --dports 1789"
70 rule+=" -m comment --comment doctor-congress"
72 if ! iptables -C INPUT $rule; then
73 iptables -I INPUT $rule
76 ha_conf=/etc/haproxy/conf.d/180-congress.cfg
77 if [[ ! -e $ha_conf ]]; then
78 sed -e "1i# generated by doctor script" \
80 -e "s/neutron/congress/" \
81 /etc/haproxy/conf.d/085-neutron.cfg > $ha_conf
82 ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart
85 ' > installer_apply_patches_$node.log 2>&1
89 function cleanup_installer_fuel {
90 if [[ -e created_doctor_flavor ]] && openstack flavor show $VM_FLAVOR ; then
91 openstack flavor delete $VM_FLAVOR && rm -f created_doctor_flavor
94 # TODO(r-mibu): fix the followings in upstream (fuel)
96 for node in $CONTROLLER_IPS;do
97 echo "restore controller configuration if touched ($node)"
98 ssh $ssh_opts_cpu "root@$node" '
100 echo "### revert patches (installer=fuel)"
103 # TODO(r-mibu): enable this section once congress 4.0.0 is available
105 ha_conf=/etc/haproxy/conf.d/180-congress.cfg
106 if grep -q "# generated by doctor script" $ha_conf; then
108 ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy restart
111 rule="-m multiport -p tcp --dports 1789"
112 rule+=" -m comment --comment doctor-congress"
114 if iptables -C INPUT $rule; then
115 iptables -D INPUT $rule
118 co_conf=/etc/congress/congress.conf
119 entry="congress.datasources.doctor_driver.DoctorDriver"
120 if grep -q -e "^drivers.*$entry # added by doctor script" $co_conf; then
121 echo "modify the congress config"
122 sed -i -e "/^drivers/s/^\(.*\),$entry/\1/" $co_conf
123 service congress-server restart
127 ep_conf=/etc/ceilometer/event_pipeline.yaml
128 if grep -q "# added by doctor script" $ep_conf; then
129 sed -ie "/# added by doctor script/d" $ep_conf
130 service ceilometer-agent-notification restart
132 ' >> installer_apply_patches_$node.log 2>&1