Bug 1122546

Summary: Update API fails in SDK & CLI for several entities
Product: [Retired] oVirt Reporter: Nelly Credi <ncredi>
Component: ovirt-engine-sdkAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 3.5CC: ecohen, gklein, iheim, istein, lsvaty, mishka8520, ncredi, ogofen, oourfali, rbalakri, yeylon
Target Milestone: ---Keywords: AutomationBlocker, Regression
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Infra
Fixed In Version: ovirt-engine-sdk-python-3.5.0.4-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 12:21:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1073943, 1088914, 1110830    

Description Nelly Credi 2014-07-23 13:26:02 UTC
Description of problem:

Update data center name fails in SDK & CLI

Version-Release number of selected component (if applicable):
3.5

How reproducible:
100%

Steps to Reproduce:
from ovirtsdk.xml import params
from ovirtsdk.api import API
api =  API(url='https://XXX/api', username='user@domain', password='pass', insecure=True)

dc = api.datacenters.get(name='dc')
dc.set_name('dcUpdated')
foo = dc.update()

Actual results:

DC does not get updated. 
There are no errors in engine\server log only:
2014-07-23 16:21:13,123 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp--127.0.0.1-8702-9) [60b4a2fc] Correlation ID: 60b4a2fc, Job ID: 79d0fa9a-d0bb-4b9a-9a7c-19fd7ca96e87, Call Stack: null, Custom Event ID: -1, Message: Data Center dc was updated by admin


Expected results:

name & description should get updated


Additional info:

Comment 1 Nelly Credi 2014-07-23 13:49:54 UTC
Updating description:
Seems that all update commands fail - datacenter, cluster & storage domain

Comment 2 Michael Pasternak 2014-07-27 14:28:33 UTC
Hey Nelly,

