merge trunk
This commit is contained in:
commit
933cc87c52
@ -261,11 +261,13 @@ def floating_ip_disassociate(context, address):
|
|||||||
return IMPL.floating_ip_disassociate(context, address)
|
return IMPL.floating_ip_disassociate(context, address)
|
||||||
|
|
||||||
|
|
||||||
def floating_ip_fixed_ip_associate(context, floating_address, fixed_address):
|
def floating_ip_fixed_ip_associate(context, floating_address,
|
||||||
|
fixed_address, host):
|
||||||
"""Associate an floating ip to a fixed_ip by address."""
|
"""Associate an floating ip to a fixed_ip by address."""
|
||||||
return IMPL.floating_ip_fixed_ip_associate(context,
|
return IMPL.floating_ip_fixed_ip_associate(context,
|
||||||
floating_address,
|
floating_address,
|
||||||
fixed_address)
|
fixed_address,
|
||||||
|
host)
|
||||||
|
|
||||||
|
|
||||||
def floating_ip_get_all(context):
|
def floating_ip_get_all(context):
|
||||||
@ -324,13 +326,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):
|
||||||
@ -365,7 +369,7 @@ def fixed_ip_get_all(context):
|
|||||||
|
|
||||||
def fixed_ip_get_all_by_instance_host(context, host):
|
def fixed_ip_get_all_by_instance_host(context, host):
|
||||||
"""Get all allocated fixed ips filtered by instance host."""
|
"""Get all allocated fixed ips filtered by instance host."""
|
||||||
return IMPL.fixed_ip_get_all_instance_by_host(context, host)
|
return IMPL.fixed_ip_get_all_by_instance_host(context, host)
|
||||||
|
|
||||||
|
|
||||||
def fixed_ip_get_by_address(context, address):
|
def fixed_ip_get_by_address(context, address):
|
||||||
|
@ -529,7 +529,8 @@ def floating_ip_count_by_project(context, project_id):
|
|||||||
|
|
||||||
|
|
||||||
@require_context
|
@require_context
|
||||||
def floating_ip_fixed_ip_associate(context, floating_address, fixed_address):
|
def floating_ip_fixed_ip_associate(context, floating_address,
|
||||||
|
fixed_address, host):
|
||||||
session = get_session()
|
session = get_session()
|
||||||
with session.begin():
|
with session.begin():
|
||||||
# TODO(devcamcar): How to ensure floating_id belongs to user?
|
# TODO(devcamcar): How to ensure floating_id belongs to user?
|
||||||
@ -540,6 +541,7 @@ def floating_ip_fixed_ip_associate(context, floating_address, fixed_address):
|
|||||||
fixed_address,
|
fixed_address,
|
||||||
session=session)
|
session=session)
|
||||||
floating_ip_ref.fixed_ip = fixed_ip_ref
|
floating_ip_ref.fixed_ip = fixed_ip_ref
|
||||||
|
floating_ip_ref.host = host
|
||||||
floating_ip_ref.save(session=session)
|
floating_ip_ref.save(session=session)
|
||||||
|
|
||||||
|
|
||||||
@ -583,6 +585,7 @@ def floating_ip_disassociate(context, address):
|
|||||||
else:
|
else:
|
||||||
fixed_ip_address = None
|
fixed_ip_address = None
|
||||||
floating_ip_ref.fixed_ip = None
|
floating_ip_ref.fixed_ip = None
|
||||||
|
floating_ip_ref.host = None
|
||||||
floating_ip_ref.save(session=session)
|
floating_ip_ref.save(session=session)
|
||||||
return fixed_ip_address
|
return fixed_ip_address
|
||||||
|
|
||||||
@ -669,14 +672,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