Deal with 501 errors from NVP correctly

This is done by adding the error code to the exception
handlers dictionary as done for other error codes.

Fixes bug #1215583

Change-Id: Ic876c6bccaf94cae626dfc908c4a34dfbcead406
This commit is contained in:
armando-migliaccio 2013-08-22 13:12:15 -07:00
parent 1c2e111a0b
commit 0d2402b3fe
3 changed files with 10 additions and 1 deletions

View File

@ -202,6 +202,7 @@ class NVPApiHelper(client_eventlet.NvpApiClientEventlet):
307: zero,
400: zero,
500: zero,
501: zero,
503: zero}

View File

@ -453,7 +453,7 @@ class FakeClient:
relations = urlparse.parse_qs(parsedurl.query).get('relations')
response_file = self.FAKE_GET_RESPONSES.get(res_type)
if not response_file:
raise Exception("resource not found")
raise NvpApiClient.NvpApiException()
if 'lport' in res_type or 'nat' in res_type:
if len(uuids) > 1:
return self._show(res_type, response_file, uuids[0],

View File

@ -1379,6 +1379,14 @@ class TestNvplibClusterManagement(NvplibTestCase):
self.assertRaises(nvp_exc.MaintenanceInProgress,
nvplib.do_request, cluster=self.fake_cluster)
def test_cluster_method_not_implemetned(self):
self.assertRaises(NvpApiClient.NvpApiException,
nvplib.do_request,
nvplib.HTTP_GET,
nvplib._build_uri_path('MY_FAKE_RESOURCE',
resource_id='foo'),
cluster=self.fake_cluster)
def _nicira_method(method_name, module_name='nvplib'):
return '%s.%s.%s' % ('neutron.plugins.nicira', module_name, method_name)