Don't fail remove-export in NFS-Ganesha

When dropping an export over DBUS, if there's a problem
with the removal, we can ignore the failure and move on.
If not, the share ends up in an "error_deleting" state.

There's not much that we can do here besides logging
the failure as an exception.

Change-Id: I73c2706c9d889f8d08057a543b2a963740bb3f33
Closes-Bug: #2035572
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
(cherry picked from commit 609b925a51)
(cherry picked from commit d6eed0ea06)
(cherry picked from commit b76a035d77)
(cherry picked from commit 13dabf77b9)
(cherry picked from commit 739301f4d4)
This commit is contained in:
Goutham Pacha Ravi 2023-10-20 15:25:01 -07:00
parent a759ed6936
commit 51baf4e84a
3 changed files with 18 additions and 4 deletions

View File

@ -514,6 +514,9 @@ class GaneshaManager(object):
try:
confdict = self._read_export(name)
self._remove_export_dbus(confdict["EXPORT"]["Export_Id"])
except Exception:
LOG.exception("There was a problem removing the export. "
"Ignoring errors and continuing operation.")
finally:
if self.ganesha_rados_store_enable:
self._delete_rados_object(

View File

@ -972,8 +972,7 @@ class GaneshaManagerTestCase(test.TestCase):
for method in methods:
self.mock_object(self._manager, method)
self.assertRaises(exception.GaneshaCommandFailure,
self._manager.remove_export, test_name)
ret = self._manager.remove_export(test_name)
self._manager._read_export.assert_called_once_with(test_name)
self.assertFalse(self._manager._remove_export_dbus.called)
@ -994,6 +993,7 @@ class GaneshaManagerTestCase(test.TestCase):
self.assertFalse(self._manager._delete_rados_object.called)
self.assertFalse(
self._manager._remove_rados_object_url_from_index.called)
self.assertIsNone(ret)
@ddt.data(True, False)
def test_remove_export_error_during_remove_export_dbus_with_rados_store(
@ -1012,8 +1012,7 @@ class GaneshaManagerTestCase(test.TestCase):
for method in methods:
self.mock_object(self._manager, method)
self.assertRaises(exception.GaneshaCommandFailure,
self._manager.remove_export, test_name)
ret = self._manager.remove_export(test_name)
self._manager._read_export.assert_called_once_with(test_name)
self._manager._remove_export_dbus.assert_called_once_with(
@ -1035,6 +1034,7 @@ class GaneshaManagerTestCase(test.TestCase):
self.assertFalse(self._manager._delete_rados_object.called)
self.assertFalse(
self._manager._remove_rados_object_url_from_index.called)
self.assertIsNone(ret)
def test_get_rados_object(self):
fakebin = chr(246).encode('utf-8')

View File

@ -0,0 +1,11 @@
---
fixes:
- |
The CephFS driver uses a `RemoveExport` DBUS API call to the NFS/Ganesha
service when a user deletes an access rule, or when deleting the share.
If this call fails, the driver now provides a log of the failure, and
continues cleaning up. Prior to this change, share deletion could fail if
the service failed the DBUS command to drop the export. This would leave
the share with an "error_deleting" status, needing administrator
intervention. See `bug #2035572 <https://launchpad.net/bugs/2035572>`_
for more information.