Bug 1540973

Summary: hosts rule in affinity group is always enabled in rest response API (even if disabled in UI )
Product: [oVirt] ovirt-engine Reporter: Polina <pagranat>
Component: BLL.VirtAssignee: Andrej Krejcir <akrejcir>
Status: CLOSED CURRENTRELEASE QA Contact: Polina <pagranat>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.1CC: akrejcir, bugs
Target Milestone: ovirt-4.2.3Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Feature: The host to VM affinity can now be explicitly disabled. Previously it was always enabled, but it had no effect if no hosts were assigned to the affinity group. Reason: Having the affinity always enabled could be confusing when using the REST API.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-10 06:33: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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1493149    

Description Polina 2018-02-01 12:34:36 UTC
Description of problem: hosts rule in affinity group is always enabled in rest response API (even it's disabled in UI )

Version-Release number of selected component (if applicable):
ovirt-engine-4.2.1.3-0.1.el7.noarch

How reproducible: 100%


Steps to Reproduce:
1.Create Affinity Group (Clusters tab/Cluster. Affinity Groups tab), both rules are Disabled (VM Affinity Rule & Host Affinity Rule).
2.Send Rest API :https://{{host}}/ovirt-engine/api/clusters/355bda00-232f-4b50-91c8-acc3efd607e2/affinitygroups
3.
Actual results:Got response with <enabled>true</enabled> for host_rule instead of false:
        <description>group1</description>
        <enforcing>true</enforcing>
        <hosts_rule>
            <enabled>true</enabled>
            <enforcing>true</enforcing>
            <positive>false</positive>
        </hosts_rule>
        <vms_rule>
            <enabled>false</enabled>
            <enforcing>true</enforcing>
            <positive>false</positive>
        </vms_rule>


Expected results:<enabled>false</enabled> for both


Additional info:

Comment 1 Polina 2018-04-24 09:06:33 UTC
Verified on rhv-release-4.2.3-2-001.noarch.
When both rules are Disabled (VM Affinity Rule & Host Affinity Rule) got the correct response.
GET https://{{host}}/ovirt-engine/api/clusters/{{clusted_ID}}/affinitygroups
        <hosts_rule>
            <enabled>false</enabled>
            <enforcing>false</enforcing>
            <positive>false</positive>
        </hosts_rule>
        <vms_rule>
            <enabled>false</enabled>
            <enforcing>false</enforcing>
            <positive>false</positive>
        </vms_rule>

Comment 2 Sandro Bonazzola 2018-05-10 06:33:11 UTC
This bugzilla is included in oVirt 4.2.3 release, published on May 4th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.3 release, it has been closed with a resolution of CURRENT RELEASE.

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