Alon Bar-Lev has posted comments on this change.

Change subject: packaging: setup: check database object ownership on upgrade
......................................................................


Patch Set 1:

(3 comments)

....................................................
File packaging/setup/plugins/ovirt-engine-setup/db/schema.py
Line 109:                 JOIN pg_namespace nsp ON nsp.oid = cls.relnamespace
Line 110:                 WHERE nsp.nspname NOT IN ('information_schema', 
'pg_catalog')
Line 111:                 AND nsp.nspname NOT LIKE 'pg_toast%'
Line 112:                 AND rol.rolname != 'engine'
Line 113:                 ORDER BY nsp.nspname, cls.relname;
hmmm.... I used to the following format, lower case... boolean at right... no 
need for ';'

 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 like ('information_schema', 'pg_catalog') and
     nsp.nspname not like 'pg_toast%' and
     rol.rolname != 'engine'
 order by
     nsp.nspname,
     cls.relname

now... for real comment... the 'engine' is the user name we actually use, not 
hard coded to engine.

and I am not sure I understand why object_type and this complex case is 
required... eli? I do not see where it is used.
Line 114:             """,
Line 115:             ownConnection=True,
Line 116:             transaction=False,
Line 117:         )


Line 133:             raise RuntimeError(
Line 134:                 _(
Line 135:                     'Cannot upgrade the database schema due to wrong '
Line 136:                     'ownership of some database entities.\n'
Line 137:                     'Please execute: {command}'
and provide postgres password?
Line 138:                 ).format(
Line 139:                     command=command,
Line 140:                 )
Line 141:             )


Line 252:             osetupcons.Stages.DB_CREDENTIALS_AVAILABLE_LATE,
Line 253:         ),
Line 254:     )
Line 255:     def _miscUpgrade(self):
Line 256:         self._checkDatabaseOwnership()
do this at validation?
Line 257:         self._checkSupportedVersionsPresent()
Line 258:         dbovirtutils = database.OvirtUtils(plugin=self)
Line 259:         backupFile = dbovirtutils.backup()
Line 260: 


-- 
To view, visit http://gerrit.ovirt.org/20935
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I45b655e88c25dd51e567405cc6747b42dfd8a98b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to