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
This commit is contained in:
Carlos Goncalves 2020-06-25 21:49:40 +02:00
parent 651f095a81
commit e99d7b9389
6 changed files with 36 additions and 9 deletions

View File

@ -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.

View File

@ -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"}

View File

@ -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** | <cache directory> ]
[-d **bionic**/**8** | <other release id> ]

View File

@ -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** | <cache directory> ]"
echo " [-d **bionic**/**8** | <other release id> ]"
@ -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

View File

@ -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:

View File

@ -0,0 +1,5 @@
---
features:
- |
Added aarch64/arm64 amphora image support to the disk image create tool
and to the devstack plugin.