[Plugins] Add executable availability check to instance_test.sh

This is related VMTasks.*runcommand* workloads which can use
standard shell script "instance_test.sh".
In some rare cases (like [1]) it is possible that wide-used
executable is not available on the VM instance. The result is
confusing error message from shell interpreter which obstructs
understanding what is actually wrong with the scenario (nothing
is wrong actually with the scenario, but the instance).

This patch adds a small piece of code to script instance_test.sh
which checks availability of all used executable commands and
outputs clear error message if some command is missed.

[1] https://bugs.launchpad.net/rally/+bug/1613144

Change-Id: I63db699b053c16dce14df919f72579af2f66fa3e
This commit is contained in:
Alexander Maretskiy 2016-08-18 15:14:45 +03:00
parent 2be9e670ad
commit bb118b9d13

View File

@ -2,6 +2,15 @@
# Load server and output JSON results ready to be processed
# by Rally scenario
for ex in awk top grep free tr df dc dd gzip
do
if ! type ${ex} >/dev/null
then
echo "Executable is required by script but not available on a server: ${ex}" >&2
return 1
fi
done
get_used_cpu_percent() {
echo 100 $(top -b -n 1 | grep -i CPU | head -n 1 | awk '{print $8}' | tr -d %) - p | dc
}