+ "Error deleting volume: ClientException: Connection aborted. (HTTP 403)"
+ )
+ self.assertEqual(created_items, expected_created_items)
+
+ def test_delete_volumes_by_id_with_cinder__delete_volume_raise_connection_exception__exception_is_raised(
+ self,
+ ):
+ """cinder delete volume raises exception."""
+ created_items = {
+ f"floating_ip:{floating_network_vim_id}": True,
+ f"volume:{volume_id2}": True,
+ f"volume:{volume_id}": True,
+ f"port:{port_id}": None,
+ }
+ expected_created_items = {
+ f"floating_ip:{floating_network_vim_id}": True,
+ f"volume:{volume_id2}": True,
+ f"volume:{volume_id}": True,
+ f"port:{port_id}": None,
+ }
+ volumes_to_hold = []
+ k = f"volume:{volume_id}"
+ k_id = volume_id
+ self.vimconn.cinder.volumes.get.return_value.status = "available"
+ self.vimconn.cinder.volumes.delete.side_effect = cExceptions.ConnectionError(
+ "Connection failed."
+ )
+ with self.assertRaises(VimConnConnectionException):
+ result = self.vimconn._delete_volumes_by_id_wth_cinder(
+ k, k_id, volumes_to_hold, created_items
+ )
+ self.assertEqual(result, None)
+ self.vimconn.cinder.volumes.get.assert_called_once_with(k_id)
+ self.vimconn.cinder.volumes.delete.assert_called_once_with(k_id)
+ self.vimconn.logger.error.assert_called_once_with(
+ "Error deleting volume: ConnectionError: Connection failed."