← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1610905] Re: Updating agent with non admin context returns 500 error.

 

*** This bug is a duplicate of bug 1515564 ***
    https://bugs.launchpad.net/bugs/1515564

** This bug has been marked a duplicate of bug 1515564
   Internal server error when running qos-bandwidth-limit-rule-update as a tenant

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1610905

Title:
  Updating agent with non admin context returns 500 error.

Status in neutron:
  In Progress

Bug description:
  When policy does not allow to perform update-agent,
  neutron try to refer to 'tenant_id' of the agent in order to
  judge whether 403 or 404 should be returned to client.

  However, there is no 'tenant_id' attribute in agent.
  Thus, accessing to 'tenant_id' is failed and unexpected error is returned. 
  It should be returned with 404.

  request
  ==========================
  ubuntu@neutron-ml2:/opt/stack/neutron$ curl -i -X PUT -H "X-Auth-Token: $TOKEN" http://172.16.1.29:9696/v2.0/agents/320ec1fd-fb68-4756-92ce-6f69965430d3 -d '{"agent":{"admin_state_up":"True"}}'
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json
  Content-Length: 150
  X-Openstack-Request-Id: req-673bb3a7-5b39-4be5-8ddd-800df819b58a
  Date: Mon, 08 Aug 2016 09:11:02 GMT

  {"NeutronError": {"message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": ""}}
  ==========================

  trace in neutron-server
  ==========================
  2016-08-08 09:11:02.070 22005 ERROR root [req-673bb3a7-5b39-4be5-8ddd-800df819b58a 2d0eae6bce4146d791c3b30941fdd083 72052756693749a7a77dfa2f1da3a497 - - -] Original exception be
  ing dropped: ['Traceback (most recent call last):\n', '  File "/opt/stack/neutron/neutron/api/v2/base.py", line 602, in _update\n    pluralized=self._collection)\n', '  File "/o
  pt/stack/neutron/neutron/policy.py", line 405, in enforce\n    LOG.debug("Failed policy check for \'%s\'", action)\n', '  File "/usr/local/lib/python2.7/dist-packages/oslo_utils
  /excutils.py", line 220, in __exit__\n    self.force_reraise()\n', '  File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise\n    six.r
  eraise(self.type_, self.value, self.tb)\n', '  File "/opt/stack/neutron/neutron/policy.py", line 401, in enforce\n    do_raise=True)\n', '  File "/usr/local/lib/python2.7/dist-p
  ackages/oslo_policy/policy.py", line 639, in enforce\n    raise PolicyNotAuthorized(rule, target, creds)\n', "PolicyNotAuthorized: rule:update_agent on {'binary': u'neutron-mete
  ring-agent', 'description': None, 'attributes_to_update': [u'admin_state_up'], 'availability_zone': None, 'heartbeat_timestamp': datetime.datetime(2016, 8, 8, 9, 10, 52), 'admin
  _state_up': True, 'alive': True, 'id': u'320ec1fd-fb68-4756-92ce-6f69965430d3', 'topic': u'metering_agent', 'host': u'neutron-ml2', 'agent_type': u'Metering agent', 'started_at'
  : datetime.datetime(2016, 8, 4, 9, 36, 40), 'created_at': datetime.datetime(2016, 8, 4, 9, 36, 40), 'configurations': {u'measure_interval': 30, u'metering_driver': u'neutron.ser
  vices.metering.drivers.noop.noop_driver.NoopMeteringDriver', u'report_interval': 300}} by {'domain': None, 'project_name': u'demo', 'tenant_name': u'demo', 'project_domain': Non
  e, 'timestamp': '2016-08-08 09:11:01.507290', 'auth_token': 'f1a803a66fde4da784c2f06b67386c32', 'resource_uuid': None, 'is_admin': False, 'user': u'2d0eae6bce4146d791c3b30941fdd
  083', 'tenant': u'72052756693749a7a77dfa2f1da3a497', 'read_only': False, 'project_id': u'72052756693749a7a77dfa2f1da3a497', 'user_id': u'2d0eae6bce4146d791c3b30941fdd083', 'show
  _deleted': False, 'roles': [u'Member', u'anotherrole'], 'user_identity': u'2d0eae6bce4146d791c3b30941fdd083 72052756693749a7a77dfa2f1da3a497 - - -', 'tenant_id': u'7205275669374
  9a7a77dfa2f1da3a497', 'request_id': 'req-673bb3a7-5b39-4be5-8ddd-800df819b58a', 'user_domain': None, 'user_name': u'demo'} disallowed by policy\n"]
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource [req-673bb3a7-5b39-4be5-8ddd-800df819b58a 2d0eae6bce4146d791c3b30941fdd083 72052756693749a7a77dfa2f1da3a497 - - -] up
  date failed: No details.
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource Traceback (most recent call last):
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     result = method(request=request, **args)
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 571, in update
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     return self._update(request, id, body, **kwargs)
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 148, in wrapper
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     ectxt.value = e.inner_exc
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     self.force_reraise()
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 138, in wrapper
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     return f(*args, **kwargs)
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 610, in _update
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource     if request.context.tenant_id != orig_obj['tenant_id']:
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource KeyError: 'tenant_id'
  2016-08-08 09:11:02.071 22005 ERROR neutron.api.v2.resource
  2016-08-08 09:11:02.074 22005 INFO neutron.wsgi [req-673bb3a7-5b39-4be5-8ddd-800df819b58a 2d0eae6bce4146d791c3b30941fdd083 72052756693749a7a77dfa2f1da3a497 - - -] 172.16.1.29 -
  - [08/Aug/2016 09:11:02] "PUT /v2.0/agents/320ec1fd-fb68-4756-92ce-6f69965430d3 HTTP/1.1" 500 344 1.411364
  ==========================

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1610905/+subscriptions


References