self.assertFalse(
self.mock_rbd.Image.return_value.unprotect_snap.called)
self.assertEqual(
- 1, self.mock_rbd.RBD.return_value.remove.call_count)
+ 3, self.mock_rbd.RBD.return_value.remove.call_count)
+ self.assertEqual(3, len(RAISED_EXCEPTIONS))
# Make sure the exception was raised
- self.assertEqual(RAISED_EXCEPTIONS,
- [self.mock_rbd.ImageBusy])
+ self.assertIn(self.mock_rbd.ImageBusy, RAISED_EXCEPTIONS)
@common_mocks
def test_delete_volume_not_found(self):
finally:
rbd_image.close()
+ @utils.retry(self.rbd.ImageBusy, retries=3)
+ def _try_remove_volume(client, volume_name):
+ self.RBDProxy().remove(client.ioctx, volume_name)
+
if clone_snap is None:
LOG.debug("deleting rbd volume %s", volume_name)
try:
- self.RBDProxy().remove(client.ioctx, volume_name)
+ _try_remove_volume(client, volume_name)
except self.rbd.ImageBusy:
msg = (_("ImageBusy error raised while deleting rbd "
"volume. This may have been caused by a "