Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine upgrade fails when db tables are owned indirectly #841

Closed
betanummeric opened this issue Apr 24, 2023 · 1 comment
Closed

engine upgrade fails when db tables are owned indirectly #841

betanummeric opened this issue Apr 24, 2023 · 1 comment

Comments

@betanummeric
Copy link

Apparently, ovirt-engine insists on having the user used for database connections own all postgres objects directly:

Failed to execute stage 'Setup validation': Cannot upgrade the Engine database schema due to wrong ownership of some database entities.

The error is raised here:

def _checkDatabaseOwnership(self):
statement = database.Statement(
dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS,
environment=self.environment,
)
result = statement.execute(
statement="""
select
nsp.nspname as object_schema,
cls.relname as object_name,
rol.rolname as owner,
case cls.relkind
when 'r' then 'TABLE'
when 'i' then 'INDEX'
when 'S' then 'SEQUENCE'
when 'v' then 'VIEW'
when 'c' then 'TYPE'
else
cls.relkind::text
end as object_type
from
pg_class cls join
pg_roles rol on rol.oid = cls.relowner join
pg_namespace nsp on nsp.oid = cls.relnamespace
where
nsp.nspname not in ('information_schema', 'pg_catalog') and
nsp.nspname not like 'pg_%%' and
cls.relname not like 'pg_%%' and
rol.rolname != %(user)s
order by
nsp.nspname,
cls.relname
""",
args=dict(
user=self.environment[oenginecons.EngineDBEnv.USER],
),
ownConnection=True,
transaction=False,
)
if len(result) > 0:
raise RuntimeError(
_(
'Cannot upgrade the Engine database schema due to wrong '
'ownership of some database entities.\n'
)
)

I'd like to put the postgres user in a postgres group and make that group owner of the tables etc. This makes it possible to share owner privileges with other users. The ovirt-engine user would still have full privileges, but the check fails, due to the rol.rolname != %(user)s .

My request is to let the check succeed also when the user is a member of the owner role.

betanummeric pushed a commit to betanummeric/ovirt-engine that referenced this issue Apr 24, 2023
betanummeric pushed a commit to betanummeric/ovirt-engine that referenced this issue Apr 24, 2023
is also ok

see oVirt#841

Signed-off-by: Felix Hamme <felix.hamme@ionos.com>
didib pushed a commit that referenced this issue May 4, 2023
is also ok

see #841

Signed-off-by: Felix Hamme <felix.hamme@ionos.com>
@betanummeric
Copy link
Author

resolved by PR #842

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant