Bug 1401979

Summary: Change cluster scheduling policy to user scheduling policy action failed
Product: [oVirt] ovirt-engine Reporter: Artyom <alukiano>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED NOTABUG QA Contact: Artyom <alukiano>
Severity: medium Docs Contact:
Priority: high    
Version: 4.1.0CC: alukiano, bugs, dchaplyg, dfediuck, mavital, mgoldboi, msivak
Target Milestone: ovirt-4.1.0-betaKeywords: Automation, Regression
Target Release: ---Flags: mgoldboi: ovirt-4.1?
mgoldboi: blocker?
mgoldboi: planning_ack+
mgoldboi: devel_ack?
mgoldboi: testing_ack?
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-11 11:34:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Artyom 2016-12-06 13:57:21 UTC
Description of problem:
Change cluster scheduling policy to user scheduling policy action failed

Version-Release number of selected component (if applicable):
ovirt-engine-4.1.0-0.2.master.20161206091320.git94e2a8d.el7.centos.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create new scheduling policy via REST API
<scheduling_policy>
    <name>test_policy</name>
</scheduling_policy>
2. Assign the scheduler policy to the cluster
<cluster>
<scheduling_policy id="new_policy_id"/>
</cluster>
3.

Actual results:
<fault>
<detail>[Cannot edit Cluster if some of the specified custom properties are not configured by the system. The keys are: CpuOverCommitDurationMinutes,HighUtilization]</detail>
<reason>Operation Failed</reason>
</fault>

Expected results:
Action succeeds without any errors

Additional info:
I believe it connect to redundant scheduling parameters that we have under none and other built-in policies(for example "none" policy has CpuOverCommitDurationMinutes,HighUtilization parameters)

Via UI all works fine

Comment 1 Martin Sivák 2016-12-07 11:37:05 UTC
Artyom, can you show us how the user scheduling policy looks like after creation?

Comment 2 Artyom 2016-12-08 08:20:03 UTC
<scheduling_policy href="/ovirt-engine/api/schedulingpolicies/f67ec269-c339-4280-b420-d96cdf2f047c" id="f67ec269-c339-4280-b420-d96cdf2f047c">
  <name>test_policy</name>
  <link href="/ovirt-engine/api/schedulingpolicies/f67ec269-c339-4280-b420-d96cdf2f047c/filters" rel="filters" />
  <link href="/ovirt-engine/api/schedulingpolicies/f67ec269-c339-4280-b420-d96cdf2f047c/weights" rel="weights" />
  <link href="/ovirt-engine/api/schedulingpolicies/f67ec269-c339-4280-b420-d96cdf2f047c/balances" rel="balances" />
  <default_policy>false</default_policy>
  <locked>false</locked>
</scheduling_policy>

Comment 3 Martin Sivák 2016-12-08 08:38:44 UTC
Well the error message tells you that there are required properties you have to set first. And there are indeed no default values for those. Does it work when you define the properties first (either on the created policy or on the cluster)?

Check one of the default policies to get an example:

<scheduling_policy href="/ovirt-engine/api/schedulingpolicies/5a2b0939-7d46-4b73-a469-e9c2c7fc6a53" id="5a2b0939-7d46-4b73-a469-e9c2c7fc6a53">
  <name>power_saving</name>
  <link href="/ovirt-engine/api/schedulingpolicies/5a2b0939-7d46-4b73-a469-e9c2c7fc6a53/filters" rel="filters"/>
  <link href="/ovirt-engine/api/schedulingpolicies/5a2b0939-7d46-4b73-a469-e9c2c7fc6a53/weights" rel="weights"/>
  <link href="/ovirt-engine/api/schedulingpolicies/5a2b0939-7d46-4b73-a469-e9c2c7fc6a53/balances" rel="balances"/>
  <default_policy>false</default_policy>
  <locked>true</locked>
  <properties>
    <property>
      <name>HighUtilization</name>
      <value>80</value>
    </property>
    <property>
      <name>CpuOverCommitDurationMinutes</name>
      <value>2</value>
    </property>
  </properties>
</scheduling_policy>

Comment 4 Artyom 2016-12-08 09:50:48 UTC
Why do we have this required properties on the policy that does not need them?

Comment 5 Martin Sivák 2016-12-09 11:19:44 UTC
Artyom, there is something in the policy that obviously needs those. Can you list the attached filters, weights and balances too?

Comment 6 Denis Chaplygin 2016-12-09 12:57:22 UTC
Well, unfortunately i'm not able to reproduce it. What i did:

1) POST /ovirt-engine/api/schedulingpolicies
<scheduling_policy>
    <name>test_policy</name>
</scheduling_policy>

2)Checked, that policy were actually created:
GET /ovirt-engine/api/schedulingpolicies
    <scheduling_policy href="/ovirt-engine/api/schedulingpolicies/b27b4898-c175-4679-a80a-9c1856b73539" id="b27b4898-c175-4679-a80a-9c1856b73539">
        <name>test_policy</name>
        <link href="/ovirt-engine/api/schedulingpolicies/b27b4898-c175-4679-a80a-9c1856b73539/filters" rel="filters"/>
        <link href="/ovirt-engine/api/schedulingpolicies/b27b4898-c175-4679-a80a-9c1856b73539/weights" rel="weights"/>
        <link href="/ovirt-engine/api/schedulingpolicies/b27b4898-c175-4679-a80a-9c1856b73539/balances" rel="balances"/>
        <default_policy>false</default_policy>
        <locked>false</locked>
    </scheduling_policy>

3)Assigned that policy to my cluster:
PUT /ovirt-engine/api/clusters/58343ea9-02ed-023a-0391-00000000020b
<cluster>
<scheduling_policy id="b27b4898-c175-4679-a80a-9c1856b73539"/>
</cluster>

4)Checked, that policy were applied correctly:
GET /ovirt-engine/api/clusters

.....
        <scheduling_policy href="/ovirt-engine/api/schedulingpolicies/b27b4898-c175-4679-a80a-9c1856b73539" id="b27b4898-c175-4679-a80a-9c1856b73539"/>
    </cluster>
</clusters>


So, it successfully applied without any error message. 

As an additional step, i checked contents of my new policy: filters, weights and balances. All three lists were empty. Artyom, could you please check those lists on your side?

Comment 7 Artyom 2016-12-11 09:12:49 UTC
In my case filters, weights and balances do not have any entities too.
So maybe you have the version where the bug somehow fixed.
Can you please attach your engine version?

Comment 8 Artyom 2016-12-11 09:25:06 UTC
I checked it on the last engine ovirt-engine-4.1.0-0.2.master.20161211071204.git26a385e.el7.centos.noarch

And all works fines, so you can close the bug.