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:
parent
bab51e2967
commit
7f192b104f
@ -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_instance_info
|
||||
|
||||
GATE_EXIT_RUN_DSTAT="${GATE_EXIT_RUN_DSTAT:-true}"
|
||||
if [ "$GATE_EXIT_RUN_DSTAT" == true ]; then
|
||||
run_dstat
|
||||
fi
|
||||
run_dstat || true
|
||||
|
||||
# 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") ))"
|
||||
|
@ -174,25 +174,27 @@ function gate_job_exit_tasks {
|
||||
}
|
||||
|
||||
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
|
||||
if [ "$GATE_EXIT_RUN_DSTAT" == true ]; then
|
||||
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
|
||||
|
||||
# https://stackoverflow.com/a/20338327 executing in ()& decouples the dstat
|
||||
# process from scripts-library to prevent hung builds if dstat fails to exit
|
||||
# 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)&
|
||||
# https://stackoverflow.com/a/20338327 executing in ()& decouples the dstat
|
||||
# process from scripts-library to prevent hung builds if dstat fails to exit
|
||||
# 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)&
|
||||
fi
|
||||
}
|
||||
|
||||
function generate_dstat_charts {
|
||||
|
Loading…
x
Reference in New Issue
Block a user