Bug 1683126 - [RFE] engine-setup/cleanup/etc. should know if it "owns" postgresql and act accordingly
Summary: [RFE] engine-setup/cleanup/etc. should know if it "owns" postgresql and act a...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Setup.EngineCommon
Version: 4.2.3
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Yedidyah Bar David
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-26 09:57 UTC by Yedidyah Bar David
Modified: 2022-02-24 14:19 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-24 14:19:49 UTC
oVirt Team: Integration
Embargoed:


Attachments (Terms of Use)

Description Yedidyah Bar David 2019-02-26 09:57:16 UTC
Description of problem:

engine-setup asks whether to use a local or a remote postgresql database, default to local. If local, it then asks whether to provision it automatically or manually, default to automatic.

But it does not keep the answers to these questions anywhere.

The assumption was that other than during the initial setup, we should treat the different cases the same - never again use 'postgres' user, etc. This assumption made some sense, especially when the current code was introduced, during 3.3 days, replacing earlier code which started with the opposite assumption 'use postgres for everything' and gradually refining it.

But later on, we had several different cases in which it failed us, and having no real solution we came up with the heuristic that if db host is 'localhost', we own it, and can do things to it. This breaks cases where users want Local but Manual.

We should get rid of this "guess", and instead:

1. For new setups, keep the answer in postinstall. Perhaps change the text as well.

2. For upgrades, if it's not set yet, set to True if db host is 'localhost' (and save in postinstall for later upgrades). Document that the user is allowed to change it to False (in postinstall, or as an option to engine-setup if we do not want people to have to manually edit postinstall).

3. Change all code that checks for 'localhost' to check for this answer instead. A good approximation (not sure it's accurate, though) is to change the methods setupOwnsDB, _setupOwnsDB.

4. Other stuff, e.g.:

4.1. On engine-cleanup, if we cleaned up all databases, and we own pt, also stop and disable pg.

Version-Release number of selected component (if applicable):
Forever

How reproducible:
Always

Steps to Reproduce:
1. engine-setup, accept default 'Local' and 'Automatic'
2. engine-cleanup
3.

Actual results:
pg remains up and enabled

Expected results:
pg should be down and disabled, perhaps also cleaned up (e.g. leave data directory empty).

Additional info:

As a recent example, see:

https://lists.ovirt.org/archives/list/users@ovirt.org/thread/YMMUX63N6D4WLBHAVHQSQVQUUC4GJEIN/ running engine-setup against postgresql running on non-default port

Comment 1 Yedidyah Bar David 2019-03-04 10:32:42 UTC
A workaround, for developers and/or users that want a db on the local machine but make engine-setup behave like it's remote: Add another name for the '127.0.0.1' line in /etc/hosts, e.g. 'localdb' or whatever, and use that name when queried. engine-setup strictly checks for the string 'localhost'.

Comment 2 Roy Golan 2019-03-04 11:02:15 UTC
The heuristics of localhost for ownership is limiting. It makes you exercise workarounds like mentioned above,
 it limits use when we would want to move to unix-socket  (which we want! for better performance) and it doesn't 
let us own a remote instance if we want.

I think the approach should be deterministic - choose not to manage if you want explicitly or if you are DEVELOPER_MODE and
persist it to etc/ovirt-engine/conf.d or etc/ovirt-engine-setup.d

Comment 3 Sandro Bonazzola 2022-02-24 14:19:49 UTC
low severity, closing due to capacity


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