]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/dapustor: smart-log-add fix
authorXiaoyuan Zhang <zhxiaoy2024@gmail.com>
Wed, 9 Oct 2024 09:47:23 +0000 (17:47 +0800)
committerDaniel Wagner <wagi@monom.org>
Thu, 10 Oct 2024 08:59:22 +0000 (10:59 +0200)
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>
plugins/dapustor/dapustor-nvme.c

index 678ba99239f4eeb550f14bda1efe75922aeb2d08..1f96a62cd23af14edf0bc36926bac5a96e8f65b7 100644 (file)
@@ -312,16 +312,16 @@ static void show_dapustor_ext_add_smart_log_jsn(struct nvme_extended_additional_
        json_object_add_value_object(dev_stats, "temp_since_born", entry_stats);
 
        entry_stats = json_create_object();
-       json_object_add_value_int(entry_stats, "normalized", smart->temp_since_born.norm);
+       json_object_add_value_int(entry_stats, "normalized", smart->temp_since_bootup.norm);
        multi = json_create_object();
        json_object_add_value_int(multi, "min",
-                                 le16_to_cpu(smart->temp_since_born.temperature.min));
+                                 le16_to_cpu(smart->temp_since_bootup.temperature.min));
        json_object_add_value_int(multi, "max",
-                                 le16_to_cpu(smart->temp_since_born.temperature.max));
+                                 le16_to_cpu(smart->temp_since_bootup.temperature.max));
        json_object_add_value_int(multi, "cur",
-                                 le16_to_cpu(smart->temp_since_born.temperature.cur));
+                                 le16_to_cpu(smart->temp_since_bootup.temperature.cur));
        json_object_add_value_object(entry_stats, "raw", multi);
-       json_object_add_value_object(dev_stats, "temp_since_born", entry_stats);
+       json_object_add_value_object(dev_stats, "temp_since_bootup", entry_stats);
 
        entry_stats = json_create_object();
        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 *
                else if (!cfg.raw_binary)
                        show_dapustor_smart_log(&smart_log, &ext_smart_log,
                                                cfg.namespace_id, dev->name, has_ext);
-               else
+               else {
                        d_raw((unsigned char *)&smart_log, sizeof(smart_log));
+                       if (has_ext)
+                               d_raw((unsigned char *)&ext_smart_log, sizeof(ext_smart_log));
+               }
        }
        dev_close(dev);
        return err;