Bug 1022691
Summary: | check database object ownership to engine before upgrade | ||
---|---|---|---|
Product: | Red Hat Enterprise Virtualization Manager | Reporter: | Alon Bar-Lev <alonbl> |
Component: | ovirt-engine-setup | Assignee: | Sandro Bonazzola <sbonazzo> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | sefi litmanovich <slitmano> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 3.3.0 | CC: | acathrow, bazulay, didi, eedri, iheim, oschreib, pstehlik, Rhev-m-bugs, sbonazzo, talayan, yeylon |
Target Milestone: | --- | Keywords: | Triaged |
Target Release: | 3.3.0 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | integration | ||
Fixed In Version: | is24 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | Type: | Bug | |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1038284 |
Description
Alon Bar-Lev
2013-10-23 19:26:01 UTC
(In reply to Alon Bar-Lev from comment #0) > During legacy backup/restore procedure, users used postgres user instead of > engine user to restore, this leads to have object owned by postgres. > > We need to abort setup in this case, asking user to run the ownership change > script[1]. > > Eli, please specify sql statements to run and assign to sandaro. pg_dump -s -h <server> -p <port> -U <user> <db>|grep -i 'owner to postgres' |wc -l This should return 0 , if returns something greater than that , fail and ask the user to run the script [1] [1] http://gerrit.ovirt.org/#/c/18682/ (In reply to Eli Mesika from comment #1) > (In reply to Alon Bar-Lev from comment #0) > > During legacy backup/restore procedure, users used postgres user instead of > > engine user to restore, this leads to have object owned by postgres. > > > > We need to abort setup in this case, asking user to run the ownership change > > script[1]. > > > > Eli, please specify sql statements to run and assign to sandaro. > > pg_dump -s -h <server> -p <port> -U <user> <db>|grep -i 'owner to postgres' > |wc -l > > This should return 0 , if returns something greater than that , fail and ask > the user to run the script [1] > > [1] http://gerrit.ovirt.org/#/c/18682/ Eli, I am very sorry... but re-assign... I would really really prefer to have sql statement for that that I can execute within opened connection to the database over using pg_dump. Is that possible? (In reply to Alon Bar-Lev from comment #2) > (In reply to Eli Mesika from comment #1) > > (In reply to Alon Bar-Lev from comment #0) > I would really really prefer to have sql statement for that that I can > execute within opened connection to the database over using pg_dump. Is that > possible? 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_toast%' and rol.rolname != 'engine' order by nsp.nspname, cls.relname; merged on upstream master and 3.3 branches, Change-Id: I45b655e88c25dd51e567405cc6747b42dfd8a98b Not merged completely. Verified on RHEL6.5 RHEVM3.3 IS25. steps of verification: 1) on a running environment with rhevm3.2.5 sf22, entered with user engine to DB and altered ownership of users table from engine to postgres 2) upgraded rhevm to 3.3 IS25. 3) engine-setup: Failed to execute stage 'Setup validation': Cannot upgrade the database schema due to wrong ownership of some database entities. Please execute: /usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432 -d engine -f postgres -t engine Using the password of the "postgres" user. 4)/usr/share/ovirt-engine/setup/dbutils/changedbowner.sh -s localhost -p 5432 -d engine -f postgres -t engine 5) engine-setup - works fine Closing - RHEV 3.3 Released Closing - RHEV 3.3 Released |