Bug 782828 - Cluster with NULL DC cannot be attached to DC
Summary: Cluster with NULL DC cannot be attached to DC
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-sdk
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Michael Pasternak
QA Contact:
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-18 16:07 UTC by Jaroslav Henner
Modified: 2014-12-30 16:54 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-09 07:58:29 UTC
oVirt Team: ---
Embargoed:


Attachments (Terms of Use)

Description Jaroslav Henner 2012-01-18 16:07:31 UTC
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:

Comment 1 Michael Pasternak 2012-01-19 11:15:24 UTC
we does not support this in api, this is why have asked you to reproduce 
this on API and you didn't...

Comment 2 Jaroslav Henner 2012-01-19 14:51:39 UTC
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

Comment 3 Michael Pasternak 2012-02-29 16:36:29 UTC
can you show me xml body that you used?

Comment 4 Michael Pasternak 2012-03-01 08:00:55 UTC
also please add python sdk code

Comment 5 Jaroslav Henner 2012-03-02 13:38:16 UTC
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.

Comment 6 Michael Pasternak 2012-03-04 11:55:54 UTC
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.

Comment 7 Itamar Heim 2012-08-09 07:58:29 UTC
closing ON_QA bugs as oVirt 3.1 was released:
http://www.ovirt.org/get-ovirt/


Note You need to log in before you can comment on or make changes to this bug.