yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #63504
[Bug 1606455] Re: Neutron server was not compatible with member actions
Reviewed: https://review.openstack.org/372108
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=daa8e1b1b0c2ec5353b20aae155cea668c637ffc
Submitter: Jenkins
Branch: master
commit daa8e1b1b0c2ec5353b20aae155cea668c637ffc
Author: lilintan <lintan.li@xxxxxxxxxxxx>
Date: Wed Sep 28 14:12:38 2016 +0800
Neutron server was not compatible with member actions
Register a new extension into Neutron server, and this extension
contains a member action. if new member action contains the "update"
string. As a result, Neutron server check the target whether contains
"ATTRIBUTES_TO_UPDATE". Because this is a member action so that neutron
server will not go "_update" method normally but "_handle_action"
method. So the exception happens KeyError: 'attributes_to_update'.
Co-Authored-By: zhang ping<ping.zhang@xxxxxxxxxxxx>
Change-Id: Ie8bb7b9af42a82aada28d2bcdfd5b0e573ad9778
Closes-Bug: #1606455
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1606455
Title:
Neutron server was not compatible with member actions
Status in neutron:
Fix Released
Bug description:
====== Problem Description =======
Register a new extension into Neutron server, and this extension
contains a member action. Just like this:
@classmethod
def get_resources(cls):
"""Returns rate limit resources. """
plural_mappings = resource_helper.build_plural_mappings(
{}, EXTENDED_ATTRIBUTES_2_0)
attr.PLURALS.update(plural_mappings)
action_map = {'floatingip': {
'update_floatingip_ratelimit': 'PUT'}
}
return resource_helper.build_resource_info(plural_mappings,
EXTENDED_ATTRIBUTES_2_0,
constants.L3_ROUTER_NAT,
action_map=action_map)
Adding a new member action named "update_floatingip_ratelimit".
Exception will happen by calling this method by a non admin user.
Exception reports:
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/api/v2/resource.py", line 83, in resource
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource result = method(request=request, **args)
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 146, in wrapper
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 195, in __exit__
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 136, in wrapper
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/api/v2/base.py", line 216, in _handle_action
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource pluralized=self._collection)
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/policy.py", line 399, in enforce
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource pluralized)
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/policy.py", line 324, in _prepare_check
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource match_rule = _build_match_rule(action, target, pluralized)
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/policy.py", line 168, in _build_match_rule
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource target, action):
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource File "/usr/lib/python2.7/site-packages/neutron/policy.py", line 95, in _is_attribute_explicitly_set
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource return (attribute_name in target[const.ATTRIBUTES_TO_UPDATE] and
2016-07-26 10:07:28.813 7562 ERROR neutron.api.v2.resource KeyError: 'attributes_to_update'
Because new member action contains the "update" string. As a result,
Neutron server check the target whether contains
"ATTRIBUTES_TO_UPDATE". Because this is a member action so that
neutron server will not go "_update" method normally. It will go
"_handle_action" method. So the exception happens.
====== How to fix ======
>>> if 'update' in action:
change into
>>> if 'update' in action and target.get(const.ATTRIBUTES_TO_UPDATE):
By doing such change, will solve this problem.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1606455/+subscriptions
References