Bug 2003441 - dnf rollback is broken
Summary: dnf rollback is broken
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: otopi
Classification: oVirt
Component: Plugins.packagers
Version: 1.9.5
Hardware: All
OS: Linux
high
high
Target Milestone: ovirt-4.4.10
: 1.9.6
Assignee: Yedidyah Bar David
QA Contact: Barbora Dolezalova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-12 10:09 UTC by Yedidyah Bar David
Modified: 2022-02-04 10:28 UTC (History)
3 users (show)

Fixed In Version: otopi-1.9.6
Doc Type: Bug Fix
Doc Text:
Cause: otopi's 'minidnf.py' was broken due to backwards-incompatible changes in dnf, around transaction rollback. Consequence: If engine-setup, used for upgrade, failed, due to some reason, after already upgrading the engine packages, it tried to undo this - to install the previously-installed packages, before the upgrade attempt. This didn't work. Fix: otopi was fixed to be compatible with recent dnf. Result: If engine-setup fails after upgrading the engine packages, it should now successfully roll back to the packages that were installed prior to the failed upgrade. doc team: I am not aware of any other program/process that uses this functionality, so it's probably enough to mention engine-setup. So a minimal version should probably be something like: engine-setup should now successfully roll back upgraded packages if it fails.
Clone Of:
Environment:
Last Closed: 2022-02-04 10:28:51 UTC
oVirt Team: Integration
Embargoed:
sbonazzo: ovirt-4.4+
sbonazzo: devel_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHV-43615 0 None None None 2021-09-12 10:12:13 UTC
oVirt gerrit 116476 0 master MERGED minidnf: fix rollback 2021-10-04 14:02:19 UTC
oVirt gerrit 116955 0 otopi-1.9 MERGED minidnf: fix rollback 2021-10-05 12:19:15 UTC

Description Yedidyah Bar David 2021-09-12 10:09:08 UTC
Description of problem:

See bug 1542492 comment 2. Decided to split it into a separate (current) bug, dealing only with missing dnf method open_history.

If e.g. 'engine-setup' fails, due to some other reason, after successfully upgrading engine packages, it tries to rollback the main transaction, including the part of dnf, but fails with something like:

[INFO] DNF Performing DNF transaction rollback
[ERROR] DNF module 'dnf.history' has no attribute 'open_history'

Was reported at:

https://lists.ovirt.org/archives/list/users@ovirt.org/thread/EZJTUOHNHKT7YBO222QVLA5VVBXCXZFD/

Version-Release number of selected component (if applicable):
I think since dnf-3 release

How reproducible:
Always

Steps to Reproduce:

See above for a realistic flow. A minimal one is something like this. I picked 'jose' as a simple example - can use any installable-but-not-installed package:

1. dnf install otopi-debug-plugins
2. dnf remove -y jose
3. OTOPI_FORCE_FAIL_STAGE=STAGE_MISC otopi ODEBUG/packagesAction=str:install ODEBUG/packages=str:jose

Actual results:
Installs 'jose', fails, leaves it installed

Expected results:
Installs jose, fails, then successfully removes 'jose'

Additional info:

Comment 1 Yedidyah Bar David 2021-09-12 10:14:33 UTC
Daniel, please review [1]. Thanks. Perhaps you want to make this easier via the official dnf api - exposing '_revert_transaction' or probably higher level.

[1] https://gerrit.ovirt.org/116476

Comment 2 RHEL Program Management 2021-10-04 14:22:45 UTC
The documentation text flag should only be set after 'doc text' field is provided. Please provide the documentation text and set the flag to '?' again.

Comment 3 Yedidyah Bar David 2021-10-05 06:02:24 UTC
Moving back to POST because I have to cherry-pick changes to 4.4 branch.

Comment 5 Guilherme Santos 2021-11-08 07:15:53 UTC
Moving to 4.4.10 due to QE capacity.

Comment 6 Barbora Dolezalova 2022-01-25 14:25:06 UTC
Verified in otopi-common-1.9.6-2.el8ev.noarch

I used these combinations for verification and after every try I checked the logs and the version of the engine and if the services are not broken. The rollback was successful. 

OTOPI_FORCE_FAIL_STAGE=STAGE_EARLY_MISC OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_LOW engine-setup

OTOPI_FORCE_FAIL_STAGE=STAGE_MISC OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_HIGH engine-setup

OTOPI_FORCE_FAIL_STAGE=STAGE_MISC OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_DEFAULT engine-setup

OTOPI_FORCE_FAIL_STAGE=STAGE_MISC OTOPI_FORCE_FAIL_PRIORITY=PRIORITY_LOW engine-setup

Comment 7 Yedidyah Bar David 2022-01-26 06:42:17 UTC
Can you please provide more details about your verification flow? It should be something like:

1. Install and setup an older engine (say, 4.4.9)

2. Add 4.4.10 repos

3. Update setup packages, including otopi

4. Run one of your commands from comment 6

You should see something like:

[INFO] DNF Performing DNF transaction rollback

And then see that it actually downgrades packages.

Thanks!

Comment 8 Barbora Dolezalova 2022-01-26 08:56:41 UTC
Yes. That were the exact steps I understood from the linked community issue. If that was wrong, please specify correct verification steps.

Comment 9 Yedidyah Bar David 2022-01-26 09:22:27 UTC
Thanks, looks good to me.


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