merging trunk
This commit is contained in:
commit
d1d389b580
@ -324,13 +324,15 @@ def migration_get_by_instance_and_status(context, instance_uuid, status):
|
||||
####################
|
||||
|
||||
|
||||
def fixed_ip_associate(context, address, instance_id, network_id=None):
|
||||
def fixed_ip_associate(context, address, instance_id, network_id=None,
|
||||
reserved=False):
|
||||
"""Associate fixed ip to instance.
|
||||
|
||||
Raises if fixed ip is not available.
|
||||
|
||||
"""
|
||||
return IMPL.fixed_ip_associate(context, address, instance_id, network_id)
|
||||
return IMPL.fixed_ip_associate(context, address, instance_id, network_id,
|
||||
reserved)
|
||||
|
||||
|
||||
def fixed_ip_associate_pool(context, network_id, instance_id=None, host=None):
|
||||
|
@ -669,14 +669,19 @@ def floating_ip_update(context, address, values):
|
||||
|
||||
|
||||
@require_admin_context
|
||||
def fixed_ip_associate(context, address, instance_id, network_id=None):
|
||||
def fixed_ip_associate(context, address, instance_id, network_id=None,
|
||||
reserved=False):
|
||||
"""Keyword arguments:
|
||||
reserved -- should be a boolean value(True or False), exact value will be
|
||||
used to filter on the fixed ip address
|
||||
"""
|
||||
session = get_session()
|
||||
with session.begin():
|
||||
network_or_none = or_(models.FixedIp.network_id == network_id,
|
||||
models.FixedIp.network_id == None)
|
||||
fixed_ip_ref = session.query(models.FixedIp).\
|
||||
filter(network_or_none).\
|
||||
filter_by(reserved=False).\
|
||||
filter_by(reserved=reserved).\
|
||||
filter_by(deleted=False).\
|
||||
filter_by(address=address).\
|
||||
with_lockmode('update').\
|
||||
|
Loading…
x
Reference in New Issue
Block a user