From e99d7b9389d340b73e9b1094c4a0b7e7997a5344 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Thu, 25 Jun 2020 21:49:40 +0200 Subject: [PATCH] Add aarch64/amd64 support to amphora and devstack The disk image create tool can now build aarch64/arm64 amphora images. The devstack plugin will facilitate image builds and upload to Glance for this CPU architecture. Change-Id: I1cebd8a3da58dc56ebbfac22f7802ab7f52585e1 --- devstack/plugin.sh | 32 +++++++++++++++---- devstack/settings | 1 + diskimage-create/README.rst | 2 +- diskimage-create/diskimage-create.sh | 3 +- elements/amphora-agent/package-installs.yaml | 2 +- ...mphora-image-support-7b0859f89d9092f8.yaml | 5 +++ 6 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/add-aarch64-amphora-image-support-7b0859f89d9092f8.yaml diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 79aff0bdba..9c5511d851 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -94,13 +94,19 @@ function build_octavia_worker_image { octavia_dib_tracing_arg="-x" fi if [[ ${OCTAVIA_AMP_BASE_OS:+1} ]] ; then - export PARAM_OCTAVIA_AMP_BASE_OS='-i '$OCTAVIA_AMP_BASE_OS + export PARAM_OCTAVIA_AMP_BASE_OS='-i '$OCTAVIA_AMP_BASE_OS fi if [[ ${OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID:+1} ]] ; then - export PARAM_OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID='-d '$OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID + export PARAM_OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID='-d '$OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID fi if [[ ${OCTAVIA_AMP_IMAGE_SIZE:+1} ]] ; then - export PARAM_OCTAVIA_AMP_IMAGE_SIZE='-s '$OCTAVIA_AMP_IMAGE_SIZE + export PARAM_OCTAVIA_AMP_IMAGE_SIZE='-s '$OCTAVIA_AMP_IMAGE_SIZE + fi + if [[ ${OCTAVIA_AMP_IMAGE_ARCH:+1} ]] ; then + export PARAM_OCTAVIA_AMP_IMAGE_ARCH='-a '$OCTAVIA_AMP_IMAGE_ARCH + fi + if [[ "$(trueorfalse False OCTAVIA_AMP_DISABLE_TMP_FS)" == "True" ]]; then + export PARAM_OCTAVIA_AMP_DISABLE_TMP_FS='-f' fi # Use the infra pypi mirror if it is available @@ -125,7 +131,7 @@ function build_octavia_worker_image { fi sudo mkdir -m755 ${dib_logs} sudo chown $STACK_USER ${dib_logs} - $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -l ${dib_logs}/$(basename $OCTAVIA_AMP_IMAGE_FILE).log $octavia_dib_tracing_arg -o $OCTAVIA_AMP_IMAGE_FILE ${PARAM_OCTAVIA_AMP_BASE_OS:-} ${PARAM_OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID:-} ${PARAM_OCTAVIA_AMP_IMAGE_SIZE:-} + $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -l ${dib_logs}/$(basename $OCTAVIA_AMP_IMAGE_FILE).log $octavia_dib_tracing_arg -o $OCTAVIA_AMP_IMAGE_FILE ${PARAM_OCTAVIA_AMP_BASE_OS:-} ${PARAM_OCTAVIA_AMP_DISTRIBUTION_RELEASE_ID:-} ${PARAM_OCTAVIA_AMP_IMAGE_SIZE:-} ${PARAM_OCTAVIA_AMP_IMAGE_ARCH:-} ${PARAM_OCTAVIA_AMP_DISABLE_TMP_FS:-} fi if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then @@ -559,8 +565,14 @@ function configure_lb_mgmt_sec_grp { } function create_amphora_flavor { + disk_size=${OCTAVIA_AMP_IMAGE_SIZE:-2} + if [[ "$OCTAVIA_AMP_IMAGE_ARCH" =~ (aarch64|arm64) ]]; then + # DIB produces images larger than size specified, add another GB to the flavor disk + # See https://bugs.launchpad.net/diskimage-builder/+bug/1918461 + disk_size=$((disk_size + 1)) + fi # Pass even if it exists to avoid race condition on multinode - openstack flavor create --id auto --ram 1024 --disk ${OCTAVIA_AMP_IMAGE_SIZE:-2} --vcpus 1 --private m1.amphora -f value -c id --property hw_rng:allowed=True || true + openstack flavor create --id auto --ram 1024 --disk $disk_size --vcpus 1 --private m1.amphora -f value -c id --property hw_rng:allowed=True || true amp_flavor_id=$(openstack flavor show m1.amphora -f value -c id) iniset $OCTAVIA_CONF controller_worker amp_flavor_id $amp_flavor_id } @@ -738,7 +750,15 @@ function octavia_init { OCTAVIA_AMP_IMAGE_ID=$(openstack image list -f value --property name=${OCTAVIA_AMP_IMAGE_NAME} -c ID) if [ -n "$OCTAVIA_AMP_IMAGE_ID" ]; then - openstack image set --tag ${OCTAVIA_AMP_IMAGE_TAG} --property hw_architecture='x86_64' --property hw_rng_model=virtio ${OCTAVIA_AMP_IMAGE_ID} + # Normalize architecture + # https://docs.openstack.org/nova/latest/configuration/config.html#filter_scheduler.image_properties_default_architecture + hw_arch=${OCTAVIA_AMP_IMAGE_ARCH:-x86_64} + if [[ "$OCTAVIA_AMP_IMAGE_ARCH" == "amd64" ]]; then + hw_arch="x86_64" + elif [[ "$OCTAVIA_AMP_IMAGE_ARCH" == "arm64" ]]; then + hw_arch="aarch64" + fi + openstack image set --tag ${OCTAVIA_AMP_IMAGE_TAG} --property hw_architecture=${hw_arch} --property hw_rng_model=virtio ${OCTAVIA_AMP_IMAGE_ID} fi # Create a management network. diff --git a/devstack/settings b/devstack/settings index ad521ef9df..46f2b99025 100644 --- a/devstack/settings +++ b/devstack/settings @@ -53,6 +53,7 @@ OCTAVIA_AMP_FLAVOR_ID=${OCTAVIA_AMP_FLAVOR_ID:-"10"} OCTAVIA_AMP_IMAGE_NAME=${OCTAVIA_AMP_IMAGE_NAME:-"amphora-x64-haproxy"} OCTAVIA_AMP_IMAGE_FILE=${OCTAVIA_AMP_IMAGE_FILE:-${OCTAVIA_DIR}/diskimage-create/${OCTAVIA_AMP_IMAGE_NAME}.qcow2} OCTAVIA_AMP_IMAGE_TAG="amphora" +OCTAVIA_AMP_IMAGE_ARCH=${OCTAVIA_AMP_IMAGE_ARCH:-"amd64"} OCTAVIA_AMP_CONN_TIMEOUT=${OCTAVIA_AMP_CONN_TIMEOUT:-"10"} OCTAVIA_AMP_READ_TIMEOUT=${OCTAVIA_AMP_READ_TIMEOUT:-"120"} diff --git a/diskimage-create/README.rst b/diskimage-create/README.rst index f650fa88c3..9a5085f5d4 100644 --- a/diskimage-create/README.rst +++ b/diskimage-create/README.rst @@ -98,7 +98,7 @@ Command syntax: .. code-block:: $ diskimage-create.sh - [-a i386 | **amd64** | armhf | ppc64le ] + [-a i386 | **amd64** | armhf | aarch64 | ppc64le ] [-b **haproxy** ] [-c **~/.cache/image-create** | ] [-d **bionic**/**8** | ] diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index 8b767e87e3..72a04801a4 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -20,7 +20,7 @@ set -e usage() { echo echo "Usage: $(basename "$0")" - echo " [-a i386 | **amd64** | armhf | ppc64le]" + echo " [-a i386 | **amd64** | armhf | aarch64 | ppc64le]" echo " [-b **haproxy** ]" echo " [-c **~/.cache/image-create** | ]" echo " [-d **bionic**/**8** | ]" @@ -98,6 +98,7 @@ while getopts "a:b:c:d:efg:hi:k:l:no:pt:r:s:vw:x" opt; do if [ "$AMP_ARCH" != "i386" ] && \ [ "$AMP_ARCH" != "amd64" ] && \ [ "$AMP_ARCH" != "ppc64le" ] && \ + [ "$AMP_ARCH" != "aarch64" ] && \ [ "$AMP_ARCH" != "armhf" ]; then echo "Error: Unsupported architecture $AMP_ARCH specified" exit 3 diff --git a/elements/amphora-agent/package-installs.yaml b/elements/amphora-agent/package-installs.yaml index f9987a22e8..2bf27e2e52 100644 --- a/elements/amphora-agent/package-installs.yaml +++ b/elements/amphora-agent/package-installs.yaml @@ -21,7 +21,7 @@ acl: acpid-ppc64le: arch: ppc64le, ppc64el acpid: - arch: i386, amd64, arm64, s390x + arch: i386, amd64, aarch64, arm64, s390x apparmor: apt-transport-https: at: diff --git a/releasenotes/notes/add-aarch64-amphora-image-support-7b0859f89d9092f8.yaml b/releasenotes/notes/add-aarch64-amphora-image-support-7b0859f89d9092f8.yaml new file mode 100644 index 0000000000..60b21b10a5 --- /dev/null +++ b/releasenotes/notes/add-aarch64-amphora-image-support-7b0859f89d9092f8.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added aarch64/arm64 amphora image support to the disk image create tool + and to the devstack plugin.