summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-03-17 14:29:48 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-03-17 14:29:48 -0400
commitc2cf224fab65d608be6ccc8143de7e1f28bdb482 (patch)
tree117165f23587d7f57050a51c136faaa1aa6fdc23 /nova/db
parent5a141466db962e184ced0a57efb6bfe94ff5a246 (diff)
parent58f66ff1d20286b4e321f90f60b3abef2d9ba8c6 (diff)
downloadnova-c2cf224fab65d608be6ccc8143de7e1f28bdb482.tar.gz
nova-c2cf224fab65d608be6ccc8143de7e1f28bdb482.tar.xz
nova-c2cf224fab65d608be6ccc8143de7e1f28bdb482.zip
merging parent branch lp:~bcwaldon/nova/osapi-flavors-1_1
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/api.py5
-rw-r--r--nova/db/sqlalchemy/api.py16
-rw-r--r--nova/db/sqlalchemy/models.py2
3 files changed, 22 insertions, 1 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 6789ac22a..f3dc3d77f 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:
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 162f6fded..1845e85eb 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -161,7 +161,7 @@ class Certificate(BASE, NovaBase):
class Instance(BASE, NovaBase):
"""Represents a guest vm."""
__tablename__ = 'instances'
- onset_files = []
+ injected_files = []
id = Column(Integer, primary_key=True, autoincrement=True)