* Michael Pasternak <mpastern(a)redhat.com> [2012-08-28 01:04]:
On 08/27/2012 10:30 PM, Ryan Harper wrote:
> * Michael Pasternak <mpastern(a)redhat.com> [2012-08-27 09:45]:
>>
>> 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")))
>
> This failed with bad request, but this worked:
are you sure about host id? i.e is it was same id as in host fetched by
api.hosts.get('hostname here') ?
[root@ichigo-dom223 ~]# python2.7
Python 2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>> from ovirtsdk.api import API
>> from ovirtsdk.xml import params
>> api = API(url='https://localhost:443/api',
username='admin@internal', password='XXXXXXX')
>> sd = api.storagedomains.get(name='iso-cluster1')
>> sd.name
'iso-cluster1'
>> sd.status.state
'unattached'
>> host =
api.hosts.get('ichigo-dom224.phx.austin.ibm.com')
>> host.name
'ichigo-dom224.phx.austin.ibm.com'
>>
sd.delete(storagedomain=params.StorageDomain(host=params.Host(id=host.name)))
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: 500
reason: Internal Server Error
detail: HTTP Status 500
>>
sd.delete(storagedomain=params.StorageDomain(host=api.hosts.get(host.name)))
''
[root@ichigo-dom223 ~]# cat /etc/issue
Fedora release 17 (Beefy Miracle)
Kernel \r on an \m (\l)
[root@ichigo-dom223 ~]# rpm -qa | grep ovirt-
ovirt-engine-userportal-3.1.0-2.fc17.noarch
ovirt-engine-webadmin-portal-3.1.0-2.fc17.noarch
ovirt-engine-sdk-3.1.0.4-1.fc17.noarch
ovirt-engine-setup-3.1.0-2.fc17.noarch
ovirt-iso-uploader-3.1.0-0.git1841d9.fc17.noarch
ovirt-engine-restapi-3.1.0-2.fc17.noarch
ovirt-engine-3.1.0-2.fc17.noarch
ovirt-engine-backend-3.1.0-2.fc17.noarch
ovirt-image-uploader-3.1.0-0.git9c42c8.fc17.noarch
ovirt-engine-config-3.1.0-2.fc17.noarch
ovirt-engine-genericapi-3.1.0-2.fc17.noarch
ovirt-engine-tools-common-3.1.0-2.fc17.noarch
ovirt-engine-dbscripts-3.1.0-2.fc17.noarch
ovirt-log-collector-3.1.0-0.git10d719.fc17.noarch
ovirt-engine-notification-service-3.1.0-2.fc17.noarch
--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh(a)us.ibm.com