diff options
author | Ilya Etingof <etingof@gmail.com> | 2018-11-21 09:37:34 +0100 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-08-14 14:19:03 +0200 |
commit | 9fab96fc3748dcdefb3a57bf40b8c9feb4a1981b (patch) | |
tree | 15a8a2a67e71e877e41cc32cad4158cb10abf290 /devstack | |
parent | 33acfa2d1b6b73e45b457e2664b8d808427bcb49 (diff) | |
download | ironic-9fab96fc3748dcdefb3a57bf40b8c9feb4a1981b.tar.gz |
Add Redfish Virtual Media Boot support
This patch introduces standard Redfish virtual media boot
support to ironic.
The patch implements basic boot interface features along with
devstack plugin support for virtual media boot. Functionally,
redfish boot interface supports the same set of features as PXE.
Unlike other virtual media boot implementations (e.g. iLo), this
patch does not require user-built deploy/rescue/boot ISO images
for virtual media boot. Instead, ironic will build necessary images
out of common kernel/ramdisk pair (though user needs to provide
ESP image).
Story: 1526753
Task: 10389
Co-Authored-By: Shivanand Tendulker <stendulker@gmail.com>
Change-Id: I0db0a64c5ccf260f5a0695dbe994af1e11f71517
Diffstat (limited to 'devstack')
-rw-r--r-- | devstack/files/debs/ironic | 2 | ||||
-rw-r--r-- | devstack/lib/ironic | 74 |
2 files changed, 76 insertions, 0 deletions
diff --git a/devstack/files/debs/ironic b/devstack/files/debs/ironic index 50fa67d7f..e769a2d7f 100644 --- a/devstack/files/debs/ironic +++ b/devstack/files/debs/ironic @@ -21,6 +21,8 @@ libguestfs-tools libvirt-bin # dist:xenial,bionic NOPRIME open-iscsi openssh-client +# TODO (etingof) pinning to older version in devstack/lib/ironic +#ovmf pxelinux # dist:xenial,bionic python-libguestfs qemu diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 614cdf868..fa28259ce 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -246,6 +246,10 @@ IRONIC_DEPLOY_RAMDISK=${IRONIC_DEPLOY_RAMDISK:-$TOP_DIR/files/ir-deploy-$IRONIC_ IRONIC_DEPLOY_KERNEL=${IRONIC_DEPLOY_KERNEL:-$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER.kernel} IRONIC_DEPLOY_ISO=${IRONIC_DEPLOY_ISO:-$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER.iso} +# If present, this file is used to deploy/boot nodes over virtual media +# (The value must be an absolute path) +IRONIC_EFIBOOT=${IRONIC_EFIBOOT:-$TOP_DIR/files/ir-deploy-$IRONIC_DEPLOY_DRIVER.efiboot} + # NOTE(jroll) this needs to be updated when stable branches are cut IPA_DOWNLOAD_BRANCH=${IPA_DOWNLOAD_BRANCH:-master} IPA_DOWNLOAD_BRANCH=$(echo $IPA_DOWNLOAD_BRANCH | tr / -) @@ -528,6 +532,14 @@ if [[ "$IRONIC_BOOT_MODE" == "uefi" ]]; then die $LINENO "Boot mode UEFI only works in Ubuntu or Fedora for now." fi + if is_arch "x86_64"; then + if is_ubuntu; then + install_package grub-efi + elif is_fedora; then + install_package grub2 grub2-efi + fi + fi + if is_ubuntu && [[ -z $IRONIC_GRUB2_FILE ]]; then IRONIC_GRUB2_SHIM_FILE=/usr/lib/shim/shimx64.efi IRONIC_GRUB2_FILE=/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed @@ -2519,6 +2531,63 @@ function build_ipa_dib_ramdisk { rm -rf $tempdir } +# download EFI boot loader image and upload it to glance +# this function sets ``IRONIC_EFIBOOT_ID`` +function upload_baremetal_ironic_efiboot { + declare -g IRONIC_EFIBOOT_ID + + local efiboot_name + efiboot_name=$(basename $IRONIC_EFIBOOT) + + echo_summary "Building and uploading EFI boot image for ironic" + + if [ ! -e "$IRONIC_EFIBOOT" ]; then + + local efiboot_path + efiboot_path=$(mktemp -d --tmpdir=${DEST})/$efiboot_name + + local efiboot_mount + efiboot_mount=$(mktemp -d --tmpdir=${DEST}) + + dd if=/dev/zero \ + of=$efiboot_path \ + bs=4096 count=1024 + + mkfs.fat -s 4 -r 512 -S 4096 $efiboot_path + + sudo mount $efiboot_path $efiboot_mount + + sudo mkdir -p $efiboot_mount/efi/boot + + sudo grub-mkimage \ + -C xz \ + -O x86_64-efi \ + -p /boot/grub \ + -o $efiboot_mount/efi/boot/bootx64.efi \ + boot linux linuxefi search normal configfile \ + part_gpt btrfs ext2 fat iso9660 loopback \ + test keystatus gfxmenu regexp probe \ + efi_gop efi_uga all_video gfxterm font \ + echo read ls cat png jpeg halt reboot + + sudo umount $efiboot_mount + + # load efiboot into glance + IRONIC_EFIBOOT_ID=$(openstack \ + image create \ + $efiboot_name \ + --public --disk-format=raw \ + --container-format=bare \ + -f value -c id \ + < $efiboot_path) + die_if_not_set $LINENO IRONIC_EFIBOOT_ID "Failed to load EFI bootloader image into glance" + + mv $efiboot_path $IRONIC_EFIBOOT + + iniset $IRONIC_CONF_FILE conductor bootloader $IRONIC_EFIBOOT_ID + fi +} + # build deploy kernel+ramdisk, then upload them to glance # this function sets ``IRONIC_DEPLOY_KERNEL_ID``, ``IRONIC_DEPLOY_RAMDISK_ID`` function upload_baremetal_ironic_deploy { @@ -2611,6 +2680,11 @@ function prepare_baremetal_basic_ops { fi upload_baremetal_ironic_deploy + + if [[ "$IRONIC_BOOT_MODE" == "uefi" && is_deployed_by_redfish ]]; then + upload_baremetal_ironic_efiboot + fi + configure_tftpd configure_iptables } |