-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
rhel-10.0
-
None
-
No
-
None
-
rhel-storage-management
-
3
-
False
-
False
-
-
None
-
None
-
None
-
None
-
Unspecified
-
Unspecified
-
Unspecified
-
-
All
-
None
targetcli is used by dbus-tests in UDisks and tends to write pretty verbose output every time to /root/.targetcli/log.txt that fills up quickly, e.g. accounting ~1.8GB already on my machine.
The goal is to silence logging completely, it's not important for us. Corresponding options are global logfile= and global loglevel_file=.
I tried to craft a patch for this but I'm facing several roadblocks:
- haven't figured a way to set global parameters from within the JSON file being restored
- sending multiple commands to targetcli is not easy, opted for stdin input at the end
- the global settings is volatile and not preserved across sessions
- even when logfile= is overriden, logging is being done to the new place in addition to the default file, making situation even worse
- similarly, the loglevel_file= option has little effect
diff --git a/src/tests/dbus-tests/run_tests.py b/src/tests/dbus-tests/run_tests.py index e4aa834b..5c2150c4 100755 --- a/src/tests/dbus-tests/run_tests.py +++ b/src/tests/dbus-tests/run_tests.py @@ -42,7 +42,10 @@ def setup_vdevs(): orig_devs = {dev for dev in os.listdir("/dev") if re.match(r'sd[a-z]+$', dev)} # create fake SCSI hard drives - assert subprocess.call(["targetcli", "restoreconfig src/tests/dbus-tests/targetcli_config.json"]) == 0 + targetcli_input = "set global logfile=/tmp/xxx\n" \ + "set global loglevel_file=critical\n" \ + "restoreconfig src/tests/dbus-tests/targetcli_config.json".encode('utf-8') + assert subprocess.run(["targetcli"], input=targetcli_input).returncode == 0 # wait until udev fully processes all the newly created devices assert subprocess.call(['udevadm', 'settle']) == 0