From 241b693baaec90347d08e63eb1dc167a0033ec21 Mon Sep 17 00:00:00 2001 From: Alexandru Nemes Date: Tue, 16 May 2017 15:50:27 +0300 Subject: Yardstick: Aarch64 jenkins slave support Change-Id: I2d58c38d75fc1fe036769340e9fb02932f543510 Signed-off-by: Alexandru Nemes --- docker/Dockerfile.aarch64.patch | 42 +++++++++++++++++++++++++++++++++++++++ install.sh | 44 ++++++++++++++++++++++++++++++----------- tests/ci/clean_images.sh | 2 +- tests/ci/load_images.sh | 14 ++++++++++--- 4 files changed, 86 insertions(+), 16 deletions(-) create mode 100644 docker/Dockerfile.aarch64.patch diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch new file mode 100644 index 000000000..33c352a1b --- /dev/null +++ b/docker/Dockerfile.aarch64.patch @@ -0,0 +1,42 @@ +From: Alexandru Nemes +Date: Mon, 19 Jun 2017 14:18:24 +0300 +Subject: [PATCH] Patch for Yardstick AARCH64 Docker file + +Signed-off-by: Alexandru Nemes +--- + 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 diff --git a/install.sh b/install.sh index b8212d2f4..ad14b8e0b 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/tests/ci/clean_images.sh b/tests/ci/clean_images.sh index f25006487..5cb0700df 100755 --- a/tests/ci/clean_images.sh +++ b/tests/ci/clean_images.sh @@ -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 diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh index 0c197b313..8e0a2f68a 100755 --- a/tests/ci/load_images.sh +++ b/tests/ci/load_images.sh @@ -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 -- cgit 1.2.3-korg