Bug 1423473

Summary: [cli] "constraint location show nodes" displays empty entries for rule constraints
Product: Red Hat Enterprise Linux 9 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Ondrej Mular <omular>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact: Steven J. Levine <slevine>
Priority: low    
Version: 9.0CC: cfeist, cluster-maint, idevat, mlisik, mpospisi, nhostako, omular, slevine, tojeline
Target Milestone: rcKeywords: Reopened, Triaged
Target Release: 9.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pcs-0.11.5-1.el9 Doc Type: Bug Fix
Doc Text:
.Location constraints with rules no longer displayed when listing is grouped by nodes Location constraints with rules cannot have a node assigned. Previously, when you grouped the listing by nodes, location constraints with rules were displayed under an empty node. With this fix, the location constraints with rules are no longer displayed and a warning is given indicating that constraints with rules are not displayed.
Story Points: ---
Clone Of:
: 2166294 (view as bug list) Environment:
Last Closed: 2023-11-07 08:23:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2163953, 2166291, 2166294    

Description Tomas Jelinek 2017-02-17 12:08:35 UTC
Description of problem:
The "pcs constraint location show nodes" lists location constraints grouped by nodes. This works well for simple constraints, where a resource is assigned to a node with some score. However for rule constraints it display empty entries as there is no node defined in the constraint (that's what the rule is for).


Version-Release number of selected component (if applicable):
pcs-0.9.152-10.el7


How reproducible:
alwas, easily


Steps to Reproduce:
1. create a rule location constraint, for example # pcs constraint location d1 rule date-spec operation=date_spec years=2005
2. # pcs constraint location show nodes


Actual results:
Note: a simple constraint was created for comparison:
# pcs constraint location d1 prefers rh73-node1

# pcs constraint location show nodes
Location Constraints:
  Node: rh73-node1
    Allowed to run:
      d1 (location-d1-rh73-node1-INFINITY) Score: INFINITY
  Node: 
    Allowed to run:
      d1 (location-d1) Score: 0
  Resource: d1
    Constraint: location-d1
      Rule: score=-INFINITY
        Expression:
          Date Spec: years=2005

The "Node: rh73-node1" lines are for the simple constraint - those are correct and show what resources are constrained to that node.
The "Node:" lines belong to the rule constraint and they do not make much sense.


Expected results:
Not displaying rule constraints by node, i.e. remove the "Node: section with empty nodes.

Comment 1 Tomas Jelinek 2017-02-17 13:05:07 UTC
Also when displaying constraints for a specified nodes the output contains rule constraints. Those should not be displayed at all as they do not match the filter.

Comment 3 RHEL Program Management 2021-01-15 07:31:58 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 5 Ondrej Mular 2023-03-30 10:47:31 UTC
Upstream patch: https://github.com/ClusterLabs/pcs/commit/ff1d564830b3ab922249a796ecfc4a63925ec4c8

Test:
[root@rhel92-node1 pcs]# pcs constraint location config nodes
Warning: Constraints with rules are not displayed.
Location Constraints:
  Node: non-existing-node
    Avoided by:
      resource 'D1' with score 10000
  Node: another-one
    Avoided by:
      resource 'D1' with score INFINITY
  Node: localhost
    Preferred by:
      resource 'D1' with score INFINITY
      resource 'D2' with score INFINITY
      resource pattern 'D*' with score INFINITY

Comment 8 Michal Pospisil 2023-05-26 09:27:41 UTC
DevTestResults:

[root@r09-03-a ~]# rpm -q pcs
pcs-0.11.5-1.el9.x86_64

[root@r09-03-a ~]# pcs constraint location r1 prefers r09-03-b.vm

[root@r09-03-a ~]# pcs constraint location config nodes
Location Constraints:
 Node: r09-03-b.vm
   Preferred by:
     resource 'r1' with score INFINITY

[root@r09-03-a ~]# pcs constraint location r2 rule score=INFINITY "#uname" eq r09-03-a.vm

[root@r09-03-a ~]# pcs constraint location config nodes
Warning: Constraints with rules are not displayed.
Location Constraints:
 Node: r09-03-b.vm
   Preferred by:
     resource 'r1' with score INFINITY

[root@r09-03-a ~]# pcs constraint location config
Location Constraints:
 resource 'r1' prefers node 'r09-03-b.vm' with score INFINITY
 resource 'r2'
   Rules:
     Rule: score=INFINITY
       Expression: #uname eq r09-03-a.vm

Comment 12 svalasti 2023-06-20 12:24:17 UTC
## BEFORE

[root@virt-022 ~]# rpm -q pcs
pcs-0.11.4-7.el9_2.x86_64

[root@virt-022 ~]# pcs resource create dummy ocf:heartbeat:Dummy

[root@virt-022 ~]# echo $?
0

[root@virt-022 ~]# pcs resource
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-022

[root@virt-022 ~]# pcs constraint location dummy prefers virt-023

[root@virt-022 ~]# pcs resource
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-023

[root@virt-022 ~]# pcs constraint location dummy rule date-spec years=2023

[root@virt-022 ~]# echo $?
0

[root@virt-022 ~]# pcs constraint location config nodes
Location Constraints:
  Node: 
    Allowed to run:
      Resource: dummy (score:0)
  Node: virt-023
    Allowed to run:
      Resource: dummy (score:INFINITY)
  Resource: dummy
    Constraint: location-dummy
      Rule: score=INFINITY
        Expression:
          Date Spec: years=2023

> The output of this command contained 'Node' section belonging to the location rule constraint, while its content did not make much sense.


## AFTER

[root@virt-525 ~]# rpm -q pcs
pcs-0.11.5-2.el9.x86_64

[root@virt-525 ~]# pcs resource create dummy ocf:heartbeat:Dummy

[root@virt-525 ~]# echo $?
0

[root@virt-525 ~]# pcs resource
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-525

[root@virt-525 ~]# pcs constraint location dummy prefers virt-535

[root@virt-525 ~]# echo $?
0

[root@virt-525 ~]# pcs resource
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-535

A.) Create a location constraint with a rule on the dummy resource (only date-spec is specified).

