diff mbox

ndctl, list: add controller temperature threshold

Message ID 20180625084217.10608-1-qi.fuli@jp.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

QI Fuli June 25, 2018, 8:42 a.m. UTC
This patch adds controller temperature threshold to list.
When the dimm-controller-temperature event fires, users need to know
the current controller temperature threshold value.

Signed-off-by: QI Fuli <qi.fuli@jp.fujitsu.com>
---
 ndctl/util/json-smart.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Verma, Vishal L June 25, 2018, 8:09 p.m. UTC | #1
On Mon, 2018-06-25 at 17:42 +0900, QI Fuli wrote:
> This patch adds controller temperature threshold to list.
> When the dimm-controller-temperature event fires, users need to know
> the current controller temperature threshold value.
> 
> Signed-off-by: QI Fuli <qi.fuli@jp.fujitsu.com>
> ---
>  ndctl/util/json-smart.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
> index 9482b35..d590b0c 100644
> --- a/ndctl/util/json-smart.c
> +++ b/ndctl/util/json-smart.c
> @@ -47,6 +47,18 @@ static void smart_threshold_to_json(struct ndctl_dimm
> *dimm,
>  					"temperature_threshold", jobj);
>  	}
>  
> +	if (alarm_control & ND_SMART_TEMP_TRIP) {

I think you want to use ND_SMART_CTEMP_TRIP here.

> +		unsigned int temp;
> +		double t;
> +
> +		temp =
> ndctl_cmd_smart_threshold_get_ctrl_temperature(cmd);
> +		t = ndctl_decode_smart_temperature(temp);
> +		jobj = json_object_new_double(t);
> +		if (jobj)
> +			json_object_object_add(jhealth,
> +				"controller_temperature_threshold",
> jobj);
> +	}
> +
>  	if (alarm_control & ND_SMART_SPARE_TRIP) {
>  		unsigned int spares;
 
We also seem to be missing from the listing, an
alarm_controller_temperature field to show whether or not the alarm is
enabled. Can you add that as well as part of this?


Thanks,
	-Vishal
QI Fuli June 25, 2018, 11:55 p.m. UTC | #2
> -----Original Message-----

> From: Verma, Vishal L [mailto:vishal.l.verma@intel.com]

> Sent: Tuesday, June 26, 2018 5:09 AM

> To: linux-nvdimm@lists.01.org; Qi, Fuli/斉 福利 <qi.fuli@jp.fujitsu.com>

> Subject: Re: [PATCH] ndctl, list: add controller temperature threshold

> 

> On Mon, 2018-06-25 at 17:42 +0900, QI Fuli wrote:

> > This patch adds controller temperature threshold to list.

> > When the dimm-controller-temperature event fires, users need to know

> > the current controller temperature threshold value.

> >

> > Signed-off-by: QI Fuli <qi.fuli@jp.fujitsu.com>

> > ---

> >  ndctl/util/json-smart.c | 12 ++++++++++++

> >  1 file changed, 12 insertions(+)

> >

> > diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c index

> > 9482b35..d590b0c 100644

> > --- a/ndctl/util/json-smart.c

> > +++ b/ndctl/util/json-smart.c

> > @@ -47,6 +47,18 @@ static void smart_threshold_to_json(struct

> > ndctl_dimm *dimm,

> >  					"temperature_threshold", jobj);

> >  	}

> >

> > +	if (alarm_control & ND_SMART_TEMP_TRIP) {

> 

> I think you want to use ND_SMART_CTEMP_TRIP here.

> 

Yes, I will fix it.

> > +		unsigned int temp;

> > +		double t;

> > +

> > +		temp =

> > ndctl_cmd_smart_threshold_get_ctrl_temperature(cmd);

> > +		t = ndctl_decode_smart_temperature(temp);

> > +		jobj = json_object_new_double(t);

> > +		if (jobj)

> > +			json_object_object_add(jhealth,

> > +				"controller_temperature_threshold",

> > jobj);

> > +	}

> > +

> >  	if (alarm_control & ND_SMART_SPARE_TRIP) {

> >  		unsigned int spares;

> 

> We also seem to be missing from the listing, an alarm_controller_temperature field

> to show whether or not the alarm is enabled. Can you add that as well as part of

> this?

> 

Sure, I will add it in v2.

Thank you very much.
 Qi

> 

> Thanks,

> 	-Vishal
diff mbox

Patch

diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 9482b35..d590b0c 100644
--- a/ndctl/util/json-smart.c
+++ b/ndctl/util/json-smart.c
@@ -47,6 +47,18 @@  static void smart_threshold_to_json(struct ndctl_dimm *dimm,
 					"temperature_threshold", jobj);
 	}
 
+	if (alarm_control & ND_SMART_TEMP_TRIP) {
+		unsigned int temp;
+		double t;
+
+		temp = ndctl_cmd_smart_threshold_get_ctrl_temperature(cmd);
+		t = ndctl_decode_smart_temperature(temp);
+		jobj = json_object_new_double(t);
+		if (jobj)
+			json_object_object_add(jhealth,
+				"controller_temperature_threshold", jobj);
+	}
+
 	if (alarm_control & ND_SMART_SPARE_TRIP) {
 		unsigned int spares;