Bug 1071872 - No parameters for Vm_Evenly_distributed cluster policy in REST
Summary: No parameters for Vm_Evenly_distributed cluster policy in REST
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-api
Version: 3.4
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
: 3.5.0
Assignee: Gilad Chaplik
QA Contact: Artyom
URL:
Whiteboard: sla
: 1073764 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-03 11:11 UTC by Artyom
Modified: 2016-02-10 19:42 UTC (History)
13 users (show)

Fixed In Version: ovirt-engine-3.5.0_beta
Clone Of:
Environment:
Last Closed: 2014-10-17 12:31:10 UTC
oVirt Team: SLA
Embargoed:


Attachments (Terms of Use)
screenshot (232.42 KB, image/png)
2014-03-03 11:11 UTC, Artyom
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 27316 0 master MERGED restapi: Implement custom properties using elements Never
oVirt gerrit 28093 0 master MERGED restapi: Introducing Scheduling Policy API Never

Description Artyom 2014-03-03 11:11:52 UTC
Created attachment 869880 [details]
screenshot

Description of problem:
If I change cluster policy to 'Vm_Evenly_distributed' with some parameters, this parameters not appear in REST 

Version-Release number of selected component (if applicable):
ovirt-engine-3.4.0-0.11.beta3.el6.noarch

How reproducible:
Always

Steps to Reproduce: 
1. Change cluster policy to 'Vm_Evenly_distributed' with some parameters
2. Go under engine/api/clusters and found your cluster, see that cluster policy is 'Vm_Evenly_distributed' without any parameters
3.

Actual results:
No parameters in REST for 'Vm_Evenly_distributed' cluster policy

Expected results:
Parameters must appear in REST

Additional info:

Comment 1 Juan Hernández 2014-03-03 11:51:38 UTC
Artyom, what version of the engine are you using exactly?

Comment 2 Artyom 2014-03-03 11:53:11 UTC
Version-Release number of selected component (if applicable):
ovirt-engine-3.4.0-0.11.beta3.el6.noarch

Comment 3 Juan Hernández 2014-03-03 12:28:13 UTC
Doron, I think this doesn't justify blocking the 3.4 release, but is worth fixing for 3.4.1. Do you agree?

Regarding representation I suggest the following:

  <scheduling_policy>
    <policy>vm_evenly_distributed</policy>
    <high_vm_count>...</high_vm_count>
    <migration_threshold>...</migration_threshold>
    <spm_vm_grace>...</spm_vm_grace>
  </scheduling_policy>

It would be good to use this same representation for the other policies.

Comment 4 Gilad Chaplik 2014-03-04 11:31:25 UTC
Juan, 

Currently the rest expose policy and thresholds (high, low, duration).
We need to expose the custom properties sheet in scheduling_policy, to include all parameters and future ones:

    <scheduling_policy>
        <policy>evenly_distributed</policy>
        <thresholds high="90" duration="120"/>
        <custom_properties> <!-- I prefer to leave it with the common name -->
                <custom_property name="HighUtilization" value="90"/>
                <custom_property name="CpuOverCommitDurationMinutes" value="2"/> <!-- value is in minutes, whereas duration is in seconds -->
        </custom_properties>
    </scheduling_policy>

Note that there is display duplication of high, low and duration in the custom properties sheet (because of backward compatibility).


Are you okay with the proposed^ solution? 

Have a nice day,
Gilad.

Comment 5 Juan Hernández 2014-03-04 11:49:41 UTC
I prefer if we avoid using the custom_property element, as it uses attributes instead of nested elements, and that means that it is difficult to extend and it is difficult to use values that aren't short strings. Please create a new "properties" element, like this:

  <xs:complexType name="Property">
    <xs:sequence>
      <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
      <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="properties" type="Properties"/>

  <xs:complexType name="Properties">
    <xs:sequence>
      <xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

Then use it, so that the representation will be as follows:

  <scheduling_policy>
    <policy>evenly_distributed</policy>
    <thresholds high="90" duration="120"/>
    <properties>
      <property>
        <name>HighUtilization</name>
        <value>90</value>
      </property>
      <property>
        <name>CpuOverCommitDurationMinutes</name>
        <value>2</value>
      </property>
    </properties>
  </scheduling_policy>

I'd appreciate if the introduction of the "properties" element can be done in a separate patch.

Also, please open a bug targeted for 4.0, so that we remember remove the "thresholds" element. Put [DEPRECATION] as a prefix to the subject.

Comment 6 Gilad Chaplik 2014-03-06 08:04:27 UTC
Thanks Juan for the elaborate explanation. giving it some more thought, we can consider not adding another 'Property' element, and simply reuse the existing one, expanding it with name and value tags:

        <custom_properties>
                <custom_property name="abd" value="1"/>
                <custom_property name="def" value="2">
                                <name>def1</name>
                                <value>2.1</value>
                </custom_property>
                <custom_property>
                                <name>ghi</name>
                                <value>3</value>
                </custom_property>
        </custom_properties>

in the example^^ all inputs are valid.
for 'def' custom property, 'def1' (val 2.1) will be applied -> tags will override attributes.

this will keep the REST unified, and later on we can deprecate the attributes (or not.. it doesn't really matter).

what do you say?

Thanks, and sorry for the nagging :)

Comment 7 Juan Hernández 2014-03-06 08:19:30 UTC
The problem with this is that having a "name" attribute and a "name" inner element generates a conflict in the Java and Python code generators that we use for the API itself and for the SDKs.

Comment 8 Juan Hernández 2014-03-07 08:31:23 UTC
*** Bug 1073764 has been marked as a duplicate of this bug. ***

Comment 9 Sandro Bonazzola 2014-05-08 13:56:15 UTC
This is an automated message.

oVirt 3.4.1 has been released.
This issue has been retargeted to 3.5.0 since it has not been marked as high priority or severity issue, please retarget if needed.

Comment 10 Artyom 2014-07-14 08:55:18 UTC
Verified on ovirt-engine-3.5.0-0.0.master.20140629172257.git0b16ed7.el6.noarch

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


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