different behavior when deleting with request body (no BadRequest with core resources in case of pecan)

Bug #1701410 reported by Yushiro FURUKAWA
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Won't Fix
Medium
Yushiro FURUKAWA

Bug Description

In master environment, it is different behavior when we try to delete with
request body. I fixed it in [1] but CORE_RESOURCE(network/subnet/port/subnetpool) doesn't pass this code in case of web_framework = pecan in /etc/neutron/neutron.conf

[1] https://github.com/openstack/neutron/blame/master/neutron/api/v2/base.py#L555

[FloatingIP, Router]
$ source ~/devstack/openrc admin admin; export TOKEN=`openstack token issue | grep ' id ' | get_field 2`
$ curl -i -X DELETE -d '{"floatingip":{"description": "aaa"}}' -H "content-type:application/json" -H 'accept:application/json' -H "x-auth-token:$TOKEN" 192.168.122.33:9696/v2.0/floatingips/f4e9b845-4472-4806-bd7a-bec8f7618af2
HTTP/1.1 400 Bad Request
Content-Length: 113
Content-Type: application/json
X-Openstack-Request-Id: req-deaffdb3-7c13-4604-89d0-78fbcc184ef5
Date: Fri, 30 Jun 2017 00:56:56 GMT

{"NeutronError": {"message": "Request body is not supported in DELETE.", "type": "HTTPBadRequest", "detail": ""}}

$ curl -i -X DELETE -d '{"router": {"name": "aaa"}}' -H "content-type:application/json" -H 'accept:application/json' -H "x-auth-token:$TOKEN" 192.168.122.33:9696/v2.0/routers/1d0ea30e-c481-4be3-a548-a659d9e3787c
HTTP/1.1 400 Bad Request
Content-Length: 113
Content-Type: application/json
X-Openstack-Request-Id: req-a2f9babb-4eb3-471e-9b42-ccfe722c44f0
Date: Fri, 30 Jun 2017 01:44:40 GMT

{"NeutronError": {"message": "Request body is not supported in DELETE.", "type": "HTTPBadRequest", "detail": ""}}

[Core resources: Network/Subnet/Port/Subnetpool]
$ source ~/devstack/openrc admin admin; export TOKEN=`openstack token issue | grep ' id ' | get_field 2`
$ curl -i -X DELETE -d '{"network":{"name": "aaaa"}}' -H "content-type:application/json" -H 'accept:application/json' -H "x-auth-token:$TOKEN" 192.168.122.33:9696/v2.0/networks/1fb94931-dabe-49dc-bce4-68c8bafea8b0

HTTP/1.1 204 No Content
Content-Length: 0
X-Openstack-Request-Id: req-7e838c38-e6cd-46c3-8703-c93f5bb4a503
Date: Fri, 30 Jun 2017 01:32:12 GMT

$ curl -i -X DELETE -d '{"subnet": {"name": "aaa"}}' -H "content-type:application/json" -H 'accept:application/json' -H "x-auth-token:$TOKEN" 192.168.122.33:9696/v2.0/subnets/a18fb191-2a89-4193-80d1-5330a8052d64

HTTP/1.1 204 No Content
Content-Length: 0
X-Openstack-Request-Id: req-901476cf-7e87-4b7c-ab20-209b81d2eb25
Date: Fri, 30 Jun 2017 01:37:01 GMT

$ curl -i -X DELETE -d '{"port": {"name": "aaa"}}' -H "content-type:application/json" -H 'accept:application/json' -H "x-auth-token:$TOKEN" 192.168.122.33:9696/v2.0/ports/47f2c36a-7461-4c1a-a23e-931d5aee3f9c

HTTP/1.1 204 No Content
Content-Length: 0
X-Openstack-Request-Id: req-48452706-6309-42c2-ac80-f0f4e387060e
Date: Fri, 30 Jun 2017 01:37:33 GMT

$ curl -i -X DELETE -d '{"subnetpool": {"description": "aaa"}}' -H "content-type:application/json" -H 'accept:application/json' -H "x-auth-token:$TOKEN" 192.168.122.33:9696/v2.0/subnetpools/e0e09ffc-a4af-4cf0-ac2e-7a8b1475cef6

HTTP/1.1 204 No Content
Content-Length: 0
X-Openstack-Request-Id: req-9601a3ae-74a0-49ca-9f99-02ad624ceacb
Date: Fri, 30 Jun 2017 06:24:58 GMT

Tags: api
Changed in neutron:
assignee: nobody → Yushiro FURUKAWA (y-furukawa-2)
Akihiro Motoki (amotoki)
tags: added: api
description: updated
Akihiro Motoki (amotoki)
Changed in neutron:
importance: Undecided → Medium
status: New → Confirmed
summary: - different behavior when deleting with request body
+ different behavior when deleting with request body (no BadRequest with
+ core resources)
Revision history for this message
Yushiro FURUKAWA (y-furukawa-2) wrote : Re: different behavior when deleting with request body (no BadRequest with core resources)

I added following patch and tried to delete network resource. As a result, I recorded trace for method calling. Please refer attached file:

[diff --no-prefix]
diff --git neutron/db/db_base_plugin_v2.py neutron/db/db_base_plugin_v2.py
index aad5461..60525c1 100644
--- neutron/db/db_base_plugin_v2.py
+++ neutron/db/db_base_plugin_v2.py
@@ -13,6 +13,8 @@
 # License for the specific language governing permissions and limitations
 # under the License.

+import inspect
+
 import functools

 import netaddr
@@ -427,6 +429,23 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,

     @db_api.retry_if_session_inactive()
     def delete_network(self, context, id):
+
+ frame_attr_dict = {
+ "f_back": "f_back",
+ "f_code": "f_code",
+ "f_lineno":"f_lineno",
+ }
+ frame_object=inspect.currentframe()
+ while frame_object != None :
+ print "=================="
+ code_object = frame_object.f_code
+ print code_object.co_name
+ for attr_name, attr_discript in sorted(frame_attr_dict.iteritems()):
+ print attr_name, "=", getattr(frame_object, attr_name), "#",attr_discript
+ frame_object = frame_object.f_back
+
         registry.notify(resources.NETWORK, events.BEFORE_DELETE, self,
                         context=context, network_id=id)
         self._ensure_network_not_in_use(context, id)

summary: different behavior when deleting with request body (no BadRequest with
- core resources)
+ core resources in case of pecan)
description: updated
Revision history for this message
Brian Haley (brian-haley) wrote :

This bug is 6 years old, can we verify it is still happening?

Revision history for this message
Brian Haley (brian-haley) wrote :

I am going to close this as it is over 6 years old and no one has stepped forward to fix it, so it's just not a priority. Please re-open if necessary.

Changed in neutron:
status: Confirmed → Won't Fix
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.