Merge "Stop allocating network and broadcast addresses"

This commit is contained in:
Zuul 2019-08-14 19:12:46 +00:00 committed by Gerrit Code Review
commit 49b3dc66af
3 changed files with 16 additions and 4 deletions

View File

@ -147,6 +147,9 @@ def update_allocation(module, allocations):
allocation_pool = netaddr.IPSet(allocation_pool)
else:
allocation_pool = netaddr.IPSet([network])
if network.prefixlen != 32:
reserved_ips = [network.network, network.broadcast]
allocation_pool -= netaddr.IPSet(reserved_ips)
free_ips = allocation_pool - allocated_ips
for free_cidr in free_ips.iter_cidrs():
ip = free_cidr[0]

View File

@ -157,10 +157,12 @@ To configure a network called ``example`` with VLAN ID ``123``:
IP Address Allocation
=====================
IP addresses are allocated automatically by Kayobe from the
allocation pool
defined by ``allocation_pool_start`` and ``allocation_pool_end``. The
allocated addresses are stored in
IP addresses are allocated automatically by Kayobe from the allocation pool
defined by ``allocation_pool_start`` and ``allocation_pool_end``. If these
variables are undefined, the entire network is used, except for network and
broadcast addresses. IP addresses are only allocated if the network ``cidr`` is
set and DHCP is not used (see ``bootproto`` in
:ref:`configuration-network-per-host`). The allocated addresses are stored in
``${KAYOBE_CONFIG_PATH}/network-allocation.yml`` using the global per-network
attribute ``ips`` which maps Ansible inventory hostnames to allocated IPs.
@ -264,6 +266,8 @@ To configure a network called ``example`` with a default route and a
- cidr: 10.1.0.0/24
table: exampleroutetable
.. _configuration-network-per-host:
Per-host Network Configuration
==============================

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Stops allocating network and broadcast addresses to hosts when an allocation pool
is not defined.