HTTP test during update/upgrade/ffwd.

To mimic real life environment during update/upgrade/ffwd
 we'll expose a 'HTTP-live' test.
This test asserts that web server running in overcloud is
 reachable via its FIP and that content served is accessible.

To access WEB server(s) running in overcloud appropriate ports
 80 and 443 have to be added to the security group(s).

Initial work done in https://review.openstack.org/#/c/547220/

Co-Authored-By: Marius Cornea <mcornea@redhat.com>

Change-Id: I818949e0e498d5cd8da4640bda2be99aafd1aa76
(cherry picked from commit 8e55883fd0)
This commit is contained in:
Yurii Prokulevych 2018-07-26 11:29:23 +02:00 committed by Sofer Athlan-Guyot
parent 64e87eab93
commit 54f16af247
9 changed files with 71 additions and 0 deletions

View File

@ -147,6 +147,9 @@ l3_agent_connectivity_check_start_template: l3_agent_start_ping.sh.j2
l3_agent_connectivity_check_stop_template: l3_agent_stop_ping.sh.j2
l3_agent_failover_check: false
# enable web load test
fip_http_check: false
# migrate instances between compute nodes during upgrade
compute_evacuate: false

View File

@ -80,3 +80,6 @@
- name: create nova actions check script
include: ../common/create_nova_actions_check_script.yml
- name: import create HTTP test scripts
import_tasks: ../common/create_http_test_scripts.yml

View File

@ -73,3 +73,6 @@
- name: create nova actions check script
include: ../common/create_nova_actions_check_script.yml
- name: import create HTTP test scripts
import_tasks: ../common/create_http_test_scripts.yml

View File

@ -95,3 +95,6 @@
- name: create nova actions check script
include: ../common/create_nova_actions_check_script.yml
- name: import create HTTP test scripts
import_tasks: ../common/create_http_test_scripts.yml

View File

@ -0,0 +1,10 @@
#!/bin/env bash
FIP=$(openstack floating ip list -f json | jq -r -c '.[] | select(.Port) | .["Floating IP Address"]' | head -1)
while true; do
curl --location --silent --show-error --max-time 5 \
--write-out "HTTP Code: %{http_code}\nTotal Time: %{time_total} sec\nEffective URL: %{url_effective}\n\n" \
http://$FIP/ 2>/dev/null >> {{ working_dir }}/http_response.log
sleep 1
done

View File

@ -0,0 +1,9 @@
#!/bin/env bash
RESULT_CODE=$(grep 'HTTP Code' {{ working_dir }}/http_response.log | sort | uniq)
#TODO: assert other conditions/thresholds for pass/fail criteria
if [[ "$RESULT_CODE" != "HTTP Code: 200" ]]; then
echo 'There are non-200 HTTP calls'
exit 1
fi

View File

@ -17,6 +17,13 @@ if [[ -e {{ working_dir }}/l3_agent_failover_pre.sh ]]; then
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_start.sh &
{% endif %}
source {{ undercloud_rc }}
echo "[$(date)] Running {% if ffu_overcloud_upgrade %} ffwd-upgrade {% else %} major {% endif %}upgrade converge step"
openstack overcloud {% if ffu_overcloud_upgrade %} ffwd-upgrade {% else %} upgrade {% endif %}converge \
@ -79,3 +86,9 @@ if [[ -e {{ working_dir }}/l3_agent_failover_post.sh ]]; then
bash {{ working_dir }}/l3_agent_failover_post.sh
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_stop.sh
{% endif %}

View File

@ -22,6 +22,12 @@ if [[ -e {{ working_dir }}/l3_agent_failover_pre.sh ]]; then
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_start.sh &
{% endif %}
source {{ undercloud_rc }}
echo "[$(date)] Runing major upgrade {{ playbook }} playbook for {{ item }} role"
@ -51,6 +57,13 @@ if [[ -e {{ working_dir }}/l3_agent_failover_post.sh ]]; then
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_stop.sh
{% endif %}
{%- endfor %}
{% else %}
@ -68,6 +81,12 @@ if [[ -e {{ working_dir }}/l3_agent_failover_pre.sh ]]; then
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_start.sh &
{% endif %}
source {{ undercloud_rc }}
echo "[$(date)] Runing major upgrade for {{ item }} role"
@ -97,4 +116,10 @@ if [[ -e {{ working_dir }}/l3_agent_failover_post.sh ]]; then
bash {{ working_dir }}/l3_agent_failover_post.sh
fi
{% endif %}
{% if fip_http_check|bool %}
source {{ overcloud_rc }}
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
bash {{ working_dir }}/fip_http_check_stop.sh
{% endif %}
{% endif %}

View File

@ -65,6 +65,8 @@ if [ $? -ne 0 ]; then
openstack security group create ${SECGROUP_NAME}
openstack security group rule create --proto icmp ${SECGROUP_NAME}
openstack security group rule create --proto tcp --dst-port 22 ${SECGROUP_NAME}
openstack security group rule create --proto tcp --dst-port 80 ${SECGROUP_NAME}
openstack security group rule create --proto tcp --dst-port 443 ${SECGROUP_NAME}
fi
## create instance