From cb0db51ff041a253db5562cc895076bfbb6ae92a Mon Sep 17 00:00:00 2001 From: Alexander Maretskiy Date: Thu, 18 Aug 2016 15:14:45 +0300 Subject: [PATCH] [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 --- samples/tasks/support/instance_test.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/samples/tasks/support/instance_test.sh b/samples/tasks/support/instance_test.sh index 4d212383ab..e15bd04530 100644 --- a/samples/tasks/support/instance_test.sh +++ b/samples/tasks/support/instance_test.sh @@ -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 }