diff --git a/manila/share/drivers/cephfs/driver.py b/manila/share/drivers/cephfs/driver.py index 620b3703e6..f8c3fed1a1 100644 --- a/manila/share/drivers/cephfs/driver.py +++ b/manila/share/drivers/cephfs/driver.py @@ -1196,6 +1196,13 @@ class NFSClusterProtocolHelper(NFSProtocolHelperMixin, ganesha.NASHelperBase): else: export_ips.append(vip) + # there are no export IPs, there are no NFS servers we can use + if not export_ips: + msg = _("There are no NFS servers available to use. " + "Please check the health of your Ceph cluster " + "and restart the manila share service.") + raise exception.ShareBackendException(msg=msg) + return export_ips def check_for_setup_error(self): diff --git a/manila/tests/share/drivers/cephfs/test_driver.py b/manila/tests/share/drivers/cephfs/test_driver.py index c53b113f25..f02b16b443 100644 --- a/manila/tests/share/drivers/cephfs/test_driver.py +++ b/manila/tests/share/drivers/cephfs/test_driver.py @@ -1265,6 +1265,27 @@ class NFSClusterProtocolHelperTestCase(test.TestCase): type(self._nfscluster_protocol_helper).nfs_clusterid = ( mock.PropertyMock(return_value='fs-manila')) + def test_get_export_ips_no_backends(self): + fake_conf = configuration.Configuration(None) + cluster_info = { + "fs-manila": { + "virtual_ip": None, + "backend": [] + } + } + + driver.rados_command.return_value = json.dumps(cluster_info) + + helper = driver.NFSClusterProtocolHelper( + self._execute, + fake_conf, + rados_client=self._rados_client, + volname=self._volname + ) + + self.assertRaises(exception.ShareBackendException, + helper._get_export_ips) + @ddt.data(constants.ACCESS_LEVEL_RW, constants.ACCESS_LEVEL_RO) def test_allow_access_rw_ro(self, mode): access_allow_prefix = "nfs export apply" diff --git a/releasenotes/notes/bug-1990150-cephadm-cephnfs-backend-fails-start-raise-exc-7459302bf662fdd6.yaml b/releasenotes/notes/bug-1990150-cephadm-cephnfs-backend-fails-start-raise-exc-7459302bf662fdd6.yaml new file mode 100644 index 0000000000..06ca022842 --- /dev/null +++ b/releasenotes/notes/bug-1990150-cephadm-cephnfs-backend-fails-start-raise-exc-7459302bf662fdd6.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + When deploying Manila CephFS NFS with cephadm, the manila share + service fails to start with the error "Backend cephfsnfs supports + neither IPv4 nor IPv6". This happens because the NFS Ganesha + daemon fails to start for some reason, and therefore the driver + never gets the location of the NFS Ganesha service that will be + used as the backend. We rely on the operator to make sure the CephFS + NFS cluster is available when initializing the driver. With this fix in + place, we raise an exception to explicitly notify the operator and + allow them to take further action.