aarch64: Improve arch detection snippet 61/31461/1
authorMatei Valeanu <Matei.Valeanu@enea.com>
Mon, 20 Mar 2017 19:19:32 +0000 (20:19 +0100)
committerJing Lu <lvjing5@huawei.com>
Thu, 23 Mar 2017 02:47:17 +0000 (02:47 +0000)
Get the arch from a compute node
Also move code that depends on YARD_IMG_ARCH,
after YARD_IMG_ARCH gets set

JIRA: YARDSTICK-591

Change-Id: I5ed3ef9cfa92e5bf9e6ada21396d18643cf1a55c
Signed-off-by: Matei Valeanu <Matei.Valeanu@enea.com>
(cherry picked from commit 13d68ab65475ec556383480a17dbaf63e3ab140c)

tests/ci/load_images.sh

index ee46962..4b8f2c0 100755 (executable)
@@ -15,21 +15,22 @@ set -e
 YARD_IMG_ARCH=amd64
 export YARD_IMG_ARCH
 
-HW_FW_TYPE=""
-if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
-    HW_FW_TYPE=uefi
-fi
-export HW_FW_TYPE
-
 if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then
     echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" | sudo tee -a /etc/sudoers
 fi
 
-ARCH_SCRIPT="test -f /etc/fuel_openstack_arch && grep -q arm64 /etc/fuel_openstack_arch"
+# Look for a compute node, that is online, and check if it is aarch64
+ARCH_SCRIPT="ssh \$(fuel2 node list | awk -F'|' '\$6 ~ /compute/ && \$11 ~ /rue/ {print \$7; exit;}') uname -m 2>/dev/null | grep -q aarch64"
 if [ "$INSTALLER_TYPE" == "fuel" ]; then
     sshpass -p r00tme ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root "${INSTALLER_IP}" "${ARCH_SCRIPT}" && YARD_IMG_ARCH=arm64
 fi
 
+HW_FW_TYPE=""
+if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
+    HW_FW_TYPE=uefi
+fi
+export HW_FW_TYPE
+
 UCA_HOST="cloud-images.ubuntu.com"
 if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
     export CLOUD_IMG_URL="http://${UCA_HOST}/${release}/current/${release}-server-cloudimg-${YARD_IMG_ARCH}.tar.gz"