Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemuimg: log warning on cmd error #356

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

aesteve-rh
Copy link
Member

@aesteve-rh aesteve-rh commented Nov 22, 2022

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:

09:49:34,851 WARNING (MainThread) [storage.operation] Command
   ['/usr/bin/qemu-img', 'commit', '-p', '-t', 'none', '-b'...]
   succeeded with warnings: 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") (operation:159)']

Signed-off-by: Albert Esteve aesteve@redhat.com

@aesteve-rh aesteve-rh self-assigned this Nov 22, 2022
@aesteve-rh aesteve-rh added the enhancement Enhancing the system by adding new feature or improving performance or reliability label Nov 22, 2022
@aesteve-rh aesteve-rh force-pushed the aesteve/warn-on-err-qemuimg branch 2 times, most recently from 9a0e00f to 1155b01 Compare November 22, 2022 09:56
lib/vdsm/storage/operation.py Outdated Show resolved Hide resolved
lib/vdsm/storage/operation.py Outdated Show resolved Hide resolved
@nirs
Copy link
Member

nirs commented Nov 22, 2022

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.

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:
09:49:34,851 WARNING (MainThread) [storage.operation] Command
   ['/usr/bin/qemu-img', 'commit', '-p', '-t', 'none', '-b'...]
   succeeded with warnings: 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") (operation:159)']

Signed-off-by: Albert Esteve <aesteve@redhat.com>
@mz-pdm
Copy link
Member

mz-pdm commented Nov 23, 2022

/ost

@mz-pdm mz-pdm merged commit 798717d into oVirt:master Nov 23, 2022
@aesteve-rh aesteve-rh deleted the aesteve/warn-on-err-qemuimg branch November 28, 2022 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancing the system by adding new feature or improving performance or reliability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants