Bug 1870055

Summary: OVESETUP_GRAFANA_CONFIG/grafanaUser might be undefined
Product: [oVirt] ovirt-engine-dwh Reporter: Yedidyah Bar David <didi>
Component: SetupAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Novotny <pnovotny>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4.0CC: bugs, gdeolive, lleistne
Target Milestone: ovirt-4.4.6Flags: pm-rhel: ovirt-4.4+
gdeolive: testing_ack+
Target Release: 4.4.6.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-dwh-4.4.6.2 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-14 07:24:32 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 Yedidyah Bar David 2020-08-19 09:40:17 UTC
Description of problem:

Under certain conditions (see below), OVESETUP_GRAFANA_CONFIG/grafanaUser will not be set, and will cause certain utilities to fail with:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/otopi/context.py", line 132, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-common/ovirt-engine-grafana-dwh/db/grafana.py", line 80, in _misc_set_access
    self.environment[ogdwhcons.ConfigEnv.GRAFANA_USER]
KeyError: 'OVESETUP_GRAFANA_CONFIG/grafanaUser'

This is because it's set only in engine-setup plugin, but used in common plugin - which is used in all utilities, including engine-cleanup and ovirt-engine-rename.

This is a result of the fix to bug 1846365, so is broken since it.

The flow where it happened was something like:

1. Run engine-setup with grafana and dwh enabled, but have it fail before starting grafana service
2. engine-cleanup

In our specific case, the flow was something like:

1. Install and setup 4.3 engine. Configure it to use 3rd-party cert and SSO.
2. Migrate dwh to its own machine.
3. Upgrade the engine to 4.4.
4. Upgrade dwh to 4.4:
4.1. Install el8 machine
4.2. Run engine-backup on the 4.3 dwh machine
4.3. Restore this backup on the el8 machine
4.4. engine-setup - It failed, due to bug 1866811, when starting httpd
5. engine-cleanup

Above flow is still not supported, though - see also bug 1846279.

Comment 1 Yedidyah Bar David 2021-04-19 07:58:40 UTC
This is now required, with patch [1] merged (for bug 1879373).

[1] https://gerrit.ovirt.org/c/ovirt-engine/+/114268

Comment 2 Yedidyah Bar David 2021-04-19 12:21:15 UTC
Reproduction/Verification, with a recent engine (that includes [1]):
- engine-setup
- engine-backup --file=f1
- engine-cleanup
- engine-backup --mode=restore --file=f1 --provision-all-databases

With an older engine, reproduction is harder. See comment 0.

(For reference:)

The reason that with [1] it's now mandatory also in this rather-simple flow, is that with [1], the grafana DB is no longer restored before we provision databases, and the condition in _misc_set_access also checks NEW_DATABASE - which will be true at this point. Before [1], it was false, so we didn't enter _misc_set_access, so didn't run into this bug.

[1] https://gerrit.ovirt.org/c/ovirt-engine/+/114268

Comment 3 Pavel Novotny 2021-05-10 22:36:56 UTC
Verified in
ovirt-engine-4.4.6.6-0.10.el8ev.noarch
ovirt-engine-dwh-4.4.6.2-1.el8ev.noarch

Verified according to steps in comment 2:
- engine install & engine-setup
- engine-backup --file=f1
- engine-cleanup
- engine-backup --mode=restore --file=f1 --provision-all-databases

All steps finished with success.