Merge "Raise an exc if no VIP/backend is available"

This commit is contained in:
Zuul 2022-09-30 18:04:54 +00:00 committed by Gerrit Code Review
commit 4aa84c722f
3 changed files with 40 additions and 0 deletions

View File

@ -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):

View File

@ -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"

View File

@ -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.