"""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
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,
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,
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]:
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:
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:
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)
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
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)
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]:
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:
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:
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:
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)
"""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