logs: create a log level flag in abort and hotplug applications
Bloated log files appear during some tests (nvmf_phy_autotest, during nvmf_abort test fot example), what makes parsing them inconvenient. This change aims to disable logs that cause this issue by adding a new flag for SPDK target and disabling notice level logging completely (using --silence-noticelog proved insufficient). Fixes: #2149 Change-Id: Ibbad92d87d90fe73c23d6027e0ff8ec49b0393c2 Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10311 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
eb48f76d61
commit
bace05499a
@ -565,6 +565,9 @@ usage(char *program_name)
|
||||
#else
|
||||
printf("\t[-G enable debug logging (flag disabled, must reconfigure with --enable-debug)\n");
|
||||
#endif
|
||||
printf("\t[-l log level]\n");
|
||||
printf("\t Available log levels:\n");
|
||||
printf("\t disabled, error, warning, notice, info, debug\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -642,7 +645,7 @@ parse_args(int argc, char **argv)
|
||||
long int val;
|
||||
int rc;
|
||||
|
||||
while ((op = getopt(argc, argv, "a:c:i:o:q:r:s:t:w:GM:T:")) != -1) {
|
||||
while ((op = getopt(argc, argv, "a:c:i:l:o:q:r:s:t:w:GM:T:")) != -1) {
|
||||
switch (op) {
|
||||
case 'a':
|
||||
case 'i':
|
||||
@ -715,6 +718,24 @@ parse_args(int argc, char **argv)
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
#endif
|
||||
break;
|
||||
case 'l':
|
||||
if (!strcmp(optarg, "disabled")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_DISABLED);
|
||||
} else if (!strcmp(optarg, "error")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_ERROR);
|
||||
} else if (!strcmp(optarg, "warning")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_WARN);
|
||||
} else if (!strcmp(optarg, "notice")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_NOTICE);
|
||||
} else if (!strcmp(optarg, "info")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_INFO);
|
||||
} else if (!strcmp(optarg, "debug")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
} else {
|
||||
fprintf(stderr, "Unrecognized log level: %s\n", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "spdk/queue.h"
|
||||
#include "spdk/string.h"
|
||||
#include "spdk/util.h"
|
||||
#include "spdk/log.h"
|
||||
|
||||
struct dev_ctx {
|
||||
TAILQ_ENTRY(dev_ctx) tailq;
|
||||
@ -427,6 +428,9 @@ static void usage(char *program_name)
|
||||
printf("\t[-r expected hot removal times]\n");
|
||||
printf("\t[-t time in seconds]\n");
|
||||
printf("\t[-m iova mode: pa or va (optional)\n");
|
||||
printf("\t[-l log level]\n");
|
||||
printf("\t Available log levels:\n");
|
||||
printf("\t disabled, error, warning, notice, info, debug\n");
|
||||
}
|
||||
|
||||
static int
|
||||
@ -438,7 +442,7 @@ parse_args(int argc, char **argv)
|
||||
/* default value */
|
||||
g_time_in_sec = 0;
|
||||
|
||||
while ((op = getopt(argc, argv, "c:i:m:n:r:t:")) != -1) {
|
||||
while ((op = getopt(argc, argv, "c:i:l:m:n:r:t:")) != -1) {
|
||||
if (op == '?') {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
@ -476,6 +480,24 @@ parse_args(int argc, char **argv)
|
||||
case 'm':
|
||||
g_iova_mode = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
if (!strcmp(optarg, "disabled")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_DISABLED);
|
||||
} else if (!strcmp(optarg, "error")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_ERROR);
|
||||
} else if (!strcmp(optarg, "warning")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_WARN);
|
||||
} else if (!strcmp(optarg, "notice")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_NOTICE);
|
||||
} else if (!strcmp(optarg, "info")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_INFO);
|
||||
} else if (!strcmp(optarg, "debug")) {
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
} else {
|
||||
fprintf(stderr, "Unrecognized log level: %s\n", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
|
@ -52,7 +52,8 @@ hotplug() {
|
||||
-i 0 \
|
||||
-t $((hotplug_events * hotplug_wait + hotplug_wait)) \
|
||||
-n $((hotplug_events * nvme_count)) \
|
||||
-r $((hotplug_events * nvme_count))
|
||||
-r $((hotplug_events * nvme_count)) \
|
||||
-l warning
|
||||
}
|
||||
|
||||
"$rootdir/scripts/setup.sh"
|
||||
|
@ -25,7 +25,7 @@ $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode0 Delay0
|
||||
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
||||
|
||||
# Run abort application
|
||||
$SPDK_EXAMPLE_DIR/abort -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" -c 0x1 -t 1
|
||||
$SPDK_EXAMPLE_DIR/abort -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" -c 0x1 -t 1 -l warning
|
||||
|
||||
# Clean up
|
||||
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode0
|
||||
|
Loading…
Reference in New Issue
Block a user