Adding only one floating IP to the cloud

Bug #943923 reported by Édouard Thuleau
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Julien Danjou

Bug Description

If we try to add only one floating IP (subnet /32) to the cloud with 'nova-mabage' command, nothing appends.

The 'nova-manage' command uses 'netaddr' python library with class 'IPNetwork' which exclude the network and broadcast addresses. So the floating IP '80.0.0.1/32' for example, is exclude and not added to the floating IP list (without warning or errors).

Revision history for this message
Édouard Thuleau (ethuleau) wrote :

diff --git a/bin/nova-manage b/bin/nova-manage
index 08c4133..45f23e2 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -702,6 +702,12 @@ class FloatingIpCommands(object):
             pool = FLAGS.default_floating_pool
         if not interface:
             interface = FLAGS.public_interface
+ if addresses.size == 1:
+ db.floating_ip_create(admin_context,
+ {'address': str(addresses.ip),
+ 'pool': pool,
+ 'interface': interface})
+ return
         for address in addresses.iter_hosts():
             db.floating_ip_create(admin_context,
                                   {'address': str(address),
@@ -711,7 +717,12 @@ class FloatingIpCommands(object):
     @args('--ip_range', dest="ip_range", metavar='<range>', help='IP range')
     def delete(self, ip_range):
         """Deletes floating ips by range"""
- for address in netaddr.IPNetwork(ip_range).iter_hosts():
+ addresses = netaddr.IPNetwork(ip_range)
+ if addresses.size == 1:
+ db.floating_ip_destroy(context.get_admin_context(),
+ str(addresses.ip))
+ return
+ for address in addresses.iter_hosts():
             db.floating_ip_destroy(context.get_admin_context(),
                                    str(address))

Revision history for this message
Édouard Thuleau (ethuleau) wrote :
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Mike Scherbakov (mihgen) wrote :

Fix committed to the master. See commit sha e430c8424a62d9d397980899ae0458a5e947704e

Changed in nova:
status: Triaged → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → essex-rc1
status: Fix Committed → Fix Released
Mark McLoughlin (markmc)
Changed in nova:
assignee: nobody → Julien Danjou (jdanjou)
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-rc1 → 2012.1
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.