Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1536880

Summary: Include text from lvm command stdout and stderr in all lvm related exceptions
Product: [oVirt] vdsm Reporter: Nir Soffer <nsoffer>
Component: CoreAssignee: Roman Bednář <rbednar>
Status: CLOSED CURRENTRELEASE QA Contact: Shir Fishbain <sfishbai>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.20.15CC: ahadas, bugs, ebenahar, eshames, tnisan, vjuranek
Target Milestone: ovirt-4.5.0Flags: pm-rhel: ovirt-4.5?
Target Release: 4.50.0.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: vdsm-4.50.0.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-28 09:26:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nir Soffer 2018-01-21 22:20:46 UTC
Description of problem:

When lvm command fail, the raised exception does not include the underlying command
stdout and stderror, hiding precious information that can make it easier to debug
the system.

Here is example useless error message:

LogicalVolumeRefreshError: Cannot refresh Logical Volume: ('lvchange --refresh 30a57b16-33b0-43c7-becd-50c574e86b54/metadata failed',)

We should use the same format used in qemuimg module for consistent errors. Here
is an example of useful error from qemuimg module:

Error: Command ['/usr/bin/qemu-img', 'create', '-f', 'qcow2', '-o', 'compat=1.1', '-b', u'714de0ca-b0f3-4d98-8fbd-e49e72758515', '-F', 'qcow2', '-u', u'/rhev/data-center/mnt/rich-nfs-server2.usersys.redhat.com:_home_storage_sd5/43bdddd5-2edd-45f5-a55e-c08cd36648a6/images/64e7f158-7829-4933-8b80-e785b72ebf6d/0a54df07-9c8c-4de5-8647-2da646136917'] failed with rc=1 out='' err='qemu-img: /rhev/data-center/mnt/rich-nfs-server2.usersys.redhat.com:_home_storage_sd5/43bdddd5-2edd-45f5-a55e-c08cd36648a6/images/64e7f158-7829-4933-8b80-e785b72ebf6d/0a54df07-9c8c-4de5-8647-2da646136917: Image creation needs a size parameter\n'

An error should include:
- the command run, list format is good enough
- the exit code
- collected stdout
- collected stderr
- additional context for the specific flow if needed.

Version-Release number of selected component (if applicable):
4.1

lvm command stderr is available in debug logs for lvm commands. In 4.1 we moved
to INFO log level. This exposed the bad errors.

How reproducible:
Always

Steps to Reproduce:
1. Cause lvm command to fail by blocking access to storage, or by corrupting lvm metadata.

Actual results:
error does not contain enough info about the failure.

Expected results:
lvm commands should contain all the available info about the failure.

Comment 1 Sandro Bonazzola 2019-01-28 09:36:43 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 2 Nir Soffer 2019-03-03 19:55:54 UTC
This requires moving from commands.execCmd() to commands.run(), which raises
proper error with all the info. This is a big change requiring modifying all
lvm commands, and will be part of python 3 work, so we should move this to 4.4.

Comment 3 Tal Nisan 2019-11-18 12:10:47 UTC
Nir / Vojtech, can we get to this in 4.4 or should I defer to 4.5?

Comment 4 Nir Soffer 2020-05-11 10:45:31 UTC
(In reply to Tal Nisan from comment #3)
> Nir / Vojtech, can we get to this in 4.4 or should I defer to 4.5?

This may require significant refactoring in lvm module, so I think it is best
to defer to 4.5.

Comment 5 Vojtech Juranek 2020-05-19 11:48:15 UTC
already answered by Nir (I agree), removing needinfo

Comment 10 Sandro Bonazzola 2022-04-28 09:26:34 UTC
This bugzilla is included in oVirt 4.5.0 release, published on April 20th 2022.

Since the problem described in this bug report should be resolved in oVirt 4.5.0 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.