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

Bug 949546

Summary: [restapi] Requesting templates of a storage domain returns an empty list
Product: Red Hat Enterprise Virtualization Manager Reporter: Gadi Ickowicz <gickowic>
Component: ovirt-engine-restapiAssignee: Ravi Nori <rnori>
Status: CLOSED NOTABUG QA Contact: Gadi Ickowicz <gickowic>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.2.0CC: acathrow, dyasny, hateya, iheim, mpastern, nlevinki, oramraz, Rhev-m-bugs, ykaul
Target Milestone: ---   
Target Release: 3.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-09 08:41:30 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 Gadi Ickowicz 2013-04-08 12:49:32 UTC
Description of problem:
Requesting all templates on a specific storage domain (/api/storagedomains/{storagedomain:id}/templates) returns an empty list even if there are templates on the storage domain

How reproducible:
100%

Steps to Reproduce:
1. Create a template from a vm
2. Try to access it at /api/storagedomains/{storagedomain:id}/templates
  
Actual results:
Empty list is returned

Expected results:
List of templates on the storage domain should be returned

Comment 1 Oded Ramraz 2013-04-08 12:55:00 UTC
I have few templates under my storage domain , can't list them as well : 

[RHEVM shell (connected)]# list templates --storagedomain-identifier bd63b51c-de2b-42b3-b5e7-1dbbdf25b5e6

Comment 2 Itamar Heim 2013-04-08 12:58:47 UTC
hmmm, templates nor VMs reside in a storage domain, rather they have disks on the SD.

Comment 3 Oded Ramraz 2013-04-08 13:00:16 UTC
On the UI we have templates view per data domain , we have same queries in CLI as well .

(In reply to comment #2)
> hmmm, templates nor VMs reside in a storage domain, rather they have disks
> on the SD.

Comment 4 Michael Pasternak 2013-04-08 13:42:59 UTC
what type is your SD? if it's not a import/export domain, you have no
vm/templates there ...

Comment 5 Gadi Ickowicz 2013-04-08 16:26:59 UTC
(In reply to comment #4)
> what type is your SD? if it's not a import/export domain, you have no
> vm/templates there ...

The domain is a data domain. However it makes sense to list templates that are part of a storage domain due to the following scenario (for example):

User wants to remove a storage domain, but the storage domain has a template (with disks) on it. A query to /api/storagedomains/{storagedomain:id}/disks shows the disks. Trying to remove these however will fail due to the disks being linked to the template. In this case a user should be able to query /api/storagedomains/{storagedomain:id}/templates to get all the templates on the storage domain to remove them

Comment 6 Michael Pasternak 2013-04-09 08:41:30 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > what type is your SD? if it's not a import/export domain, you have no
> > vm/templates there ...
> 
> The domain is a data domain. However it makes sense to list templates that
> are part of a storage domain due to the following scenario (for example):
> 
> User wants to remove a storage domain, but the storage domain has a template
> (with disks) on it. A query to /api/storagedomains/{storagedomain:id}/disks
> shows the disks. Trying to remove these however will fail due to the disks
> being linked to the template. 

this is not correct, you can remove the disks from SD regardless of template

> In this case a user should be able to query
> /api/storagedomains/{storagedomain:id}/templates to get all the templates on
> the storage domain to remove them

you don't need to remove all templates form the SD, but theirs disks, as template
itself does not resides on the SD, only it's disk/s

import templates is a special use-case where entire template is located on the
SD with all it's metadata as it has to be used on the destination env.

Comment 7 Oded Ramraz 2013-04-09 08:53:14 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > > what type is your SD? if it's not a import/export domain, you have no
> > > vm/templates there ...
> > 
> > The domain is a data domain. However it makes sense to list templates that
> > are part of a storage domain due to the following scenario (for example):
> > 
> > User wants to remove a storage domain, but the storage domain has a template
> > (with disks) on it. A query to /api/storagedomains/{storagedomain:id}/disks
> > shows the disks. Trying to remove these however will fail due to the disks
> > being linked to the template. 
> 
> this is not correct, you can remove the disks from SD regardless of template
> 
> > In this case a user should be able to query
> > /api/storagedomains/{storagedomain:id}/templates to get all the templates on
> > the storage domain to remove them
> 
> you don't need to remove all templates form the SD, but theirs disks, as
> template
> itself does not resides on the SD, only it's disk/s
> 
> import templates is a special use-case where entire template is located on
> the
> SD with all it's metadata as it has to be used on the destination env.


On the UI I can see under data storage domain the top X consuming VM's in the storage domain ( storage wise ) . Can I get the same information in CLI ? We used to have this option in Powershell btw. 
Please advise if we need to open new RFE or reopen this bug for adding this query .

Comment 8 Michael Pasternak 2013-04-09 09:17:29 UTC
you should be able seeing this at [1] using query/matrix parameter in api,
(SDKs/CLIs will inherit this capability automatically), please file RFE against
api on this.

thanks.

[1] /api/storagedomains/xxx/disks