X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Flib%2Finstallers%2Fapex;h=f7b9624e15ebb6a536bfaa14f2d000cad9b5a6aa;hb=9fd701278bf7d8c5b9451491bcb1a92580adc780;hp=e353d251ce07c5ef9a60cc6d942e484b65496632;hpb=1d5c5fae6b040a19404a1cfd9afd28237d93f6a7;p=doctor.git diff --git a/tests/lib/installers/apex b/tests/lib/installers/apex index e353d251..f7b9624e 100644 --- a/tests/lib/installers/apex +++ b/tests/lib/installers/apex @@ -5,7 +5,7 @@ ssh_opts_cpu="$ssh_opts -i instack_key" function get_installer_ip { is_set INSTALLER_IP && return - INSTALLER_IP=$(get_first_vnic_ip instack) + INSTALLER_IP=$(get_first_vnic_ip undercloud) } function installer_get_ssh_keys { @@ -24,10 +24,49 @@ function get_controller_ips { die_if_not_set $LINENO CONTROLLER_IPS "No controller IPs" } +function installer_apply_patches { + # TODO(r-mibu): fix the followings in upstream (apex) + for node in $CONTROLLER_IPS;do + echo "check controller configuration for doctor ($node)" + ssh $ssh_opts_cpu "heat-admin@$node" ' + set -x + date + echo "### apply patches (installer=apex)" + + ep_conf=/etc/ceilometer/event_pipeline.yaml + ep_entry="- notifier://?topic=alarm.all" + if sudo grep -e "$ep_entry" $ep_conf; then + echo "NOTE: ceilometer is configured as we needed" + else + echo "modify the ceilometer config" + sudo sed -i -e "$ a \ \ \ \ \ \ \ \ \ \ $ep_entry # added by doctor script" $ep_conf + sudo systemctl restart openstack-ceilometer-notification.service + fi + + co_conf=/etc/congress/congress.conf + co_conf_bak=/etc/congress/congress.conf.bak + co_entry="congress.datasources.doctor_driver.DoctorDriver" + if sudo grep -e "^drivers.*$co_entry" $co_conf; then + echo "NOTE: congress is configured as we needed" + else + echo "modify the congress config" + sudo cp $co_conf $co_conf_bak + sudo sed -i -e "/^drivers/s/$/,$co_entry/" $co_conf + sudo systemctl restart openstack-congress-server.service + fi + ' > installer_apply_patches_$node.log 2>&1 + done +} + function setup_installer { get_installer_ip installer_get_ssh_keys get_controller_ips + installer_apply_patches + + # NOTE: while executing command as doctor user, + # 'OS_PROJECT_ID' env parameter make openstack clients confused. + unset OS_PROJECT_ID } function get_compute_ip_from_hostname { @@ -41,7 +80,35 @@ function get_compute_ip_from_hostname { die_if_not_set $LINENO COMPUTE_IP "Could get IP address of $compute_host." } +function installer_revert_patches { + # TODO(r-mibu): fix the followings in upstream (apex) + get_controller_ips + for node in $CONTROLLER_IPS;do + echo "restore controller configuration if touched ($node)" + ssh $ssh_opts_cpu "heat-admin@$node" ' + set -x + echo "### revert patches (installer=apex)" + date + + co_conf=/etc/congress/congress.conf + co_conf_bak=/etc/congress/congress.conf.bak + if [ -e $co_conf_bak ]; then + echo "restore the congress config" + sudo mv $co_conf_bak $co_conf + sudo systemctl restart openstack-congress-server.service + fi + + ep_conf=/etc/ceilometer/event_pipeline.yaml + if sudo grep -q -e "# added by doctor script" $ep_conf; then + echo "modify the ceilometer config" + sudo sed -ie "/# added by doctor script/d" $ep_conf + sudo systemctl restart openstack-ceilometer-notification.service + fi + ' >> installer_apply_patches_$node.log 2>&1 + done +} + function cleanup_installer { - # Noop + installer_revert_patches return }