Skip to contentSkip to conversation

test: monitor: Use in-tree configuration file

PATCH In review Michal Suchanek 3 participants 5 messages Apr 28, 2022 – Jun 17, 2022 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: monitor: Use in-tree configuration file

When ndctl is not installed /etc/ndctl.conf.d does not exist and the monitor fails to start. Use in-tree configuration for testing.

---
 test/monitor.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
test/monitor.sh +3 -1
index e58c908..c5beb2c 100755
@@ -13,6 +13,8 @@ smart_supported_bus=""
 
 . $(dirname $0)/common
 
+monitor_conf="$TEST_PATH/../ndctl"
+
 check_prereq "jq"
 
 trap 'err $LINENO' ERR
@@ -22,7 +24,7 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
 start_monitor()
 {
 	logfile=$(mktemp)
-	$NDCTL monitor -l $logfile $1 &
+	$NDCTL monitor -c "$monitor_conf" -l $logfile $1 &
 	monitor_pid=$!
 	sync; sleep 3
 	truncate --size 0 $logfile #remove startup log
Signature · 1 line
2.36.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Michal Suchanek

When ndctl is not installed /etc/ndctl.conf.d does not exist and the monitor fails to start. Use in-tree configuration for testing.

Looks reasonable to me:

Quoted 31 lines
---
 test/monitor.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
test/monitor.sh +3 -2
index e58c908..c5beb2c 100755
@@ -13,6 +13,8 @@ smart_supported_bus=""
 
 . $(dirname $0)/common
 
+monitor_conf="$TEST_PATH/../ndctl"
+
 check_prereq "jq"
 
 trap 'err $LINENO' ERR
@@ -22,7 +24,7 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
 start_monitor()
 {
        logfile=$(mktemp)
-       $NDCTL monitor -l $logfile $1 &
+       $NDCTL monitor -c "$monitor_conf" -l $logfile $1 &
        monitor_pid=$!
        sync; sleep 3
        truncate --size 0 $logfile #remove startup log
--

2.36.0

#2 lore raw
In reply to Michal Suchanek
Quoted 14 lines · Michal Suchanek

When ndctl is not installed /etc/ndctl.conf.d does not exist and the monitor fails to start. Use in-tree configuration for testing.

---
  test/monitor.sh | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
test/monitor.sh +0 -0
index e58c908..c5beb2c 100755

test/monitor.sh smart_supported_bus="" · line 16

Quoted 4 lines
test/monitor.sh +1 -0
@@ -13,6 +13,8 @@ smart_supported_bus=""
 
  . $(dirname $0)/common
 
+monitor_conf="$TEST_PATH/../ndctl"

Though this patch gets the monitor to "listening" mode, its not really parsing anything from the $TEST_PATH/../ndctl

There are two issues here.
1) Using the iniparser for parsing the monitor config file
when the parser is set to parse_monitor_config() for monitor.
I have posted a patch for this at https://patchwork.kernel.org/project/linux-nvdimm/patch/164750955519.2000193.16903542741359443926.stgit@LAPTOP-TBQTPII8/

2) The directory passed in -c would silently be ignored
in parse_monitor_config() during fseek() failure. The command proceeds to monitor everything.

Should the -c option be made to accept the directory as argument?

Thanks,
Shivaprasad

#3 lore raw
Quoted 26 lines · Shivaprasad G Bhat
Quoted 14 lines · Michal Suchanek

When ndctl is not installed /etc/ndctl.conf.d does not exist and the monitor fails to start. Use in-tree configuration for testing.

---
  test/monitor.sh | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
test/monitor.sh +0 -0
index e58c908..c5beb2c 100755

test/monitor.sh smart_supported_bus="" · line 14

Quoted 2 lines
test/monitor.sh +1 -0
@@ -13,6 +13,8 @@ smart_supported_bus=""
  . $(dirname $0)/common
+monitor_conf="$TEST_PATH/../ndctl"

Though this patch gets the monitor to "listening" mode, its not really parsing anything from the $TEST_PATH/../ndctl

There are two issues here.
1) Using the iniparser for parsing the monitor config file
when the parser is set to parse_monitor_config() for monitor.
I have posted a patch for this at https://patchwork.kernel.org/project/linux-nvdimm/patch/164750955519.2000193.16903542741359443926.stgit@LAPTOP-TBQTPII8/

Quoted 5 lines

2) The directory passed in -c would silently be ignored
in parse_monitor_config() during fseek() failure. The command proceeds to monitor everything.

Should the -c option be made to accept the directory as argument?

The documentation of -c states:

-c, --config-file=
Provide the config file(s) to use. This overrides the default config typically found in /etc/ndctl.conf.d

It is not clear from this description if file or directory is expected. Given that it suggests multiple files can be provided it implies a directory is accepted.

Either the description should be clarified or directory accepted.

Thanks

Michal

#4 lore raw
In reply to Shivaprasad G Bhat
Quoted 10 lines · Shivaprasad G Bhat
Quoted 9 lines · Michal Suchanek

When ndctl is not installed /etc/ndctl.conf.d does not exist and the monitor fails to start. Use in-tree configuration for testing.

---
  test/monitor.sh | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 10 lines

test/monitor.sh smart_supported_bus="" · line 14

Quoted 7 lines
test/monitor.sh +1 -0
index e58c908..c5beb2c 100755
@@ -13,6 +13,8 @@ smart_supported_bus=""
  . $(dirname $0)/common
+monitor_conf="$TEST_PATH/../ndctl"

Though this patch gets the monitor to "listening" mode, its not really parsing anything from the $TEST_PATH/../ndctl

Yes, very likely. The tests do pass so not failing to not parse the file is good enough at this point.

Quoted 5 lines

There are two issues here.
1) Using the iniparser for parsing the monitor config file
when the parser is set to parse_monitor_config() for monitor.
I have posted a patch for this at https://patchwork.kernel.org/project/linux-nvdimm/patch/164750955519.2000193.16903542741359443926.stgit@LAPTOP-TBQTPII8/

Thanks for fixing this. I am not really using the monitor for anything so I did not notice.

Quoted 6 lines

2) The directory passed in -c would silently be ignored
in parse_monitor_config() during fseek() failure. The command proceeds to monitor everything.

Should the -c option be made to accept the directory as argument?

This has been already asked, and as far as I am concerned the answere remains the same:

The documentation of the -c option talks about files which implies a directory should be accepted.

This can be resolved either by clarifying the documentation to make it clear only single file is accepted for -c, or accepting a directory.

Thanks

Michal