Handle PortLimitExceeded in POST /servers/{server_id}/os-interface
When attaching an interface to a server, if an existing port is not
specified, nova-compute will attempt to create a port on either the
user-specified network or the network that is available to the tenant.
If the tenant exceeds their port quota in neutron, a PortLimitExceeded
exception is raised up from nova-compute [1] which is not being handled
in the API controller code - which is fixed in this change.
Note that this is one of the few synchronous RPC call operations [2]
in the compute API so exceptions from the compute service will leak
back to the API like in this case and need to be handled to avoid a
500 response to the user.
The 403 response used here matches how PortLimitExceeded is handled in
the server create API [3].
Reviewed: https:/ /review. opendev. org/665513 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=43926ebca0f 9a7f59be96e965e 5be70b84501fa3
Committed: https:/
Submitter: Zuul
Branch: stable/stein
commit 43926ebca0f9a7f 59be96e965e5be7 0b84501fa3
Author: Matt Riedemann <email address hidden>
Date: Thu Apr 4 14:44:02 2019 -0400
Handle PortLimitExceeded in POST /servers/ {server_ id}/os- interface
When attaching an interface to a server, if an existing port is not
specified, nova-compute will attempt to create a port on either the
user-specified network or the network that is available to the tenant.
If the tenant exceeds their port quota in neutron, a PortLimitExceeded
exception is raised up from nova-compute [1] which is not being handled
in the API controller code - which is fixed in this change.
Note that this is one of the few synchronous RPC call operations [2]
in the compute API so exceptions from the compute service will leak
back to the API like in this case and need to be handled to avoid a
500 response to the user.
The 403 response used here matches how PortLimitExceeded is handled in
the server create API [3].
[1] https:/ /github. com/openstack/ nova/blob/ 6ebb2c4ca/ nova/network/ neutronv2/ api.py# L565 /github. com/openstack/ nova/blob/ 6ebb2c4ca/ nova/compute/ rpcapi. py#L489 /github. com/openstack/ nova/blob/ 6ebb2c4ca/ nova/api/ openstack/ compute/ servers. py#L688
[2] https:/
[3] https:/
Change-Id: I5687480a22542e ea31d299442837b d64bf731285 8fd5897888c3c4c 739b4b5f45)
Closes-Bug: #1823203
(cherry picked from commit 8ff0fae42bce9f9