Bug 859897

Summary: RHEVM-API: add /alias property to disk and deprecate name
Product: Red Hat Enterprise Virtualization Manager Reporter: Ondra Machacek <omachace>
Component: ovirt-engine-restapiAssignee: Michael Pasternak <mpastern>
Status: CLOSED CURRENTRELEASE QA Contact: Gadi Ickowicz <gickowic>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: amureini, bazulay, dyasny, ecohen, gickowic, hateya, iheim, lpeer, mpastern, nlevinki, oramraz, Rhev-m-bugs, sgrinber, yeylon, ykaul
Target Milestone: ---   
Target Release: 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: si20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 20:02:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ondra Machacek 2012-09-24 11:05:39 UTC
Description of problem:
Searching disks via RESTAPI should be supported, it is not.

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. Create disk with name 'a'.
2. Try to search disk via RESTAPI.(https://url/api/disks?search=name%3Da)
  
Actual results:
Return empty <disks/> tag.

Expected results:
Should return <disk> tag with all information about disk with alias 'a'.

Additional info:

Comment 1 Michael Pasternak 2012-09-24 13:47:25 UTC
basically this is inconsistency issue between the api and backend,
backend does not have disk.name property but disk.alias, we preserve it
for the backward compatibility, correct syntax is: 

/api/disks?search=alias%3DXXX

Comment 2 Michael Pasternak 2012-10-03 12:24:54 UTC
http://gerrit.ovirt.org/8326

Comment 4 Ondra Machacek 2012-10-10 11:18:22 UTC
Doesnt miss you rewrite part that generates function get? This line:

result = self._getProxy().get(url=SearchHelper.appendQuery(url, {'search':'name='+name}),

should be

result = self._getProxy().get(url=SearchHelper.appendQuery(url, {'search':'alias='+name}),

Comment 7 Michael Pasternak 2012-10-10 11:32:28 UTC
making {'search':'alias='+name}) in sdk will break generic name=X search
dialect concept, 'name='+name will be preserved in SDK, user can fetch
the disk by alias using **kwargs

Comment 8 Ondra Machacek 2012-10-10 12:20:06 UTC
using **kwargs doesnt work for me:

API = getApi()
a = API.disks.list()[0].get_alias()
d = API.disks.get(name=a, alias=a)
print d.get_alias()

>>>
Traceback (most recent call last):
  File "./test.py", line 197, in <module>
    print d.get_alias()
AttributeError: 'NoneType' object has no attribute 'get_alias

Comment 9 Michael Pasternak 2012-10-10 12:26:03 UTC
(In reply to comment #8)
> using **kwargs doesnt work for me:
> 
> API = getApi()
> a = API.disks.list()[0].get_alias()
> d = API.disks.get(name=a, alias=a)
> print d.get_alias()
> 
> >>>
> Traceback (most recent call last):
>   File "./test.py", line 197, in <module>
>     print d.get_alias()
> AttributeError: 'NoneType' object has no attribute 'get_alias

do not use name=x in 3,1, just:

d = API.disks.get(alias=a)

Comment 10 Gadi Ickowicz 2012-10-15 15:16:40 UTC
Verified in SI20 - rhevm-3.1.0-20.el6ev.noarch.

able to search with REST as stated in comment#1