Re: [Users] Query regarding storagedomins

2013-04-07 Thread Michael Pasternak

Right, links in sdk entities are used only for convenient tracking of objects 
in api,
sdk itself abstracts HTTP internals, and expose decorators for 
collections/entities
where every collection decorator has list()/get()/add()/etc. methods for 
listing/querying/creating
objects and entity's decorator has methods like update()/delete()/actions etc.

On 04/05/2013 08:00 AM, Romil Gupta wrote:
 Hi ,
 
 Here is the sample code :
 
 sd =api.datacenters.get(id = datacenter_id).storagedomains.list()
   for s in sd:
   if(s.get_master()):
   disk_used =s.get_used() / (1024*1024*1024)
   disk_available = s.get_available() / (1024*1024*1024)
   print disk_used
   print disk_available
 
 
 On Fri, Apr 5, 2013 at 2:04 AM, Gianluca Cecchi gianluca.cec...@gmail.com 
 mailto:gianluca.cec...@gmail.com wrote:
 
 On Thu, Apr 4, 2013 at 9:35 PM, Romil Gupta wrote:
  I solved it by myself , pls ignore this mail :)
 
 Would you like to share it?
 Thanks,
 Gianluca
 
 
 
 
 -- 
 *Thanks  Regards,*
 *Romil Gupta
 M.Tech (CSE), Manipal
 Intern@ HP ISO,Bangalore
 Contact No. : 8880414133*


-- 

Michael Pasternak
RedHat, ENG-Virtualization RD
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Query regarding storagedomins

2013-04-04 Thread Romil Gupta
Hi ,

*I want to fetch the storagedomains details based on the datacenter id
using ovirt-engine-sdk-3.2.0.2-1.*

Datacenter details:

data_centers
data_center id=e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3
href=/api/datacenters/e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3
namedatacenter1/name
description/
link rel=storagedomains
href=/api/datacenters/e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3/storagedomains/
link rel=permissions
href=/api/datacenters/e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3/permissions/
/data_center

data_center id=347748d0-b72b-439f-bb2b-bd5c82041158
href=/api/datacenters/347748d0-b72b-439f-bb2b-bd5c82041158
nameDefault/name
description/
link rel=storagedomains
href=/api/datacenters/347748d0-b72b-439f-bb2b-bd5c82041158/storagedomains/
link rel=permissions
href=/api/datacenters/347748d0-b72b-439f-bb2b-bd5c82041158/permissions/
/data_center
/data_centers

I want to know how I could get the storagedomains details using the above
xml ?

