Merge from trunk
This commit is contained in:
commit
07ecd43ea9
@ -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.
|
"""Associate fixed ip to instance.
|
||||||
|
|
||||||
Raises if fixed ip is not available.
|
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):
|
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
|
@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()
|
session = get_session()
|
||||||
with session.begin():
|
with session.begin():
|
||||||
network_or_none = or_(models.FixedIp.network_id == network_id,
|
network_or_none = or_(models.FixedIp.network_id == network_id,
|
||||||
models.FixedIp.network_id == None)
|
models.FixedIp.network_id == None)
|
||||||
fixed_ip_ref = session.query(models.FixedIp).\
|
fixed_ip_ref = session.query(models.FixedIp).\
|
||||||
filter(network_or_none).\
|
filter(network_or_none).\
|
||||||
filter_by(reserved=False).\
|
filter_by(reserved=reserved).\
|
||||||
filter_by(deleted=False).\
|
filter_by(deleted=False).\
|
||||||
filter_by(address=address).\
|
filter_by(address=address).\
|
||||||
with_lockmode('update').\
|
with_lockmode('update').\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user