Description of problem: Having a cluster not attached to any DC (happens after DC remove), I cannot set the dc using SDK. With XML it works. Version-Release number of selected component (if applicable): 95c1bbccf1c6ab93eeece287c6f5c7b3f334c656 How reproducible: allways Steps to Reproduce: In [95]: cl=apicko.clusters.get(name="mycl") In [96]: dc=apicko.datacenters.get() In [97]: cl.name Out[97]: 'mycl' In [98]: dc.name Out[98]: 'mydc' In [99]: cl.set_data_center(dc) In [100]: cl.data_center Out[100]:<ovirtsdk.xml.params.DataCenter at 0x1eec890> In [101]: cl.data_center.name Out[101]: 'mydc' In [102]: updcl=cl.update() ##### This seems to fail silently. In [103]: updcl.data_center ##### None! In [104]: cl=apicko.clusters.get(name="mycl") In [105]: cl.data_center.name --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/jhenner/work/rest-api-tests/<ipython-input-105-f9b98f9cdd31> in<module>() ----> 1 cl.data_center.name AttributeError: 'NoneType' object has no attribute 'name' Actual results: Expected results: Additional info:
we does not support this in api, this is why have asked you to reproduce this on API and you didn't...
I did. It worked for me using bare hand and xml, and so I opened a bug. And I informed you about that: On 01/18/2012 08:12 AM, Michael Pasternak wrote: - hide quoted text - > On 01/17/2012 11:52 PM, Jaroslav Henner wrote: >> On 01/17/2012 09:53 PM, Michael Pasternak wrote: >>> no, if it's true, - this is backend bug ...., >>> please reproduce with the API and open BZ for BE if its works. >> My apology, it is not possible to switch cluster between datacenters, at least in webdmin, but it is possible to set datacenter of cluster with NULL datacenter. This makes >> some sense to me that there is such possibility. >> >> This is not possible with sdk. So I think bug is on SDK. > > > J. having cluster in air without any Dc seems logical to you? It happens when you delete DC with some clusters and it probably is the way how they let the clusters survive DataCenter remove. I just asked mlipchuk about NULL DC in Cl and he agree it is by design. There is also some bug he mentioned https://bugzilla.redhat.com/show_bug.cgi?id=754053
can you show me xml body that you used?
also please add python sdk code
Having <cluster id="2f459a7c-6469-11e1-a7ff-001a4a013f09" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09"> <name>RestCluster1</name><link rel="networks" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09/networks"/> <link rel="permissions" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09/permissions"/> <cpu id="Intel Conroe Family"/> <memory_policy> <overcommit percent="200"/> <transparent_hugepages> <enabled>true</enabled> </transparent_hugepages> </memory_policy> <scheduling_policy/> <version minor="0" major="3"/> <error_handling> <on_error>migrate</on_error> </error_handling> </cluster> I can send PUT <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <cluster id="2f459a7c-6469-11e1-a7ff-001a4a013f09" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09"> <data_center id="38ceeaba-00a4-4439-be57-37babad42668" href="/api/datacenters/38ceeaba-00a4-4439-be57-37babad42668"/> </cluster> Returning: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <cluster id="2f459a7c-6469-11e1-a7ff-001a4a013f09" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09"> <name>RestCluster1</name> <link rel="networks" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09/networks"/> <link rel="permissions" href="/api/clusters/2f459a7c-6469-11e1-a7ff-001a4a013f09/permissions"/> <cpu id="Intel Conroe Family"/> <data_center id="38ceeaba-00a4-4439-be57-37babad42668" href="/api/datacenters/38ceeaba-00a4-4439-be57-37babad42668"/> <memory_policy> <overcommit percent="200"/> <transparent_hugepages> <enabled>true</enabled> </transparent_hugepages> </memory_policy> <scheduling_policy/> <version minor="0" major="3"/> <error_handling> <on_error>migrate</on_error> </error_handling> </cluster> You have the sdk code right in the first Description comment.
fixed in 1.5-3, notice: datacenter is link in cluster, so code like: "[101]: cl.data_center.name" have no meaning and will always return 'None', compare by id instead.
closing ON_QA bugs as oVirt 3.1 was released: http://www.ovirt.org/get-ovirt/