Description of problem: trying to update a host's SPM priority fails with ovirt-shell. the cmd: update host {host_name} --storage_manager-priority 2. returns: status: 400 reason: Bad Request detail: Value "" isn't a valid boolean, it should be "true" or "false" the parameter 'storage_manager-priority' expects a digit and not a boolean. Version-Release number of selected component (if applicable): ovirt-engine-3.5.0-0.0.master.20140821064931.gitb794d66.el6.noarch ovirt-engine-cli-3.5.0.4-1.20140820.git374a657.el6.noarch How reproducible: always Additional info: Problem doesn't occur when using python or java sdk and rest api.
This happens because the "storage_manager" property is defined in the XML schema with both attributes and text content (it is the only property defined in this way): <xs:complexType name="StorageManager"> <xs:simpleContent> <xs:extension base="xs:boolean"> <xs:attribute name="priority" type="xs:int"/> </xs:extension> </xs:simpleContent> </xs:complexType> As a result it is impossible to create a XML document that contains the "priority" attribute but not the text content. When the command "update host myhost --storage_manager-priority 2" is executed it will generate the following XML document: <host> <storage_manager priority="2"/> </host> This isn't correct, as the value of text content is empty instead of a valid boolean, thus the complain from the engine. A correct XML document would look like this: <host> <storage_manager priority="2">true</storage_manager> </host> But the CLI can't invent the the value, as it doesn't have any way to decide if it should be "true" or "false".
The solution to this problem would be to model the "storage_manager" element with nested elements instead of attributes, for example: <xs:complexType name="StorageManager"> <xs:sequence> <xs:element name="enabled" type="xs:boolean" minOccurs="0" maxOccurs="1"/> <xs:element name="priority" type="xs:int" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:complexType> That way the CLI could send values separately. But this breaks backwards compatibility, so it isn't feasible in 3.x.
The proposed solution is to add a new "spm" element that contains the priority and the status as nested elements: <host> <spm> <priority>5</priority> <status> <state>spm</state> </status> </spm> </host> The existing "storage_manager" element will be preserved, but it won't be documented in the RSDL metadata, so the CLI won't see it. Once the proposed patch is merged the Python SDK will need to be regenerated. No change is needed in the CLI, but the command to use will be different: Old: update host myhost --storage_manager-priority 2 New: update host myhost --spm-priority 2
*** Bug 1146447 has been marked as a duplicate of this bug. ***
Verified in build 3.6.0-1 update host myhost --spm-priority 2 spm-priority : 2 storage_manager-priority : 2
I just realized that there is a bug in the implementation of this change. The SPM status isn't reported correctly. This is what we get: <spm> <priority>5</priority> <-- Note the missing "state" </spm> And this is what we should get: <spm> <priority>5</priority> <status> <state>whatever</state> </status> </spm> Can we re-open the bug to handle this?
Moving the bug back to assigned, per comment 6
oVirt 3.6.0 has been released on November 4th, 2015 and should fix this issue. If problems still persist, please open a new BZ and reference this one.