[Engine-devel] storagedomain status via API

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> -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com

* Ryan Harper <ryanh@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@us.ibm.com
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
-- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com

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@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@us.ibm.com
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
-- Michael Pasternak RedHat, ENG-Virtualization R&D

* Michael Pasternak <mpastern@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]
Thanks for the tip on the __doc__ 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@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@us.ibm.com
_______________________________________________ Engine-devel mailing list Engine-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-devel
--
Michael Pasternak RedHat, ENG-Virtualization R&D
-- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com

* Michael Pasternak <mpastern@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: sd.delete(storagedomain=params.StorageDomain(host=api.hosts.get('hostname here'))) Thanks again, Ryan -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com

On 08/27/2012 10:30 PM, Ryan Harper wrote:
* Michael Pasternak <mpastern@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') ?
sd.delete(storagedomain=params.StorageDomain(host=api.hosts.get('hostname here')))
Thanks again, Ryan
-- Michael Pasternak RedHat, ENG-Virtualization R&D

* Michael Pasternak <mpastern@redhat.com> [2012-08-28 01:04]:
On 08/27/2012 10:30 PM, Ryan Harper wrote:
* Michael Pasternak <mpastern@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@us.ibm.com

On 08/28/2012 09:56 PM, Ryan Harper wrote:
* Michael Pasternak <mpastern@redhat.com> [2012-08-28 01:04]:
On 08/27/2012 10:30 PM, Ryan Harper wrote:
* Michael Pasternak <mpastern@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)))
well, this is your problem: you trying to set host.name in to 'id' property ^, it should be => sd.delete(storagedomain=params.StorageDomain(host=params.Host(id=host.id))) the error on the server side, is 'name' str. to UUID conversion failure, though response error not informative enough - i'll address this.
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
-- Michael Pasternak RedHat, ENG-Virtualization R&D
participants (2)
-
Michael Pasternak
-
Ryan Harper