Bug 1536880 - Include text from lvm command stdout and stderr in all lvm related exceptions
Summary: Include text from lvm command stdout and stderr in all lvm related exceptions
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: vdsm
Classification: oVirt
Component: Core
Version: 4.20.15
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.5.0
: 4.50.0.4
Assignee: Roman Bednář
QA Contact: Shir Fishbain
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-21 22:20 UTC by Nir Soffer
Modified: 2022-04-28 09:26 UTC (History)
6 users (show)

Fixed In Version: vdsm-4.50.0.4
Clone Of:
Environment:
Last Closed: 2022-04-28 09:26:34 UTC
oVirt Team: Storage
Embargoed:
pm-rhel: ovirt-4.5?


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 114257 0 master MERGED lvm: avoid exception for in use volume deactivation 2021-06-02 10:24:21 UTC
oVirt gerrit 115247 0 master ABANDONED lvm: improve lvm command exceptions 2021-07-01 16:30:23 UTC
oVirt gerrit 115455 0 master MERGED lvm: make commands raise early for better debugging 2021-07-16 14:57:58 UTC
oVirt gerrit 115507 0 master MERGED lvm: let command execution raise 2021-07-16 14:58:04 UTC
oVirt gerrit 115508 0 master ABANDONED WIP: change _initpvs() to raise early in createVG() and extendVG() 2021-08-18 14:56:10 UTC
oVirt gerrit 115675 0 master MERGED lvm: use run_command() in changelv() flow 2021-07-30 06:19:19 UTC
oVirt gerrit 115698 0 master MERGED lvm: use run_command() in removeVG() flow 2021-07-30 06:19:15 UTC
oVirt gerrit 115745 0 master MERGED lvm: use run_command() in resizePV() flow 2021-07-30 06:19:21 UTC
oVirt gerrit 115746 0 master MERGED lvm: use run_command() in movePV() flow 2021-07-30 06:19:17 UTC
oVirt gerrit 115959 0 master MERGED tests: better coverage for lvm exception handling 2021-09-14 14:35:49 UTC
oVirt gerrit 116227 0 master MERGED exception: add a helper for re-rasing with traceback 2021-09-09 21:22:46 UTC
oVirt gerrit 116228 0 master MERGED lvm: use run_command() in reduceVG() flow 2021-09-22 14:52:45 UTC
oVirt gerrit 116229 0 master MERGED lvm: use run_command() in chkVG() flow 2021-12-14 12:57:25 UTC
oVirt gerrit 116254 0 master MERGED devicemapper: allow raising while removing mappings 2021-09-09 21:22:49 UTC
oVirt gerrit 116255 0 master MERGED lvm: raise in _createpv() 2021-09-09 21:22:51 UTC
oVirt gerrit 116256 0 master MERGED lvm: make function for removing dm devices private 2021-09-09 21:22:54 UTC
oVirt gerrit 116257 0 master ABANDONED lvm: move metadata area activation to separate function 2021-09-03 10:31:07 UTC
oVirt gerrit 116258 0 master MERGED lvm: use run_command() in createVG() flow 2021-12-14 12:57:34 UTC
oVirt gerrit 116321 0 master MERGED lvm: use run_command() in createLV() flow 2021-10-04 18:33:31 UTC
oVirt gerrit 116322 0 master MERGED lvm: use run_command() in removeLVs() flow 2021-12-07 08:58:58 UTC
oVirt gerrit 116404 0 master MERGED lvm: use run_command() in reduceLV() and extendLV() flows 2021-10-04 18:38:26 UTC
oVirt gerrit 116457 0 master MERGED tests: add fake device helpers 2021-09-14 14:32:54 UTC
oVirt gerrit 116505 0 master MERGED lvm: use run_command() in renameLV() flow 2021-10-04 18:44:11 UTC
oVirt gerrit 116506 0 master MERGED lvm: use run_command() in refreshLVs() flow 2021-10-04 18:45:41 UTC
oVirt gerrit 116827 0 master MERGED lvm: use from_lvmerror() helper for all remaining lvm exceptions 2021-10-04 20:32:19 UTC
oVirt gerrit 117560 0 master MERGED lvm: use run_command() in changeVGTags() flow 2021-12-14 12:57:27 UTC
oVirt gerrit 117561 0 master MERGED lvm: use run_command() while reloading lvm devices 2021-12-14 12:57:30 UTC
oVirt gerrit 117562 0 master MERGED tests: use run_command() in all lvm tests 2021-12-14 12:58:14 UTC
oVirt gerrit 117563 0 master MERGED lvm: remove deprecated function for running lvm commands 2021-12-14 12:58:16 UTC
oVirt gerrit 117795 0 master MERGED lvm: use run_command() for enabling pv metadata 2021-12-14 12:57:32 UTC
oVirt gerrit 117796 0 master MERGED lvm: use run_command() in extendVG() flow 2021-12-14 12:57:37 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.