summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorandy <github@anarkystic.com>2010-08-21 15:37:00 +0200
committerandy <github@anarkystic.com>2010-08-21 15:37:00 +0200
commit152baf34247c5a4b76f643cac0d33c0158de0bfa (patch)
tree216859744db75835fd28a9cacdb13d7acb790569 /nova/db
parent6f5aa18747384f46f8d89ac0d6c82a710849ce59 (diff)
Moves auth.manager to the data layer.
A couple weird things are going on, I added a try-except in Manager.delete_project because it seems to have an issue finding the network to delete, I think something is probably deleting it before the tests get a chance to. Also stubbed out task.LoopingCall in service_unittest because there wasn't a good way to kill the task from outside of service.Service.create()
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/api.py8
-rw-r--r--nova/db/sqlalchemy/api.py13
2 files changed, 20 insertions, 1 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index e76e6b057..bbd69ec65 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -111,6 +111,14 @@ def network_update(context, network_id, values):
###################
+def project_get_network(context, project_id):
+ """Return the network associated with the project."""
+ return _impl.project_get_network(context, project_id)
+
+
+###################
+
+
def volume_allocate_shelf_and_blade(context, volume_id):
"""Atomically allocate a free shelf and blade from the pool."""
return _impl.volume_allocate_shelf_and_blade(context, volume_id)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index d80c03c19..e883e14cb 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -82,7 +82,7 @@ def network_create(context, values):
for (key, value) in values.iteritems():
network_ref[key] = value
network_ref.save()
- return network_ref.id
+ return network_ref
def network_destroy(context, network_id):
@@ -104,6 +104,17 @@ def network_update(context, network_id, values):
###################
+def project_get_network(context, project_id):
+ session = models.create_session()
+ rv = session.query(models.Network).filter_by(project_id=project_id).first()
+ if not rv:
+ raise exception.NotFound('No network for project: %s' % project_id)
+ return rv
+
+
+###################
+
+
def volume_allocate_shelf_and_blade(context, volume_id):
session = models.NovaBase.get_session()
query = session.query(models.ExportDevice).filter_by(volume=None)