3 function get_installer_ip {
4 local instack_mac=$(sudo virsh domiflist fuel-opnfv | awk '/pxebr/{print $5}')
5 INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk '{print $1}')
6 die_if_not_set $LINENO $INSTALLER_IP "No installer IP"
9 function installer_get_ssh_keys {
10 sshpass -p r00tme scp $ssh_opts root@${INSTALLER_IP}:.ssh/id_rsa instack_key
11 sudo chown $(whoami):$(whoami) instack_key
13 ssh_opts_cpu+=" -i instack_key"
16 function installer_apply_patches {
17 cat > set_conf.sh << 'END_TXT'
19 if [ -e /etc/ceilometer/event_pipeline.yaml ]; then
20 if ! grep -q '^ *- notifier://?topic=alarm.all$' /etc/ceilometer/event_pipeline.yaml; then
21 sed -i 's|- notifier://|- notifier://?topic=alarm.all|' /etc/ceilometer/event_pipeline.yaml
22 echo "modify the ceilometer config"
23 service ceilometer-agent-notification restart
26 echo "ceilometer event_pipeline.yaml file does not exist"
29 if [ -e /etc/nova/nova.conf ]; then
30 if ! grep -q '^notification_driver=messaging$' /etc/nova/nova.conf; then
31 sed -i -r 's/notification_driver=/notification_driver=messaging/g' /etc/nova/nova.conf
32 echo "modify nova config"
33 service nova-api restart
36 echo "nova.conf file does not exist"
43 CONTROLLER_IP=$(sshpass -p r00tme ssh 2>/dev/null $ssh_opts root@${INSTALLER_IP} \
44 "fuel node | grep controller | cut -d '|' -f 5|xargs")
45 for node in $CONTROLLER_IP;do
46 scp $ssh_opts_cpu set_conf.sh "root@$node:"
47 ssh $ssh_opts_cpu "root@$node" './set_conf.sh > set_conf.log 2>&1 &'
49 scp $ssh_opts_cpu "root@$node:set_conf.log" set_conf_$node.log
52 if grep -q "modify the ceilometer config" set_conf_*.log ; then
53 NEED_TO_RESTORE_CEILOMETER=true
55 if grep -q "modify nova config" set_conf_*.log ; then
56 NEED_TO_RESTORE_NOVA=true
59 echo "waiting service restart..."
64 function cleanup_installer_fuel {
65 if ! ($NEED_TO_RESTORE_CEILOMETER || $NEED_TO_RESTORE_NOVA) ; then
66 echo "Don't need to restore config"
70 echo "restore the configuration..."
71 cat > restore_conf.sh << 'END_TXT'
73 if @NEED_TO_RESTORE_CEILOMETER@ ; then
74 if [ -e /etc/ceilometer/event_pipeline.yaml ]; then
75 if grep -q '^ *- notifier://?topic=alarm.all$' /etc/ceilometer/event_pipeline.yaml; then
76 sed -i 's|- notifier://?topic=alarm.all|- notifier://|' /etc/ceilometer/event_pipeline.yaml
77 service ceilometer-agent-notification restart
80 echo "ceilometer event_pipeline.yaml file does not exist"
84 if @NEED_TO_RESTORE_NOVA@ ; then
85 if [ -e /etc/nova/nova.conf ]; then
86 if grep -q '^notification_driver=messaging$' /etc/nova/nova.conf; then
87 sed -i -r 's/notification_driver=messaging/notification_driver=/g' /etc/nova/nova.conf
88 service nova-api restart
91 echo "nova.conf file does not exist"
97 sed -i -e "s/@NEED_TO_RESTORE_CEILOMETER@/$NEED_TO_RESTORE_CEILOMETER/" restore_conf.sh
98 sed -i -e "s/@NEED_TO_RESTORE_NOVA@/$NEED_TO_RESTORE_NOVA/" restore_conf.sh
99 chmod +x restore_conf.sh
100 for node in $CONTROLLER_IP;do
101 scp $ssh_opts_cpu restore_conf.sh "root@$node:"
102 ssh $ssh_opts_cpu "root@$node" './restore_conf.sh > restore_conf.log 2>&1 &'
105 echo "waiting service restart..."