Avoid loading policy when processing rpc requests

When Neutron server is restarted in the environment where multiple agents
are sending rpc requests to Neutron, it causes loading of policy.json
before API extensions are loaded. That causes different policy check
failures later on.
This patch avoids loading policy when creating a Context in rpc layer.

Change-Id: I66212baa937ec1457e0d284b5445de5243a8931f
Partial-Bug: 1254555
This commit is contained in:
Eugene Nikanorov 2013-11-28 12:46:41 +04:00 committed by Akihiro Motoki
parent e631e89e2b
commit 5f959d76a0
1 changed files with 2 additions and 1 deletions

View File

@ -39,6 +39,7 @@ class PluginRpcDispatcher(dispatcher.RpcDispatcher):
tenant_id = rpc_ctxt_dict.pop('tenant_id', None)
if not tenant_id:
tenant_id = rpc_ctxt_dict.pop('project_id', None)
neutron_ctxt = context.Context(user_id, tenant_id, **rpc_ctxt_dict)
neutron_ctxt = context.Context(user_id, tenant_id,
load_admin_roles=False, **rpc_ctxt_dict)
return super(PluginRpcDispatcher, self).dispatch(
neutron_ctxt, version, method, namespace, **kwargs)