Fix aarch64/arm64 support for MicroStack

Fix the builds for MicroStack on aarch64/arm64. To resolve the build
issues, the SNAP_ARCH and SNAP_ARCH_TRIPLET variables need to be used
in appropriate places to reference the underlying platform rather than
the x86_64 platform.

Arm64/Aarch64 support requires that EFI support is enabled, which
involves adding the EFI packages for arm64. These are also included for
x86_64 for ensuring consistency in EFI support between the
architectures. The /usr/share/{OVMF,AAVMF} paths need to be bind-mounted
to the appropriate locations to avoid having to custom build the
packages within the snap.

The setup sequence also needs to consider loading the right image into
glance. This is done by using the platform to determine which cirros
image to import into glance. A new cirros image was not included in this
patch for aarch64 platform in order to keep the snap image size lower.
The setup sequence has fallback code to attempt to download the image if
it is unavailable in the filesystem.

Finally, the snapcraft architectures for building microstack are limited
to the x86_64 and arm64 platforms. There's no need to build on s390x or
other architectures at this point.

Additionally, bump the timeouts in osci.yaml as the new architecture
support unfortunately adds build time.

Closes-Bug: #1821872

Change-Id: I26625621fb9895027139ecb895e882e60f2e6502
This commit is contained in:
Billy Olsen 2021-03-19 15:45:05 -07:00
parent 0d7785f233
commit ef771d3087
3 changed files with 29 additions and 26 deletions

View File

@ -1,7 +1,7 @@
- job: - job:
name: microstack-bionic name: microstack-bionic
parent: openstack-tox-snap-with-sudo parent: openstack-tox-snap-with-sudo
timeout: 7200 timeout: 9000
nodeset: nodeset:
nodes: nodes:
- name: bionic-brown - name: bionic-brown
@ -12,7 +12,7 @@
- job: - job:
name: microstack-bionic-lvm name: microstack-bionic-lvm
parent: openstack-tox-snap-with-sudo parent: openstack-tox-snap-with-sudo
timeout: 7200 timeout: 9000
nodeset: nodeset:
nodes: nodes:
- name: bionic-brown - name: bionic-brown
@ -23,7 +23,7 @@
- job: - job:
name: microstack-focal name: microstack-focal
parent: openstack-tox-snap-with-sudo parent: openstack-tox-snap-with-sudo
timeout: 7200 timeout: 9000
nodeset: nodeset:
nodes: nodes:
- name: focal-brown - name: focal-brown
@ -34,7 +34,7 @@
- job: - job:
name: microstack-focal-lvm name: microstack-focal-lvm
parent: openstack-tox-snap-with-sudo parent: openstack-tox-snap-with-sudo
timeout: 7200 timeout: 9000
nodeset: nodeset:
nodes: nodes:
- name: focal-brown - name: focal-brown
@ -53,4 +53,4 @@
fail-fast: true fail-fast: true
jobs: jobs:
- microstack-bionic-lvm - microstack-bionic-lvm
- microstack-focal-lvm - microstack-focal-lvm

View File

