From: Shweta Bhosale Date: Tue, 25 Mar 2025 10:05:28 +0000 (+0530) Subject: nfs/mgr: Updated logs and exception messages X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ddce67a5be478a9cfd3adc2f19761a8ac89d5bee;p=ceph.git nfs/mgr: Updated logs and exception messages fixes: https://tracker.ceph.com/issues/69458 Signed-off-by: Shweta Bhosale --- diff --git a/src/pybind/mgr/nfs/cluster.py b/src/pybind/mgr/nfs/cluster.py index 8e860cddb967..8e0d547dac27 100644 --- a/src/pybind/mgr/nfs/cluster.py +++ b/src/pybind/mgr/nfs/cluster.py @@ -387,10 +387,10 @@ class NFSCluster: """Update cluster QOS config""" qos_obj_exists = False if not qos_obj: - log.debug(f"Creating new QOS block for cluster {cluster_id}") + log.debug(f"Creating new QoS block for cluster {cluster_id}") qos_obj = QOS(True, enable_qos, qos_type, bw_obj, ops_obj) else: - log.debug(f"Updating existing QOS block for cluster {cluster_id}") + log.debug(f"Updating existing QoS block for cluster {cluster_id}") qos_obj_exists = True qos_obj.enable_qos = enable_qos qos_obj.qos_type = qos_type @@ -423,7 +423,7 @@ class NFSCluster: return raise ClusterNotFound() except NotImplementedError: - raise ManualRestartRequired(f"NFS-Ganesha QOS config added successfully for {cluster_id}") + raise ManualRestartRequired(f"NFS-Ganesha QoS config added successfully for {cluster_id}") def validate_qos_type(self, qos_obj: QOS, @@ -451,10 +451,10 @@ class NFSCluster: if other_qos_obj and is_other_enable: # if earlier only other qos control is enabled if not is_this_enable and qos_obj.qos_type != qos_type: - raise Exception(f"{ctrl_type} control is using {qos_obj.qos_type.name} qos type, please update that qos type for {ctrl_type} first.") + raise Exception(f"{ctrl_type} control is using {qos_obj.qos_type.name} QoS type, please update that QoS type for {ctrl_type} first.") # if both qos control are enabled, the user will need to disable one first to change qos type elif is_this_enable and qos_obj.qos_type != qos_type: - raise Exception(f"{ctrl_type} control is using {qos_obj.qos_type.name} qos type, please disable {ctrl_type} control to update qos type and then enable {ctrl_type} control again with new qos type") + raise Exception(f"{ctrl_type} control is using {qos_obj.qos_type.name} QoS type, please disable {ctrl_type} control to update QoS type and then enable {ctrl_type} control again with new QoS type") def enable_cluster_qos_bw(self, cluster_id: str, @@ -479,12 +479,12 @@ class NFSCluster: self.validate_qos_type(qos_obj, qos_type, bw_obj=bw_obj) bw_obj.qos_bandwidth_checks(qos_type) self.update_cluster_qos(cluster_id, qos_obj, True, qos_type=qos_type, bw_obj=bw_obj) - log.info(f"QOS bandwidth control has been successfully enabled for cluster {cluster_id}. " + log.info(f"QoS bandwidth control has been successfully enabled for cluster {cluster_id}. " "If the qos_type is changed during this process, ensure that the bandwidth " "values for all exports are updated accordingly.") return except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS bandwidth control config failed for {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS bandwidth control config failed for {cluster_id}") raise ErrorResponse.wrap(e) def get_cluster_qos(self, cluster_id: str, ret_bw_in_bytes: bool = False) -> Dict[str, Any]: @@ -494,7 +494,7 @@ class NFSCluster: return qos_obj.to_dict(ret_bw_in_bytes) if qos_obj else {} raise ClusterNotFound() except Exception as e: - log.exception(f"Fetching NFS-Ganesha QOS bandwidth control config failed for {cluster_id}") + log.exception(f"Fetching NFS-Ganesha QoS bandwidth control config failed for {cluster_id}") raise ErrorResponse.wrap(e) def disable_cluster_qos_bw(self, cluster_id: str) -> None: @@ -509,10 +509,10 @@ class NFSCluster: self.update_cluster_qos(cluster_id, qos_obj, status, qos_type, bw_obj=QOSBandwidthControl()) log.info("Cluster-level QoS bandwidth control has been successfully disabled for " f"cluster {cluster_id}. As a result, export-level bandwidth control will " - "no longer have any effect, even if it's enabled.") + "no longer have any effect, even if enabled.") return except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS bandwidth control config failed for {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS bandwidth control config failed for {cluster_id}") raise ErrorResponse.wrap(e) def enable_cluster_qos_ops(self, cluster_id: str, qos_type: QOSType, ops_obj: QOSOpsControl) -> None: @@ -542,8 +542,8 @@ class NFSCluster: self.update_cluster_qos(cluster_id, qos_obj, status, qos_type, ops_obj=QOSOpsControl()) log.info("Cluster-level QoS IOPS control has been successfully disabled for " f"cluster {cluster_id}. As a result, export-level ops control will " - "no longer have any effect, even if it's enabled.") + "no longer have any effect, even if enabled.") return except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS IOPS control config failed for {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS IOPS control config failed for {cluster_id}") raise ErrorResponse.wrap(e) diff --git a/src/pybind/mgr/nfs/export.py b/src/pybind/mgr/nfs/export.py index 3fba41ec109e..a0a2c84748a3 100644 --- a/src/pybind/mgr/nfs/export.py +++ b/src/pybind/mgr/nfs/export.py @@ -898,13 +898,13 @@ class ExportMgr: enable_qos: bool, bw_obj: Optional[QOSBandwidthControl] = None, ops_obj: Optional[QOSOpsControl] = None) -> None: - """Update Export QOS block""" + """Update Export QoS block""" # if qos_block does not exists in export create one else update existing block if not export_obj.qos_block: - log.debug(f"Creating new QOS block for export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Creating new QoS block for export {pseudo_path} of cluster {cluster_id}") export_obj.qos_block = QOS(enable_qos=enable_qos, bw_obj=bw_obj, ops_obj=ops_obj) else: - log.debug(f"Updating existing QOS block of export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Updating existing QoS block of export {pseudo_path} of cluster {cluster_id}") export_obj.qos_block.enable_qos = enable_qos if bw_obj: export_obj.qos_block.bw_obj = bw_obj @@ -913,7 +913,7 @@ class ExportMgr: self.exports[cluster_id].remove(export_obj) self._update_export(cluster_id, export_obj, False) - log.debug(f"Successfully updated QOS control config for export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Successfully updated QoS control config for export {pseudo_path} of cluster {cluster_id}") def get_export_obj(self, cluster_id: str, pseudo_path: str) -> Export: self._validate_cluster_id(cluster_id) @@ -943,9 +943,9 @@ class ExportMgr: export_obj = self.get_export_obj(cluster_id, pseudo_path) export_qos_bw_checks(cluster_id, self.mgr, bw_obj=bw_obj) self.update_export_qos(cluster_id, pseudo_path, export_obj, True, bw_obj=bw_obj) - log.debug(f"Successfully enabled QOS bandwidth control for export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Successfully enabled QoS bandwidth control for export {pseudo_path} of cluster {cluster_id}") except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS bandwidth control failed for {pseudo_path} of {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS bandwidth control failed for {pseudo_path} of {cluster_id}") raise ErrorResponse.wrap(e) def get_export_qos(self, cluster_id: str, pseudo_path: str, ret_bw_in_bytes: bool = False) -> Dict[str, int]: @@ -966,7 +966,7 @@ class ExportMgr: return qos_block return {} except Exception as e: - log.exception(f"Failed to get QOS configuration for {pseudo_path} of {cluster_id}") + log.exception(f"Failed to get QoS configuration for {pseudo_path} of {cluster_id}") raise ErrorResponse.wrap(e) def disable_export_qos_bw(self, cluster_id: str, pseudo_path: str) -> None: @@ -975,9 +975,9 @@ class ExportMgr: if export_obj.qos_block: status = export_obj.qos_block.get_enable_qos_val(disable_bw=True) self.update_export_qos(cluster_id, pseudo_path, export_obj, status, bw_obj=QOSBandwidthControl()) - log.debug(f"Successfully disabled QOS bandwidth control for export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Successfully disabled QoS bandwidth control for export {pseudo_path} of cluster {cluster_id}") except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS bandwidth control failed for {pseudo_path} of {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS bandwidth control failed for {pseudo_path} of {cluster_id}") raise ErrorResponse.wrap(e) def enable_export_qos_ops(self, cluster_id: str, pseudo_path: str, ops_obj: QOSOpsControl) -> None: @@ -985,9 +985,9 @@ class ExportMgr: export_obj = self.get_export_obj(cluster_id, pseudo_path) export_qos_ops_checks(cluster_id, self.mgr, ops_obj=ops_obj) self.update_export_qos(cluster_id, pseudo_path, export_obj, True, ops_obj=ops_obj) - log.debug(f"Successfully enabled QOS IOPS control for export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Successfully enabled QoS IOPS control for export {pseudo_path} of cluster {cluster_id}") except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS IOPS control failed for {pseudo_path} of {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS IOPS control failed for {pseudo_path} of {cluster_id}") raise ErrorResponse.wrap(e) def disable_export_qos_ops(self, cluster_id: str, pseudo_path: str) -> None: @@ -998,9 +998,9 @@ class ExportMgr: if export_obj.qos_block: status = export_obj.qos_block.get_enable_qos_val(disable_ops=True) self.update_export_qos(cluster_id, pseudo_path, export_obj, status, ops_obj=QOSOpsControl()) - log.debug(f"Successfully updated QOS IOPS control for export {pseudo_path} of cluster {cluster_id}") + log.debug(f"Successfully updated QoS IOPS control for export {pseudo_path} of cluster {cluster_id}") except Exception as e: - log.exception(f"Setting NFS-Ganesha QOS IOPS control failed for {pseudo_path} of {cluster_id}") + log.exception(f"Setting NFS-Ganesha QoS IOPS control failed for {pseudo_path} of {cluster_id}") raise ErrorResponse.wrap(e) diff --git a/src/pybind/mgr/nfs/export_utils.py b/src/pybind/mgr/nfs/export_utils.py index c67fd2fd5ec7..fcf12ee20041 100644 --- a/src/pybind/mgr/nfs/export_utils.py +++ b/src/pybind/mgr/nfs/export_utils.py @@ -68,7 +68,7 @@ def export_dict_qos_bw_ops_checks(cluster_id: str, """Validate the qos block of dict passed to apply_export method""" qos_enable = qos_dict.get('enable_qos') if qos_enable is None: - raise Exception('The QOS block requires at least the enable_qos parameter') + raise Exception('The QoS block requires at least the enable_qos parameter') if not isinstance(qos_enable, bool): raise Exception('Invalid value for the enable_qos parameter') # if cluster level bandwidth or ops control is disabled or qos type changed to PerClient