List servers by hypervisor doesn't support ids

Bug #1730975 reported by Forest Romain
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Undecided
Forest Romain

Bug Description

compute_node_search_by_hypervisor[1] (used by GET http://nova/v2/tenant_id/os-hypervisors/<hypervisor-id>/servers) searchs hypervisor using "like" hypervisor name instead of using hypervisor id.

For example:

Lets assume that we have hypervisors hyp1 (with id=9), hyp2 (with id=1), hyp11 (with id=2):
http://nova/v2/tenant_id/os-hypervisors/<hypervisor-id>
returns information on an hypervisor using its id as key
=> http://nova/v2/tenant_id/os-hypervisors/1 returns information on hyp2

http://nova/v2/tenant_id/os-hypervisors/<hypervisor-id>/servers
returns information on hypervisor(s) using a like query on hypervisor hostname.
=> http://nova/v2/tenant_id/os-hypervisors/1/servers returns servers on hyp1 and hyp12 (because "hyp1" and "hyp12" contain "1")

It seems inconsistent, usually REST APIs use resource ids not resource names (nor even worse like resource names).

This trouble affects at least kilo, ocata and queen. According to git it affects every version supporting this feature.

[1]https://github.com/openstack/nova/blob/b7f53a33faf6187ad0b16e45cb14ece07892f7bc/nova/db/sqlalchemy/api.py#L737

Changed in nova:
assignee: nobody → Forest Romain (romain-forest)
description: updated
description: updated
description: updated
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/518699

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Stephen Finucane (<email address hidden>) on branch: master
Review: https://review.opendev.org/518699
Reason: I agree that since this is a deprecated API, it seems wrong to make changes to it even if the changes themselves make sense. In any case, given that this effort has stalled, I'm going to abandon this. Please re-open and raise in the weekly meeting [1] or on the openstack-discuss mailing list if you think this should be addressed

[1] http://eavesdrop.openstack.org/#Nova_Team_Meeting

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.