VMware: fix regression for 'TaskInProgress'

Commit 73d4a7c1b4 caused a regression
with the snapshot deletion. That is, the snapshot deletion will retry
if the resource is busy. The fact that the exception was not supported
in olso caused the problem.

Version 0.6.0 supports this exception.

Change-Id: I12fcc7d039a123e681c51978b9cf632af8f9644b
Closes-bug: #1369463
This commit is contained in:
Gary Kotton 2014-09-15 02:14:37 -07:00
parent d9d04933a4
commit af4723842a
3 changed files with 3 additions and 7 deletions

View File

@ -1244,7 +1244,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
side_effect=exception),
mock.patch.object(vmops, '_time_sleep_wrapper')
) as (_fake_wait, _fake_sleep):
if exception != error_util.TaskInProgress:
if exception != vexc.TaskInProgress:
self.assertRaises(exception,
self.conn._vmops._delete_vm_snapshot,
self.instance, fake_vm, snapshot_ref)
@ -1260,7 +1260,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
def test_snapshot_delete_vm_snapshot_exception_retry(self):
self.flags(api_retry_count=5, group='vmware')
self._snapshot_delete_vm_snapshot_exception(error_util.TaskInProgress,
self._snapshot_delete_vm_snapshot_exception(vexc.TaskInProgress,
5)
def test_reboot(self):

View File

@ -30,10 +30,6 @@ class NoRootDiskDefined(vexc.VMwareDriverException):
msg_fmt = _("No root disk defined.")
class TaskInProgress(vexc.VMwareDriverException):
msg_fmt = _("Virtual machine is busy.")
class PbmDefaultPolicyUnspecified(vexc.VMwareDriverConfigurationException):
msg_fmt = _("Default PBM policy is required if PBM is enabled.")

View File

@ -132,7 +132,7 @@ def retry_if_task_in_progress(f, *args, **kwargs):
try:
f(*args, **kwargs)
return
except error_util.TaskInProgress:
except vexc.TaskInProgress:
pass