← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1659811] [NEW] /v2.1/servers/detail?tenant_id=XX returns unpredictable results

 

Public bug reported:

Found this while investigating why the tempest test
test_list_servers_by_admin_with_specified_tenant randomly fails on Py35.

This test produces the following API call:

GET /v2.1/servers/detail?tenant_id=XXX

Which calls this method in Nova:

nova.api.openstack.compute.servers.ServersController.detail()

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': '74e1044b53de44d1bac80cded5146504',
'deleted': False, 'tenant_id': '153d2038e0bc4ea99819a21a55cb66ea'}
get_all /opt/stack/new/nova/nova/compute/api.py:2336

Now, in nova/nova/compute/api.py in the get_all() method, there's a dict
called filter_mapping, that is iterated upon. I believe, based on which
order the dict (i.e the search options) is iterated upon, either
tenant_id or project_id gets rewritten. This leads to random return
values.

[1] :
https://github.com/openstack/nova/blob/cba26a6e561c18fa4659efac8ddc0b3c139023fe/nova/api/openstack/compute/servers.py#L322

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1659811

Title:
  /v2.1/servers/detail?tenant_id=XX returns unpredictable results

Status in OpenStack Compute (nova):
  New

Bug description:
  Found this while investigating why the tempest test
  test_list_servers_by_admin_with_specified_tenant randomly fails on
  Py35.

  This test produces the following API call:

  GET /v2.1/servers/detail?tenant_id=XXX

  Which calls this method in Nova:

  nova.api.openstack.compute.servers.ServersController.detail()

  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': '74e1044b53de44d1bac80cded5146504',
  'deleted': False, 'tenant_id': '153d2038e0bc4ea99819a21a55cb66ea'}
  get_all /opt/stack/new/nova/nova/compute/api.py:2336

  Now, in nova/nova/compute/api.py in the get_all() method, there's a
  dict called filter_mapping, that is iterated upon. I believe, based on
  which order the dict (i.e the search options) is iterated upon, either
  tenant_id or project_id gets rewritten. This leads to random return
  values.

  [1] :
  https://github.com/openstack/nova/blob/cba26a6e561c18fa4659efac8ddc0b3c139023fe/nova/api/openstack/compute/servers.py#L322

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


Follow ups