@ -15,7 +15,11 @@ environment:
PYTHONPATH: $PYTHONPATH:/usr/lib/python3.8:/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.8:$SNAP/lib/python3.8/site-packages:$SNAP/usr/lib/python3/dist-packages PYTHONPATH: $PYTHONPATH:/usr/lib/python3.8:/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.8:$SNAP/lib/python3.8/site-packages:$SNAP/usr/lib/python3/dist-packages
PYTHONWARNINGS: ignore PYTHONWARNINGS: ignore
# Needed by a targetcli dependency. # Needed by a targetcli dependency.
GI_TYPELIB_PATH: $SNAP/usr/lib/x86_64-linux-gnu/girepository-1.0 GI_TYPELIB_PATH: $SNAP/usr/lib/$SNAP_ARCH-linux-gnu/girepository-1.0
architectures:
- build-on: amd64
- build-on: arm64
system-usernames: system-usernames:
snap_daemon: shared snap_daemon: shared
@ -35,6 +39,12 @@ layout:
bind: $SNAP/usr/share/libvirt bind: $SNAP/usr/share/libvirt
/usr/share/qemu: /usr/share/qemu:
bind: $SNAP/usr/share/qemu bind: $SNAP/usr/share/qemu
# For UEFI Support, bindmount the OVMF and AAVMF directories
# appropriately. UEFI support is required for aarch64.
/usr/share/OVMF:
bind: $SNAP/usr/share/OVMF
/usr/share/AAVMF:
bind: $SNAP/usr/share/AAVMF
# Keystone really wants to look here for its fernet keys for some reason # Keystone really wants to look here for its fernet keys for some reason
/etc/keystone/fernet-keys: /etc/keystone/fernet-keys:
bind: $SNAP_COMMON/fernet-keys bind: $SNAP_COMMON/fernet-keys
@ -738,20 +748,6 @@ parts:
# patch --batch --forward --strip 1 --input ../project/patches/nova/nova_log_error.patch # patch --batch --forward --strip 1 --input ../project/patches/nova/nova_log_error.patch
organize: organize:
lib/python3.8/site-packages/openstack_dashboard/local/local_settings.py.example: lib/python3.8/site-packages/openstack_dashboard/local/local_settings.py lib/python3.8/site-packages/openstack_dashboard/local/local_settings.py.example: lib/python3.8/site-packages/openstack_dashboard/local/local_settings.py
override-build: |
snapcraftctl build
rm $SNAPCRAFT_PART_INSTALL/pyvenv.cfg
--strip 1 \
--input "$patch"
echo
done
# Now that everything is built, let's disable user site-packages
# as stated in PEP-0370
# sed -i usr/lib/python3.8/site.py -e 's/^ENABLE_USER_SITE = None$/ENABLE_USER_SITE = False/'
# Uncomment the below line for better python-libvirt debugging output.
# patch --batch --forward --strip 1 --input ../project/patches/nova/nova_log_error.patch
organize:
lib/python3.8/site-packages/openstack_dashboard/local/local_settings.py.example: lib/python3.8/site-packages/openstack_dashboard/local/local_settings.py
override-build: | override-build: |
snapcraftctl build snapcraftctl build
rm $SNAPCRAFT_PART_INSTALL/pyvenv.cfg rm $SNAPCRAFT_PART_INSTALL/pyvenv.cfg
@ -771,7 +767,6 @@ parts:
etc/*.ini: etc/keystone/ etc/*.ini: etc/keystone/
etc/*.json: etc/keystone/ etc/*.json: etc/keystone/
etc/*.templates: etc/keystone/ etc/*.templates: etc/keystone/
filesets: filesets:
etc: etc:
- etc/keystone/* - etc/keystone/*
@ -1087,6 +1082,12 @@ parts:
- librtmp1 - librtmp1
- libssh-4 - libssh-4
- libwind0-heimdal - libwind0-heimdal
# UEFI Support, required on arm64
- on arm64:
- qemu-efi-aarch64
- qemu-efi-arm
- on amd64:
- ovmf
build-packages: build-packages:
- acpica-tools - acpica-tools
- libaio-dev - libaio-dev
@ -1130,7 +1131,7 @@ parts:
- --disable-bsd-user - --disable-bsd-user
- --disable-vhost-user - --disable-vhost-user
- --enable-system - --enable-system
- --target-list=x86_64-softmmu - --target-list=x86_64-softmmu,aarch64-softmmu
- --disable-xen - --disable-xen
override-build: | override-build: |
dpkg-source --before-build . dpkg-source --before-build .
@ -1239,7 +1240,7 @@ parts:
# for the child processes they spawn since the environment variables are not passed down to children by default after execve(2). # for the child processes they spawn since the environment variables are not passed down to children by default after execve(2).
# `readelf -d /snap/microstack/current/usr/libexec/virt-aa-helper` should return something like: # `readelf -d /snap/microstack/current/usr/libexec/virt-aa-helper` should return something like:
# (RUNPATH) Library runpath: [/snap/microstack/current/usr/lib:/snap/microstack/current/usr/lib/x86_64-linux-gnu:...] # (RUNPATH) Library runpath: [/snap/microstack/current/usr/lib:/snap/microstack/current/usr/lib/x86_64-linux-gnu:...]
- LDFLAGS: '$LDFLAGS -Wl,-rpath=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib -Wl,-rpath=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib/x86_64-linux-gnu -Wl,-rpath=/snap/$SNAPCRAFT_PROJECT_NAME/current/lib -Wl,-rpath=/lib/x86_64-linux-gnu -Wl,-rpath=/lib/' - LDFLAGS: '$LDFLAGS -Wl,-rpath=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib -Wl,-rpath=/snap/$SNAPCRAFT_PROJECT_NAME/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET -Wl,-rpath=/snap/$SNAPCRAFT_PROJECT_NAME/current/lib -Wl,-rpath=/lib/$SNAPCRAFT_ARCH_TRIPLET -Wl,-rpath=/lib/'
override-build: | override-build: |
dpkg-source --before-build . dpkg-source --before-build .
logger `echo -n $PWD` logger `echo -n $PWD`
@ -1441,7 +1442,7 @@ parts:
# see LP: #1882994 # see LP: #1882994
rm $SNAPCRAFT_PART_INSTALL/bin/python3 rm $SNAPCRAFT_PART_INSTALL/bin/python3
rm $SNAPCRAFT_PART_INSTALL/bin/python rm $SNAPCRAFT_PART_INSTALL/bin/python
rm $SNAPCRAFT_PART_INSTALL/lib/python3.8/site-packages/netifaces.cpython-38-x86_64-linux-gnu.so rm $SNAPCRAFT_PART_INSTALL/lib/python3.8/site-packages/netifaces.cpython-38-$SNAPCRAFT_ARCH_TRIPLET.so
# Launch script # Launch script
launch: launch:
@ -1557,7 +1558,6 @@ parts:
lma-build-prep: lma-build-prep:
plugin: nil plugin: nil
source: ""
build-packages: build-packages:
- dirmngr - dirmngr
override-build: | override-build: |

View File

@ -24,6 +24,8 @@ limitations under the License.
""" """
import json import json
import platform
from time import sleep from time import sleep
from os import path from os import path
@ -828,7 +830,8 @@ class GlanceSetup(Question):
env = dict(**_env) env = dict(**_env)
env['VER'] = '0.4.0' env['VER'] = '0.4.0'
env['IMG'] = 'cirros-{VER}-x86_64-disk.img'.format(**env) env['ARCH'] = platform.machine()
env['IMG'] = 'cirros-{VER}-{ARCH}-disk.img'.format(**env)
cirros_path = '{SNAP_COMMON}/images/{IMG}'.format(**env) cirros_path = '{SNAP_COMMON}/images/{IMG}'.format(**env)