Bug 1136061 - updating SPM level for host using ovirt-shell fails due to wrong expected value type
Summary: updating SPM level for host using ovirt-shell fails due to wrong expected val...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-api
Version: 3.5
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 3.6.0
Assignee: Juan Hernández
QA Contact: Petr Matyáš
URL:
Whiteboard: infra
: 1146447 (view as bug list)
Depends On:
Blocks: 1146457
TreeView+ depends on / blocked
 
Reported: 2014-09-01 14:41 UTC by sefi litmanovich
Modified: 2016-02-10 19:32 UTC (History)
8 users (show)

Fixed In Version: 3.6.0-12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-04 11:43:18 UTC
oVirt Team: Infra
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 32274 0 master MERGED restapi: Replace "storage_manager" with "spm" Never
oVirt gerrit 45666 0 master MERGED restapi: Populate correctly host.spm Never
oVirt gerrit 45790 0 ovirt-engine-3.6 MERGED restapi: Populate correctly host.spm Never

Description sefi litmanovich 2014-09-01 14:41:31 UTC
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.

Comment 1 Juan Hernández 2014-09-01 15:34:23 UTC
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".

Comment 2 Juan Hernández 2014-09-01 15:50:59 UTC
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.

Comment 3 Juan Hernández 2014-09-01 17:59:13 UTC
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

Comment 4 Juan Hernández 2014-10-16 16:53:19 UTC
*** Bug 1146447 has been marked as a duplicate of this bug. ***

Comment 5 Antonin Pagac 2015-04-29 10:39:22 UTC
Verified in build 3.6.0-1

update host myhost --spm-priority 2

spm-priority             : 2
storage_manager-priority : 2

Comment 6 Juan Hernández 2015-09-02 13:43:17 UTC
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?

Comment 7 Ilanit Stein 2015-09-10 12:24:21 UTC
Moving the bug back to assigned, per comment 6

Comment 8 Sandro Bonazzola 2015-11-04 11:43:18 UTC
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.


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