Bug 1552539

Summary: upgrade from 4.1 to 4.2 fails as engine-setup does wrong test of /var/opt/rh/rh-postgresql95/lib/pgsql/data existence
Product: [oVirt] ovirt-engine Reporter: Jiri Belka <jbelka>
Component: Setup.CoreAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 4.2.2CC: bugs
Target Milestone: ovirt-4.2.2Keywords: Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 11:12:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Belka 2018-03-07 10:05:18 UTC
Description of problem:

probably after previous upgrade issues I got ... created and it is the empty dir.

# ls -al /var/opt/rh/rh-postgresql95/lib/pgsql/data
total 0
drwx------. 2 postgres postgres  6 Sep  1  2017 .
drwx------. 4 postgres postgres 54 Mar  6 17:19 ..


but setup refused to use this empty dir, imo if it is empty it could be used.

2018-03-06 17:41:12,260+0100 DEBUG otopi.context context._executeMethod:143 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 133, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/db/dbmsupgrade.py", line 74, in _customization
    ) = dbovirtutils.DBMSUpgradeCustomizationHelper('engine')
  File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/database.py", line 1560, in DBMSUpgradeCustomizationHelper
    'Cannot upgrade PostgreSQL automatically - directory '
RuntimeError: Cannot upgrade PostgreSQL automatically - directory of the new version already exists
2018-03-06 17:41:12,264+0100 ERROR otopi.context context._executeMethod:152 Failed to execute stage 'Environment customization': Cannot upgrade PostgreSQL automatically - directory of the new version already exists


Version-Release number of selected component (if applicable):
ovirt-engine-setup-base-4.2.2.2-0.1.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. have 4.1
2. install -d -o postgres -g postgres -m700 /var/opt/rh/rh-postgresql95/lib/pgsql/data
3. do upgrade

Actual results:
upgrade fails

Expected results:
upgrade could (re)use already existing empty dir

Additional info:

Comment 1 Yedidyah Bar David 2018-03-07 10:53:49 UTC
This is essentially a duplicate of bug 1546771. Keeping open to verify both flows (data dir is missing, data dir exists and empty). Feel free to close, though.

Comment 2 Jiri Belka 2018-03-07 13:39:19 UTC
So basically this test of the PG 9.5 data_dir existence prevents any upgrade from 4.1 to 4.2. Tested on clean 4.1 without any remnants of PG 9.5 before the upgrade itself.

Comment 3 Jiri Belka 2018-03-07 13:42:41 UTC
Current workaround, check that after first ugprade failure there's no /var/opt/rh/rh-postgresql95/lib/pgsql/data, then try again and it will pass.

Comment 4 Red Hat Bugzilla Rules Engine 2018-03-09 10:33:09 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 5 Jiri Belka 2018-03-21 13:05:13 UTC
ok, ovirt-engine-setup-base-4.2.2.4-0.1.el7.noarch

- tested with populated pg95 data dir
- tested with empty pg95 data dir

Comment 6 Sandro Bonazzola 2018-03-29 11:12:46 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 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.