[Engine-devel] storagedomain status via API

Michael Pasternak mpastern at redhat.com
Mon Aug 27 14:43:57 UTC 2012


Ryan,

each sdk method is well documented, if you'll take a look
on .delete().__doc__ it's:

        @param storagedomain.host.id|name: string
        [@param async: boolean (true|false)]
        [@param correlation_id: any string]

and that's exactly what error says,
-> StorageDomain [host.id|name] required for remove

do:

sd = api.storagedomains.get(name="xxx")
sd.delete(storagedomain=params.StorageDomain(host=params.Host(id="yyy")))


On 08/27/2012 05:28 PM, Ryan Harper wrote:
> * Ryan Harper <ryanh at us.ibm.com> [2012-08-27 08:39]:
>> 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.
> 
> And while I'm here... trying to delete an unattached storage domain:
> 
>>>> iso
> <ovirtsdk.infrastructure.brokers.StorageDomain object at 0x1d94f90>
>>>> 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
> 
> 
> 
>>
>>
>> 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>
>>
>>
>> -- 
>> Ryan Harper
>> Software Engineer; Linux Technology Center
>> IBM Corp., Austin, Tx
>> ryanh at us.ibm.com
>>
>> _______________________________________________
>> Engine-devel mailing list
>> Engine-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/engine-devel
> 


-- 

Michael Pasternak
RedHat, ENG-Virtualization R&D



More information about the Engine-devel mailing list