Uniqueness checks for floating ip addresses.
Fixes bug 1003392. Change-Id: I3f4554659c68476539c82d359cc080b34088b3ae
This commit is contained in:
@@ -431,11 +431,17 @@ class FloatingIpCommands(object):
|
|||||||
pool = FLAGS.default_floating_pool
|
pool = FLAGS.default_floating_pool
|
||||||
if not interface:
|
if not interface:
|
||||||
interface = FLAGS.public_interface
|
interface = FLAGS.public_interface
|
||||||
for address in self.address_to_hosts(ip_range):
|
|
||||||
db.floating_ip_create(admin_context,
|
ips = ({'address': str(address), 'pool': pool, 'interface': interface}
|
||||||
{'address': str(address),
|
for address in self.address_to_hosts(ip_range))
|
||||||
'pool': pool,
|
try:
|
||||||
'interface': interface})
|
db.floating_ip_bulk_create(admin_context, ips)
|
||||||
|
except exception.FloatingIpExists as exc:
|
||||||
|
# NOTE(simplylizz): Maybe logging would be better here
|
||||||
|
# instead of printing, but logging isn't used here and I
|
||||||
|
# don't know why.
|
||||||
|
print('error: %s' % exc)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
@args('--ip_range', dest="ip_range", metavar='<range>', help='IP range')
|
@args('--ip_range', dest="ip_range", metavar='<range>', help='IP range')
|
||||||
def delete(self, ip_range):
|
def delete(self, ip_range):
|
||||||
|
|||||||
Reference in New Issue
Block a user