quota-delete should error out if input provided is wrong tenant id

Bug #1307506 reported by Tushar Bankar
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Unassigned

Bug Description

neutron quota-delete --tenant-id wrong-id

Deleted quota: wrong-id

And neutron is returning with status 204 (No Content)

But it is expected to return with 404 with message. eg.- No tenant ID found

Tags: api
Changed in neutron:
assignee: nobody → Tushar Bankar (tushar-bankar)
tags: added: izeltech
tags: removed: izeltech
Changed in neutron:
status: New → Incomplete
Revision history for this message
Eugene Nikanorov (enikanorov) wrote :

It's expected behavior from Neutron, which should not validate tenant ID. In case an object is not found, 404 is not returned, because operation has succeeded - no object with such properties exists anymore.

However I think something could be done on python-neutronclient side

Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

The analysis is correct; however, even validating the tenant on the client side will still require an extra round trip to keystone.
If such a change is agreed, it should probably apply to all neutron requests, not only quota delete ones.

However, there is something true about this bug. A 404 should indeed be returned if a quota for a tenant was never created in the first place. So far the code is returning "success" messages for deleting quotas which never existed in the first place, and this is not correct.

The fix should be trivial.

Changed in neutron:
status: Incomplete → Confirmed
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
assignee: Tushar Bankar (tushar-bankar) → Salvatore Orlando (salvatore-orlando)
status: Confirmed → In Progress
Changed in neutron:
assignee: Salvatore Orlando (salvatore-orlando) → Armando Migliaccio (armando-migliaccio)
Changed in neutron:
assignee: Armando Migliaccio (armando-migliaccio) → Salvatore Orlando (salvatore-orlando)
Changed in neutron:
assignee: Salvatore Orlando (salvatore-orlando) → nobody
status: In Progress → New
Deep Shikha (d-shikha)
Changed in neutron:
assignee: nobody → Deep Shikha (d-shikha)
Revision history for this message
Deep Shikha (d-shikha) wrote :

While deleting quota with any valid/invalid tenant-id,
the path it searches for the .json file to delete is "/v2.0/quotas/<tenant-id>.json"

for eg. if tenant-is is "abc123", then the path will be"/v2.0/quotas/abc123.json"

With that, I tried some scenarios and the findings are (assuming we provide any arbitrary tenant-id as abc123):

quota-delete with tenant-id abc123 # 204 response

quota-delete with tenant-id abc123 , but the path is changed to "/v2.0/quotas/xyz" # 204 response

quota-delete with tenant-id abc123 , but the path is changed to "/v2.0/xyz/abc123.json" # 404 response

quota-delete with tenant-id abc123 , but the path is changed to "/v2.0/abc123.json" # 404 response

It seems whatever tenant-id we pass(whether valid or invalid), it provides 204 response, till it searches in "/v2.0/quotas/" path, but if we change this path, the 404 response comes up.

Any suggestions or pointers?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Kyle Mestery (<email address hidden>) on branch: master
Review: https://review.openstack.org/92790
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Gary Kotton (garyk)
tags: added: api
Changed in neutron:
status: New → Confirmed
Revision history for this message
Reedip (reedip-banerjee-deactivatedaccount) wrote :

Taking this bug up , as there is no progress for a LONG time

Changed in neutron:
assignee: Deep Shikha (d-shikha) → Reedip (reedip-banerjee)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/276096
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=915352725296de45a74ffd2ea1edc4c498eb4a8f
Submitter: Jenkins
Branch: master

commit 915352725296de45a74ffd2ea1edc4c498eb4a8f
Author: reedip <email address hidden>
Date: Thu Feb 4 17:36:32 2016 +0900

    Return a 404 on quota delete if entry not found

    If a tenant quota is not found, the delete operation should fail
    with a 404 error. It currently returns 204 even if the delete
    operation actually does not delete anything which is inconsistent
    with other delete operations in the Neutron API.

    APIImpact

    Change-Id: I1cd91b5e06bd17f9aac97bba71228f2e5c48879b
    Closes-Bug: 1307506
    Co-Authored-By: Salvatore Orlando <email address hidden>

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 9.0.0.0b1

This issue was fixed in the openstack/neutron 9.0.0.0b1 development milestone.

tags: added: neutron-proactive-backport-potential
Revision history for this message
Ihar Hrachyshka (ihar-hrachyshka) wrote :

It's an APIImpact change, probably not worth a backport.

tags: removed: neutron-proactive-backport-potential
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.