Closed aesteve-rh closed 1 year ago
Add flag to Command class to log to WARNING level instead of DEBUG level if the command execution has data in the stderr output, even if the command finished succesfully.
This was correct for the initial implementation, but now we don't change only the log level but log different log for this case.
ProgressCommand in qemuimg will enable the flag so that qemuimg commands show warning on errors.
Example:
09:49:34,851 WARNING (MainThread) [storage.operation] Command ['/usr/bin/qemu-img', 'commit', '-p', '-t', 'none', '-b'...] succeeded with warnings: SUCCESS: <err> = bytearray(b"qcow2_free_clusters failed: No space left on device\nqemu-img: Lost persistent bitmaps during inactivation of node \'#block365\': Failed to write bitmap \'stale-bitmap5\' to file: No space left on device\nqemu-img: Failed to flush the refcount block cache: No space left on device\n"); <rc> = 0 (operation:159)']
Warning looks good!
Except the SUCCESS: <err>
and ; <rc> = 0
- these is legacy text that should remain in
the legacy debug log.
/ost
Add flag warn_stderr to Command class to log to WARNING level instead of DEBUG level if the command execution has data in the stderr output, even if the command finished succesfully.
Also, the logged message changes if the new warn_stderr flag is set, printing the command that originated the error output.
Legacy debug logging remains unchanged.
ProgressCommand in qemuimg will enable the flag so that qemuimg commands show warning on errors.
Example:
Signed-off-by: Albert Esteve aesteve@redhat.com