Should not use an IPNetwork when assigning floating IPs

Bug #1017682 reported by Joel Friedly
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
John Tran

Bug Description

Using the iter_hosts() method of an IPNetwork in nova-manage.FloatingIpCommands.address_to_hosts() filters out the first and last IPs, as the documentation on iter_hosts() notes:

>>> help(netaddr.IPNetwork.iter_hosts())
    ...
    - for IPv4, the network and broadcast adresses are always excluded. Any subnet that contains less than 4 IP addresses yields an empty list

For most users, this isn't a problem because usually IP addresses are over-provisioned, but it can lead to a very annoying bug where 'nova-manage floating create 192.168.0.2' works, but 'nova-manage floating create 192.168.0.2/32' and 'nova-manage floating create 192.168.0.2/31' both fail to affect nova's floating_ips table at all.

Sean Dague (sdague)
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
tags: added: low-hanging-fruit
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/9181

Changed in nova:
assignee: nobody → John Tran (jtran)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/9181
Committed: http://github.com/openstack/nova/commit/1684c95568a3cf98458f154a4ea3508dd475e763
Submitter: Jenkins
Branch: master

commit 1684c95568a3cf98458f154a4ea3508dd475e763
Author: John Tran <email address hidden>
Date: Fri Jun 29 10:54:24 2012 -0700

    Floating_ip create /31,32 shouldn't silent error

    Fixes bug 1017682 the netaddr.IPNetwork.iter_hosts
    method doesn't return any IPs when /32 or /31 and
    should throw an exception instead of silent error

    Change-Id: Id8875b6016a4dbb40b29d2f7687e6c35491e0129

Changed in nova:
status: In Progress → Fix Committed
Chuck Short (zulcss)
tags: removed: low-hanging-fruit
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-3 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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