nova/playbooks/nova-emulation/pre.yaml
Jonathan Race 1b2ff083eb zuul-job for Adds Pick guest CPU architecture based on host arch
in libvirt driver support

This is split 3 of 3 for the architecture emulation feature.

Added initial ci content for tempest test.

Implements: blueprint pick-guest-arch-based-on-host-arch-in-libvirt-driver
Signed-off-by: Jonathan Race <jrace@augusta.edu>
Change-Id: I0159baa99ccf1e76040c197becf2a56c3d69d026
2022-02-25 16:55:43 -05:00

36 lines
1.2 KiB
YAML

- hosts: controller
tasks:
- name: create local.sh
become: yes
blockinfile:
path: /opt/stack/devstack/local.sh
create: True
mode: 0777
block: |
#!/bin/bash
sudo apt update
sudo apt install -yy qemu-system qemu-efi-aarch64 qemu-efi-arm
# This changes the default image metadata to enable emulation
source /opt/stack/devstack/openrc admin
image_id=$(openstack image list -f value -c ID | awk 'NR==1{print $1}')
echo "Setting required image metadata properties"
openstack image set --property hw_emulation_architecture=aarch64 ${image_id}
openstack image set --property hw_firmware_type=uefi ${image_id}
openstack image set --property hw_machine_type=virt ${image_id}
meta_props=$(openstack image show ${image_id} | grep properties | sed 's/,\||/\n/g' | grep hw_)
for prop in ${meta_props};
do
if [ -z "${prop}" ]
then
echo "Image Properties not set"
exit 5
else
echo ${prop}
fi
done