Raise an exc if no VIP/backend is available

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 should raise an error in this case with more information
about the failure.

This change adds this to the NFSClusterProtocol helper.

Closes-Bug: #1990150

Change-Id: Ic74c6c9d9770974848ec9dfb6d2225ce9b3bcb52
This commit is contained in:
Victoria Martinez de la Cruz 2022-09-19 08:32:42 +00:00
parent 3f431ef9eb
commit 8276fa3c88
3 changed files with 40 additions and 0 deletions

View File

@ -1196,6 +1196,13 @@ class NFSClusterProtocolHelper(NFSProtocolHelperMixin, ganesha.NASHelperBase):
else: else:
export_ips.append(vip) 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 return export_ips
def check_for_setup_error(self): def check_for_setup_error(self):

View File

@ -1265,6 +1265,27 @@ class NFSClusterProtocolHelperTestCase(test.TestCase):
type(self._nfscluster_protocol_helper).nfs_clusterid = ( type(self._nfscluster_protocol_helper).nfs_clusterid = (
mock.PropertyMock(return_value='fs-manila')) 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) @ddt.data(constants.ACCESS_LEVEL_RW, constants.ACCESS_LEVEL_RO)
def test_allow_access_rw_ro(self, mode): def test_allow_access_rw_ro(self, mode):
access_allow_prefix = "nfs export apply" 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.