Bug 1149107

Summary: [REGENERATE JAVA SDK] storage_manager element is not validated correctly
Product: Red Hat Enterprise Virtualization Manager Reporter: Juan Hernández <juan.hernandez>
Component: ovirt-engine-sdk-javaAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED ERRATA QA Contact: Ondra Machacek <omachace>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: aberezin, bazulay, ecohen, gklein, iheim, lsurette, omachace, pstehlik, rbalakri, Rhev-m-bugs, sherold, yeylon
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: rhevm-sdk-java-3.5.0.5-2.el6ev Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1146457 Environment:
Last Closed: 2015-02-11 18:11:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1146457    
Bug Blocks: 1156162    
Attachments:
Description Flags
Proposed patch to fix the issue none

Description Juan Hernández 2014-10-03 08:50:28 UTC
+++ This bug was initially created as a clone of Bug #1146457 +++

Description of problem:


Version-Release number of selected component (if applicable):
rhevm-cli-3.5.0.4-1.el6ev.noarch.rpm

How reproducible:
always

Steps to Reproduce:
1. run command:
update host 'hostX' --storage_manager-priority 5

Actual results:
send: 'PUT /api/hosts/a5898cff-8836-4d60-ba85-c3219937beae HTTP/1.1\r\nHost: jenkins-vm-10.scl.lab.tlv.redhat.com\r\nAccept-Encoding: identity\r\nContent-Length: 93\r\nSession-TTL: 3600\r\nPrefer: persistent-auth\r\nCorrelation-Id: hosts_update_508dc25b-9098-4eee\r\nAccept: application/xml\r\nFilter: False\r\ncookie: JSESSIONID=EfGmN01Nlx3gddnOyjeyLCeC\r\nContent-type: application/xml\r\nAuthorization: Basic dXNlcnBvcnRhbDFAcWEubGFiLnRsdi5yZWRoYXQuY29tOjEyMzQ1Ng==\r\n\r\n'
send: '<host id="a5898cff-8836-4d60-ba85-c3219937beae">\n    <storage_manager priority="5"/>\n</host>\n'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Date: Wed, 17 Sep 2014 20:18:34 GMT^M
header: JSESSIONID: EfGmN01Nlx3gddnOyjeyLCeC^M
header: Content-Type: application/xml^M
header: Content-Length: 179^M
header: Vary: Accept-Encoding^M
header: Connection: close^M
^MESC[KESC[?1lESC>ESC[1;31m   ERROR 
  status: 400^M
  reason: Bad Request^M
  detail: Value "" isn't a valid boolean, it should be "true" or "false"
  
ESC[1;m


Expected results:
Update successfully.

Additional info:
Works fine in javasdk.
Worked fine in 3.4 rhevm-cli.

--- Additional comment from Juan Hernández on 2014-09-25 07:05:28 EDT ---

It isn't possible to restore the previous behavior, but we will introduce a new --spm-priority option that will work correctly and with the same meaning.

--- Additional comment from Juan Hernández on 2014-09-25 07:08:35 EDT ---

Note that this needs to be fixed in the engine, then the Python SDK needs to be regenerated.

--- Additional comment from RHEL Product and Program Management on 2014-09-25 07:11:39 EDT ---

This bug report has Keywords: Regression or TestBlocker.

Since no regressions or test blockers are allowed between releases,
it is also being identified as a blocker for this release.

Please resolve ASAP.

Comment 1 Juan Hernández 2014-10-06 09:19:44 UTC
Created attachment 944191 [details]
Proposed patch to fix the issue

Comment 3 Ondra Machacek 2014-10-23 12:11:10 UTC
public static void main(String[] args) throws Exception{
        Api api = new Api(URL, user, password, true, false);
        org.ovirt.engine.sdk.decorators.Host host = api.getHosts().get(host_name);
        System.out.println("Old SPM priority value is: "+ host.getSpm().getPriority());
        SPM spm = new SPM();
        spm.setPriority(5);
        host.setSpm(spm);
        Host h = host.update();
        System.out.println("New SPM priority value is: "+ h.getSpm().getPriority());
        api.shutdown();
    }

# ./run.sh 
Old SPM priority value is: 10
New SPM priority value is: 5

Comment 5 errata-xmlrpc 2015-02-11 18:11:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0184.html