improper usage of HTTP 413 status code

Bug #1298131 reported by Matthew Edmonds
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Unassigned

Bug Description

HTTP 413 is supposed to mean (per RFC2616) that the request entity was too large. E.g., if you send an enormous body with the request. That is not at all how it is being used in the server resize request example below. The nova/api/openstack/compute/servers.py is coded to return 413 for QuotaError and PortLimitExceeded on create as well as for QuotaError on resize, and there may be other places 413 is being returned inappropriately.

POST /v2/6ce8fae0510349dcbf9b3965f7a20061/servers/8ebaabfc-9018-4ac1-afc6-630aee8a8ae3/action
Request body: { "resize": {
            "flavor": {
              "vcpus": 1,
              "ram": 9999999999,
              "disk": 20
          }}}

Response: HTTP 413 (Request Entity Too Large)
Response body:
{
overLimit: {
message: "Quota exceeded for ram: Requested 1410063359, but already used 6144 of 8000000 ram"
code: 413
retryAfter: "0"
}
-
}

Tags: api
Matt Riedemann (mriedem)
tags: added: api
description: updated
Matt Riedemann (mriedem)
description: updated
Revision history for this message
Facundo Farias (facundo-farias) wrote :

Which one should be used instead? HTTPBadRequest?

Changed in nova:
assignee: nobody → Facundo Farias (facundo-farias)
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/84224

Changed in nova:
status: New → In Progress
Revision history for this message
Matthew Edmonds (edmondsw) wrote :

I would think HTTPBadRequest, yes.

Changed in nova:
assignee: Facundo Farias (facundo-farias) → Christopher Yeoh (cyeoh-0)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in nova:
assignee: Christopher Yeoh (cyeoh-0) → zhu zhu (zhuzhubj)
Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

There is currently a patch in the review queue for this https://review.openstack.org/102103

Changed in nova:
assignee: zhu zhu (zhuzhubj) → Christopher Yeoh (cyeoh-0)
Changed in nova:
assignee: Christopher Yeoh (cyeoh-0) → zhu zhu (zhuzhubj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/95671
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=af44b50b6b8187c559c56b9d3f7dc047fc5be407
Submitter: Jenkins
Branch: master

commit af44b50b6b8187c559c56b9d3f7dc047fc5be407
Author: Facundo Farias <email address hidden>
Date: Mon Mar 31 16:26:51 2014 -0300

    Correct returned HTTP status code (Use 403 instead of 413)

    The exception HTTPRequestEntityTooLarge should not be used as an
    exception response based on RFC2616. Because of that, change
    the returned response to HTTPForbidden.

    Restore commit for Iab090c40c632a76b0528df8145ad0897c8b649bf
    And add compute V3 changes.

    Related Tempest commit to match this change:
    If376eda0a7929ba2baa4ac4acbb457883bcfc96d

    DocImpact: corrects HTTP return code from 413 to 403 for quota-related
    limit faults

    Closes-Bug: #1298131
    Change-Id: I2bb8a60ef254afbfed514cfeebe75355d0de4475

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/102103
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=007ed9b6c825da482275b30f982eac46690337a3
Submitter: Jenkins
Branch: master

commit 007ed9b6c825da482275b30f982eac46690337a3
Author: Chris Yeoh <email address hidden>
Date: Tue Jun 24 14:01:04 2014 +0930

    Change error status code for out of quota to be 403 instead of 413

    Instead of returning 413 as the error status code when the
    request fails due to lack of quota we should return 403

    DocImpact: Return 403 Forbidden instead of 413 RequestEntityTooLarge
    when a request fails due to lack of quota

    Change-Id: I7c179748769b8a0e2cc2e476ebefe33449f6f304
    Closes-Bug: 1298131

zhu zhu (zhuzhubj)
Changed in nova:
assignee: zhu zhu (zhuzhubj) → nobody
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-3 → 2014.2
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.