Bug 1418602 - [DOC] Grant read-only access to tables and views(RHV provider)
Summary: [DOC] Grant read-only access to tables and views(RHV provider)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Documentation
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: GA
: cfme-future
Assignee: Suyog Sainkar
QA Contact: Dayle Parker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-02 10:25 UTC by Sachin
Modified: 2018-08-06 01:44 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-06 01:44:39 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1606935 0 high CLOSED Deployment Planning Guide Updates for RHV 4.2 2021-09-09 15:08:18 UTC

Internal Links: 1606935

Description Sachin 2017-02-02 10:25:12 UTC
Document URL: 

https://access.redhat.com/documentation/en/red-hat-cloudforms/4.2/single/deployment-planning-guide/


Section Number and Name: 

3.3: Data Collection for Red Hat Enterprise Virtualization

Describe the issue: 

What should be expected output of below command?

~~~
SELECT 'GRANT SELECT ON ' || relname || ' TO cfme;' FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE nspname = 'public' AND relkind IN ('r', 'v', 'S');
~~~

Description says "grant read-only access to tables and views: "

Suggestions for improvement: 
n/a

Additional information: 

I got zero records found

Comment 3 Sachin 2017-02-06 06:29:59 UTC
Suyog,

BZ#1334742 is unrelated to this bug. My question was if a user executes query
~~~
SELECT 'GRANT SELECT ON ' || relname || ' TO cfme;' FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE nspname = 'public' AND relkind IN ('r', 'v', 'S');
~~~

which according to documentation enables read-only access to user 'cfme'. When I executed the query, it replied with "0 records found". What I doubt is the command did not worked. If the command worked(cfme was granted r/o access) it should have replied with something like "1 record was modified". Does it makes sense? My assumption may be wrong.


--
Sachin

Comment 5 jhoffer 2017-05-19 21:07:08 UTC
The SQL command above and in the documentation (CloudForms 4.2 and prior) only outputs a series of subsequent SQL commands that would need to be executed to actually grant access for cfme user to the ovirt_engine_history DB tables.  This method may be for older versions of postgresql.  In my environment (CFME 5.7.2.1 and RHVM 4.1.1) the following commands gave read (SELECT) access to cfme user and metrics began to appear shortly after:

[root@vrhvm-demolab ~]# su - postgres
Last login: Fri May 19 14:35:50 EDT 2017 on pts/0
-bash-4.2$ psql -d ovirt_engine_history -c "grant usage on schema public to cfme;"
GRANT
-bash-4.2$ psql -d ovirt_engine_history -c "grant select on all tables in schema public to cfme;"
GRANT

This worked on two separate RHVM providers reporting to a single CFME.

Comment 7 Yaniv Lavi 2017-05-21 08:39:43 UTC
This is simple the PL\SQL reply for the scripts.
It gives no printed output. This doesn't mean it won't work.
It does the job.

Comment 8 Sachin 2017-05-24 12:01:30 UTC
I agree. But it did not altered any records("0 record found") which I assumed made no changes in the DB.

Comment 9 Deepak 2017-05-24 12:11:56 UTC
We have verified #comment 5 in our rhevm environment and it works as expected. 

but confusion here is the SQL query altered the DB?

SELECT 'GRANT SELECT ON ' || relname || ' TO cfme;' FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE nspname = 'public' AND relkind IN ('r', 'v', 'S');

Comment 10 Sachin 2017-05-24 12:17:02 UTC
As Deepak verified command in comment#5 worked. My question being the SQL query

~~~
 SELECT 'GRANT SELECT ON ' || relname || ' TO cfme;' FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE nspname = 'public' AND relkind IN ('r', 'v', 'S');
~~~

is expected to give o/p as "0 records found"? in that case I guess above query did not actually grant r/o permissions.

Comment 12 jhoffer 2017-06-20 15:05:43 UTC
The output of...

ovirt_engine_history=# SELECT 'GRANT SELECT ON ' || relname || ' TO cfme;' FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE nspname = 'public' AND relkind IN ('r', 'v', 'S');

...produces SQL statements that need to be run as a script.  It does not in fact GRANT access to the cfme user. Additional steps are required to grant access.

I suggest that the CloudForms Deployment Planning Guide documentation be aligned to and reference the RHV documentation, specifically section 2.6 of the RHV Data Warehouse Guide:

https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.1/html-single/data_warehouse_guide/#Allowing_Read_Only_Access_to_the_History_Database

Comment 15 Andrew Dahms 2018-07-24 01:33:48 UTC
Linking to BZ#1606935, which requests changes to the same section.


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