Ironic: uefi localboot support

This commit adds support for uefi localboot in
deploy-ironic element. The change is to mount the efi
system partition (created by Ironic) in /boot/efi.

The corresponding Ironic change is
I00ac31da325676ea4ea1ac4185f5ac3a52c5809a

Implements: blueprint local-boot-support-with-partition-images
Change-Id: Idf7ac5987e14e1d31311834196ca7283deec15c6
This commit is contained in:
Ramakrishnan G 2015-03-02 13:35:33 +00:00
parent 451aa827d1
commit 13c906059b
3 changed files with 23 additions and 0 deletions

View File

@ -2,3 +2,4 @@ curl
tgtadm tgtadm
tgtd tgtd
partprobe partprobe
lsblk

View File

@ -1,5 +1,6 @@
readonly IRONIC_API_URL=$(get_kernel_parameter ironic_api_url) readonly IRONIC_API_URL=$(get_kernel_parameter ironic_api_url)
readonly IRONIC_BOOT_OPTION=$(get_kernel_parameter boot_option) readonly IRONIC_BOOT_OPTION=$(get_kernel_parameter boot_option)
readonly IRONIC_BOOT_MODE=$(get_kernel_parameter boot_mode)
if [ -z "$ISCSI_TARGET_IQN" ]; then if [ -z "$ISCSI_TARGET_IQN" ]; then
err_msg "iscsi_target_iqn is not defined" err_msg "iscsi_target_iqn is not defined"
@ -79,6 +80,21 @@ if [ "$IRONIC_BOOT_OPTION" = "local" ]; then
mount -o bind /sys $root_part_mount/sys mount -o bind /sys $root_part_mount/sys
mount -o bind /proc $root_part_mount/proc mount -o bind /proc $root_part_mount/proc
# If boot mode is uefi, then mount the system partition in /boot/efi.
# Grub expects the efi system partition to be mounted here.
if [ "$IRONIC_BOOT_MODE" = "uefi" ]; then
# efi system partition is labelled as "efi-part" by Ironic.
# lsblk output looks like this:
# NAME="sda1" LABEL="efi-part"
readonly efi_system_part=$(lsblk -Pio NAME,LABEL $target_disk | \
awk -F'"' '/"efi-part"/{print $2}')
readonly efi_system_part_dev_file="/dev/$efi_system_part"
readonly efi_system_part_mount="$root_part_mount/boot/efi"
mkdir -p $efi_system_part_mount
mount $efi_system_part_dev_file $efi_system_part_mount
fi
# TODO(lucasagomes): Add extlinux as a fallback # TODO(lucasagomes): Add extlinux as a fallback
# Find grub version # Find grub version
V= V=
@ -100,6 +116,11 @@ if [ "$IRONIC_BOOT_OPTION" = "local" ]; then
ret=$? ret=$?
fi fi
# If we had mounted efi system partition, umount it.
if [ "$IRONIC_BOOT_MODE" = "uefi" ]; then
umount $efi_system_part_mount
fi
umount $root_part_mount/dev umount $root_part_mount/dev
umount $root_part_mount/sys umount $root_part_mount/sys
umount $root_part_mount/proc umount $root_part_mount/proc

View File

@ -1,3 +1,4 @@
curl: curl:
tgt: tgt:
parted: parted:
util-linux: