Merge "moved floating ip db access and sanity checking from network api into network manager added floating ip get by fixed address added fixed_ip_get moved floating ip testing from osapi into the network tests where they belong"

This commit is contained in:
Jenkins 2011-10-10 17:01:35 +00:00 committed by Gerrit Code Review
commit ab0ef769e2
3 changed files with 25 additions and 0 deletions
nova

@ -372,6 +372,11 @@ def fixed_ip_disassociate_all_by_timeout(context, host, time):
return IMPL.fixed_ip_disassociate_all_by_timeout(context, host, time)
def fixed_ip_get(context, id):
"""Get fixed ip by id or raise if it does not exist."""
return IMPL.fixed_ip_get(context, id)
def fixed_ip_get_all(context):
"""Get all defined fixed ips."""
return IMPL.fixed_ip_get_all(context)

@ -796,6 +796,25 @@ def fixed_ip_disassociate_all_by_timeout(_context, host, time):
return result
@require_context
def fixed_ip_get(context, id, session=None):
if not session:
session = get_session()
result = session.query(models.FixedIp).\
filter_by(id=id).\
filter_by(deleted=can_read_deleted(context)).\
options(joinedload('floating_ips')).\
options(joinedload('network')).\
first()
if not result:
raise exception.FixedIpNotFound(id=id)
if is_user_context(context):
authorize_project_context(context, result.instance.project_id)
return result
@require_admin_context
def fixed_ip_get_all(context, session=None):
if not session:

@ -56,6 +56,7 @@ LOG = log.getLogger('nova.tests')
class skip_test(object):
"""Decorator that skips a test."""
# TODO(tr3buchet): remember forever what comstud did here
def __init__(self, msg):
self.message = msg