Public bug reported: Neutronclient transforms errors using exception_handler_v20[1]. In particular, it transforms 404 responses into: 1) [2] neutronclient.common.exceptions.<type>Client if response body contains a type attribute (with value <type>, type examples: NetworkNotFound, PortNotFound) and <type>Client exists 2) [3] neutronclient.common.NotFound otherwise
Nova neutron driver[4] supports mostly 1) but not 2). But Neutron in case of 404 returns the following body: {"message": "The resource could not be found.<br /><br />\n\n\n", "code": "404 Not Found", "title": "Not Found"} and we end in 2) and Nova Neutron driver doesn't catch the error correctly and raises a 500 You can reproduce it indirectly using: openstack server add fixed ip <vm> <network-name> which queries: nova-base-url/os-networks/<network-name> assuming it would return the network or a 404 but it returns 500. This trouble can be solved by catching NotFound instead of NetworkNotFoundClient/PortNotFoundClient as there are subclasses of NotFound. [1] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L47-L93 [2] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L71 [3] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L85 [4] nova.network.neutronv2.api ** Affects: nova Importance: Undecided Assignee: Cedric Brandily (cbrandily) Status: New ** Tags: ocata-backport-potential pike-backport-potential ** Changed in: nova Assignee: (unassigned) => Cedric Brandily (cbrandily) ** Description changed: - Neutronclient transforms errors using exception_handler_v20[1]. + Neutronclient transforms errors using exception_handler_v20[1]. In particular, it transforms 404 responses into: - 1) [2] neutronclient.common.exceptions.<type>Client if response body contains a type attribute (with value <type>, type examples: NetworkNotFound, PortNotFound) and <type>Client exists - 2) [3] neutronclient.common.NotFound otherwise + 1) [2] neutronclient.common.exceptions.<type>Client if response body contains a type attribute (with value <type>, type examples: NetworkNotFound, PortNotFound) and <type>Client exists + 2) [3] neutronclient.common.NotFound otherwise Nova neutron driver[4] supports mostly 1) but not 2). But Neutron in case of 404 returns the following body: - {"message": "The resource could not be found.<br /><br />\n\n\n", + {"message": "The resource could not be found.<br /><br />\n\n\n", "code": "404 Not Found", "title": "Not Found"} and we end in 2) and Nova Neutron driver doesn't catch the error correctly and raises a 500 + You can reproduce it indirectly using: + openstack server add fixed ip <vm> <network-name> - You can reproduce it indirectly using: - openstack server add fixed ip <vm> <network-name> + which queries: + nova-base-url/os-networks/<network-name> - which queries: - nova-base-url/os-networks/<network-name> - - assuming it would return the network or a 404 but it returns 500 + assuming it would return the network or a 404 but it returns 500. This trouble can be solved by catching NotFound instead of NetworkNotFoundClient/PortNotFoundClient as there are subclasses of NotFound. + [1] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L47-L93 [2] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L71 [3] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L85 [4] nova.network.neutronv2.api -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1747167 Title: Neutron driver handles incorrectly 404 errors Status in OpenStack Compute (nova): New Bug description: Neutronclient transforms errors using exception_handler_v20[1]. In particular, it transforms 404 responses into: 1) [2] neutronclient.common.exceptions.<type>Client if response body contains a type attribute (with value <type>, type examples: NetworkNotFound, PortNotFound) and <type>Client exists 2) [3] neutronclient.common.NotFound otherwise Nova neutron driver[4] supports mostly 1) but not 2). But Neutron in case of 404 returns the following body: {"message": "The resource could not be found.<br /><br />\n\n\n", "code": "404 Not Found", "title": "Not Found"} and we end in 2) and Nova Neutron driver doesn't catch the error correctly and raises a 500 You can reproduce it indirectly using: openstack server add fixed ip <vm> <network-name> which queries: nova-base-url/os-networks/<network-name> assuming it would return the network or a 404 but it returns 500. This trouble can be solved by catching NotFound instead of NetworkNotFoundClient/PortNotFoundClient as there are subclasses of NotFound. [1] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L47-L93 [2] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L71 [3] https://github.com/openstack/python-neutronclient/blob/6a2112e1824980af1bc9216441fa58a7dfd00988/neutronclient/v2_0/client.py#L85 [4] nova.network.neutronv2.api To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1747167/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp