From 4dcc4bc4b459b454431ca60bec0dead2146f52af Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 9 Sep 2010 07:53:57 -0700 Subject: list command for floating ips --- nova/db/sqlalchemy/api.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'nova') diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 4330c86a9..eb39166ac 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -144,16 +144,20 @@ def floating_ip_disassociate(_context, address): def floating_ip_get_all(_context): - return models.FloatingIp.all() + session = get_session() + return session.query(models.FloatingIp + ).options(joinedload_all('fixed_ip.instance') + ).filter_by(deleted=False + ).all() def floating_ip_get_all_by_host(_context, host): session = get_session() - with session.begin(): - return session.query(models.FloatingIp - ).filter_by(host=host - ).filter_by(deleted=False - ).all() + return session.query(models.FloatingIp + ).options(joinedload_all('fixed_ip.instance') + ).filter_by(host=host + ).filter_by(deleted=False + ).all() def floating_ip_get_by_address(_context, address): return models.FloatingIp.find_by_str(address) -- cgit