Fix PXE booting with Ubuntu 16.04 LTS and Newton

This changeset contains the changes required to build the OpenStack
Newton cluster on Ubuntu 16.04 LTS:

- config/scripts.ubuntu_pxecluster: Newton update for PXE cluster
- New preseed-ssh-v5.cfg: pass the target device to grub
- Use new preseed file in create_xxx_node_pxeboot.sh
- install_pxeserver.sh, create_xxx_node_pxeboot.sh: use infrastructure
  introduced with Change-Id Id2cd684152911289821b165daf6b8fc002f42f2d
  to dynamically detect network interfaces (needed for Ubuntu 16.04 LTS)

Change-Id: Iae9f99440341b9ce541f77e970ca82838d2d1a5c
This commit is contained in:
Roger Luethi 2016-10-29 17:36:23 +02:00
parent 758297b3f0
commit cf5ab16a2e
4 changed files with 182 additions and 27 deletions

View File

@ -17,45 +17,56 @@ cmd boot -n controller
cmd wait_for_shutdown -n controller
cmd snapshot -n controller controller_node_init
# Environment
cmd queue ubuntu/apt_install_mysql.sh
cmd queue ubuntu/apt_nosql_database.sh
cmd queue ubuntu/install_rabbitmq.sh
cmd queue ubuntu/install_memcached.sh
cmd snapshot_cycle -n controller pre-openstack_installed
# Identity
cmd queue ubuntu/setup_keystone.sh
cmd queue test/get_auth_token.sh
cmd snapshot_cycle -n controller keystone_installed
# Image
cmd queue ubuntu/setup_glance.sh
cmd snapshot_cycle -n controller glance_installed
# Compute
cmd queue ubuntu/setup_nova_controller.sh
cmd snapshot_cycle -n controller nova-controller_installed
# Networking
cmd queue ubuntu/setup_neutron_controller.sh
cmd queue ubuntu/setup_self-service_controller.sh
cmd queue ubuntu/setup_neutron_controller_part_2.sh
cmd snapshot_cycle -n controller neutron-controller_installed
cmd queue ubuntu/setup_cinder_controller.sh
cmd snapshot_cycle -n controller cinder_installed
# Dashboard
cmd queue ubuntu/setup_horizon.sh
cmd snapshot_cycle -n controller horizon_installed
# FIXME Our LBaaS support for kilo is broken; the configuration edits
# Block Storage
cmd queue ubuntu/setup_cinder_controller.sh
cmd snapshot_cycle -n controller cinder_installed
# Orchestration
cmd queue ubuntu/setup_heat_controller.sh
cmd snapshot_cycle -n controller heat_controller_installed
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Telemetry (currently unsupported)
# NoSQL DB (mongo) needed for Telemetry
#cmd queue ubuntu/apt_nosql_database.sh
# Note: Disable Telemetry service if it overloads the cluster.
#cmd queue ubuntu/setup_telemetry_controller.sh
#cmd snapshot_cycle -n controller telemetry-controller_installed
# FIXME Our LBaaS support is broken; the configuration edits
# in setup_lbaas_controller.sh break neutron
#cmd queue ubuntu/setup_lbaas_controller.sh
#cmd snapshot_cycle -n controller lbaas-controller_installed
# Ceilometer; disable if necessary, fix comments in this file
# Note: Disable Telemetry service if it overloads the cluster.
cmd queue ubuntu/setup_telemetry_controller.sh
cmd snapshot_cycle -n controller telemetry-controller_installed
cmd queue ubuntu/setup_heat_controller.sh
cmd snapshot_cycle -n controller heat_controller_installed
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cmd boot -n controller
#==============================================================================
@ -76,21 +87,25 @@ cmd boot -n compute1
cmd wait_for_shutdown -n compute1
cmd snapshot -n compute1 compute1_node_init
# Compute
cmd queue ubuntu/setup_nova_compute.sh
cmd snapshot_cycle -n compute1 nova-compute1_installed
# Networking
cmd queue ubuntu/setup_neutron_compute.sh
cmd queue ubuntu/setup_self-service_compute.sh
cmd queue ubuntu/setup_neutron_compute_part_2.sh
cmd snapshot_cycle -n compute1 neutron-compute_installed
# Block Storage
cmd queue ubuntu/setup_cinder_volumes.sh
cmd snapshot_cycle -n compute1 cinder-volume_installed
cmd queue ubuntu/setup_telemetry_compute.sh
cmd snapshot_cycle -n compute1 telemetry-compute_installed
cmd boot -n compute1
# Telemetry
#cmd queue ubuntu/setup_telemetry_compute.sh
#cmd snapshot_cycle -n compute1 telemetry-compute_installed
cmd boot -n compute1
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Take snapshot of database changes on controller VM, too
cmd shutdown -n controller
@ -100,5 +115,6 @@ cmd snapshot -n controller controller_-_compute1_node_installed
cmd queue config_public_network.sh
cmd queue config_private_network.sh
cmd snapshot_cycle -n controller public_private_networks
#==============================================================================
cmd boot -n controller

