summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorChristian Berendt <berendt@b1-systems.de>2011-03-16 17:06:30 +0000
committerTarmac <>2011-03-16 17:06:30 +0000
commitce205ea2c92de2a77f2c308a71551040fa2444df (patch)
tree748a5e69257e0cf51df9a9acbc306d84f2b2151c /nova
parentd36b4d5f3797521b1c2d13a0d30fe98a0671768e (diff)
parent8b3e35b157c688fd38d5aa0eb10ddef33653003d (diff)
downloadnova-ce205ea2c92de2a77f2c308a71551040fa2444df.tar.gz
nova-ce205ea2c92de2a77f2c308a71551040fa2444df.tar.xz
nova-ce205ea2c92de2a77f2c308a71551040fa2444df.zip
added new class Instances for managaging instances
added new method list in class Instances: # nova-manage instance list instance node type state launched image kernel ramdisk project user zone index i-00000547 XXXXXXX m1.small running 2011-02-18 08:36:37 ami-a03ndz0q ami-0isqekvw testing berendt None 0 i-00000548 XXXXXXX m1.small running 2011-02-18 08:37:17 ami-a03ndz0q ami-0isqekvw testing berendt None 1 i-00000549 XXXXXXX m1.small running 2011-02-18 08:37:52 ami-a03ndz0q ami-0isqekvw testing berendt None 2 # nova-manage instance list ares instance node type state launched image kernel ramdisk project user zone index i-00000c1c ares m1.tiny running 2011-02-26 22:51:40 ami-pus9dj84 ami-zhcv0yyx ami-av96fu30 testing berendt None 1 extended the method list in class FixedIps to lookup ip addresses assigned to a specified node: # nova-manage fixed list ares network IP address MAC address hostname host 192.168.3.0/24 192.168.3.6 02:16:3e:75:d7:9a i-00000c1c ares
Diffstat (limited to 'nova')
-rw-r--r--nova/db/api.py5
-rw-r--r--nova/db/sqlalchemy/api.py16
2 files changed, 21 insertions, 0 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index 0aa846d61..3cb0e5811 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -353,6 +353,11 @@ def fixed_ip_get_all(context):
return IMPL.fixed_ip_get_all(context)
+def fixed_ip_get_all_by_host(context, host):
+ """Get all defined fixed ips used by a host."""
+ return IMPL.fixed_ip_get_all_by_host(context, host)
+
+
def fixed_ip_get_by_address(context, address):
"""Get a fixed ip by address or raise if it does not exist."""
return IMPL.fixed_ip_get_by_address(context, address)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 56998ce05..44540617f 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -672,6 +672,22 @@ def fixed_ip_get_all(context, session=None):
return result
+@require_admin_context
+def fixed_ip_get_all_by_host(context, host=None):
+ session = get_session()
+
+ result = session.query(models.FixedIp).\
+ join(models.FixedIp.instance).\
+ filter_by(state=1).\
+ filter_by(host=host).\
+ all()
+
+ if not result:
+ raise exception.NotFound(_('No fixed ips for this host defined'))
+
+ return result
+
+
@require_context
def fixed_ip_get_by_address(context, address, session=None):
if not session: