[Engine-devel] Fwd: storagedomain status via API

Ryan Harper ryanh at us.ibm.com
Mon Aug 27 14:41:20 UTC 2012


* Michael Pasternak <mpastern at redhat.com> [2012-08-27 09:24]:
> 
> 
> Hi Ryan,
> 

He Michael,

> SD status available only in datacenter context [1], as some of domains
> may be shared between datacenters, i.e:
> 
> dc = api.datacenters.get(name="xxx")
> sd = dc.storagedomains.get(name="images-cluster1")
> sd.status
> 
> [1] except of 'unatached' domains.

Right, this does make checking the state/status of a storage domain
programtically troublesome.

I can get a list of all storagedomains, but only some of them will have.
the 'status' attribute.  If it doesn't have the status attribute, then I 
need to enumerate all of the datacenters, and for each datacenter, I can
list the storage domains, and check the status there.

Any reason the status of each storagedomain can't be present under
api/storagedomains?


Also, any tips on deleting 'unattached' domains via the python bindings?

>>> iso.delete()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 3180, in delete
    body=ParseHelper.toXml(storagedomain))
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 111, in delete
    return self.request('DELETE', url, body, headers)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 128, in request
    last=last)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 154, in __doRequest
    raise RequestError, response
ovirtsdk.infrastructure.errors.RequestError: 
status: 400
reason: Bad Request
detail: StorageDomain [host.id|name] required for remove


> 
> On 08/27/2012 05:11 PM, Itamar Heim wrote:
> > 
> > 
> > 
> > -------- Original Message --------
> > Subject: [Engine-devel] storagedomain status via API
> > Date: Mon, 27 Aug 2012 08:36:49 -0500
> > From: Ryan Harper <ryanh at us.ibm.com>
> > To: engine-devel at ovirt.org
> > 
> > Should all created storage domains have 'status' in the API?  Below, I've got one active NFS data domain, and a second ISO domain defined, but not activated.  the <status>
> > element is only available for the the ISO domain.
> > 
> > I'd really like a way to enumerate the storage domains, and check whether a domain is OK or not.
> > 
> > 
> > via python shell ovirt-sdk:
> >>>> iso = api.storagedomains.get(name='isos-20120614')
> >>>> iso.name
> > 'isos-20120614'
> >>>> iso.status.state
> > 'unattached'
> >>>> sd = api.storagedomains.get(name='images-cluster1')
> >>>> sd.name
> > 'images-cluster1'
> >>>> sd.status.state
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > AttributeError: 'NoneType' object has no attribute 'state'
> > 
> > 
> > Refrence XML via https://enginehost/api/storagedomains/
> > 
> > <storage_domains>
> > <storage_domain href="/api/storagedomains/73c7f296-6dac-4bc3-95c1-f0d88a1db7ad" id="73c7f296-6dac-4bc3-95c1-f0d88a1db7ad">
> > <name>images-cluster1</name>
> > <link href="/api/storagedomains/73c7f296-6dac-4bc3-95c1-f0d88a1db7ad/permissions" rel="permissions"/>
> > <type>data</type>
> > <master>true</master>
> > <storage>
> > <type>nfs</type>
> > <address>ichigo-dom209.phx.austin.ibm.com</address>
> > <path>/images-cluster1</path>
> > </storage>
> > <available>6442450944</available>
> > <used>39728447488</used>
> > <committed>0</committed>
> > <storage_format>v1</storage_format>
> > </storage_domain>
> > <storage_domain href="/api/storagedomains/723c254e-7585-4c33-b8d1-cb88a2245d7d" id="723c254e-7585-4c33-b8d1-cb88a2245d7d">
> > <name>isos-20120614</name>
> > <link href="/api/storagedomains/723c254e-7585-4c33-b8d1-cb88a2245d7d/permissions" rel="permissions"/>
> > <link href="/api/storagedomains/723c254e-7585-4c33-b8d1-cb88a2245d7d/files" rel="files"/>
> > <type>iso</type>
> > <status>
> > <state>unattached</state>
> > </status>
> > <master>false</master>
> > <storage>
> > <type>nfs</type>
> > <address>ichigo-dom209.phx.austin.ibm.com</address>
> > <path>/iso-cluster1</path>
> > </storage>
> > <available>6442450944</available>
> > <used>39728447488</used>
> > <committed>0</committed>
> > <storage_format>v1</storage_format>
> > </storage_domain>
> > </storage_domains>
> > 
> > 
> 
> 
> -- 
> 
> Michael Pasternak
> RedHat, ENG-Virtualization R&D

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh at us.ibm.com




More information about the Engine-devel mailing list