Merge "Run dstat in gate tests"
This commit is contained in:
commit
6cb3cf400e
@ -80,6 +80,10 @@ trap gate_job_exit_tasks EXIT
|
|||||||
# Log some data about the instance and the rest of the system
|
# Log some data about the instance and the rest of the system
|
||||||
log_instance_info
|
log_instance_info
|
||||||
|
|
||||||
|
if [ "$GATE_EXIT_RUN_DSTAT" == true ]; then
|
||||||
|
run_dstat
|
||||||
|
fi
|
||||||
|
|
||||||
# Get minimum disk size
|
# Get minimum disk size
|
||||||
DATA_DISK_MIN_SIZE="$((1024**3 * $(awk '/bootstrap_host_data_disk_min_size/{print $2}' "${OSA_CLONE_DIR}/tests/roles/bootstrap-host/defaults/main.yml") ))"
|
DATA_DISK_MIN_SIZE="$((1024**3 * $(awk '/bootstrap_host_data_disk_min_size/{print $2}' "${OSA_CLONE_DIR}/tests/roles/bootstrap-host/defaults/main.yml") ))"
|
||||||
|
|
||||||
@ -153,9 +157,6 @@ pushd "${OSA_CLONE_DIR}/tests"
|
|||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# Implement the log directory
|
|
||||||
mkdir -p /openstack/log
|
|
||||||
|
|
||||||
pushd "${OSA_CLONE_DIR}/playbooks"
|
pushd "${OSA_CLONE_DIR}/playbooks"
|
||||||
# Disable Ansible color output
|
# Disable Ansible color output
|
||||||
export ANSIBLE_NOCOLOR=1
|
export ANSIBLE_NOCOLOR=1
|
||||||
|
@ -25,6 +25,7 @@ COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs"}
|
|||||||
GATE_EXIT_LOG_COPY="${GATE_EXIT_LOG_COPY:-false}"
|
GATE_EXIT_LOG_COPY="${GATE_EXIT_LOG_COPY:-false}"
|
||||||
GATE_EXIT_LOG_GZIP="${GATE_EXIT_LOG_GZIP:-true}"
|
GATE_EXIT_LOG_GZIP="${GATE_EXIT_LOG_GZIP:-true}"
|
||||||
GATE_EXIT_RUN_ARA="${GATE_EXIT_RUN_ARA:-true}"
|
GATE_EXIT_RUN_ARA="${GATE_EXIT_RUN_ARA:-true}"
|
||||||
|
GATE_EXIT_RUN_DSTAT="${GATE_EXIT_RUN_DSTAT:-true}"
|
||||||
# If this is a gate node from OpenStack-Infra Store all logs into the
|
# If this is a gate node from OpenStack-Infra Store all logs into the
|
||||||
# execution directory after gate run.
|
# execution directory after gate run.
|
||||||
if [[ -d "/etc/nodepool" ]]; then
|
if [[ -d "/etc/nodepool" ]]; then
|
||||||
@ -131,6 +132,9 @@ function gate_job_exit_tasks {
|
|||||||
# If this is a gate node from OpenStack-Infra Store all logs into the
|
# If this is a gate node from OpenStack-Infra Store all logs into the
|
||||||
# execution directory after gate run.
|
# execution directory after gate run.
|
||||||
if [ "$GATE_EXIT_LOG_COPY" == true ]; then
|
if [ "$GATE_EXIT_LOG_COPY" == true ]; then
|
||||||
|
if [ "$GATE_EXIT_RUN_DSTAT" == true ]; then
|
||||||
|
generate_dstat_charts || true
|
||||||
|
fi
|
||||||
GATE_LOG_DIR="${OSA_CLONE_DIR:-$(dirname $0)/..}/logs"
|
GATE_LOG_DIR="${OSA_CLONE_DIR:-$(dirname $0)/..}/logs"
|
||||||
mkdir -p "${GATE_LOG_DIR}/host" "${GATE_LOG_DIR}/openstack"
|
mkdir -p "${GATE_LOG_DIR}/host" "${GATE_LOG_DIR}/openstack"
|
||||||
rsync --archive --verbose --safe-links --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true
|
rsync --archive --verbose --safe-links --ignore-errors /var/log/ "${GATE_LOG_DIR}/host" || true
|
||||||
@ -138,7 +142,7 @@ function gate_job_exit_tasks {
|
|||||||
# Rename all files gathered to have a .txt suffix so that the compressed
|
# Rename all files gathered to have a .txt suffix so that the compressed
|
||||||
# files are viewable via a web browser in OpenStack-CI.
|
# files are viewable via a web browser in OpenStack-CI.
|
||||||
# except tempest results testrepository.subunit and testr_results.html
|
# except tempest results testrepository.subunit and testr_results.html
|
||||||
find "${GATE_LOG_DIR}/" -type f -not -name "testrepository.subunit" -not -name "testr_results.html" -exec mv {} {}.txt \;
|
find "${GATE_LOG_DIR}/" -type f -not -name "testrepository.subunit" -not -name "testr_results.html" -not -name "dstat.html" -exec mv {} {}.txt \;
|
||||||
|
|
||||||
# Generate the ARA report if enabled
|
# Generate the ARA report if enabled
|
||||||
if [ "$GATE_EXIT_RUN_ARA" == true ]; then
|
if [ "$GATE_EXIT_RUN_ARA" == true ]; then
|
||||||
@ -166,6 +170,35 @@ function gate_job_exit_tasks {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_dstat {
|
||||||
|
case ${DISTRO_ID} in
|
||||||
|
centos|rhel)
|
||||||
|
# Prefer dnf over yum for CentOS.
|
||||||
|
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||||
|
$RHT_PKG_MGR -y install dstat
|
||||||
|
;;
|
||||||
|
ubuntu)
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get -y install dstat
|
||||||
|
;;
|
||||||
|
opensuse)
|
||||||
|
zypper -n install -l dstat
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
dstat -tcmsdn --top-cpu --top-mem --top-bio --nocolor --output /openstack/log/instance-info/dstat.csv 3 > /openstack/log/instance-info/dstat.log&
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate_dstat_charts {
|
||||||
|
kill $(pgrep dstat)
|
||||||
|
if [[ ! -d /opt/dstat_graph ]]; then
|
||||||
|
git clone https://github.com/Dabz/dstat_graph /opt/dstat_graph
|
||||||
|
fi
|
||||||
|
pushd /opt/dstat_graph
|
||||||
|
/usr/bin/env bash -e ./generate_page.sh /openstack/log/instance-info/dstat.csv >> /openstack/log/instance-info/dstat.html
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
function print_info {
|
function print_info {
|
||||||
PROC_NAME="- [ $@ ] -"
|
PROC_NAME="- [ $@ ] -"
|
||||||
printf "\n%s%s\n" "$PROC_NAME" "${LINE:${#PROC_NAME}}"
|
printf "\n%s%s\n" "$PROC_NAME" "${LINE:${#PROC_NAME}}"
|
||||||
|
Loading…
Reference in New Issue
Block a user