Bug 1537735

Summary: Unable to use paging when searching for VM pools available for specific user sorted by name
Product: [oVirt] ovirt-engine Reporter: jniederm
Component: RestAPIAssignee: Ori Liel <oliel>
Status: CLOSED CURRENTRELEASE QA Contact: Radim Hrazdil <rhrazdil>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: futureCC: bugs, jniederm, lsvaty, lveyde, michal.skrivanek, mperina
Target Milestone: ovirt-4.2.2Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.2.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 11:18:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jniederm 2018-01-23 18:58:39 UTC
Description of problem:
Rest api sometimes hides entities when 'Fiter: true' header, search and max params are used.

Version-Release number of selected component (if applicable):
current master, commit 8ebd58feca

How reproducible:
100%

Steps to Reproduce:
1. Remove all pools from the system
2. Create 3 VM pools named pa, pb, pc
3. Assing UserRole for pool pb for user admin@internal
3. Fire api request
   GET /api/vmpools?max=1&search=SORTBY NAME ASC page 1
   Authorization: Basic ...admin@internal...
   Filter: true

Actual results:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vm_pools/>

Expected results:
pool pb is returned

Additional info:

Comment 1 Michal Skrivanek 2018-01-24 06:11:32 UTC
"sometimes"?
Why is it a separate case from bug 1534607?

Comment 2 Martin Perina 2018-01-24 09:09:28 UTC
Search engine is not usable with permissions and it would required complete redesign of it to allow that. That's why we decided to internally provide specialized query which is able to fetch VM pools by name for specific user and provide paging support for it.

Comment 5 Radim Hrazdil 2018-02-27 07:37:46 UTC
Verified that only pool with set UserRole permissions for admin is returned for request 
GET /api/vmpools?max=1&search=SORTBY%20NAME%20ASC%20page%201

RHV version 4.2.2

Comment 6 Radim Hrazdil 2018-02-27 08:00:15 UTC
Command used to forge the request was the following:

curl -v -u "<username>:<password>" -H "Content-type: application/json" -H "filter: true"  --insecure  https://<engine_fqdn>/ovirt-engine/api/vmpools/?search=SORTBY%20NAME%20ASC

Comment 7 Sandro Bonazzola 2018-03-29 11:18:51 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.