*_session = API(url=rhevm_uri, username=rhevm_username,
password=rhevm_password, insecure=True)
*
*print Connected to RHEVM Successful*
*datacenters = _session.datacenters.list()*
*for dc in datacenters:*
*   print dc.name*
*   print dc.id*
*   links = dc.link*
*   for l in links:*
*  print l.rel*
*  print l.href*
*but this wont give any storagedomain details :(*



I tried this :
storages = _session.storagedomains.list()
for storage in storages:
print storage.name

storage_domains
storage_domain id=e3e3b0cd-48a4-4bb8-a75b-07813f2c165e
href=/api/storagedomains/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e
namerhevmiso/name
link rel=permissions
href=/api/storagedomains/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e/permissions/
link rel=files
href=/api/storagedomains/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e/files/
typeiso/type
masterfalse/master
storage
typenfs/type
address*.*.*.*/address
path/iso/rhevmisonfs/path
/storage
available767725404160/available
used94489280512/used
committed0/committed
storage_formatv1/storage_format
/storage_domain
storage_domain id=baa46f57-13e0-4159-ace1-f04e61e1e937
href=/api/storagedomains/baa46f57-13e0-4159-ace1-f04e61e1e937
namerhevmVMdata/name
link rel=permissions
href=/api/storagedomains/baa46f57-13e0-4159-ace1-f04e61e1e937/permissions/
link rel=files
href=/api/storagedomains/baa46f57-13e0-4159-ace1-f04e61e1e937/files/
typedata/type
mastertrue/master
storage
typenfs/type
address*.*.*.*/address
path/iso/rhevmnfs/path
/storage
available767725404160/available
used94489280512/used
committed100931731456/committed
storage_formatv1/storage_format
/storage_domain
/storage_domains

but it wont contains datacenter ID :(

help me out !


-- 
*Thanks  Regards,*
*Romil Gupta
*
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Query regarding storagedomins

2013-04-04 Thread Romil Gupta
I solved it by myself , pls ignore this mail :)


On Thu, Apr 4, 2013 at 8:30 PM, Romil Gupta romilgupt...@gmail.com wrote:

 Hi ,

 *I want to fetch the storagedomains details based on the datacenter id
 using ovirt-engine-sdk-3.2.0.2-1.*

 Datacenter details:

 data_centers

 data_center id=e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3 
 href=/api/datacenters/e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3
 namedatacenter1/name
 description/

 link rel=storagedomains 
 href=/api/datacenters/e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3/storagedomains/

 link rel=permissions 
 href=/api/datacenters/e1165cdf-2c42-48a9-87ca-5c3f5cfa8fb3/permissions/
 /data_center


 data_center id=347748d0-b72b-439f-bb2b-bd5c82041158 
 href=/api/datacenters/347748d0-b72b-439f-bb2b-bd5c82041158
 nameDefault/name
 description/

 link rel=storagedomains 
 href=/api/datacenters/347748d0-b72b-439f-bb2b-bd5c82041158/storagedomains/

 link rel=permissions 
 href=/api/datacenters/347748d0-b72b-439f-bb2b-bd5c82041158/permissions/
 /data_center
 /data_centers

 I want to know how I could get the storagedomains details using the above
 xml ?

 *_session = API(url=rhevm_uri, username=rhevm_username,
 password=rhevm_password, insecure=True)
 *
 *print Connected to RHEVM Successful*
 *datacenters = _session.datacenters.list()*
 *for dc in datacenters:*
 *   print dc.name*
 *   print dc.id*
 *   links = dc.link*
 *   for l in links:*
 *  print l.rel*
 *  print l.href*
 *but this wont give any storagedomain details :(*



 I tried this :
 storages = _session.storagedomains.list()
 for storage in storages:
 print storage.name

 storage_domains

 storage_domain id=e3e3b0cd-48a4-4bb8-a75b-07813f2c165e 
 href=/api/storagedomains/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e
 namerhevmiso/name

 link rel=permissions 
 href=/api/storagedomains/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e/permissions/

 link rel=files 
 href=/api/storagedomains/e3e3b0cd-48a4-4bb8-a75b-07813f2c165e/files/
 typeiso/type
 masterfalse/master
 storage
 typenfs/type
 address*.*.*.*/address
 path/iso/rhevmisonfs/path
 /storage
 available767725404160/available
 used94489280512/used
 committed0/committed
 storage_formatv1/storage_format
 /storage_domain

 storage_domain id=baa46f57-13e0-4159-ace1-f04e61e1e937 
 href=/api/storagedomains/baa46f57-13e0-4159-ace1-f04e61e1e937
 namerhevmVMdata/name

 link rel=permissions 
 href=/api/storagedomains/baa46f57-13e0-4159-ace1-f04e61e1e937/permissions/

 link rel=files 
 href=/api/storagedomains/baa46f57-13e0-4159-ace1-f04e61e1e937/files/
 typedata/type
 mastertrue/master
 storage
 typenfs/type
 address*.*.*.*/address
 path/iso/rhevmnfs/path
 /storage
 available767725404160/available
 used94489280512/used
 committed100931731456/committed
 storage_formatv1/storage_format
 /storage_domain
 /storage_domains

 but it wont contains datacenter ID :(

 help me out !


 --
 *Thanks  Regards,*
 *Romil Gupta
 *




-- 
*Thanks  Regards,*
*Romil Gupta
M.Tech (CSE), Manipal
Intern @ HP ISO,Bangalore
Contact No. : 8880414133*
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Query regarding storagedomins

2013-04-04 Thread Gianluca Cecchi
On Thu, Apr 4, 2013 at 9:35 PM, Romil Gupta wrote:
 I solved it by myself , pls ignore this mail :)

Would you like to share it?
Thanks,
Gianluca
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Query regarding storagedomins

2013-04-04 Thread Romil Gupta
Hi ,

Here is the sample code :

sd =api.datacenters.get(id = datacenter_id).storagedomains.list()
  for s in sd:
  if(s.get_master()):
  disk_used =s.get_used() / (1024*1024*1024)
  disk_available = s.get_available() / (1024*1024*1024)
  print disk_used
  print disk_available


On Fri, Apr 5, 2013 at 2:04 AM, Gianluca Cecchi
gianluca.cec...@gmail.comwrote:

 On Thu, Apr 4, 2013 at 9:35 PM, Romil Gupta wrote:
  I solved it by myself , pls ignore this mail :)

 Would you like to share it?
 Thanks,
 Gianluca




-- 
*Thanks  Regards,*
*Romil Gupta
M.Tech (CSE), Manipal
Intern@ HP ISO,Bangalore
Contact No. : 8880414133*
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users