[openstack-dev] HTTP response code for not implemented features

Davanum Srinivas davanum at gmail.com
Thu Dec 6 12:29:12 UTC 2012


+1 to 501 for this specific scenario

On Thu, Dec 6, 2012 at 6:58 AM, Mark McLoughlin <markmc at redhat.com> wrote:
> Hey,
>
> Kevin raised a good point here:
>
>   https://review.openstack.org/17565
>
> Currently attempting to set a host's status to disabled will fail with
> 400 Bad Request (without any explanatory error message) if you're using
> the libvirt driver.
>
> To be clear, this is a PUT request containing a representation of the
> desired status for the host and we don't support changing its status.
>
> I proposed changing this to return a 501 Not Implemented with an
> explanatory message, but it's not clear that's correct either.
>
> Things to consider:
>
>   - 4xx codes are for client errors - is this a client error? There is
>     no way for a client to know that a cloud supports this without
>     trying it, so it's obviously something we expect clients to do.
>
>   - 400 explicitly states that clients should not retry the request
>     without modifications. That does apply here.
>
>   - 405 Method Not Allowed is only appropriate where a request method
>     isn't allowed. We do support PUT requests on host resources, just
>     not this particular request.
>
>   - 5xx codes "indicate cases in which the server is aware that it has
>     erred or is incapable of performing the request". The latter part
>     seems appropriate here.
>
>   - The 501 docs say:
>
>        The server does not support the functionality required to
>        fulfill the request. This is the appropriate response when the
>        server does not recognize the request method and is not capable
>        of supporting it for any resource.
>
>     The first sentence makes it seem like 501 is a good fit here. I
>     take the second sentence to be an example of one of cases where 501
>     is appropriate, rather than the only case.
>
>
> I think I'm still leaning towards 501. Any thoughts?
>
> Cheers,
> Mark.
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



-- 
Davanum Srinivas :: http://davanum.wordpress.com



More information about the OpenStack-dev mailing list