Skip to content

Commit c83cad5

Browse files
xyzhang-upigaw
authored andcommitted
plugins/dapustor: smart-log-add fix
Output Extended Additional SMART raw binary data if it exists. Add the missing 'temp_since_bootup' field for json output. Signed-off-by: Xiaoyuan Zhang <zhxiaoy2024@gmail.com>
1 parent 8dfa127 commit c83cad5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

plugins/dapustor/dapustor-nvme.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,16 @@ static void show_dapustor_ext_add_smart_log_jsn(struct nvme_extended_additional_
312312
json_object_add_value_object(dev_stats, "temp_since_born", entry_stats);
313313

314314
entry_stats = json_create_object();
315-
json_object_add_value_int(entry_stats, "normalized", smart->temp_since_born.norm);
315+
json_object_add_value_int(entry_stats, "normalized", smart->temp_since_bootup.norm);
316316
multi = json_create_object();
317317
json_object_add_value_int(multi, "min",
318-
le16_to_cpu(smart->temp_since_born.temperature.min));
318+
le16_to_cpu(smart->temp_since_bootup.temperature.min));
319319
json_object_add_value_int(multi, "max",
320-
le16_to_cpu(smart->temp_since_born.temperature.max));
320+
le16_to_cpu(smart->temp_since_bootup.temperature.max));
321321
json_object_add_value_int(multi, "cur",
322-
le16_to_cpu(smart->temp_since_born.temperature.cur));
322+
le16_to_cpu(smart->temp_since_bootup.temperature.cur));
323323
json_object_add_value_object(entry_stats, "raw", multi);
324-
json_object_add_value_object(dev_stats, "temp_since_born", entry_stats);
324+
json_object_add_value_object(dev_stats, "temp_since_bootup", entry_stats);
325325

326326
entry_stats = json_create_object();
327327
json_object_add_value_int(entry_stats, "normalized", smart->inflight_write_io_cmd.norm);
@@ -542,8 +542,11 @@ static int dapustor_additional_smart_log(int argc, char **argv, struct command *
542542
else if (!cfg.raw_binary)
543543
show_dapustor_smart_log(&smart_log, &ext_smart_log,
544544
cfg.namespace_id, dev->name, has_ext);
545-
else
545+
else {
546546
d_raw((unsigned char *)&smart_log, sizeof(smart_log));
547+
if (has_ext)
548+
d_raw((unsigned char *)&ext_smart_log, sizeof(ext_smart_log));
549+
}
547550
}
548551
dev_close(dev);
549552
return err;

0 commit comments

Comments
 (0)