Error message when trying to reserve the same static IP twice is unhelpful
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Graham Binns |
Bug Description
Using the MAAS CLI I was able to do this twice in a row:
$ maas maas-user ipaddresses reserve network=
No error was reported on the second run. I was expecting something like "192.168.50.100 is already reserved".
Then, trying to release "192.168.50.100" reservation twice, this happened:
$ maas maas-user ipaddresses release ip=192.168.50.100
null
$ maas maas-user ipaddresses release ip=192.168.50.100
Not Found
There's nothing relevant in the log files. I have the "192.168.50.0/24" network configured as Manage DNS and DHCP on the single cluster controller's eth0 interface, having a static range 192.168.50.100 - 192.168.50.200.
$ dpkg -l '*maas*'|cat
Desired=
| Status=
|/ Err?=(none)
||/ Name Version Architecture Description
+++-===
ii maas 1.7.0~beta5+
ii maas-cli 1.7.0~beta5+
ii maas-cluster-
ii maas-common 1.7.0~beta5+
ii maas-dhcp 1.7.0~beta5+
ii maas-dns 1.7.0~beta5+
un maas-proxy <none> <none> (no description available)
ii maas-region-
ii maas-region-
ii python-django-maas 1.7.0~beta5+
ii python-maas-client 1.7.0~beta5+
ii python-
Related branches
- Raphaël Badin (community): Approve
-
Diff: 31 lines (+7/-3)2 files modifiedsrc/maasserver/api/tests/test_ipaddresses.py (+4/-2)
src/maasserver/models/staticipaddress.py (+3/-1)
description: | updated |
summary: |
- Better error message when trying to reserve the same static IP twice + Error message when trying to reserve the same static IP twice is + unhelpful |
Changed in maas: | |
status: | New → Triaged |
importance: | Undecided → High |
description: | updated |
tags: | added: trivial |
Changed in maas: | |
milestone: | none → next |
Changed in maas: | |
status: | Triaged → In Progress |
assignee: | nobody → Graham Binns (gmb) |
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas: | |
milestone: | next → 1.7.1 |
Changed in maas: | |
status: | Fix Committed → Fix Released |
Sorry, so I got a bit confused -- there's no duplicate created, but also there's no error message about the duplicate:
$ maas maas-user ipaddresses reserve network= 192.168. 50.0/24 requested_ address= 192.168. 50.100 api/1.0/ ipaddresses/ ", 20T13:22: 07.252"
{
"alloc_type": 4,
"ip": "192.168.50.100",
"resource_uri": "/MAAS/
"created": "2014-10-
}
(first run)
$ maas maas-user ipaddresses reserve network= 192.168. 50.0/24 requested_ address= 192.168. 50.100
(second run)
After second run "ipaddresses read" does not show more than one 192.168.50.100 address.
So I guess the bug report is about a better error message. Also it will be nicer to have a better message when "requested_address" is invalid:
$ maas maas-user ipaddresses reserve network= 192.168. 50.0/24 requested_ address= invalid
failed to detect a valid IP address from u'invalid'
In the case above there's this traceback in /var/logs/ maas/maas- django. log: ####### ####### ####### #### Exception: failed to detect a valid IP address from u'invalid' ####### ####### ####### ####### #### python2. 7/dist- packages/ django/ core/handlers/ base.py" , line 112, in get_response callback( request, *callback_args, **callback_kwargs) python2. 7/dist- packages/ django/ views/decorator s/vary. py", line 19, in inner_func python2. 7/dist- packages/ piston/ resource. py", line 167, in __call__ handler( e, request, meth, em_format) python2. 7/dist- packages/ piston/ resource. py", line 165, in __call__ python2. 7/dist- packages/ maasserver/ api/support. py", line 189, in dispatch python2. 7/dist- packages/ maasserver/ api/ip_ addresses. py", line 103, in reserve python2. 7/dist- packages/ maasserver/ api/ip_ addresses. py", line 67, in claim_ip python2. 7/dist- packages/ maasserver/ models/ staticipaddress .py", line 178, in allocate_new address = IPAddress( requested_ address) python2. 7/dist- packages/ netaddr/ ip/__init_ _.py", line 315, in __init__
ERROR 2014-10-20 13:25:06,078 maasserver #######
ERROR 2014-10-20 13:25:06,081 maasserver Traceback (most recent call last):
File "/usr/lib/
response = wrapped_
File "/usr/lib/
response = func(*args, **kwargs)
File "/usr/lib/
result = self.error_
File "/usr/lib/
result = meth(request, *args, **kwargs)
File "/usr/lib/
return function(self, request, *args, **kwargs)
File "/usr/lib/
request.user, interface, requested_address)
File "/usr/lib/
user=user)
File "/usr/lib/
requested_
File "/usr/lib/
'address from %r' % addr)
AddrFormatError: failed to detect a valid IP address from u'invalid'