From 43ebc12fb53546a286ac6180db52ee8bbb775b1a Mon Sep 17 00:00:00 2001 From: silvacarloss Date: Wed, 13 Oct 2021 19:32:43 -0300 Subject: [PATCH] Adapt CephFS driver to do not try to escape export ip Changes CephFS driver to do not try to escape export ip in case it is a hostname. The CephFS driver might use the hostname as an export ip in case no ``cephfs_ganesha_server_ip`` is configured. If that happens, we should not be allowing ip validations to occur uppon a hostname, because it differs from an IPv4 or IPv6 and that isn't necessarily an issue. Change-Id: I1bd57eec3474768596cfab1bf2f8eb6123cc95a8 --- manila/share/drivers/cephfs/driver.py | 11 +++++++++-- ...port-ip-escaping-on-hostname-e2866be32a8f5e38.yaml | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/cephfs-fix-export-ip-escaping-on-hostname-e2866be32a8f5e38.yaml diff --git a/manila/share/drivers/cephfs/driver.py b/manila/share/drivers/cephfs/driver.py index 9c1ccb0d1c..4910a2292d 100644 --- a/manila/share/drivers/cephfs/driver.py +++ b/manila/share/drivers/cephfs/driver.py @@ -987,9 +987,16 @@ class NFSProtocolHelper(ganesha.GaneshaNASHelper2): def get_export_locations(self, share, subvolume_path): export_locations = [] for export_ip in self.export_ips: + # Try to escape the export ip. If it fails, means that the + # `cephfs_ganesha_server_ip` wasn't possibly set and the used + # address is the hostname + try: + server_address = driver_helpers.escaped_address(export_ip) + except ValueError: + server_address = export_ip + export_path = "{server_address}:{mount_path}".format( - server_address=driver_helpers.escaped_address(export_ip), - mount_path=subvolume_path) + server_address=server_address, mount_path=subvolume_path) LOG.info("Calculated export path for share %(id)s: %(epath)s", {"id": share['id'], "epath": export_path}) diff --git a/releasenotes/notes/cephfs-fix-export-ip-escaping-on-hostname-e2866be32a8f5e38.yaml b/releasenotes/notes/cephfs-fix-export-ip-escaping-on-hostname-e2866be32a8f5e38.yaml new file mode 100644 index 0000000000..7c6f97bca7 --- /dev/null +++ b/releasenotes/notes/cephfs-fix-export-ip-escaping-on-hostname-e2866be32a8f5e38.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + When ``cephfs_ganesha_server_ip`` is not set, the current hostname is used + as a default for such config option. The driver was treating this value + as an IP address and trying to perform validations on it. The CEPH NFS + driver will no longer treat hostnames as ip addresses and try to validate + them as such.