(In reply to Nelly Credi from comment #0)
> Description of problem:
> 
> Update data center name fails in SDK & CLI
> 
> Version-Release number of selected component (if applicable):
> 3.5
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> from ovirtsdk.xml import params
> from ovirtsdk.api import API
> api =  API(url='https://XXX/api', username='user@domain', password='pass',
> insecure=True)
> 
> dc = api.datacenters.get(name='dc')
> dc.set_name('dcUpdated')
> foo = dc.update()

the workaround is simple, just use attribute rather than setter,
i.e: dc.name ='dcUpdated', 

can't recall, but IIRC set_x() had issues cause it generated by generateDS
and was spiking our __setattr__ procedure,

anyway this should not block from 3.5 to go out.

> 
> Actual results:
> 
> DC does not get updated. 
> There are no errors in engine\server log only:
> 2014-07-23 16:21:13,123 INFO 
> [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector]
> (ajp--127.0.0.1-8702-9) [60b4a2fc] Correlation ID: 60b4a2fc, Job ID:
> 79d0fa9a-d0bb-4b9a-9a7c-19fd7ca96e87, Call Stack: null, Custom Event ID: -1,
> Message: Data Center dc was updated by admin
> 
> 
> Expected results:
> 
> name & description should get updated
> 
> 
> Additional info:

Comment 3 Michael Pasternak 2014-07-27 17:46:37 UTC
Nelly,

I simulated issue you've reported [1] and got the following
output [2], e.g <name> property does send to server by sdk,
checking the log, i noticed that this issue has been addressed already at
sdk-3.5.0.1 by [3],

please make sure you updated to this version, and if
you still can reproduce it, please run sdk in debug mode (passing 
debug=true in constructor) and attach the output.

[1]

dc = DataCenter(params.DataCenter(),Context())
dc.set_name('dcUpdated')
print ParseHelper.toXml(dc)

[2]

<data_center>
    <name>dcUpdated</name>
</data_center>

[3] 

http://gerrit.ovirt.org/#/c/28366/

Comment 4 Nelly Credi 2014-07-29 10:37:07 UTC
Michael,

We are running sdk-3.5.0.2. below reproduced in debug mode:

In [7]: dc = api.datacenters.get(name='dc')
send: 'GET /api/datacenters?search=name%3Ddc HTTP/1.1\r\nHost: dhcp163-100.scl.lab.tlv.redhat.com\r\nAccept-Encoding: identity\r\nFilter: False\r\ncookie: JSESSIONID=LOSSUdqOexROsythgp2hk8Ql.undefined\r\nPrefer: persistent-auth\r\nContent-type: application/xml\r\nAccept: application/xml\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Tue, 29 Jul 2014 10:29:44 GMT
header: Pragma: No-cache
header: Cache-Control: no-cache
header: Expires: Thu, 01 Jan 1970 02:00:00 IST
header: JSESSIONID: LOSSUdqOexROsythgp2hk8Ql.undefined
header: Content-Type: application/xml
header: Content-Length: 1016
header: Vary: Accept-Encoding
header: Connection: close
body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data_centers>
    <data_center href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318" id="ffd91e81-49ff-4d04-a127-0e82ebda8318">
        <name>dc</name>
        <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/storagedomains" rel="storagedomains"/>
        <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/clusters" rel="clusters"/>
        <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/networks" rel="networks"/>
        <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/permissions" rel="permissions"/>
        <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/quotas" rel="quotas"/>
        <local>false</local>
        <version major="3" minor="5"/>
        <supported_versions>
            <version major="3" minor="5"/>
        </supported_versions>
        <status>
            <state>uninitialized</state>
        </status>
    </data_center>
</data_centers>


In [8]: dc.set_name('dcUpdated')

In [9]: foo = dc.update()
send: 'PUT /api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318 HTTP/1.1\r\nHost: dhcp163-100.scl.lab.tlv.redhat.com\r\nAccept-Encoding: identity\r\nContent-Length: 865\r\nFilter: False\r\nPrefer: persistent-auth\r\ncookie: JSESSIONID=LOSSUdqOexROsythgp2hk8Ql.undefined\r\nContent-type: application/xml\r\nAccept: application/xml\r\n\r\n'
send: '<data_center href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318" id="ffd91e81-49ff-4d04-a127-0e82ebda8318">\n    <name>dc</name>\n    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/storagedomains" rel="storagedomains"/>\n    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/clusters" rel="clusters"/>\n    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/networks" rel="networks"/>\n    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/permissions" rel="permissions"/>\n    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/quotas" rel="quotas"/>\n    <local>false</local>\n    <version major="3" minor="5"/>\n    <supported_versions>\n        <version major="3" minor="5"/>\n    </supported_versions>\n    <status>\n        <state>uninitialized</state>\n    </status>\n</data_center>\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Tue, 29 Jul 2014 10:30:06 GMT
header: Pragma: No-cache
header: Cache-Control: no-cache
header: Expires: Thu, 01 Jan 1970 02:00:00 IST
header: JSESSIONID: LOSSUdqOexROsythgp2hk8Ql.undefined
header: Content-Type: application/xml
header: Content-Length: 921
header: Vary: Accept-Encoding
header: Connection: close
body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data_center href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318" id="ffd91e81-49ff-4d04-a127-0e82ebda8318">
    <name>dc</name>
    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/storagedomains" rel="storagedomains"/>
    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/clusters" rel="clusters"/>
    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/networks" rel="networks"/>
    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/permissions" rel="permissions"/>
    <link href="/api/datacenters/ffd91e81-49ff-4d04-a127-0e82ebda8318/quotas" rel="quotas"/>
    <local>false</local>
    <version major="3" minor="5"/>
    <supported_versions>
        <version major="3" minor="5"/>
    </supported_versions>
    <status>
        <state>uninitialized</state>
    </status>
</data_center>

Comment 5 Ravi Nori 2014-08-11 16:35:21 UTC
*** Bug 1124795 has been marked as a duplicate of this bug. ***

Comment 6 Michal Skrivanek 2014-08-12 07:16:42 UTC
*** Bug 1124796 has been marked as a duplicate of this bug. ***

Comment 7 Juan Hernández 2014-08-20 08:17:04 UTC
*** Bug 1129246 has been marked as a duplicate of this bug. ***

Comment 8 Juan Hernández 2014-08-20 17:58:07 UTC
*** Bug 1129641 has been marked as a duplicate of this bug. ***

Comment 9 Nelly Credi 2014-08-24 11:57:17 UTC
verified in ovirt-3.5.0_rc1.1

Comment 10 Juan Hernández 2014-09-08 11:31:04 UTC
*** Bug 1138983 has been marked as a duplicate of this bug. ***

Comment 11 Sandro Bonazzola 2014-10-17 12:21:26 UTC
oVirt 3.5 has been released and should include the fix for this issue.