Bug 859897 - RHEVM-API: add /alias property to disk and deprecate name
RHEVM-API: add /alias property to disk and deprecate name
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.1.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.1.0
Assigned To: Michael Pasternak
Gadi Ickowicz
storage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-24 07:05 EDT by Ondra Machacek
Modified: 2016-02-10 15:34 EST (History)
15 users (show)

See Also:
Fixed In Version: si20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 15:02:24 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ondra Machacek 2012-09-24 07:05:39 EDT
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 09:47:25 EDT
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 08:24:54 EDT
http://gerrit.ovirt.org/8326
Comment 4 Ondra Machacek 2012-10-10 07:18:22 EDT
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 07:32:28 EDT
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 08:20:06 EDT
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 08:26:03 EDT
(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 11:16:40 EDT
Verified in SI20 - rhevm-3.1.0-20.el6ev.noarch.

able to search with REST as stated in comment#1

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