Adds support for floating ip pools
* Implements blueprint multiple-floating-ip-ranges * Adds pool and interface fields to floating ip tables * Adds extension to get a list of available pools * Optionally allows a pool to be specified when allocating * Changes nova-manage command to allow pool and interface * Ip binding uses the interface from table instead of flag * Adds default pool flag to use when pool is not specified * updates test to work with new fields * adds tests for extension Change-Id: Ieb4cbbf07b211697d08178b1cf2252caf75049a2
This commit is contained in:
parent
d383ef607a
commit
80f6ddf3d4
@ -1,5 +1,6 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
|
||||
# Copyright 2010 United States Government as represented by the
|
||||
# Administrator of the National Aeronautics and Space Administration.
|
||||
# All Rights Reserved.
|
||||
@ -237,13 +238,18 @@ def floating_ip_get(context, id):
|
||||
return IMPL.floating_ip_get(context, id)
|
||||
|
||||
|
||||
def floating_ip_allocate_address(context, project_id):
|
||||
"""Allocate free floating ip and return the address.
|
||||
def floating_ip_get_pools(context):
|
||||
"""Returns a list of floating ip pools"""
|
||||
return IMPL.floating_ip_get_pools(context)
|
||||
|
||||
|
||||
def floating_ip_allocate_address(context, project_id, pool):
|
||||
"""Allocate free floating ip from specified pool and return the address.
|
||||
|
||||
Raises if one is not available.
|
||||
|
||||
"""
|
||||
return IMPL.floating_ip_allocate_address(context, project_id)
|
||||
return IMPL.floating_ip_allocate_address(context, project_id, pool)
|
||||
|
||||
|
||||
def floating_ip_create(context, values):
|
||||
|
@ -1,5 +1,6 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
|
||||
# Copyright 2010 United States Government as represented by the
|
||||
# Administrator of the National Aeronautics and Space Administration.
|
||||
# All Rights Reserved.
|
||||
@ -489,7 +490,16 @@ def floating_ip_get(context, id):
|
||||
|
||||
|
||||
@require_context
|
||||
def floating_ip_allocate_address(context, project_id):
|
||||
def floating_ip_get_pools(context):
|
||||
session = get_session()
|
||||
pools = []
|
||||
for result in session.query(models.FloatingIp.pool).distinct():
|
||||
pools.append({'name': result[0]})
|
||||
return pools
|
||||
|
||||
|
||||
@require_context
|
||||
def floating_ip_allocate_address(context, project_id, pool):
|
||||
authorize_project_context(context, project_id)
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
@ -497,6 +507,7 @@ def floating_ip_allocate_address(context, project_id):
|
||||
session=session, read_deleted="no").\
|
||||
filter_by(fixed_ip_id=None).\
|
||||
filter_by(project_id=None).\
|
||||
filter_by(pool=pool).\
|
||||
with_lockmode('update').\
|
||||
first()
|
||||
# NOTE(vish): if with_lockmode isn't supported, as in sqlite,
|
||||
|
Loading…
x
Reference in New Issue
Block a user