From 51baf4e84ac2ecc98cf793cee4ddb2218d89019b Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Fri, 20 Oct 2023 15:25:01 -0700 Subject: [PATCH] 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 (cherry picked from commit 609b925a51b230c93d8ad408cf8ba351657dd83e) (cherry picked from commit d6eed0ea06f662946dcc7cfac3b90de38c168eaf) (cherry picked from commit b76a035d770093b230c4de4ed3f81c5bc249c1ff) (cherry picked from commit 13dabf77b9ae931c2d70ea76a0d13fdf0a5d26ae) (cherry picked from commit 739301f4d4ac4d7ec3e966eda52996b959bc176f) --- manila/share/drivers/ganesha/manager.py | 3 +++ manila/tests/share/drivers/ganesha/test_manager.py | 8 ++++---- ...rs-remove-export-nfs-ganesha-fd0f8eb1db800d31.yaml | 11 +++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/bug-2035572-ignore-errors-remove-export-nfs-ganesha-fd0f8eb1db800d31.yaml diff --git a/manila/share/drivers/ganesha/manager.py b/manila/share/drivers/ganesha/manager.py index c42ecfadd0..11c6234a7d 100644 --- a/manila/share/drivers/ganesha/manager.py +++ b/manila/share/drivers/ganesha/manager.py @@ -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( diff --git a/manila/tests/share/drivers/ganesha/test_manager.py b/manila/tests/share/drivers/ganesha/test_manager.py index 57753a0309..2c98fdfc01 100644 --- a/manila/tests/share/drivers/ganesha/test_manager.py +++ b/manila/tests/share/drivers/ganesha/test_manager.py @@ -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') diff --git a/releasenotes/notes/bug-2035572-ignore-errors-remove-export-nfs-ganesha-fd0f8eb1db800d31.yaml b/releasenotes/notes/bug-2035572-ignore-errors-remove-export-nfs-ganesha-fd0f8eb1db800d31.yaml new file mode 100644 index 0000000000..64d126c0b2 --- /dev/null +++ b/releasenotes/notes/bug-2035572-ignore-errors-remove-export-nfs-ganesha-fd0f8eb1db800d31.yaml @@ -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 `_ + for more information.