Merge "NetApp: Log unexpected errors from backend"

This commit is contained in:
Jenkins 2016-06-08 23:01:48 +00:00 committed by Gerrit Code Review
commit 0d2e9cc00d
2 changed files with 4 additions and 2 deletions

View File

@ -214,7 +214,7 @@ class NetAppApiServerTests(test.TestCase):
na_element = zapi_fakes.FAKE_NA_ELEMENT
self.mock_object(self.root, '_create_request', mock.Mock(
return_value=('abc', zapi_fakes.FAKE_NA_ELEMENT)))
self.mock_object(netapp_api, 'LOG')
mock_log = self.mock_object(netapp_api, 'LOG')
self.root._opener = zapi_fakes.FAKE_HTTP_OPENER
self.mock_object(self.root, '_build_opener')
self.mock_object(self.root._opener, 'open', mock.Mock(
@ -222,6 +222,7 @@ class NetAppApiServerTests(test.TestCase):
self.assertRaises(netapp_api.NaApiError, self.root.send_http_request,
na_element)
self.assertEqual(1, mock_log.exception.call_count)
def test_send_http_request_valid(self):
"""Tests the method send_http_request with valid parameters"""

View File

@ -32,7 +32,7 @@ import six
from six.moves import urllib
from cinder import exception
from cinder.i18n import _
from cinder.i18n import _, _LE
from cinder import ssh_utils
from cinder import utils
@ -224,6 +224,7 @@ class NaServer(object):
except urllib.error.HTTPError as e:
raise NaApiError(e.code, e.msg)
except Exception:
LOG.exception(_LE("Error communicating with NetApp filer."))
raise NaApiError('Unexpected error')
response_xml = response.read()