View File

@ -0,0 +1,132 @@
# Based on
# https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
#
# For details, see:
# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html
#-------------------------------------------------------------------------------
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i netcfg/get_hostname string osbash
d-i netcfg/get_domain string unassigned-domain
#-------------------------------------------------------------------------------
# Proxy
#d-i mirror/http/proxy string http://192.168.178.20:3128/
d-i mirror/http/proxy string
#-------------------------------------------------------------------------------
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
d-i time/zone string Etc/UTC
#-------------------------------------------------------------------------------
### Partitioning
d-i partman-auto/disk string /dev/sda
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm: use LVM to partition the disk
# - crypto: use LVM within an encrypted partition
d-i partman-auto/method string regular
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
#-------------------------------------------------------------------------------
# To create a normal user account.
d-i passwd/user-fullname string OpenStack user
d-i passwd/username string osbash
d-i passwd/user-password password osbash
d-i passwd/user-password-again password osbash
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
#-------------------------------------------------------------------------------
### Package selection
tasksel tasksel/first minimal
# Individual additional packages to install
d-i pkgsel/include string openssh-server dkms localepurge
# http://sfxpt.wordpress.com/2013/06/09/get-the-debianubuntu-ready-and-customized-the-way-you-like-in-10-minutes/
### Pkg:localepurge
# Options explained at: http://anonscm.debian.org/cgit/collab-maint/localepurge.git/tree/debian/localepurge.templates
localepurge localepurge/nopurge multiselect en_US
# Really remove all locales?
localepurge localepurge/none_selected boolean false
# Also delete localized man pages?
localepurge localepurge/mandelete boolean true
# Avoid note that localepurge will not take any action until configured
localepurge localepurge/remove_no note
# Inform about new locales?
localepurge localepurge/dontbothernew boolean false
# Display verbose output?
localepurge localepurge/verbose boolean false
# Display freed disk space?
localepurge localepurge/showfreedspace boolean true
# Accurate disk space calculation?
localepurge localepurge/quickndirtycalc boolean true
# Use dpkg --path-exclude?
localepurge localepurge/use-dpkg-feature bolean true
#-------------------------------------------------------------------------------
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select none
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/sda
# Avoid warning about install CD not containing full support for language
d-i pkgsel/install-language-support boolean false
# Avoid reboot confirmation
d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true
# Halt after installation
#d-i debian-installer/exit/poweroff boolean true
#ubiquity ubiquity/poweroff boolean true
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
# With Ubuntu 12.04 LTS, modesetting may result in a blank console
d-i debian-installer/add-kernel-opts string vga=0x301 nomodeset
#-------------------------------------------------------------------------------
#### Advanced options
### Running custom commands during the installation
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations!
# This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
d-i preseed/late_command string DIR=/target/home/osbash/.ssh; \
mkdir -v $DIR; \
chmod 700 $DIR; \
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSnGKD4VTg7KhomNhFxjO8VfvSHZJzuFSvthK9jIeH2+M45QTR4batY+4qOtq9DzGgjsSVp6hP2QSfcVbZtSL3jjh3sjSN3ErT4UKeqRehNX/bCKmdHg0eK5m1EbPpJlY+fzSYj4qDw5x8rDeFoHVHydh2jyRFdd39/McaNQOYuQRmZbR9f7IISH99isIxmosYn3PeAfIVAcLqT9OcYPgPKJ+tsTvbFkYE2hOiS7Eek0C90KOVbJP01Vz3b/ccEYQ5WFlL0oqFkesVQ5I4cth1wMG26glbZO5SVT0GAldMwvm+H/wnVhQ/AjF5NmuIEGn45K4/c0csoIzWcKduPEyf osbash insecure public key' >> $DIR/authorized_keys; \
in-target chown -Rv osbash:osbash /home/osbash/.ssh; \
echo 'osbash ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers; \
echo 'Defaults:osbash !requiretty' >> /target/etc/sudoers

