Whamcloud - gitweb
EX-9230 lipe: Add device name in file report name
authorVitaliy Kuznetsov <vkuznetsov@ddn.com>
Tue, 26 Mar 2024 13:55:30 +0000 (14:55 +0100)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 30 Mar 2024 07:38:34 +0000 (07:38 +0000)
This patch adds the device name (eg MDT-xxxx) to the
report name when automatically generating the name.
It also corrects the end time in the file name
(when scanning is completed) to the initial time
(when scanning began). Only for lipe_scan3.

Example of a new file name for a report:
files_sizes_report_lustre-MDT0000.2024-03-26-09:54:25.out

Test-Parameters: trivial testlist=sanity-lipe-scan3,sanity-lipe-find3
Signed-off-by: Vitaliy Kuznetsov <vkuznetsov@ddn.com>
Change-Id: I2e79404e459b5717858b92a0783fe3f1bad552ab
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54574
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexandre Ioffe <aioffe@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lipe/src/lipe_scan3/ls3_stats.c

index c64afc7..46ce8fc 100644 (file)
@@ -278,14 +278,18 @@ static void ls3_stats_prepare_file(void)
 
        /* when using lipe_scan3 --collect-fsize-stats without path to file */
        if (!reports_with_stats->report_file_name) {
-               char file_name_buffer[256];
-               time_t current_time = time(NULL);
-               struct tm *timeinfo = localtime(&current_time);
+               char format_buffer[512];
+               char file_name_buffer[512];
+               struct tm *timeinfo = localtime(&reports_with_stats->start_time);
+
+               sprintf(format_buffer,
+                       DEFAULT_DIR_FOR_REPORTS
+                       "files_sizes_report_%s.%%Y-%%m-%%d-%%H:%%M:%%S.out",
+                       reports_with_stats->device_name);
+
                strftime(file_name_buffer, sizeof(file_name_buffer),
-                        DEFAULT_DIR_FOR_REPORTS
-                        "file_size_report.%Y-%m-%d-%H:%M:%S.out", timeinfo);
-               reports_with_stats->report_file_name =
-                       xstrdup(file_name_buffer);
+                        format_buffer, timeinfo);
+               reports_with_stats->report_file_name = xstrdup(file_name_buffer);
        }
 
        ls3_stats_get_report_extension(reports_with_stats->report_file_name);