Comment 0 for bug 1730975

Revision history for this message
Forest Romain (romain-forest) wrote :

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" contains "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