dns zoneconfig error with ranges of one IP length

Bug #1615686 reported by Paolo de Rosa on 2016-08-22
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Status tracked in Trunk
2.0
High
Unassigned
Trunk
High
LaMont Jones

Bug Description

Platform MAAS 2.0 Xenial

Our customer is using MAAS to provide dhcp service on /30 networks, IP range has only one address reserved ad dynamic range so MAAS generates DHCP configuration correctly but it has an issue generating bind zones.

For example when there is a network like 172.16.0.4/30 where 172.16.0.6 is the gateway and 172.16.0.5 is the only one IP in the dynamic range what happens is that in file /usr/lib/python3/dist-packages/provisioningserver/dns/zoneconfig.py function get_details_for_ip_range(ip_range)will be called with only one element.

The traceback below is reported by the region controller:

Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011Traceback (most recent call last):
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3.5/threading.py", line 862, in run
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 self._target(*self._args, **self._kwargs)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 904, in worker
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return target()
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/twisted/_threads/_threadworker.py", line 46, in work
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 task()
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/twisted/_threads/_team.py", line 190, in doWork
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 task()
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011--- <exception caught here> ---
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 246, in inContext
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 result = inContext.theWork()
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 262, in <lambda>
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 118, in callWithContext
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return self.currentContext().callWithContext(ctx, func, *args, **kw)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 81, in callWithContext
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return func(*args,**kw)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 937, in callInContext
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return func(*args, **kwargs)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 602, in call_within_transaction
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return func_outside_txn(*args, **kwargs)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 421, in retrier
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return func(*args, **kwargs)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3.5/contextlib.py", line 30, in inner
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 return func(*args, **kwds)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/maasserver/dns/config.py", line 65, in dns_update_all_zones
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 bind_write_zones(zones)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/dns/actions.py", line 143, in bind_write_zones
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 zone.write_config()
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/dns/zoneconfig.py", line 303, in write_config
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 for dynamic_range in self._dynamic_ranges
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/dns/zoneconfig.py", line 304, in <genexpr>
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 if dynamic_range.version == 4
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/dns/zoneconfig.py", line 275, in get_GENERATE_directives
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 subnets, prefix, rdns_suffix = get_details_for_ip_range(dynamic_range)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/provisioningserver/dns/zoneconfig.py", line 78, in get_details_for_ip_range
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 cidr = spanning_cidr(ip_range)
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 File "/usr/lib/python3/dist-packages/netaddr/ip/__init__.py", line 1661, in spanning_cidr
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011 raise ValueError('IP sequence must contain at least 2 elements!')
Aug 22 13:35:31 maasregioncontroller1 sh[27208]: #011builtins.ValueError: IP sequence must contain at least 2 elements!

Related branches

lp:~lamont/maas/bug-1615686
Mike Pontillo: Approve on 2016-08-22
lp:~lamont/maas/bug-1615686-2.0
Andres Rodriguez: Approve on 2016-08-22
description: updated
summary: - dns zoneconfig error with /30 networks
+ dns zoneconfig error with ranges of one IP length
Changed in maas:
importance: Undecided → High
status: New → Confirmed
no longer affects: maas/2.1
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers