Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1173196

Summary: [restapi] Add support to search disk by name parameter
Product: [Retired] oVirt Reporter: Ondra Machacek <omachace>
Component: ovirt-engine-coreAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Ori Gofen <ogofen>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.5CC: acanan, amureini, bugs, ecohen, gklein, juan.hernandez, lsurette, rbalakri, yeylon, ylavi
Target Milestone: ---   
Target Release: 3.5.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Disks are special in that they don't have a "name" attribute like all the other entities do. Instead they have an "alias" attribute with has essentially the same meaning. Consequence: This makes things confusing for users and tools, specially taking into account that when we generate the representation of a disk we already populate the "name" attribute with the value of the "alias" attribute. Fix: Modify the RESTAPI so it accepts "name" in addition to "alias" when searching for a disk. Result: Both "name" and "alias" will be accepted.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-29 06:18:14 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:
Bug Depends On:    
Bug Blocks: 1193058, 1196662, 1197441    

Description Ondra Machacek 2014-12-11 16:31:36 UTC
Description of problem:
Would be good if disk could be searched also by name parameter.
Currently it's possible only by alias paramter.


Steps to Reproduce:
$ curl -v -k -X GET -H "Accept: application/xml" -H "Content-Type: application/xml" https://ovirt-engine/api/disks/?search=name=my_disk

Actual results:
empty list of disks

Expected results:
list of disk with name "my_disk"

Additional info:

Comment 1 Allon Mureinik 2014-12-18 13:19:34 UTC
Juan, shouldn't the search simply be done with the alias instead of the name?

Comment 2 Juan Hernández 2014-12-18 14:19:09 UTC
(In reply to Allon Mureinik from comment #1)
> Juan, shouldn't the search simply be done with the alias instead of the name?

Allowing to query by "name" makes things a bit more consistent, as users are already used to get both "name" and "alias" populated. For example, when retrieving a disk:

  GET /disks/{disk:id}

  <disk href="..." id="...">
   <name>mydisk</name>
   <alias>mydisk</alias>
   ...
  </disk>

Both "name" and "alias" are populated with the same value. Same when adding or updating a disk: both "name" and "alias" are accepted.

Anyhow this is just a little convenience. As you suggest the caller can always use the "alias". Feel free to close if you think it isn't relevant.

In the future I think that what should be deprecated is "alias", not "name", as almost all the entities have a "name", and only disks have an "alias". This irregularity has already caused bugs in the SDKs and the CLI.

Comment 3 Allon Mureinik 2014-12-21 11:44:49 UTC
Fair enough - let's just solve this, especially since the patch is already posted, and seems pretty trivial.

Comment 4 Eyal Edri 2015-02-26 12:32:39 UTC
this ovirt bug was fixed during 3.5.1 cycle and is included in the build, and therefore should be verified.

Comment 5 Ori Gofen 2015-03-22 11:11:41 UTC
verified on 14.1

Comment 6 Allon Mureinik 2015-03-29 18:12:50 UTC
Juan, can you provide some doctext for this bz please?

Comment 7 Eyal Edri 2015-04-29 06:18:14 UTC
ovirt 3.5.2 was GA'd. closing current release.