Split out nova-bm-dnsmasq.

To migrate to using Neutron's DHCP agent (and get away from file
injection) we need to stop using the workaround pool based dnsmasq
DHCP server. We may need to build either configuration until the
Neutron DHCP agent is stable and working, so rather than deleting,
lets split it into a dedicated element.

Change-Id: I11a048c6d0974dc613cd27509e3e9574a85cbc45
This commit is contained in:
Robert Collins 2013-09-18 18:15:25 +12:00
parent 462002cf3c
commit cbd8993954
8 changed files with 89 additions and 79 deletions

View File

@ -0,0 +1,12 @@
Non-PXE Neutron DHCP workaround
-------------------------------
Separate pool based dnsmasq to workaround old Neutron not supporting PXE
booting, which is restarted during os-refresh-config.
Installs a filter-bootps cronjob. filter-bootps adds an iptables filter to the
br-ctlplane bridge interface, ensuring that only bootps requests from nodes
registered with nova baremetal are received by services running in the image.
This prevents the seed node from trying to PXE boot overcloud nodes (rather
than the undercloud node doing so).

View File

@ -0,0 +1,71 @@
#!/bin/bash
set -eux
function install_dnsmasq_upstart {
cat > /etc/init/nova-bm-dnsmasq.conf << eof
start on runlevel [2345]
stop on runlevel [016]
pre-start script
mkdir -p /tftpboot
chown -R nova:nova /tftpboot
killall -9 dnsmasq || echo 'no dnsmasq running'
end script
respawn
respawn limit 2 5
script
exec dnsmasq --conf-file= \\
--keep-in-foreground \\
--port=0 \\
--enable-tftp \\
--tftp-root=/tftpboot \\
--dhcp-boot=pxelinux.0 \\
--bind-interfaces \\
--pid-file=/var/run/dnsmasq.pid \\
--interface=br-ctlplane \\
--dhcp-range=192.0.2.65,192.0.2.69,29
end script
post-start exec sleep 1
eof
}
function install_dnsmasq_systemd {
cat > /lib/systemd/system/nova-bm-dnsmasq.service << eof
[Unit]
Description=Nova dnsmasq service
After=openvswitch.service
[Service]
Type=forking
ExecStartPre=/bin/mkdir -p /tftpboot
ExecStartPre=/bin/chown -R nova:nova /tftpboot
ExecStartPre=-/bin/killall -9 dnsmasq
ExecStart=/sbin/dnsmasq --conf-file= \\
--port=0 \\
--enable-tftp \\
--tftp-root=/tftpboot \\
--dhcp-boot=pxelinux.0 \\
--bind-interfaces \\
--pid-file=/var/run/dnsmasq.pid \\
--interface=br-ctlplane \\
--dhcp-range=192.0.2.65,192.0.2.69,29
[Install]
WantedBy=multi-user.target
Alias=nova-bm-dnsmasq.service
eof
# Make systemd take notice of it
systemctl daemon-reload
# Enable the service
systemctl enable nova-bm-dnsmasq.service
}
if [ -d /etc/init ]; then
install_dnsmasq_upstart
elif [ -d /lib/systemd/system ]; then
install_dnsmasq_systemd
fi

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -eux
service nova-bm-dnsmasq restart

View File

@ -1,14 +1,8 @@
Nova baremetal services
-----------------------
Configures the nova-baremetal directories on disk and restarts the baremetal
dnsmasq and helper services in os-refresh-config.
Installs a filter-bootps cronjob. filter-bootps adds an iptables filter to the
br-ctlplane bridge interface, ensuring that only bootps requests from nodes
registered with nova baremetal are received by services running in the image.
This prevents the seed node from trying to PXE boot overcloud nodes (rather
than the undercloud node doing so).
Configures the nova-baremetal directories on disk and restarts the deploy
helper service in os-refresh-config.
An iptables rule to capture incoming EC2 metadata API requests and redirect
them to the nova API is automatically added to the neutron.ovs.physical\_bridge

View File

@ -1,74 +1,4 @@
#!/bin/bash
set -eux
function install_dnsmasq_upstart {
cat > /etc/init/nova-bm-dnsmasq.conf << eof
start on runlevel [2345]
stop on runlevel [016]
pre-start script
mkdir -p /tftpboot
chown -R nova:nova /tftpboot
killall -9 dnsmasq || echo 'no dnsmasq running'
end script
respawn
respawn limit 2 5
script
exec dnsmasq --conf-file= \\
--keep-in-foreground \\
--port=0 \\
--enable-tftp \\
--tftp-root=/tftpboot \\
--dhcp-boot=pxelinux.0 \\
--bind-interfaces \\
--pid-file=/var/run/dnsmasq.pid \\
--interface=br-ctlplane \\
--dhcp-range=192.0.2.65,192.0.2.69,29
end script
post-start exec sleep 1
eof
}
function install_dnsmasq_systemd {
cat > /lib/systemd/system/nova-bm-dnsmasq.service << eof
[Unit]
Description=Nova dnsmasq service
After=openvswitch.service
[Service]
Type=forking
ExecStartPre=/bin/mkdir -p /tftpboot
ExecStartPre=/bin/chown -R nova:nova /tftpboot
ExecStartPre=-/bin/killall -9 dnsmasq
ExecStart=/sbin/dnsmasq --conf-file= \\
--port=0 \\
--enable-tftp \\
--tftp-root=/tftpboot \\
--dhcp-boot=pxelinux.0 \\
--bind-interfaces \\
--pid-file=/var/run/dnsmasq.pid \\
--interface=br-ctlplane \\
--dhcp-range=192.0.2.65,192.0.2.69,29
[Install]
WantedBy=multi-user.target
Alias=nova-bm-dnsmasq.service
eof
# Make systemd take notice of it
systemctl daemon-reload
# Enable the service
systemctl enable nova-bm-dnsmasq.service
}
if [ -d /etc/init ]; then
install_dnsmasq_upstart
elif [ -d /lib/systemd/system ]; then
install_dnsmasq_systemd
fi
os-svc-daemon nova-baremetal-deploy-helper nova nova-baremetal-deploy-helper "--config-dir /etc/nova"

View File

@ -2,4 +2,3 @@
set -eux
service nova-baremetal-deploy-helper restart
service nova-bm-dnsmasq restart