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
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'.
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
low severity, closing due to capacity