Bug 1077678

Summary: Inconsistency in Snapshot collections links and Snapshot object
Product: Red Hat Enterprise Virtualization Manager Reporter: Raz Tamir <ratamir>
Component: ovirt-engine-restapiAssignee: Liron Aravot <laravot>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: high Docs Contact:
Priority: medium    
Version: 3.4.0CC: acanan, amureini, bazulay, gklein, iheim, juan.hernandez, laravot, mishka8520, nlevinki, oliel, oramraz, rbalakri, Rhev-m-bugs, scohen, tnisan, yeylon
Target Milestone: ---Keywords: AutomationBlocker
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: org.ovirt.engine-root-3.5.0-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-16 19:11:10 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: 1142923, 1156165    

Description Raz Tamir 2014-03-18 12:04:14 UTC
Description of problem:
The <snapshot> XML that you receive from the API is currently looks like:

<snapshot href="/api/vms/086b5092-71d6-4cfa-b73d-d32bff2890cb/snapshots/93d8fc6e-bdcf-4726-b1c5-8c5c24f8a783" id="93d8fc6e-bdcf-4726-b1c5-8c5c24f8a783">
  <description>1</description>
  <type>regular</type>
  <vm id="086b5092-71d6-4cfa-b73d-d32bff2890cb">
     <name>elad2-3</name>
     <description/>
     <link href="/api/vms/086b5092-71d6-4cfa-b73d-d32bff2890cb/snapshots/93d8fc6e-bdcf-4726-b1c5-8c5c24f8a783/cdroms" rel="cdroms"/>
     <link href="/api/vms/086b5092-71d6-4cfa-b73d-d32bff2890cb/snapshots/93d8fc6e-bdcf-4726-b1c5-8c5c24f8a783/disks" rel="disks"/>
     <link href="/api/vms/086b5092-71d6-4cfa-b73d-d32bff2890cb/snapshots/93d8fc6e-bdcf-4726-b1c5-8c5c24f8a783/nics" rel="nics"/>
     <type>server</type>
     ... *more stuff not relevant for this bug*
  </vm>
</snapshot>

The links points directly with the URL to the collections (i.e. cdroms, disks, nics) being under the snapshot object, which is not consistence with the xml object which is <snapshot>....<vm><link ....=/collection/></vm></snapshot>.


Version-Release number of selected component (if applicable):
rhevm-3.4.0-0.3.master.el6ev.noarch
rhevm-restapi-3.4.0-0.3.master.el6ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a snapshot of vm with disk
2. from REST api go to: /api/vms/<vm_id>/snapshots/<snapshot_id>/
3. The links are located under <vm> ... </vm>

Actual results:
The links are found under vm: <snapshot>....<vm><link ....=/collection/></vm></snapshot>.
And a link to disks collection (for example) is:
<link href="/api/vms/086b5092-71d6-4cfa-b73d-d32bff2890cb/snapshots/93d8fc6e-bdcf-4726-b1c5-8c5c24f8a783/disks" rel="disks"/>
which is not consistence with the xml object

Expected results:
All links should be directly under snapshot and not under vm

Additional info:

Comment 1 Allon Mureinik 2014-03-18 22:54:32 UTC
Liron, any thoughts on the matter?

Comment 2 Michael Pasternak 2014-06-23 13:05:42 UTC
i don't think this is a bug, URI structure does not have to be 1:1 with
object representation,

(also there is no much sense in mentioning vm in url once again cause it already represented by 086b5092-71d6-4cfa-b73d-d32bff2890cb identifier)

as long as representation self descriptive and let accessing related resources
via links it holds, it's okay from the REST PoV,

so bottom line IMHO it's not a bug.

Comment 3 Allon Mureinik 2014-06-23 22:15:28 UTC
Ori/Michael - up to you guys.
Please either close this bug or move forward with the proposed patch.

Thanks!

Comment 4 Allon Mureinik 2014-07-10 18:30:16 UTC
What's the verdict on this one?

Comment 5 Raz Tamir 2014-07-17 14:36:24 UTC
Verified on:
ovirt-engine-3.5.0-0.0.master.20140715172116.git4687dc1.el6.noarch
ovirt-engine-restapi-3.5.0-0.0.master.20140715172116.git4687dc1.el6.noarch

Comment 7 Allon Mureinik 2015-02-16 19:11:10 UTC
RHEV-M 3.5.0 has been released, closing this bug.

Comment 8 Allon Mureinik 2015-02-16 19:11:23 UTC
RHEV-M 3.5.0 has been released, closing this bug.