Fix dhcp range for static inventory

For static inventory, we need to define dhcp range, but
we need to provide the static flag. If we don't add the flag, and
there are more NICs attached to that network, dnsmasq will continue
providing dynamic ips on that range, causing the nodes expecting
this one to fail because the ip is already assigned.
Also, set the lease time to infinite, as we have static assignment
on that case, so no need to renew.

Change-Id: I6c0e5a3974900a4e71608e7e6c2c3fcfd1c69463
This commit is contained in:
Yolanda Robla 2015-12-09 11:08:22 +01:00
parent 5dec04a8d0
commit 1f5085bbfd
3 changed files with 12 additions and 2 deletions

View File

@ -67,8 +67,15 @@ dhcp_lease_time: 12h
Alternatively, a user can choose to perform static DHCP assignments to nodes.
This can be enabled by setting the ``inventory_dhcp`` setting to ``true``.
This will result in the ``dhcp_pool_start`` and ``dhcp_pool_end`` settings
being ignored and the ``ipv4_address`` setting being bound to the first
listed MAC address for the node.
only being used to define the range of valid ips to be accepted, and the
``ipv4_address`` setting being bound to the first listed MAC address for
the node.
If you choose to use the static DHCP assignments, you may need to set
the ``dhcp_static_mask`` setting according to your needs. It defaults to
a /24 range.
In the case of static inventory, please also consider to set the
``dhcp_lease_time`` setting to infinite, to avoid unnecessary refreshes
of ips.
In case your HW needs a kernel option to boot, set the following variable:

View File

@ -56,6 +56,7 @@ enabled_drivers: "agent_ipmitool,pxe_amt,agent_ilo,agent_ucs"
dhcp_pool_start: 192.168.1.200
dhcp_pool_end: 192.168.1.250
dhcp_lease_time: 12h
dhcp_static_mask: 255.255.255.0
# Dnsmasq default route for clients. If not defined, dnsmasq will push to clients
# as default route the same IP of the dnsmasq server.
# Default: undefined

View File

@ -156,6 +156,8 @@ dhcp-hostsfile=/etc/dnsmasq.d/bifrost.dhcp-hosts.d
# service.
{% if testing %}
dhcp-range=192.168.122.2,192.168.122.254,12h
{% elif inventory_dhcp %}
dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},static,{{dhcp_static_mask}},{{dhcp_lease_time}}
{% else %}
dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},{{dhcp_lease_time}}
{% endif %}