From 4203bba809eec90dd8a176c2d4f8869ae748e8bc Mon Sep 17 00:00:00 2001 From: Ryan Lane Date: Thu, 20 Jan 2011 00:47:33 +0000 Subject: Changing service_get_all_by_host to not require admin context as it is used for describing instances, which any user in a project can do. --- nova/db/sqlalchemy/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 7b965f672..9825764bf 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -156,7 +156,7 @@ def service_get_all_by_topic(context, topic): all() -@require_admin_context +@require_context def service_get_all_by_host(context, host): session = get_session() return session.query(models.Service).\ -- cgit From 36681f096574e5fdab26e6167a39e87df0f92fd4 Mon Sep 17 00:00:00 2001 From: Ryan Lane Date: Thu, 20 Jan 2011 01:34:54 +0000 Subject: Passing in an elevated context instead of making the call non-elevated. --- nova/api/ec2/cloud.py | 2 +- nova/db/sqlalchemy/api.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index c94540793..a64c9fed8 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -133,7 +133,7 @@ class CloudController(object): return result def _get_availability_zone_by_host(self, context, host): - services = db.service_get_all_by_host(context, host) + services = db.service_get_all_by_host(context.elevated(), host) if len(services) > 0: return services[0]['availability_zone'] return 'unknown zone' diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 9825764bf..7b965f672 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -156,7 +156,7 @@ def service_get_all_by_topic(context, topic): all() -@require_context +@require_admin_context def service_get_all_by_host(context, host): session = get_session() return session.query(models.Service).\ -- cgit