/v2.1/servers/detail?tenant_id=XX returns unpredictable results
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| OpenStack Compute (nova) |
Medium
|
Jordan Pittier | ||
| Ocata |
Medium
|
Matt Riedemann |
Bug Description
Found this while investigating why the tempest test test_list_
This test produces the following API call:
GET /v2.1/servers/
Which calls this method in Nova:
nova.api.
In the _get_servers() method that detail() calls, for some reason (bug ? [1]), the 'project_id' is added to the search options. So now, we see that get_all() is called with both tenant_id and project_id:
Searching by: {'project_id': '74e1044b53de44
Now, in nova/nova/
Changed in nova: | |
assignee: | nobody → Jordan Pittier (jordan-pittier) |
status: | New → In Progress |
Changed in nova: | |
importance: | Undecided → Medium |
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: master
commit f702762934e0a46
Author: Jordan Pittier <email address hidden>
Date: Fri Jan 27 15:22:25 2017 +0100
Fix unspecified bahavior on GET /servers/
When an admin calls /v2.1/servers/
`get_all` method of nova.compute.
conflicting search options: {'tenant_id': XX, 'project_id': YY}.
But because, latter on, in that `get_all` method we define a dict
called filter_mapping, on which we iter upon, which value takes
precedence depends on the order in which the dict is iterated upon.
As the order in unpredictable and varies between Py2 and Py3, this
is problematic. Especially, on Python 2 hash randomization is
disabled by default but it's enabled by default on Py3 (unless
the PYTHONHASHSEED env var is set to a fixed value) [0]
The (unreliable) order we iterate on items of that `filter_mapping`
dict is why the Tempest test_list_
test randomly fails on Py35.
This patch ensures that, if the all_tenants search option is
not set, then the `tenant_id` search option is ignored. Note that
this *is* the current behavior on Py27, as documented in lp:#1185290
and tested by Tempest here [1].
[0] https:/
[1] https:/
Change-Id: I1a74ef0f16da14
Closes-Bug: #1659811
Changed in nova: | |
status: | In Progress → Fix Released |
Fix proposed to branch: stable/ocata
Review: https:/
Reviewed: https:/
Committed: https:/
Submitter: Jenkins
Branch: stable/ocata
commit 1c992c7a172af08
Author: Jordan Pittier <email address hidden>
Date: Fri Jan 27 15:22:25 2017 +0100
Fix unspecified bahavior on GET /servers/
When an admin calls /v2.1/servers/
`get_all` method of nova.compute.
conflicting search options: {'tenant_id': XX, 'project_id': YY}.
But because, latter on, in that `get_all` method we define a dict
called filter_mapping, on which we iter upon, which value takes
precedence depends on the order in which the dict is iterated upon.
As the order in unpredictable and varies between Py2 and Py3, this
is problematic. Especially, on Python 2 hash randomization is
disabled by default but it's enabled by default on Py3 (unless
the PYTHONHASHSEED env var is set to a fixed value) [0]
The (unreliable) order we iterate on items of that `filter_mapping`
dict is why the Tempest test_list_
test randomly fails on Py35.
This patch ensures that, if the all_tenants search option is
not set, then the `tenant_id` search option is ignored. Note that
this *is* the current behavior on Py27, as documented in lp:#1185290
and tested by Tempest here [1].
[0] https:/
[1] https:/
Change-Id: I1a74ef0f16da14
Closes-Bug: #1659811
(cherry picked from commit f702762934e0a46
This issue was fixed in the openstack/nova 15.0.1 release.
This issue was fixed in the openstack/nova 16.0.0.0b1 development milestone.
Fix proposed to branch: master /review. openstack. org/426259
Review: https:/