commit 1c992c7a172af0890c9fea147e018257ee018f2d
Author: Jordan Pittier <email address hidden>
Date: Fri Jan 27 15:22:25 2017 +0100
Fix unspecified bahavior on GET /servers/detail?tenant_id=X as admin
When an admin calls /v2.1/servers/detail?tenant_id=XX, then the
`get_all` method of nova.compute.api.API is called with 2
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_servers_by_admin_with_specified_tenant
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].
Reviewed: https:/ /review. openstack. org/430504 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=1c992c7a172 af0890c9fea147e 018257ee018f2d
Committed: https:/
Submitter: Jenkins
Branch: stable/ocata
commit 1c992c7a172af08 90c9fea147e0182 57ee018f2d
Author: Jordan Pittier <email address hidden>
Date: Fri Jan 27 15:22:25 2017 +0100
Fix unspecified bahavior on GET /servers/ detail? tenant_ id=X as admin
When an admin calls /v2.1/servers/ detail? tenant_ id=XX, then the api.API is called with 2
`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` servers_ by_admin_ with_specified_ tenant
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:/ /docs.python. org/dev/ using/cmdline. html#cmdoption- R /github. com/openstack/ tempest/ blob/fe1a8e289c 2d79df29beaa6b3 603afe5feb60fb3 /tempest/ api/compute/ admin/test_ servers. py#L96
[1] https:/
Change-Id: I1a74ef0f16da14 444029c0f184b43 3df367ffb41 449091243a39ad5 d57108b23f)
Closes-Bug: #1659811
(cherry picked from commit f702762934e0a46