Add option to serve PXE for baremetal from nova-network

New variable BM_DNSMASQ_FROM_NOVA_NETWORK: if setting this true,
DevStack configures nova-network's dnsmask to provide PXE and does
not run baremetal's one. In this case PXE traffic occur in the fixed-ip
network, so no dedicated network for PXE is needed.

Change-Id: I67cade02c03ab45ab6b77d8da9066d7d5ec6c78b
This commit is contained in:
Arata Notsu 2013-07-26 20:26:07 +09:00
parent c41a059864
commit bbf0645981
3 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,3 @@
enable-tftp
tftp-root=/tftpboot
dhcp-boot=pxelinux.0

View File

@ -80,6 +80,15 @@ BM_USE_FAKE_ENV=`trueorfalse False $BM_USE_FAKE_ENV`
# change the virtualization type: --engine qemu # change the virtualization type: --engine qemu
BM_POSEUR_EXTRA_OPTS=${BM_POSEUR_EXTRA_OPTS:-} BM_POSEUR_EXTRA_OPTS=${BM_POSEUR_EXTRA_OPTS:-}
# To provide PXE, configure nova-network's dnsmasq rather than run the one
# dedicated to baremetal. When enable this, make sure these conditions are
# fulfilled:
# 1) nova-compute and nova-network runs on the same host
# 2) nova-network uses FlatDHCPManager
# NOTE: the other BM_DNSMASQ_* have no effect on the behavior if this option
# is enabled.
BM_DNSMASQ_FROM_NOVA_NETWORK=`trueorfalse False $BM_DNSMASQ_FROM_NOVA_NETWORK`
# BM_DNSMASQ_IFACE should match FLAT_NETWORK_BRIDGE # BM_DNSMASQ_IFACE should match FLAT_NETWORK_BRIDGE
if [ "$BM_USE_FAKE_ENV" ]; then if [ "$BM_USE_FAKE_ENV" ]; then
BM_DNSMASQ_IFACE=${BM_DNSMASQ_IFACE:-br99} BM_DNSMASQ_IFACE=${BM_DNSMASQ_IFACE:-br99}

View File

@ -1045,6 +1045,11 @@ if is_service_enabled nova; then
iniset $NOVA_CONF baremetal driver $BM_DRIVER iniset $NOVA_CONF baremetal driver $BM_DRIVER
iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER
iniset $NOVA_CONF baremetal tftp_root /tftpboot iniset $NOVA_CONF baremetal tftp_root /tftpboot
if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "True" ]]; then
BM_DNSMASQ_CONF=$NOVA_CONF_DIR/dnsmasq-for-baremetal-from-nova-network.conf
sudo cp "$FILES/dnsmasq-for-baremetal-from-nova-network.conf" "$BM_DNSMASQ_CONF"
iniset $NOVA_CONF DEFAULT dnsmasq_config_file "$BM_DNSMASQ_CONF"
fi
# Define extra baremetal nova conf flags by defining the array ``EXTRA_BAREMETAL_OPTS``. # Define extra baremetal nova conf flags by defining the array ``EXTRA_BAREMETAL_OPTS``.
for I in "${EXTRA_BAREMETAL_OPTS[@]}"; do for I in "${EXTRA_BAREMETAL_OPTS[@]}"; do
@ -1292,16 +1297,17 @@ if is_service_enabled nova && is_baremetal; then
[[ -n "$BM_DEPLOY_KERNEL_ID" ]] && [[ -n "$BM_DEPLOY_RAMDISK_ID" ]] && \ [[ -n "$BM_DEPLOY_KERNEL_ID" ]] && [[ -n "$BM_DEPLOY_RAMDISK_ID" ]] && \
create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID create_baremetal_flavor $BM_DEPLOY_KERNEL_ID $BM_DEPLOY_RAMDISK_ID
# otherwise user can manually add it later by calling nova-baremetal-manage
# otherwise user can manually add it later by calling nova-baremetal-manage # otherwise user can manually add it later by calling nova-baremetal-manage
[[ -n "$BM_FIRST_MAC" ]] && add_baremetal_node [[ -n "$BM_FIRST_MAC" ]] && add_baremetal_node
if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "False" ]]; then
# NOTE: we do this here to ensure that our copy of dnsmasq is running # NOTE: we do this here to ensure that our copy of dnsmasq is running
sudo pkill dnsmasq || true sudo pkill dnsmasq || true
sudo dnsmasq --conf-file= --port=0 --enable-tftp --tftp-root=/tftpboot \ sudo dnsmasq --conf-file= --port=0 --enable-tftp --tftp-root=/tftpboot \
--dhcp-boot=pxelinux.0 --bind-interfaces --pid-file=/var/run/dnsmasq.pid \ --dhcp-boot=pxelinux.0 --bind-interfaces --pid-file=/var/run/dnsmasq.pid \
--interface=$BM_DNSMASQ_IFACE --dhcp-range=$BM_DNSMASQ_RANGE \ --interface=$BM_DNSMASQ_IFACE --dhcp-range=$BM_DNSMASQ_RANGE \
${BM_DNSMASQ_DNS:+--dhcp-option=option:dns-server,$BM_DNSMASQ_DNS} ${BM_DNSMASQ_DNS:+--dhcp-option=option:dns-server,$BM_DNSMASQ_DNS}
fi
# ensure callback daemon is running # ensure callback daemon is running
sudo pkill nova-baremetal-deploy-helper || true sudo pkill nova-baremetal-deploy-helper || true
screen_it baremetal "nova-baremetal-deploy-helper" screen_it baremetal "nova-baremetal-deploy-helper"