NSX|V3+P: Fix HTTP response code for cluster down
This change removes ManagerError from fault translation. ManagerError is too generic and would pull in all child classes to be translated as bad request, which is not correct for temporary errors such as ClusterUnavailable. Explicit child classes should be added to the map instead. Change-Id: I5fb4bbcabd6540f30f4d30732bfb704680b5ffa9
This commit is contained in:
parent
cdf0647104
commit
79dd8edae5
|
@ -158,7 +158,7 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||
Exceptions specific to the NSX Plugin are mapped to standard
|
||||
HTTP Exceptions.
|
||||
"""
|
||||
faults.FAULT_MAP.update({nsx_lib_exc.ManagerError:
|
||||
faults.FAULT_MAP.update({nsx_lib_exc.InvalidInput:
|
||||
webob.exc.HTTPBadRequest,
|
||||
nsx_lib_exc.ServiceClusterUnavailable:
|
||||
webob.exc.HTTPServiceUnavailable,
|
||||
|
|
|
@ -786,14 +786,14 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxV3PluginTestCaseMixin):
|
|||
# Fail the backend update
|
||||
with mock.patch("vmware_nsxlib.v3.core_resources."
|
||||
"NsxLibLogicalSwitch.update",
|
||||
side_effect=nsxlib_exc.ManagerError):
|
||||
side_effect=nsxlib_exc.InvalidInput):
|
||||
args = {'network': {'description': 'test rollback'}}
|
||||
req = self.new_update_request('networks', args,
|
||||
net['network']['id'], fmt='json')
|
||||
res = self.deserialize('json', req.get_response(self.api))
|
||||
# should fail with the nsxlib error (meaning that the rollback
|
||||
# did not fail)
|
||||
self.assertEqual('ManagerError',
|
||||
self.assertEqual('InvalidInput',
|
||||
res['NeutronError']['type'])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue