There is a lot of cases that API with an invalid parameter returns 500.

Bug #1062046 reported by Itsuro Oda on 2012-10-05
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
High
Gary Kotton
Folsom
High
Gary Kotton
quantum (Ubuntu)
Undecided
Unassigned
Quantal
Undecided
Unassigned

Bug Description

400 is expected.

This is a list that I found 500 is returned.
(Of course this may not be a complete list.)
(Of course I don't expect they are fixed individually. Some enhances need for
validation codes.)

[invalid parameter]
o subnet create
  - "ip_version": "abc" (string is specified)
  - host_routes duplicate
    "host_routes": [
      {"destination": "10.100.2.0/24", "nexthop": "10.100.1.254"},
      {"destination": "10.100.2.0/24", "nexthop": "10.100.1.254"}]
o port create
  - fixed_ips duplicate
    "fixed_ips": [
      {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
      {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
    ]
  - invalid ip_address
    "ip_address": "310.100.1.2"
o port update
  - fixed_ips duplicate
    "fixed_ips": [
       {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
       {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
     ]
  - invalid ip_address
    "ip_address": "310.100.1.2"

[parameter missing]
o network update
  - "network"
o subnet create
  - "start" in the "allocation_pools"
  - "end" in tne "allocation_pools"
  - "destination" in the "host_routes"
  - "nexthop" in the "host_routes"
o subnet update
  - "subnet"
  - "destination"
  - "nexthop"
o port update
  - "port"

[null specified]
o network create
  - "admin_state_up": null
  - "shared": null
o bulk network create
  - "networks": null
o network update
  - "admin_state_up": null
  - "shared": null
o subnet create
  - "ip_version": null
  - "dns_nameservers": null
  - "enable_dhcp": null
  - "allocation_pools": null
  - "host_routes": null
  - "destination": null
o bulk subnet create
  - "subnets": null
o subnet update
  - "dns_nameservers": null
  - "enable_dhcp": null
  - "host_routes": null
  - "destination": null
o port create
  - "admin_state_up": null
  - "fixed_ips": null
  - "ip_address": null
  - "device_id": null
  - "device_owner": null
o bulk port create
  - "ports": null
o port update
  - "admin_state_up": null
  - "fixed_ips": null
  - "ip_address": null

dan wendlandt (danwent) on 2012-10-05
Changed in quantum:
importance: Undecided → High
status: New → Confirmed
dan wendlandt (danwent) wrote :

great, thanks for auditing the API for handling of bad inputs... this work is long overdue.

tags: added: folsom-backport-potential
Changed in quantum:
milestone: none → grizzly-1
Gary Kotton (garyk) wrote :

I think that I got em all. i guess that maybe it can be done in a more elegant fasion...

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

Changed in quantum:
assignee: nobody → Gary Kotton (garyk)
status: Confirmed → In Progress
Itsuro Oda (oda-g) wrote :

I checked https://review.openstack.org/14219 patch set 2.
The follwings is the result.

[invalid parameter]
o subnet create
- "ip_version": "abc" (string is specified) [Fixed]
- host_routes duplicate  [NotFixed]
o port create
- fixed_ips duplicate [NotFixed]
"fixed_ips": [
{"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
{"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
]
- invalid ip_address [Fixed]
"ip_address": "310.100.1.2"
o port update
- fixed_ips duplicate [NotFixed]
"fixed_ips": [
{"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
{"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
]
- invalid ip_address [Fixed]
"ip_address": "310.100.1.2"

[parameter missing]
o network update
- "network"  [NotFixed]
o subnet create
- "start" in the "allocation_pools" [Fixed]
- "end" in tne "allocation_pools" [Fixed]
- "destination" in the "host_routes" [NotFixed]
- "nexthop" in the "host_routes" [Fixed]
o subnet update
- "subnet" [NotFixed]
- "destination" [Fixed]
- "nexthop" [Fixed]
o port update
- "port" [NotFixed]

[null specified]
o network create
- "admin_state_up": null [Fixed]
- "shared": null [Fixed]
o bulk network create
- "networks": null [NotFixed]
o network update
- "admin_state_up": null [Fixed]
- "shared": null  [Fixed]
o subnet create
- "ip_version": null [NotFixed]
- "dns_nameservers": null [NotFixed]
- "enable_dhcp": null [Fixed]
- "allocation_pools": null [NotFixed]
- "host_routes": null [NotFixed]
- "destination": null [Fixed]
o bulk subnet create
- "subnets": null [NotFixed]
o subnet update
- "dns_nameservers": null [NotFixed]
- "enable_dhcp": null [Fixed]
- "host_routes": null [NotFixed]
- "destination": null [Fixed]
o port create
- "admin_state_up": null [Fixed]
- "fixed_ips": null [NotFixed]
- "ip_address": null [Fixed]
- "device_id": null [NotFixed]
- "device_owner": null [NotFixed]
o bulk port create
- "ports": null  [NotFixed]
o port update
- "admin_state_up": null [Fixed]
- "fixed_ips": null  [NotFixed]
- "ip_address": null [Fixed]

On 10/16/2012 03:34 AM, Itsuro Oda wrote:
> I checked https://review.openstack.org/14219 patch set 2.
> The follwings is the result.
>
> [invalid parameter]
> o subnet create
> - "ip_version": "abc" (string is specified) [Fixed]
> - host_routes duplicate  [NotFixed]

In the patch set this was treated but it was decided that this is not a bug.
> o port create
> - fixed_ips duplicate [NotFixed]
> "fixed_ips": [
> {"ip_address": "10.100.1.4", "subnet_id":<same-subnet-id>},
> {"ip_address": "10.100.1.4", "subnet_id":<same-subnet-id>},

I also do not think that this is a problem.
> ]
> - invalid ip_address [Fixed]
> "ip_address": "310.100.1.2"
> o port update
> - fixed_ips duplicate [NotFixed]
> "fixed_ips": [
> {"ip_address": "10.100.1.4", "subnet_id":<same-subnet-id>},
> {"ip_address": "10.100.1.4", "subnet_id":<same-subnet-id>},
> ]
> - invalid ip_address [Fixed]
> "ip_address": "310.100.1.2"
>
> [parameter missing]
> o network update
> - "network"  [NotFixed]

can you please elaborate on how you you reproduce this. Is this done via
the client?
> o subnet create
> - "start" in the "allocation_pools" [Fixed]
> - "end" in tne "allocation_pools" [Fixed]
> - "destination" in the "host_routes" [NotFixed]

can you please elaborate a bit more what the problem is here?
> - "nexthop" in the "host_routes" [Fixed]
> o subnet update
> - "subnet" [NotFixed]

not sure i understand. can you please show me how you reproduce this and
i'll investigate
> - "destination" [Fixed]
> - "nexthop" [Fixed]
> o port update
> - "port" [NotFixed]
>
> [null specified]

please show me how you reproduce these.
> o network create
> - "admin_state_up": null [Fixed]
> - "shared": null [Fixed]
> o bulk network create
> - "networks": null [NotFixed]
> o network update
> - "admin_state_up": null [Fixed]
> - "shared": null  [Fixed]
> o subnet create
> - "ip_version": null [NotFixed]
> - "dns_nameservers": null [NotFixed]
> - "enable_dhcp": null [Fixed]
> - "allocation_pools": null [NotFixed]
> - "host_routes": null [NotFixed]
> - "destination": null [Fixed]
> o bulk subnet create
> - "subnets": null [NotFixed]
> o subnet update
> - "dns_nameservers": null [NotFixed]
> - "enable_dhcp": null [Fixed]
> - "host_routes": null [NotFixed]
> - "destination": null [Fixed]
> o port create
> - "admin_state_up": null [Fixed]
> - "fixed_ips": null [NotFixed]
> - "ip_address": null [Fixed]
> - "device_id": null [NotFixed]
> - "device_owner": null [NotFixed]
> o bulk port create
> - "ports": null  [NotFixed]
> o port update
> - "admin_state_up": null [Fixed]
> - "fixed_ips": null  [NotFixed]
> - "ip_address": null [Fixed]
>

Itsuro Oda (oda-g) wrote :

>> - host_routes duplicate  [NotFixed]
>
>In the patch set this was treated but it was decided that this is not a bug.

Do you mean 'host_routes duplicate' is OK? Then it should be 200, not 500.

>> "fixed_ips": [
>> {"ip_address": "10.100.1.4", "subnet_id":<same-subnet-id>},
>> {"ip_address": "10.100.1.4", "subnet_id":<same-subnet-id>},
>
>I also do not think that this is a problem.

Same as above.

>> [parameter missing]

Sorry for my poor quality of English.
It means a required parameter is not specified.

>> o network update
>> - "network"  [NotFixed]
>can you please elaborate on how you you reproduce this. Is this done via
>the client?

for example:
---
$ curl -v -H "X-Auth-Token: 5399f4a8e6d04768894b620edbb07d41" -H "Content-Type: application/json" -X PUT -d {"netwok": {"name": "netX"}} http://172.17.190.3:9696/v2.0/networks/e763c6ba-6cc9-4bbb-9d2d-f547fe6c4392
curl: (3) [globbing] unmatched brace at pos 7
curl: (3) [globbing] unmatched close brace/bracket at pos 5
* About to connect() to 172.17.190.3 port 9696 (#0)
* Trying 172.17.190.3... connected
> PUT /v2.0/networks/e763c6ba-6cc9-4bbb-9d2d-f547fe6c4392 HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 172.17.190.3:9696
> Accept: */*
> X-Auth-Token: 5399f4a8e6d04768894b620edbb07d41
> Content-Type: application/json
> Content-Length: 8
>
* upload completely sent off: 8out of 8 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Content-Length: 88
< Date: Tue, 16 Oct 2012 23:08:30 GMT
<
* Connection #0 to host 172.17.190.3 left intact
* Closing connection #0
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

Thanks.

Itsuro Oda (oda-g) wrote :

Sorry. This is my mistake. I will do feedback later.

>for example:
>---
>$ curl -v -H "X-Auth-Token: 5399f4a8e6d04768894b620edbb07d41" -H "Content-Type: application/json" -X PUT -d >{"netwok": {"name": "netX"}} http://172.17.190.3:9696/v2.0/networks/e763c6ba-6cc9-4bbb-9d2d-f547fe6c4392
>curl: (3) [globbing] unmatched brace at pos 7
>curl: (3) [globbing] unmatched close brace/bracket at pos 5
>* About to connect() to 172.17.190.3 port 9696 (#0)
>* Trying 172.17.190.3... connected
>> PUT /v2.0/networks/e763c6ba-6cc9-4bbb-9d2d-f547fe6c4392 HTTP/1.1
>> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
>> Host: 172.17.190.3:9696
>> Accept: */*
>> X-Auth-Token: 5399f4a8e6d04768894b620edbb07d41
>> Content-Type: application/json
>> Content-Length: 8
>>
>* upload completely sent off: 8out of 8 bytes
>< HTTP/1.1 500 Internal Server Error
>< Content-Type: application/json
>< Content-Length: 88
>< Date: Tue, 16 Oct 2012 23:08:30 GMT
><
>* Connection #0 to host 172.17.190.3 left intact
>* Closing connection #0
>{"QuantumError": "Request Failed: internal server error while processing your request."}
>---

Itsuro Oda (oda-g) wrote :
Download full text (5.6 KiB)

> Sorry. This is my mistake. I will do feedback later.

Here is the update.

[parameter missing]
o subnet create
- "destination" in the "host_routes" [NotFixed] => [Fixed] # sorry. my mistake.

[parameter missing]
o network update
- "network"  [NotFixed]
o subnet update
- "subnet" [NotFixed]
o port update
- "port" [NotFixed]

There is a bug in my test code. But there is another problem.
In my test:
---
$ curl -v -H "X-Auth-Token: 5399f4a8e6d04768894b620edbb07d41" -H "Content-Type: application/json" -X PUT -d '{{"name": "aaa"}}' http://172.17.190.3:9696/v2.0/networks/e763c6ba-6cc9-4bbb-9d2d-f547fe6c4392
...
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Content-Length: 88
< Date: Wed, 17 Oct 2012 01:42:45 GMT
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

I think the cause of error is '{{"name": "aaa"}}' is not correct json format.

But... It should not be 500 anyway.

The followings are how to reproduce for other cases.

[null specified]
o bulk network create
- "networks": null [NotFixed]
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -H 'Content-Type: application/json' -X POST -d '{"networks": null}' http://172.17.190.3:9696/v2.0/networks
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

o subnet create
- "ip_version": null [NotFixed]
- "dns_nameservers": null [NotFixed]
- "allocation_pools": null [NotFixed]
- "host_routes": null [NotFixed]
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"subnet": {"network_id": "9090a21d-55ce-45a2-a9b4-db811c901a3f", "cidr": "110.0.0.0/24", "ip_version": null }}' http://172.17.190.3:9696/v2.0/subnets
{"QuantumError": "Request Failed: internal server error while processing your request."}

curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"subnet": {"network_id": "9090a21d-55ce-45a2-a9b4-db811c901a3f", "cidr": "110.0.0.0/24", "ip_version": 4 , "dns_nameservers": null}}' http://172.17.190.3:9696/v2.0/subnets
{"QuantumError": "Request Failed: internal server error while processing your request."}

curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"subnet": {"network_id": "9090a21d-55ce-45a2-a9b4-db811c901a3f", "cidr": "110.0.0.0/24", "ip_version": 4 , "allocation_pools": null}}' http://172.17.190.3:9696/v2.0/subnets
{"QuantumError": "Request Failed: internal server error while processing your request."}

curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"subnet": {"network_id": "9090a21d-55ce-45a2-a9b4-db811c901a3f", "cidr": "110.0.0.0/24", "ip_version": 4 , "host_routes": null}}' http://172.17.190.3:9696/v2.0/subnets
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

o bulk subnet create
- "subnets": null [NotFixed]
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"subnets": null}}' http://172.17.190.3:9696/v2.0/subnets
{"QuantumError": "Request Faile...

Read more...

Gary Kotton (garyk) wrote :

Hi,
I have addressed all except the bulk issues you have reported. I need to double check if these are actually a bug.
Thanks
Gary

Itsuro Oda (oda-g) wrote :

Hi,

patch set 3:

This is a list of unfixed.

[invalid parameter]
o subnet create
  - host_routes duplicate
    "host_routes": [
      {"destination": "10.100.2.0/24", "nexthop": "10.100.1.254"},
      {"destination": "10.100.2.0/24", "nexthop": "10.100.1.254"}]
o port create
  - fixed_ips duplicate
    "fixed_ips": [
      {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
      {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
    ]
o port update
  - fixed_ips duplicate
    "fixed_ips": [
       {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
       {"ip_address": "10.100.1.4", "subnet_id": <same-subnet-id>},
     ]

[illegal json format]
---
curl -v -H "X-Auth-Token: 5399f4a8e6d04768894b620edbb07d41" -H "Content-Type: application/json" -X PUT -d '{{"name": "aaa"}}' http://172.17.190.3:9696/v2.0/networks/e763c6ba-6cc9-4bbb-9d2d-f547fe6c4392
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

[null specified]
o port create
- "fixed_ips": null
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"port": {"network_id": "9090a21d-55ce-45a2-a9b4-db811c901a3f", "fixed_ips": null}}' http://172.17.190.3:9696/v2.0/ports
{"QuantumError": "Request Failed: internal server error while processing your request."}
---
o port update
- "fixed_ips": null  [NotFixed]
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X PUT -H 'Content-Type: application/json' -d '{"port": {"name":"test", "fixed_ips": null}}' http://172.17.190.3:9696/v2.0/ports/07ab0d74-662c-4792-8bbe-b23e0e40c7b2
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

---bulk---

o bulk network create
- "networks": null
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -H 'Content-Type: application/json' -X POST -d '{"networks": null}' http://172.17.190.3:9696/v2.0/networks
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

o bulk subnet create
- "subnets": null
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"subnets": null}}' http://172.17.190.3:9696/v2.0/subnets
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

o bulk port create
- "ports": null  [NotFixed]
---
curl -H 'X-Auth-Token: e65b12ec013946518b0a993b0d3df2ea' -X POST -H 'Content-Type: application/json' -d '{"ports": null}' http://172.17.190.3:9696/v2.0/ports
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

Thanks.

Itsuro Oda (oda-g) wrote :

Hi,

The result of the patch set 4 is same as the patch set 3. (see note-10 please)

Moreover I noticed that some items which did not cause error response (ie. return 200 or 201) cause error (400).
For example:
[null]
o network create
  "name" : null
o network update
  "name" : null
o subnet create
  "name" : null
o subnet update
  "name" : null
o port create
  "tenant_id" : null
  "name" : null
o port update
  "name" : null

[blank]
o subnet create
  "allocation_pools" : []
  "dns_nameservers" : ""
  "host_routes" : ""
o subnet update
  "dns_nameservers" : ""
  "host_routes" : ""

Is this intended change?
I think null/blank is meaningless for create but may be meaningfull for update.

Thanks.

Gary Kotton (garyk) wrote :

Hi,
I have a number of comments:
1. The null for the name etc is an intended change. This was actually added following your comments
2. I'll address the comments in #10 in the next patch.
Thanks
Gary

Itsuro Oda (oda-g) wrote :

Hi, Gray

OK, Thanks.

Note that the list of the 'Bug Description' includes the items which retured 500 only.
The "parameter: null" should return 200/201 or 400 is independent issue.

Gary Kotton (garyk) wrote :

On 10/22/2012 06:28 AM, Itsuro Oda wrote:
> Hi,
>
> The result of the patch set 4 is same as the patch set 3. (see note-10
> please)
>
> Moreover I noticed that some items which did not cause error response (ie. return 200 or 201) cause error (400).
> For example:
> [null]
> o network create
> "name" : null
> o network update
> "name" : null
> o subnet create
> "name" : null
> o subnet update
> "name" : null
> o port create
> "tenant_id" : null
> "name" : null
> o port update
> "name" : null
>
> [blank]
> o subnet create
> "allocation_pools" : []
> "dns_nameservers" : ""
> "host_routes" : ""
> o subnet update
> "dns_nameservers" : ""
> "host_routes" : ""
>
> Is this intended change?
> I think null/blank is meaningless for create but may be meaningfull for update.
>
> Thanks.
>
Hi,
I hope that the latest patch addresses your concerns,.
Thanks
Gary

Itsuro Oda (oda-g) wrote :

Patch set 5:

Excellent. I confirmed almost of all are fixed.
Only exceptions are bulk creates.

Thanks.

Gary Kotton (garyk) wrote :

On 10/23/2012 02:41 AM, Itsuro Oda wrote:
> Patch set 5:
>
> Excellent. I confirmed almost of all are fixed.
> Only exceptions are bulk creates.
>
> Thanks.
>
:). Happy to hear that. I'll deal with the bulk creates today.
Thanks
Gary

Itsuro Oda (oda-g) wrote :

Patch set 6:

The result is same as the patch set 5.

There is an item which I forgot to report for the patch set 5.
Illegal json format still causes 500.

Thus remaining problems are "illegal json format " and "bulk creates" (specify null for required parameter).

Thanks.

Itsuro Oda (oda-g) wrote :

Patch set 11:

The result is same as the patch set 6.

ie. The problem fixed except "illegal json format " and "bulk creates" (specify null for required parameter).

Gary Kotton (garyk) wrote :

On 10/26/2012 12:44 AM, Itsuro Oda wrote:
> Patch set 11:
>
> The result is same as the patch set 6.
>
> ie. The problem fixed except "illegal json format " and "bulk creates"
> (specify null for required parameter).
>
Hi,
This is odd. I have checked the JSON issue with test
test_update_invalid_json_400. What do you think is missing here?
The bulk is still missing. I prefer to do this in a separate patch.
Thanks
Gary

Itsuro Oda (oda-g) wrote :

Hi Gary,

> The bulk is still missing. I prefer to do this in a separate patch.

OK, no problem.

> This is odd. I have checked the JSON issue with test
> test_update_invalid_json_400. What do you think is missing here?

This is my test pattern: (this log is under patch set 12)
---
curl -v -H "X-Auth-Token: ee94a1f0743b4c269acb0b14c1281523" -H "Content-Type: application/json" -X POST -d '{{"name": "aaa"}}' http://172.17.190.3:9696/v2.0/networks.json
* About to connect() to 172.17.190.3 port 9696 (#0)
* Trying 172.17.190.3... connected
> POST /v2.0/networks.json HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 172.17.190.3:9696
> Accept: */*
> X-Auth-Token: ee94a1f0743b4c269acb0b14c1281523
> Content-Type: application/json
> Content-Length: 17
>
* upload completely sent off: 17out of 17 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Content-Length: 88
< Date: Fri, 26 Oct 2012 08:06:43 GMT
<
* Connection #0 to host 172.17.190.3 left intact
* Closing connection #0
{"QuantumError": "Request Failed: internal server error while processing your request."}
---

Note that the body is {{"name": "aaa"}}.

The followings is quantum server's log:
---
2012-10-26 17:06:43 ERROR [quantum.api.v2.resource] create failed
Traceback (most recent call last):
  File "/opt/stack/quantum/quantum/api/v2/resource.py", line 92, in resource
    args['body'] = deserializer(request.body)
  File "/opt/stack/quantum/quantum/api/v2/resource.py", line 57, in <lambda>
    'application/json': lambda x: json.loads(x)}
  File "/opt/stack/quantum/quantum/openstack/common/jsonutils.py", line 134, in loads
    return json.loads(s)
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 1 column 1 (char 1)
---

Thanks.

Gary Kotton (garyk) wrote :

On 10/26/2012 10:13 AM, Itsuro Oda wrote:
> This is my test pattern: (this log is under patch set 12) --- curl -v
> -H "X-Auth-Token: ee94a1f0743b4c269acb0b14c1281523" -H "Content-Type:
> application/json" -X POST -d '{{"name": "aaa"}}'
> http://172.17.190.3:9696/v2.0/networks.json * About to connect() to
> 172.17.190.3 port 9696 (#0) * Trying 172.17.190.3... connected
Would it be possible to trf and add the following and let me know if it
helps:

diff --git a/quantum/api/v2/base.py b/quantum/api/v2/base.py
index a370381..6484b8e 100644
--- a/quantum/api/v2/base.py
+++ b/quantum/api/v2/base.py
@@ -48,6 +48,7 @@ FAULT_MAP = {exceptions.NotFound: webob.exc.HTTPNotFound,
               exceptions.PolicyNotAuthorized: webob.exc.HTTPForbidden,
               netaddr.AddrFormatError: webob.exc.HTTPBadRequest,
               AttributeError: webob.exc.HTTPBadRequest,
+ ValueError: webob.exc.HTTPBadRequest,
               }

And

diff --git a/quantum/api/v2/resource.py b/quantum/api/v2/resource.py
index 8300a53..785943d 100644
--- a/quantum/api/v2/resource.py
+++ b/quantum/api/v2/resource.py
@@ -94,7 +94,7 @@ def Resource(controller, faults=None,
deserializers=None, serializers=None):
              method = getattr(controller, action)

              result = method(request=request, **args)
- except (AttributeError,
+ except (ValueError, AttributeError,
                  exceptions.QuantumException,
                  netaddr.AddrFormatError) as e:
              LOG.exception('%s failed' % action)

Thanks
Gary

Itsuro Oda (oda-g) wrote :

Hi Gary,

> Would it be possible to trf and add the following and let me know if it
> helps:

Wow, this fixed the problem. Please apply.

Thanks.

Gary Kotton (garyk) wrote :

On 10/27/2012 02:58 AM, Itsuro Oda wrote:
> Hi Gary,
>
>> Would it be possible to trf and add the following and let me know if it
>> helps:
> Wow, this fixed the problem. Please apply.
>
> Thanks.
>
Great!

Reviewed: https://review.openstack.org/14219
Committed: http://github.com/openstack/quantum/commit/5dbb4046637462bdcb04acc8f4cbebf8db480f35
Submitter: Jenkins
Branch: master

commit 5dbb4046637462bdcb04acc8f4cbebf8db480f35
Author: Gary Kotton <email address hidden>
Date: Mon Oct 8 05:58:00 2012 +0000

    Ensure that HTTP 400 codes are returned for invalid input

    Fixes bug 1062046

    A number of additional validation functions were added. They
    do basic validations.

    Change-Id: I0fc207e996f11b50fdaa4d80075ae5704cba7003

Changed in quantum:
status: In Progress → Fix Committed

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/16085

Reviewed: https://review.openstack.org/16085
Committed: http://github.com/openstack/quantum/commit/49f649c80d0d67feb4cdcb8ec7cb0570abbfbe4b
Submitter: Jenkins
Branch: stable/folsom

commit 49f649c80d0d67feb4cdcb8ec7cb0570abbfbe4b
Author: Gary Kotton <email address hidden>
Date: Mon Oct 8 05:58:00 2012 +0000

    Ensure that HTTP 400 codes are returned for invalid input

    Fixes bug 1062046

    A number of additional validation functions were added. They
    do basic validations.

    Change-Id: I0fc207e996f11b50fdaa4d80075ae5704cba7003

tags: added: in-stable-folsom
Gary Kotton (garyk) on 2012-11-14
tags: removed: folsom-backport-potential
Thierry Carrez (ttx) on 2012-11-21
Changed in quantum:
status: Fix Committed → Fix Released
Changed in quantum (Ubuntu):
status: New → Fix Released
Changed in quantum (Ubuntu Quantal):
status: New → Confirmed

Hello Itsuro, or anyone else affected,

Accepted quantum into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/quantum/2012.2.1-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in quantum (Ubuntu Quantal):
status: Confirmed → Fix Committed
tags: added: verification-needed
Mark McLoughlin (markmc) on 2013-01-22
tags: removed: in-stable-folsom
Launchpad Janitor (janitor) wrote :
Download full text (3.8 KiB)

This bug was fixed in the package quantum - 2012.2.1-0ubuntu1

---------------
quantum (2012.2.1-0ubuntu1) quantal-proposed; urgency=low

  * Resynchronize with stable/folsom (1e774867) (LP: #1085255):
    - [aeabb42] There are routing problems when the dnsmasq port does not come
      first in the routing table (LP: #1083238)
    - [04aab72] Quantum linux bridge not optimized with libvirt (LP: #1078210)
    - [ca7fc10] getting quotas from database has severe performance implications
      (LP: #1075369)
    - [66605e8] failed to update an external network into non external network
      (LP: #1083387)
    - [c60051a] Quantum test suite leaks memory like a sieve (LP: #1065276)
    - [3179dfc] clear_db() does incomplete db teardown (LP: #1080988)
    - [c1e19d7] Unauthorized command: cat /proc/None/cmdline (LP: #1077651)
    - [af9e076] At times a instance will not receive an IP address from the DHCP
      agent (LP: #1081664)
    - [e0d1a7d] allow multiple floating-ip on single port if they use different
      fixed ips and/or external nets (LP: #1057844)
    - [8471d79] Delete port fails to gateway ip (LP: #1079980)
    - [aca8b4a] fixed_ip allocation which is not included within
      allocation_pools makes error when delete port or re-create port
      (LP: #1077292)
    - [eacc9d3] Mapping same bridge to different phyiscal networks succeed
      (LP: #1067669)
    - [51b4c82] python-quantum: not region aware (LP: #1080793)
    - [6f0a486] delete floatingip should be in one transaction to delete port
      (LP: #1080516)
    - [db6cda7] Remove qpid configuration variables no longer supported
    - [a112840] Allow NVP plugin to use per-tenant quota extension
    - [82b1a55] Quantum service does not restart after reboot (LP: #1073999)
    - [c01a839] There are some cases that L3 API with an invalid parameter
      returns 500. (LP: #1064765)
    - [26b383f] external network can be plugged also as internal network for one
      router (LP: #1053633)
    - [49f649c] There is a lot of cases that API with an invalid parameter
      returns 500. (LP: #1062046)
    - [4546a18] When create subnet, you con set up the value as cidr (the value
      isn't cidr form). (LP: #1067959)
    - [9ba453a] killfilter should handle updated/deleted executables
      (LP: #1073768)
    - [7c8a55c] a port which is not able to delete is made when floatingip
      create fails. (LP: #1064748)
    - [c9b84cf] Linux bridge port update causes exception (LP: #1072713)
    - [cb57932] I can't add interface to router, if there is another port in
      non-shared network of other tenant (LP: #1057558)
    - [574e278] Ryu plugin does not support Security Groups (LP: #1059393)
    - [607f486] tap device added to integration bridge without tag
      (LP: #1064070)
    - [21a0fdf] L3 agent external network flag (LP: #1056720)
    - [5cbaff4] router create with external_gateway_info fails with 500 always.
      (LP: #1064235)
    - [63b81f6] l3 db operations failed in multiple transactions (LP: #1070335)
    - [bff17fb] Ensure that the SqlSoup import is still supported.
    - [e091a29] l3_nat_agent was renamed to l3_agent
    - [9030969] remove default value of 'local_ip' of 10...

Read more...

Changed in quantum (Ubuntu Quantal):
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-04-04
Changed in quantum:
milestone: grizzly-1 → 2013.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers