'nova-manage floating create' does nothing for /31 or /32 address range

Bug #987760 reported by David Wragg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Low
Unassigned

Bug Description

Version: 2012.1-LOCALBRANCH:LOCALREVISION (from the ubuntu 2012.1-0ubuntu2 packages, i.e. essex/stable).

'nova-manage floating create' silently does nothing if you pass a /31 or /32 address range. E.g.

# nova-manage floating list
No floating IP addresses have been defined.
# nova-manage floating create 10.20.223.242/31

No error was reported, so my expectation is that this has added 2 IP addresses to the pool, but:

# nova-manage floating list
No floating IP addresses have been defined.

The same occurs for a /32 network:

# nova-manage floating create 10.20.223.242/32
# nova-manage floating list
No floating IP addresses have been defined.

This occurs because nova/bin/nova-manage:FloatingIpCommands address_to_hosts calls netaddr.IPNetwork.iter_hosts, which states that "Any subnet that contains less than 4 IP addresses yields an empty list" (<http://packages.python.org/netaddr/netaddr.ip.IPNetwork-class.html#iter_hosts>):

>>> list(netaddr.IPNetwork('10.20.223.242/31').iter_hosts())
[]

I believe the netaddr.IPNetwork.iter_hosts behaviour is reasonable, as once the network and broadcast addresses are excluded, no addresses remain in an /31 network. But rather than silently doing nothing in such cases, nova-manage should report an error and suggest to the user that they add the IP addresses individually (which does work).

Revision history for this message
Sean Dague (sdague) wrote :

Suggested priority: medium

Changed in nova:
status: New → Confirmed
tags: added: low-hanging-fruit
Revision history for this message
Thierry Carrez (ttx) wrote :

Setting to Low because it's a bit of a corner case

Changed in nova:
importance: Undecided → Low
Revision history for this message
Mark McLoughlin (markmc) wrote :

See bug #951161 - we support specifying a single IP address now, just don't specify /31 or /32

/32 and /31 are basically invalid network ranges:

 http://en.wikipedia.org/wiki/IPv4#Addresses_ending_in_0_or_255
 http://tools.ietf.org/html/rfc1122

 IP addresses are not permitted to have the value 0 or -1 for
 any of the <Host-number>, <Network-number>, or <Subnet-
 number> fields (except in the special cases listed above).
 This implies that each of these fields will be at least two
 bits long.

Changed in nova:
status: Confirmed → Invalid
tags: removed: low-hanging-fruit
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.