DevStack: Fix standard PXE on Ubuntu Xenial

The pxelinux.0 file in Ubuntu Xenial is now distributed by the
"pxelinux" package and lives at /usr/lib/PXELINUX/pxelinux.0 instead
of /usr/lib/syslinux/pxelinux.0.

This patch refactors the get_pxe_boot_file() function to accommodate to
be able to find the pxelinux.0 binary in the new path and also creates a
new setup_syslinux_modules() function to place the *.c32 modules in the
TFTP root dir (which in Xenial doesn't live at the same directory as the
PXE image anymore).

Change-Id: I9bd412f10f2235f1979a12dd3004fc60d4aa922f
Closes-Bug: #1638940
This commit is contained in:
Lucas Alvares Gomes 2016-11-03 14:42:53 +00:00
parent d41cf18a4c
commit 2f201d0c4e
1 changed files with 38 additions and 18 deletions

View File

@ -328,18 +328,27 @@ IRONIC_DEPLOY_LOGS_LOCAL_PATH=${IRONIC_DEPLOY_LOGS_LOCAL_PATH:-$IRONIC_VM_LOG_DI
# get_pxe_boot_file() - Get the PXE/iPXE boot file path
function get_pxe_boot_file {
local relpath=syslinux/pxelinux.0
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
relpath=ipxe/undionly.kpxe
fi
local pxe_boot_file
if is_ubuntu; then
pxe_boot_file=/usr/lib/$relpath
elif is_fedora || is_suse; then
pxe_boot_file=/usr/share/$relpath
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
if is_ubuntu; then
pxe_boot_file=/usr/lib/ipxe/undionly.kpxe
elif is_fedora || is_suse; then
pxe_boot_file=/usr/share/ipxe/undionly.kpxe
fi
else
# Standard PXE
if is_ubuntu; then
# Ubuntu Xenial (16.04) places the file under /usr/lib/PXELINUX
pxe_paths="/usr/lib/syslinux/pxelinux.0 /usr/lib/PXELINUX/pxelinux.0"
for p in $pxe_paths; do
if [[ -f $p ]]; then
pxe_boot_file=$p
fi
done
elif is_fedora || is_suse; then
pxe_boot_file=/usr/share/syslinux/pxelinux.0
fi
fi
echo $pxe_boot_file
}
@ -403,6 +412,23 @@ function is_deploy_iso_required {
return 1
}
# Syslinux >= 5.00 pxelinux.0 binary is not "stand-alone" anymore,
# it depends on some c32 modules to work correctly.
# More info: http://www.syslinux.org/wiki/index.php/Library_modules
function setup_syslinux_modules {
# Ignore it for iPXE, it doesn't repend on syslinux modules
[[ "$IRONIC_IPXE_ENABLED" == "True" ]] && return 0
# Ubuntu Xenial keeps doesn't ship pxelinux.0 as part of syslinux anymore
if is_ubuntu && [[ -d /usr/lib/PXELINUX/ ]]; then
# TODO(lucasagomes): Figure out whether its UEFI or BIOS once
# we have UEFI support in DevStack
cp -aR /usr/lib/syslinux/modules/bios/*.c32 $IRONIC_TFTPBOOT_DIR
else
cp -aR $(dirname $IRONIC_PXE_BOOT_IMAGE)/*.c32 $IRONIC_TFTPBOOT_DIR
fi
}
function setup_virtualbmc {
# Install pyghmi from source, if requested, otherwise it will be
# downloaded as part of the virtualbmc installation
@ -523,14 +549,8 @@ function configure_ironic_dirs {
fi
# Copy PXE binary
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]] ; then
cp $IRONIC_PXE_BOOT_IMAGE $IRONIC_TFTPBOOT_DIR
else
# Syslinux >= 5.00 pxelinux.0 binary is not "stand-alone" anymore,
# it depends on some c32 modules to work correctly.
# More info: http://www.syslinux.org/wiki/index.php/Library_modules
cp -aR $(dirname $IRONIC_PXE_BOOT_IMAGE)/*.{c32,0} $IRONIC_TFTPBOOT_DIR
fi
cp $IRONIC_PXE_BOOT_IMAGE $IRONIC_TFTPBOOT_DIR
setup_syslinux_modules
# Create the logs directory when saving the deploy logs to the filesystem
if [ "$IRONIC_DEPLOY_LOGS_STORAGE_BACKEND" = "local"] && [ "$IRONIC_DEPLOY_LOGS_COLLECT" != "never" ]; then