Yardstick: Aarch64 jenkins slave support 41/34841/17
authorAlexandru Nemes <alexandru.nemes@enea.com>
Tue, 16 May 2017 12:50:27 +0000 (15:50 +0300)
committerAlexandru Nemes <alexandru.nemes@enea.com>
Mon, 3 Jul 2017 11:39:35 +0000 (11:39 +0000)
Change-Id: I2d58c38d75fc1fe036769340e9fb02932f543510
Signed-off-by: Alexandru Nemes <alexandru.nemes@enea.com>
docker/Dockerfile.aarch64.patch [new file with mode: 0644]
install.sh
tests/ci/clean_images.sh
tests/ci/load_images.sh

diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch
new file mode 100644 (file)
index 0000000..33c352a
--- /dev/null
@@ -0,0 +1,42 @@
+From: Alexandru Nemes <alexandru.nemes@enea.com>
+Date: Mon, 19 Jun 2017 14:18:24 +0300
+Subject: [PATCH] Patch for Yardstick AARCH64 Docker file
+
+Signed-off-by: Alexandru Nemes <alexandru.nemes@enea.com>
+---
+ docker/Dockerfile | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/docker/Dockerfile b/docker/Dockerfile
+index 96a5d77..03307a2 100644
+--- a/docker/Dockerfile
++++ b/docker/Dockerfile
+@@ -1,5 +1,5 @@
+ ##############################################################################
+-# Copyright (c) 2015 Ericsson AB and others.
++# Copyright (c) 2017 Enea AB and others.
+ #
+ # All rights reserved. This program and the accompanying materials
+ # are made available under the terms of the Apache License, Version 2.0
+@@ -7,9 +7,9 @@
+ # http://www.apache.org/licenses/LICENSE-2.0
+ ##############################################################################
+
+-FROM ubuntu:14.04
++FROM aarch64/ubuntu:14.04
+
+-LABEL image=opnfv/yardstick
++LABEL image=opnfv/yardstick_aarch64
+
+ ARG BRANCH=master
+
+@@ -40,8 +40,8 @@ RUN echo "daemon off;" >> /etc/nginx/nginx.conf
+
+ EXPOSE 5000
+
+-ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img ${IMAGE_DIR}
+-ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img ${IMAGE_DIR}
++ADD http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img ${IMAGE_DIR}
++ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-disk1.img ${IMAGE_DIR}
+
+ COPY ./exec_tests.sh /usr/local/bin/
\ No newline at end of file
index b8212d2..ad14b8e 100755 (executable)
@@ -9,24 +9,44 @@
 ##############################################################################
 
 # fit for arm64
+DOCKER_ARCH="$(uname -m)"
+
+UBUNTU_PORTS_URL="http://ports.ubuntu.com/ubuntu-ports/"
+UBUNTU_ARCHIVE_URL="http://archive.ubuntu.com/ubuntu/"
+
 source_file=/etc/apt/sources.list
-sed -i -e 's/^deb \([^/[]\)/deb [arch=amd64] \1/g' "${source_file}"
+
+if [[ "${DOCKER_ARCH}" == "aarch64" ]]; then
+    sed -i -e 's/^deb \([^/[]\)/deb [arch=arm64] \1/g' "${source_file}"
+    DOCKER_ARCH="arm64"
+    DOCKER_REPO="${UBUNTU_PORTS_URL}"
+    EXTRA_ARCH="amd64"
+    EXTRA_REPO="${UBUNTU_ARCHIVE_URL}"
+    dpkg --add-architecture amd64
+else
+    sed -i -e 's/^deb \([^/[]\)/deb [arch=amd64] \1/g' "${source_file}"
+    DOCKER_ARCH="amd64"
+    DOCKER_REPO="${UBUNTU_ARCHIVE_URL}"
+    EXTRA_ARCH="arm64"
+    EXTRA_REPO="${UBUNTU_PORTS_URL}"
+    dpkg --add-architecture arm64
+fi
+
 sed -i -e 's/^deb-src /# deb-src /g' "${source_file}"
 echo "APT::Default-Release \"trusty\";" > /etc/apt/apt.conf.d/default-distro
 
 sub_source_file=/etc/apt/sources.list.d/yardstick.list
 touch "${sub_source_file}"
-echo -e "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ xenial-updates universe
-deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty main universe multiverse restricted
-deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main universe multiverse restricted
-deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-security main universe multiverse restricted
-deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-proposed main universe multiverse restricted" > "${sub_source_file}"
-echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf
 
-proc_type=$(uname -m)
-if [[ $proc_type == "arm"* ]]; then
-    dpkg --add-architecture arm64
-fi
+# first add xenial repo needed for installing qemu_static_user/xenial in the container
+# then add complementary architecture repositories in case the cloud image is of different arch
+echo -e "deb [arch="${DOCKER_ARCH}"] "${DOCKER_REPO}" xenial-updates universe
+deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" trusty main universe multiverse restricted
+deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" trusty-updates main universe multiverse restricted
+deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" trusty-security main universe multiverse restricted
+deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" trusty-proposed main universe multiverse restricted" > "${sub_source_file}"
+
+echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf
 
 # install tools
 apt-get update && apt-get install -y \
@@ -52,7 +72,7 @@ apt-get update && apt-get install -y \
     python-pip \
     vim
 
-if [[ $proc_type == "arm"* ]]; then
+if [[ "${DOCKER_ARCH}" != "aarch64" ]]; then
     apt-get install -y libc6:arm64
 fi
 
index f250064..5cb0700 100755 (executable)
@@ -25,7 +25,7 @@ cleanup()
         return
     fi
 
-    for image in $(openstack ${SECURE} image list | grep -e cirros-0.3.5 -e yardstick-image -e Ubuntu-16.04 \
+    for image in $(openstack ${SECURE} image list | grep -e cirros-0.3.5 -e cirros-d161201 -e yardstick-image -e Ubuntu-16.04 \
         | awk '{print $2}'); do
         echo "Deleting image $image..."
         openstack ${SECURE} image delete $image || true
index 0c197b3..8e0a2f6 100755 (executable)
@@ -150,13 +150,21 @@ load_yardstick_image()
 
 load_cirros_image()
 {
-    if [[ -n $(openstack ${SECURE} image list | grep -e Cirros-0.3.5) ]]; then
-        echo "Cirros-0.3.5 image already exist, skip loading cirros image"
+    if [[ "${YARD_IMG_ARCH}" == "arm64" ]]; then
+        CIRROS_IMAGE_VERSION="cirros-d161201"
+        CIRROS_IMAGE_PATH="/home/opnfv/images/cirros-d161201-aarch64-disk.img"
+    else
+        CIRROS_IMAGE_VERSION="Cirros-0.3.5"
+        CIRROS_IMAGE_PATH="/home/opnfv/images/cirros-0.3.5-x86_64-disk.img"
+    fi
+
+    if [[ -n $(openstack ${SECURE} image list | grep -e "${CIRROS_IMAGE_VERSION}") ]]; then
+        echo "${CIRROS_IMAGE_VERSION} image already exist, skip loading cirros image"
     else
         echo
         echo "========== Loading cirros cloud image =========="
 
-        local image_file=/home/opnfv/images/cirros-0.3.5-x86_64-disk.img
+        local image_file="${CIRROS_IMAGE_PATH}"
 
         EXTRA_PARAMS=""
         # VPP requires guest memory to be backed by large pages