Revert "Raise VimFaultException for unknown faults"

This reverts commit 1668fef9ca

This is a backwards incompatible change, as we see with the
nova driver code that is expecting a VMwareDriverException
but is now getting back a VimFaultException because the unit
tests in nova were passing an unknown fault class name.

Change-Id: I0f8042c6e47f6eb9802e770ffb7d09bdbe57013b
Closes-Bug: #1459021
This commit is contained in:
Matt Riedemann
2015-05-26 21:32:40 +00:00
parent 1668fef9ca
commit 8ec7f0fe04
5 changed files with 11 additions and 28 deletions

View File

@@ -373,19 +373,6 @@ class VMwareAPISessionTest(base.TestCase):
userName=api_session._session_username)
api_session._create_session.assert_called_once_with()
def test_invoke_api_with_unknown_fault(self):
api_session = self._create_api_session(True)
fault_list = ['NotAFile']
module = mock.Mock()
module.api.side_effect = exceptions.VimFaultException(fault_list,
'Not a file.')
ex = self.assertRaises(exceptions.VimFaultException,
api_session.invoke_api,
module,
'api')
self.assertEqual(fault_list, ex.fault_list)
def test_wait_for_task(self):
api_session = self._create_api_session(True)
task_info_list = [('queued', 0), ('running', 40), ('success', 100)]
@@ -426,7 +413,7 @@ class VMwareAPISessionTest(base.TestCase):
api_session.invoke_api = mock.Mock(side_effect=invoke_api_side_effect)
task = mock.Mock()
with mock.patch.object(greenthread, 'sleep'):
self.assertRaises(exceptions.VimFaultException,
self.assertRaises(exceptions.VMwareDriverException,
api_session.wait_for_task,
task)
api_session.invoke_api.assert_called_with(vim_util,
@@ -544,8 +531,8 @@ class VMwareAPISessionTest(base.TestCase):
def test_poll_task_unknown_exception(self):
_unknown_exceptions = {
'NotAFile': exceptions.VimFaultException,
'RuntimeFault': exceptions.VimFaultException
'NotAFile': exceptions.VMwareDriverException,
'RuntimeFault': exceptions.VMwareDriverException
}
for k, v in six.iteritems(_unknown_exceptions):