Bug 1839676 - Run engine-setup with answerfile fails on "rollback failed: cannot use a string pattern on a bytes-like object"
Summary: Run engine-setup with answerfile fails on "rollback failed: cannot use a stri...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Setup.EngineCommon
Version: 4.4.1
Hardware: x86_64
OS: Linux
high
high
Target Milestone: ovirt-4.4.1
: 4.4.1.2
Assignee: Yedidyah Bar David
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-25 08:46 UTC by Ilan Zuckerman
Modified: 2020-07-08 08:24 UTC (History)
4 users (show)

Fixed In Version: ovirt-engine-4.4.1.2
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-08 08:24:44 UTC
oVirt Team: Integration
Embargoed:
pm-rhel: ovirt-4.4+
mtessun: planning_ack+
sbonazzo: devel_ack+
lleistne: testing_ack+


Attachments (Terms of Use)
Jenkins stdout + engine-setup log (26.15 KB, application/zip)
2020-05-25 08:46 UTC, Ilan Zuckerman
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 109258 0 master MERGED packaging: setup: Rollback: decode pg_restore stderr 2020-07-14 21:42:49 UTC
oVirt gerrit 109259 0 master MERGED packaging: setup: Rollback: Adapt ignored errors to PostgreSQL 12 2020-07-14 21:42:49 UTC

Description Ilan Zuckerman 2020-05-25 08:46:16 UTC
Created attachment 1691763 [details]
Jenkins stdout + engine-setup log

Description of problem:

This Issue is a consiquence of the following BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=1839665

The engine-setup fails to roll back due to "cannot use a string pattern on a bytes-like object". This occurred as a part of Jenkins flow for upgrading the 4.4 env to latest build rhv-4.4.1-1:

Creating/refreshing Engine database schema\n[ ERROR ] schema.sh: FATAL: Cannot execute sql command: --file=/usr/share/ovirt-engine/dbscripts/upgrade/04_04_0650_add_fk_to_vm_checkpoint_disk_map.sql\n[ ERROR ] Failed to execute stage 'Misc configuration': Engine schema refresh failed\n[ INFO  ] DNF Performing DNF transaction rollback\n[ INFO  ] DNF Repository ansible-2-rhel8-nightly-rhv-4.4 is listed more than once in the configuration\n[ INFO  ] DNF Repository jb-eap-7.3-for-rhel-8-server-rpms is listed more than once in the configuration\n[ INFO  ] DNF Repository rhel-8-openstack-cinderlib-rpms is listed more than once in the configuration\n[ ERROR ] DNF module 'dnf.history' has no attribute 'open_history'\n[WARNING] Rollback of DWH database postponed to Stage \"Clean up\"\n[ INFO  ] Rolling back database schema\n[ INFO  ] Clearing Engine database engine\n[ INFO  ] Restoring Engine database engine\n[ INFO  ] Restoring file '/var/lib/ovirt-engine/backups/engine-20200524094253.ncgb6klw.dump' to database localhost:engine.\n[ ERROR ] Engine database rollback failed: cannot use a string pattern on a bytes-like object\n[ INFO  ] Stage: Clean up\n          Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-setup-20200524094034-xuwab0.log\n[ INFO  ] Generating answer file '/var/lib/ovirt-engine/setup/answers/20200524094347-setup.conf'\n[WARNING] Rollback of DWH database started\n          This might be a long process, but it should be safe to start the engine service before it finishes, if needed.\n[ INFO  ] Clearing DWH database ovirt_engine_history\n[ INFO  ] Restoring DWH database ovirt_engine_history\n[ INFO  ] Restoring file '/var/lib/ovirt-engine-dwh/backups/dwh-20200524094236.dep1o6wu.dump' to database localhost:ovirt_engine_history.\n[ ERROR ] DWH database rollback failed: cannot use a string pattern on a bytes-like object\n[ INFO  ] Stage: Pre-termination\n[ INFO  ] Stage: Termination\n[ ERROR ] Execution of setup failed", "stdout_lines": ["[ INFO  ] Stage: Initializing", "[ INFO  ] Stage: Environment setup", "

Version-Release number of selected component (if applicable):
rhv-4.4.1-1

How reproducible:
Reproduced only once when running the Jenkins upgrade flow.

Attaching engine setup std out print [1] and full log of the responsible Jenkins job [2], as well as the link to it [3]

[1] engine_setup_stdout.txt
[2] jenkins_job.log
[3] https://rhv-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/rhv-ge-deploy-4.4/1066/consoleFull

Comment 1 Petr Matyáš 2020-06-05 10:13:27 UTC
Are there some reproduction steps? Otherwise this will be sanity only.

Comment 3 Yedidyah Bar David 2020-06-11 05:45:18 UTC
The reproduction steps are generally to make engine-setup fail after it already updated the database (perhaps preferably both engine and dwh DBs) - after 'Creating/refreshing * database schema' - and see that it rolls back correctly.

Manually, you can do this simply by pressing Ctrl-C at the right time.

Automatically, you can do something like:

- install, setup and backup a 4.3 engine+dwh (no need to be done specifically for this flow, btw - you can take a backup done elsewhere)
- Install 4.4 engine+dwh, and: otopi-debug-plugins
- Restore the backup from first step
- Run: OTOPI_FORCE_FAIL_STAGE=STAGE_MISC OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_LAST engine-setup --offline --accept-defaults

Alternatively, for verifying just current bug (and not real 4.3->4.4 upgrade), you can upgrade to same version:

- install, setup and backup engine+dwh
- engine-cleanup. To automate: engine-cleanup --otopi-environment='OVESETUP_CORE/remove=bool:True OVESETUP_CORE/engineStop=bool:True'
(and also, until we fix bug 1811593: /bin/rm /etc/pki/ovirt-engine/keys/engine.p12)
- restore and setup the same as previous flow

In both cases, make sure you only get these errors:

[ ERROR ] Failed to execute stage 'Misc configuration': Force Fail: stage 11 priority 90000
(or something similar, if you pressed Ctrl-C)
[ ERROR ] Execution of setup failed

Sadly, I now tried this, with grafana set up, and it did have another error, related to grafna's db user. Filed bug 1846212 for this, so if you try latter flow (meaning, all in 4.4), please do not configure grafana (for current bug).

Comment 5 Yedidyah Bar David 2020-06-11 05:51:10 UTC
(In reply to Yedidyah Bar David from comment #3)
> - Run: OTOPI_FORCE_FAIL_STAGE=STAGE_MISC
> OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_LAST engine-setup --offline
> --accept-defaults

We default to 'Yes', in 'Configure grafana?', so:

[snip]

> Sadly, I now tried this, with grafana set up, and it did have another error,
> related to grafna's db user. Filed bug 1846212 for this, so if you try
> latter flow (meaning, all in 4.4), please do not configure grafana (for
> current bug).

To make it not configure grafana, for now, you can e.g.:

OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_LAST engine-setup --offline --accept-defaults --otopi-environment=OVESETUP_GRAFANA_CORE/enable=bool:False

Comment 8 Petr Matyáš 2020-06-11 13:36:08 UTC
Verified on ovirt-engine-setup-4.4.1.2-0.10.el8ev.noarch

Rollback of DB is successful (no string pattern for bytes-like object error appears) when engine-setup fails after creating DB schemas.
I ran the upgrade from 4.3 flow as that seemed to be the main point of this bug.

Comment 9 Sandro Bonazzola 2020-07-08 08:24:44 UTC
This bugzilla is included in oVirt 4.4.1 release, published on July 8th 2020.

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