diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-02-04 16:54:02 +0100 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-02-17 12:52:42 +0100 |
commit | 5194a5b0aa515f6a196fafab29e4bd4be19a8451 (patch) | |
tree | 47c585ff1b92e2430f7bc0d83fd599522c14857a /devstack/lib/ironic | |
parent | c8a02c59d8d31d9df61fe50bb25f81d79c28e751 (diff) | |
download | ironic-5194a5b0aa515f6a196fafab29e4bd4be19a8451.tar.gz |
CI: use a custom cirros partition image instead of the default
Cirros partition images are not compatible with local boot since they
don't ship grub (nor a normal root partition). This change adds a script
that builds a partition image with UEFI artifacts present. It still
cannot be booted in legacy mode, but it's a progress.
Set the tempest plugin's partition_netboot option. We need it to inform
the tempest plugin about the ability to do local boot. This option
already exists but is never set.
Also set the new default_boot_option parameter, which will be introduced
and used in Iaba563a2ecbca029889bc6894b2a7f0754d27b88.
Remove netboot from most of the UEFI jobs.
Conflicts:
devstack/files/bindep.txt
zuul.d/ironic-jobs.yaml
Change-Id: I15189e7f5928126c6b336b1416ce6408a4950062
(cherry picked from commit bbceca562e0b552cd2fc33b2833931ab3cbbfce5)
Diffstat (limited to 'devstack/lib/ironic')
-rw-r--r-- | devstack/lib/ironic | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 5f39e97b7..6669e4b57 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -2811,6 +2811,44 @@ function build_ipa_dib_ramdisk { rm -rf $tempdir } +function upload_image_if_needed { + if [[ "$IRONIC_PARTITIONED_IMAGE_NAME" =~ cirros ]] \ + && [[ "$IRONIC_DEFAULT_BOOT_OPTION" == local ]] \ + && is_service_enabled glance; then + echo Building a Cirros image suitable for local boot + + local dest + IRONIC_PARTITIONED_IMAGE_NAME=cirros-${CIRROS_VERSION}-x86_64-partition + dest="$IRONIC_DATA_DIR/$IRONIC_PARTITIONED_IMAGE_NAME.img" + + # Export some variables that the script is using. + CIRROS_ARCH=$CIRROS_ARCH CIRROS_VERSION=$CIRROS_VERSION \ + IRONIC_TTY_DEV=$IRONIC_TTY_DEV VERBOSE=$VERBOSE \ + $IRONIC_SCRIPTS_DIR/cirros-partition.sh "$dest" + + # TODO(dtantsur): stop uploading kernel/ramdisk when image_type support + # lands. + local kernel_id + kernel_id=$(openstack image list -f value -c ID -c Name \ + | awk '/cirros.*kernel/ { print $1; exit 0; }') + die_if_not_set $LINENO kernel_id "Cannot find cirros kernel" + + local ramdisk_id + ramdisk_id=$(openstack image list -f value -c ID -c Name \ + | awk '/cirros.*ramdisk/ { print $1; exit 0; }') + die_if_not_set $LINENO ramdisk_id "Cannot find cirros ramdisk" + + openstack image create $IRONIC_PARTITIONED_IMAGE_NAME \ + --public --disk-format raw --container-format bare \ + --property kernel_id=$kernel_id --property ramdisk_id=$ramdisk_id \ + --file "$dest" + + if [[ "$IRONIC_TEMPEST_WHOLE_DISK_IMAGE" != True ]]; then + IRONIC_IMAGE_NAME=$IRONIC_PARTITIONED_IMAGE_NAME + fi + fi +} + # download EFI boot loader image and upload it to glance # this function sets ``IRONIC_EFIBOOT_ID`` function upload_baremetal_ironic_efiboot { @@ -2975,6 +3013,8 @@ function prepare_baremetal_basic_ops { upload_baremetal_ironic_efiboot fi + upload_image_if_needed + configure_tftpd configure_iptables } @@ -3097,6 +3137,13 @@ function ironic_configure_tempest { iniset $TEMPEST_CONFIG baremetal partition_image_ref $image_uuid fi + # Our cirros images cannot do local boot in legacy mode. + if [[ "${IRONIC_PARTITIONED_IMAGE_NAME}" =~ cirros && "${IRONIC_BOOT_MODE}" == "bios" ]]; then + iniset $TEMPEST_CONFIG baremetal partition_netboot True + else + iniset $TEMPEST_CONFIG baremetal partition_netboot False + fi + if [[ "$IRONIC_IP_VERSION" == "6" ]]; then iniset $TEMPEST_CONFIG baremetal whole_disk_image_url "http://$IRONIC_HOST_IPV6:$IRONIC_HTTP_PORT/${IRONIC_WHOLEDISK_IMAGE_NAME}.img" else @@ -3119,6 +3166,8 @@ function ironic_configure_tempest { # Driver for API tests iniset $TEMPEST_CONFIG baremetal driver fake-hardware + iniset $TEMPEST_CONFIG baremetal default_boot_option $IRONIC_DEFAULT_BOOT_OPTION + local adjusted_root_disk_size_gb if [[ "$IRONIC_IS_HARDWARE" == "False" ]]; then adjusted_root_disk_size_gb=$(( ${IRONIC_VM_SPECS_DISK} - ${IRONIC_VM_EPHEMERAL_DISK} )) |