[root@virt-525 ~]# pcs constraint location dummy rule date-spec years=2023

[root@virt-525 ~]# echo $?
0

[root@virt-525 ~]# pcs constraint location config nodes
Warning: Constraints with rules are not displayed.
Location Constraints:
  Node: virt-535
    Preferred by:
      resource 'dummy' with score INFINITY

> OK. The output of 'pcs constraint location config nodes' is slightly different than output of same command for el8. Output of this command does not contain the 'Node' section and also constraints with rules are not displayed.

B.) Create a location constraint with a rule on resource (+score property, + #uname node attribute in expression)

[root@virt-525 ~]# pcs resource create dummy2 ocf:heartbeat:Dummy

[root@virt-525 ~]# echo $?
0

[root@virt-525 ~]# pcs constraint location dummy2 prefers virt-525

[root@virt-525 ~]# echo $?
0

[root@virt-525 ~]# pcs constraint location dummy2 rule score=INFINITY "#uname" eq virt-525

[root@virt-525 ~]# echo $?
0

[root@virt-525 ~]# pcs constraint location config nodes
Warning: Constraints with rules are not displayed.
Location Constraints:
  Node: virt-525
    Preferred by:
      resource 'dummy2' with score INFINITY

> OK. Also in this case the output of 'pcs constraint location config nodes' is slightly different than output of the same command for el8. Output of this command does not contain the 'Node' section.

[root@virt-525 ~]# pcs constraint location config
Location Constraints:
  resource 'dummy2' prefers node 'virt-525' with score INFINITY
  resource 'dummy2'
    Rules:
      Rule: score=INFINITY
        Expression: #uname eq virt-525

> OK. The ability to view configured location rules still exists.

> Marking as VERIFIED for pcs-0.11.5-2.el9.x86_64

Comment 19 errata-xmlrpc 2023-11-07 08:23:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: pcs security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHSA-2023:6316