Bug 2014865 - Errors hidden in %posttrans scriptlet
Summary: Errors hidden in %posttrans scriptlet
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: vdsm
Classification: oVirt
Component: Packaging.rpm
Version: 4.50
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ovirt-4.5.1
: 4.50.0
Assignee: Marcin Sobczyk
QA Contact: Ivana Saranova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-10-17 13:52 UTC by Nir Soffer
Modified: 2022-06-23 05:54 UTC (History)
3 users (show)

Fixed In Version: vdsm-4.50.0
Clone Of:
Environment:
Last Closed: 2022-06-23 05:54:58 UTC
oVirt Team: Infra
Embargoed:
mperina: ovirt-4.5+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-43818 0 None None None 2021-10-17 14:05:34 UTC
oVirt gerrit 117231 0 master MERGED Fix errors hidden in %posttrans scriptlet 2021-10-28 11:45:39 UTC

Description Nir Soffer 2021-10-17 13:52:35 UTC
Description of problem:

In vdsm %posttrans scriplet, all errors are hidden. This make it impossible to
debug install or upgrade issues.

All errors must be logged to stderr.

Host deploy scripts should propagate errors during install or upgrade to engine
event log.

%posttrans
if  [ -f "%{_localstatedir}/lib/%{vdsm_name}/upgraded_version" ]; then 
    # removing temporary files at first to avoid leaving upgrade leftovers
    /bin/rm -f "%{_localstatedir}/lib/%{vdsm_name}/upgraded_version"
    if [ -f "%{_localstatedir}/lib/%{vdsm_name}/vdsmd_start_required" ]; then 
        vdsmd_start_required='yes'
        /bin/rm -f "%{_localstatedir}/lib/%{vdsm_name}/vdsmd_start_required"
        /bin/systemctl stop vdsmd >/dev/null 2>&1 || : 
    fi   

    if [ -f "%{_localstatedir}/lib/%{vdsm_name}/supervdsmd_start_required" ]; then 
        supervdsmd_start_required='yes'
        /bin/rm -f "%{_localstatedir}/lib/%{vdsm_name}/supervdsmd_start_required"
        /bin/systemctl stop supervdsmd >/dev/null 2>&1 || : 
    fi   

    if /bin/systemctl status vdsm-network >/dev/null 2>&1; then 
        /bin/systemctl stop vdsm-network >/dev/null 2>&1 || : 
    fi   

    if ! %{_bindir}/vdsm-tool is-configured >/dev/null 2>&1; then 
        %{_bindir}/vdsm-tool configure --force >/dev/null 2>&1
    fi   

    if [ "${supervdsmd_start_required}" = 'yes' ]; then 
        /bin/systemctl start supervdsmd >/dev/null 2>&1 || : 
    fi   
    if [ "${vdsmd_start_required}" = 'yes' ]; then 
        /bin/systemctl start vdsmd >/dev/null 2>&1 || : 
    fi   
fi
exit 0

Version-Release number of selected component (if applicable):
Issues exists since:

commit 45f60872674efccfe6f945fc1e1a451a1da52e4a

    Adding reconfigure libvirt to vdsm upgrade flow


How reproducible:
Always

Steps to Reproduce:
1. Simulate failure in vdsm-tool configure by modifying one of the
   configuratiors to fails.
2. Install or upgrade vdsm

Actual results:
Error in vdsm-tool configure is hidden

Expected results:
All errors during %posttrans scriptlet must be logged.

Additional info:
See bug 2013383 - could be much easier to handle if error was not hidden.

Comment 2 Ivana Saranova 2022-05-17 11:54:16 UTC
Steps:
1) add break stuff to vdsm-tool code
2) add the RPM to host
3) run reinstall/install host

Results:
```
      "stderr_lines" : [ "Traceback (most recent call last):", "  File \"/usr/bin/vdsm-tool\", line 226, in <module>", "    sys.exit(main())", "  File \"/usr/bin/vdsm-tool\", line 169, in main", "    raise Exception(\"test error\")", "Exception: test error" ],
```

Error message is present in the logs and can be used for debug purposes.

Verified in:
vdsm-4.50.0.13-1.el8ev.x86_64

Comment 3 Sandro Bonazzola 2022-06-23 05:54:58 UTC
This bugzilla is included in oVirt 4.5.1 release, published on June 22nd 2022.
Since the problem described in this bug report should be resolved in oVirt 4.5.1 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.