Description
===========
If Neutron disable security-group extension, Nova security group API could not handle the 404 exception which Neutron returns emitting 500 error. Security API in Nova is deprecated though I think it's better to wrap 404 exception instead of 500 error.
Steps to reproduce
==================
0) Disable neutron security-group extension
m2_conf.ini [security_group] enabled_security_group = false
1) Request Nova to control any security-group related functions
Expected result
===============
Return 404 error from Nova
Actual result
=============
Return 500 error from Nova
Environment
===========
1. Exact version of OpenStack you are running. See the following
stable/ocata
2. Which hypervisor did you use?
Libvirt + KVM
2. Which storage type did you use?
Ceph
3. Which networking type did you use?
Neutron with linuxbridge
Logs & Configs
==============
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions [req-7459f23d-d972-4826-8596-4b7ece999727 0a084841c373499198a43b6d09c72f4f e4ce445c7c644f1481d48c36f5d962fc - default default] Unexpected exception in API method
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions Traceback (most recent call last):
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/api/openstack/extensions.py", line 338, in wrapped
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions return f(*args, **kwargs)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/api/openstack/compute/security_groups.py", line 194, in create
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions context, group_name, group_description)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/network/security_group/neutron_driver.py", line 64, in create_security_group
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions six.reraise(*exc_info)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/network/security_group/neutron_driver.py", line 50, in create_security_group
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions body).get('security_group')
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/network/neutronv2/api.py", line 113, in wrapper
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions ret = obj(*args, **kwargs)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 938, in create_security_group
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions return self.post(self.security_groups_path, body=body)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/network/neutronv2/api.py", line 113, in wrapper
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions ret = obj(*args, **kwargs)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 366, in post
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions headers=headers, params=params)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/network/neutronv2/api.py", line 113, in wrapper
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions ret = obj(*args, **kwargs)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 301, in do_request
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions self._handle_fault_response(status_code, replybody, resp)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/src/nova/nova/network/neutronv2/api.py", line 113, in wrapper
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions ret = obj(*args, **kwargs)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 276, in _handle_fault_response
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions exception_handler_v20(status_code, error_body)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions File "/opt/openstack/lib/python2.7/site-packages/neutronclient/v2_0/client.py", line 92, in exception_handler_v20
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions request_ids=request_ids)
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions NotFound: The resource could not be found.<br /><br />
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions Neutron server returns request_ids: ['req-f59ab511-7e66-4346-8944-bc023465b2d5']
2019-02-27 11:25:18.150 26387 ERROR nova.api.openstack.extensions
2019-02-27 11:25:18.153 26387 INFO nova.api.openstack.wsgi [req-7459f23d-d972-4826-8596-4b7ece999727 0a084841c373499198a43b6d09c72f4f e4ce445c7c644f1481d48c36f5d962fc - default default] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<class 'neutronclient.common.exceptions.NotFound'>
2019-02-27 11:25:18.154 26387 DEBUG nova.api.openstack.wsgi [req-7459f23d-d972-4826-8596-4b7ece999727 0a084841c373499198a43b6d09c72f4f e4ce445c7c644f1481d48c36f5d962fc - default default] Returning 500 to user: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
I don't know that we'll actually fix this given it's a proxy API but I'll mark as triaged/low for now.