View File

@ -98,22 +98,25 @@ sudo sed -i 's|// forwarders {|forwarders {\n\
echo "Restarting DNS server."
sudo service bind9 restart
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo "Creating a VLAN IP as gateway."
set_iface_list
IFACE_0=$(ifnum_to_ifname 0)
IFACE_1=$(ifnum_to_ifname 1)
echo "Creating a VLAN IP as gateway (interfaces $IFACE_0, $IFACE_1)."
sudo apt-get -y install vlan
sudo modprobe 8021q
sudo vconfig add eth1 10
sudo vconfig add "$IFACE_1" 10
sudo su -c 'echo "8021q" >> /etc/modules'
cat << VLAN_IP | sudo tee -a /etc/network/interfaces
auto eth1.10
iface eth1.10 inet static
auto $IFACE_1.10
iface $IFACE_1.10 inet static
address $PXE_GATEWAY
netmask 255.255.255.0
vlan-raw-device eth1
vlan-raw-device $IFACE_1
VLAN_IP
sudo ifup eth1.10
sudo ifup "$IFACE_1".10
# Forward traffic from eth0.10 to eth0 and eth1
@ -131,9 +134,9 @@ sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -X
sudo iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface eth0 -j ACCEPT
sudo iptables --append FORWARD --in-interface eth1 -j ACCEPT
sudo iptables --table nat --append POSTROUTING --out-interface $IFACE_0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface $IFACE_0 -j ACCEPT
sudo iptables --append FORWARD --in-interface $IFACE_1 -j ACCEPT
echo "Making iptable rules persistent."
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections

View File

@ -31,7 +31,11 @@ echo "IP on the management network: $PXE_NET_IP."
# -----------------------------------------------------------------------------
echo "Creating preseed file for training-labs."
TMPF=/var/www/html/ubuntu/preseed/training-labs.seed
sudo cp "$LIB_DIR/osbash/netboot/preseed-ssh-v3.cfg" "$TMPF"
sudo cp -v "$LIB_DIR/osbash/netboot/preseed-ssh-v5.cfg" "$TMPF"
set_iface_list
IFACE_1=$(ifnum_to_ifname 1)
echo "Using interface $IFACE_1."
# -----------------------------------------------------------------------------
function create_boot_entry {
@ -46,7 +50,7 @@ function create_boot_entry {
label $entry_name
kernel ubuntu-installer/amd64/linux
append preseed/url=http://$PXE_NET_IP/ubuntu/preseed/training-labs.seed vga=normal initrd=ubuntu-installer/amd64/initrd.gz debian-installer=en_US auto=true locale=en_US hostname=foobar debconf/frontend=noninteractive keyboard-configuration/modelcode=SKIP console-setup/ask_detect=false netcfg/choose_interface=eth1 priority=critical netcfg/get_ipaddress=$node_ip netcfg/get_netmask=255.255.255.0 netcfg/get_gateway=$PXE_GATEWAY netcfg/get_nameservers=$PXE_GATEWAY netcfg/disable_dhcp=true
append preseed/url=http://$PXE_NET_IP/ubuntu/preseed/training-labs.seed vga=normal initrd=ubuntu-installer/amd64/initrd.gz debian-installer=en_US auto=true locale=en_US hostname=foobar debconf/frontend=noninteractive keyboard-configuration/modelcode=SKIP console-setup/ask_detect=false netcfg/choose_interface=$IFACE_1 priority=critical netcfg/get_ipaddress=$node_ip netcfg/get_netmask=255.255.255.0 netcfg/get_gateway=$PXE_GATEWAY netcfg/get_nameservers=$PXE_GATEWAY netcfg/disable_dhcp=true
PXEMENU
}