Cleanup the gate-check-commit dstat part
Following the advice given in review [1], we could put the conditional inside the scripts-library to simplify the behavior inside the gate-check-commit script. On top of that, if we pipe to || true, the function wouldn't fail on branches where the function/vars are not defined, cleaning the code further. [1]: https://review.openstack.org/#/c/531131/2 Change-Id: Icda339747267cf6bf514d45878c26533b5341f83
This commit is contained in:
@@ -77,10 +77,7 @@ info_block "Checking for required libraries." 2> /dev/null || source "${OSA_CLON
|
|||||||
# 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
|
||||||
|
|
||||||
GATE_EXIT_RUN_DSTAT="${GATE_EXIT_RUN_DSTAT:-true}"
|
run_dstat || true
|
||||||
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") ))"
|
||||||
|
@@ -174,25 +174,27 @@ function gate_job_exit_tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function run_dstat {
|
function run_dstat {
|
||||||
case ${DISTRO_ID} in
|
if [ "$GATE_EXIT_RUN_DSTAT" == true ]; then
|
||||||
centos|rhel)
|
case ${DISTRO_ID} in
|
||||||
# Prefer dnf over yum for CentOS.
|
centos|rhel)
|
||||||
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
# Prefer dnf over yum for CentOS.
|
||||||
$RHT_PKG_MGR -y install dstat
|
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
|
||||||
;;
|
$RHT_PKG_MGR -y install dstat
|
||||||
ubuntu)
|
;;
|
||||||
apt-get update
|
ubuntu)
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install dstat
|
apt-get update
|
||||||
;;
|
DEBIAN_FRONTEND=noninteractive apt-get -y install dstat
|
||||||
opensuse)
|
;;
|
||||||
zypper -n install -l dstat
|
opensuse)
|
||||||
;;
|
zypper -n install -l dstat
|
||||||
esac
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# https://stackoverflow.com/a/20338327 executing in ()& decouples the dstat
|
# https://stackoverflow.com/a/20338327 executing in ()& decouples the dstat
|
||||||
# process from scripts-library to prevent hung builds if dstat fails to exit
|
# process from scripts-library to prevent hung builds if dstat fails to exit
|
||||||
# for any reason.
|
# for any reason.
|
||||||
(dstat -tcmsdn --top-cpu --top-mem --top-bio --nocolor --output /openstack/log/instance-info/dstat.csv 3 > /openstack/log/instance-info/dstat.log)&
|
(dstat -tcmsdn --top-cpu --top-mem --top-bio --nocolor --output /openstack/log/instance-info/dstat.csv 3 > /openstack/log/instance-info/dstat.log)&
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_dstat_charts {
|
function generate_dstat_charts {
|
||||||
|
Reference in New Issue
Block a user