RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2058247 - [RFE] Provide easier management of constraints created by pcs move command
Summary: [RFE] Provide easier management of constraints created by pcs move command
Keywords:
Status: CLOSED ERRATA
Alias: None
Deadline: 2022-07-04
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: pcs
Version: 9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 9.1
Assignee: Miroslav Lisik
QA Contact: cluster-qe@redhat.com
Steven J. Levine
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-24 15:06 UTC by Tomas Jelinek
Modified: 2022-11-16 17:46 UTC (History)
13 users (show)

Fixed In Version: pcs-0.11.2-1.el9
Doc Type: Enhancement
Doc Text:
Feature: Pcs status displays warning about constraint created by move command. Reason: Constraint created by move command can be forgotten by a user. Result: User can noticed from pcs status that there are move constraints still in place.
Clone Of: 1730232
Environment:
Last Closed: 2022-11-15 09:48:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-113682 0 None None None 2022-02-24 15:15:11 UTC
Red Hat Knowledge Base (Solution) 6169652 0 None None None 2022-11-16 17:46:37 UTC
Red Hat Product Errata RHSA-2022:7935 0 None None None 2022-11-15 09:48:58 UTC

Description Tomas Jelinek 2022-02-24 15:06:01 UTC
+++ This bug was initially created as a clone of Bug #1730232 +++

When customers use the pcs move command they will occasionally forget to remove the constraints and then later try to move the resource back to the original node, forgetting that the constraint exists.

We need to investigate some ways to notify the user when this is happening.  I'm thinking about these two options (although I'm open to alternatives).

1.  In the pcs status screen show a note/warning for resources that currently have constraints created by pcs move

2.  When running pcs move, notify the user if that resource has existing move constraints on it.

Comment 1 Miroslav Lisik 2022-03-25 15:34:17 UTC
Upstream commit: https://github.com/ClusterLabs/pcs/commit/7e9fa041c5e5a5e47df112d82762ca3dda8537ef
Updated commands:
  * pcs status
  * pcs resource move-with-constraint

1. Pcs status displays warning with resources which have constraints created by 'pcs resource move-with-constraint' command.
2. Command 'pcs resource move-with-constraint' displays warning in case when a move constraint is created for a resource but resource may not move because there could be other configuration preventing resource running on the specified node.

Test:

[root@r90-node-01 pcs]# pcs resource
  * d1  (ocf:pacemaker:Dummy):   Started r90-node-01
  * d2  (ocf:pacemaker:Dummy):   Started r90-node-02
  * d3  (ocf:pacemaker:Dummy):   Started r90-node-01
  * d4  (ocf:pacemaker:Dummy):   Started r90-node-02

[root@r90-node-01 pcs]# pcs resource move-with-constraint d1
Warning: Creating location constraint 'cli-ban-d1-on-r90-node-01' with a score of -INFINITY for resource d1 on r90-node-01.
        This will prevent d1 from running on r90-node-01 until the constraint is removed
        This will be the case even if r90-node-01 is the last node in the cluster
[root@r90-node-01 pcs]# pcs resource move-with-constraint d2 r90-node-01
[root@r90-node-01 pcs]# pcs constraint location d3 avoids r90-node-02
[root@r90-node-01 pcs]# pcs constraint location --full
Location Constraints:
  Resource: d1
    Disabled on:
      Node: r90-node-01 (score:-INFINITY) (role:Started) (id:cli-ban-d1-on-r90-node-01)
  Resource: d2
    Enabled on:
      Node: r90-node-01 (score:INFINITY) (role:Started) (id:cli-prefer-d2)
  Resource: d3
    Disabled on:
      Node: r90-node-02 (score:-INFINITY) (id:location-d3-r90-node-02--INFINITY)

Check the status:


[root@r90-node-01 pcs]# pcs status
Cluster name: HACluster

WARNINGS:
Following resources have been moved and their move constraints are still in place: 'd1', 'd2'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

Cluster Summary:
  * Stack: corosync
  * Current DC: r90-node-02 (version 2.1.2-4.el9-ada5c3b36e2) - partition with quorum
  * Last updated: Fri Mar 25 16:05:26 2022
  * Last change:  Fri Mar 25 16:04:57 2022 by root via cibadmin on r90-node-01
  * 2 nodes configured
  * 6 resource instances configured

Node List:
  * Online: [ r90-node-01 r90-node-02 ]

Full List of Resources:
  * fence-r90-node-01   (stonith:fence_xvm):     Started r90-node-01
  * fence-r90-node-02   (stonith:fence_xvm):     Started r90-node-02
  * d1  (ocf:pacemaker:Dummy):   Started r90-node-02
  * d2  (ocf:pacemaker:Dummy):   Started r90-node-01
  * d3  (ocf:pacemaker:Dummy):   Started r90-node-01
  * d4  (ocf:pacemaker:Dummy):   Started r90-node-02

Daemon Status:
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/disabled

Resources d1 and d2 are displayed in the warning because they have a constraint created by move command.


[root@r90-node-01 pcs]# pcs resource | grep d3
  * d3  (ocf:pacemaker:Dummy):   Started r90-node-01
[root@r90-node-01 pcs]# pcs resource move-with-constraint d3 r90-node-02
Warning: A move constraint has been created and the resource 'd3' may or may not move depending on other configuration
[root@r90-node-01 pcs]# pcs resource | grep d3
  * d3  (ocf:pacemaker:Dummy):   Started r90-node-01

Resource hasn't been moved because there is a constraint preventing resource running on r90-node-02.

[root@r90-node-01 pcs]# pcs constraint location
Location Constraints:
  Resource: d1
    Disabled on:
      Node: r90-node-01 (score:-INFINITY) (role:Started)
  Resource: d2
    Enabled on:
      Node: r90-node-01 (score:INFINITY) (role:Started)
  Resource: d3
    Enabled on:
      Node: r90-node-02 (score:INFINITY) (role:Started)
    Disabled on:
      Node: r90-node-02 (score:-INFINITY)

Comment 3 Miroslav Lisik 2022-05-19 17:32:06 UTC
DevTestResults:

[root@r91-1 ~]# rpm -q pcs
pcs-0.11.2-1.el9.x86_64

[root@r91-1 ~]# pcs resource
  * d1  (ocf:pacemaker:Dummy):   Started r91-2
  * d2  (ocf:pacemaker:Dummy):   Started r91-2
  * d3  (ocf:pacemaker:Dummy):   Started r91-3
[root@r91-1 ~]# pcs resource move-with-constraint d1
Warning: Creating location constraint 'cli-ban-d1-on-r91-2' with a score of -INFINITY for resource d1 on r91-2.
        This will prevent d1 from running on r91-2 until the constraint is removed
        This will be the case even if r91-2 is the last node in the cluster
[root@r91-1 ~]# pcs resource move-with-constraint d2 r91-1
Warning: A move constraint has been created and the resource 'd2' may or may not move depending on other configuration
[root@r91-1 ~]# pcs constraint location d3 avoids r91-2
[root@r91-1 ~]# pcs constraint location --full
Location Constraints:
  Resource: d1
    Disabled on:
      Node: r91-2 (score:-INFINITY) (role:Started) (id:cli-ban-d1-on-r91-2)
  Resource: d2
    Enabled on:
      Node: r91-1 (score:INFINITY) (role:Started) (id:cli-prefer-d2)
  Resource: d3
    Disabled on:
      Node: r91-2 (score:-INFINITY) (id:location-d3-r91-2--INFINITY)


1)
[root@r91-1 ~]# pcs status | grep WARNINGS: -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'd1', 'd2'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively


2)
[root@r91-1 ~]# pcs resource | grep d3
  * d3  (ocf:pacemaker:Dummy):   Started r91-3
[root@r91-1 ~]# pcs resource move-with-constraint d3 r91-2
Warning: A move constraint has been created and the resource 'd3' may or may not move depending on other configuration
[root@r91-1 ~]# pcs resource | grep d3
  * d3  (ocf:pacemaker:Dummy):   Started r91-3
[root@r91-1 ~]# pcs constraint location
Location Constraints:
  Resource: d1
    Disabled on:
      Node: r91-2 (score:-INFINITY) (role:Started)
  Resource: d2
    Enabled on:
      Node: r91-1 (score:INFINITY) (role:Started)
  Resource: d3
    Enabled on:
      Node: r91-2 (score:INFINITY) (role:Started)
    Disabled on:
      Node: r91-2 (score:-INFINITY)

Comment 7 svalasti 2022-07-25 13:25:23 UTC
[root@virt-014 ~]# rpm -q pcs
pcs-0.11.3-1.el9.x86_64


1.) Checking the validity of warning message after a resource move (without specification of the dest. node.)


A.) Moving 'dummy1' and after that removing constraint.

[root@virt-014 ~]# pcs resource | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs resource move-with-constraint dummy1
Warning: Creating location constraint 'cli-ban-dummy1-on-virt-014' with a score of -INFINITY for resource dummy1 on virt-014.
	This will prevent dummy1 from running on virt-014 until the constraint is removed
	This will be the case even if virt-014 is the last node in the cluster

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

[root@virt-014 ~]# pcs constraint location
Location Constraints:
  Resource: dummy1
    Disabled on:
      Node: virt-014 (score:-INFINITY) (role:Started)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs resource clear dummy1
Removing constraint: cli-ban-dummy1-on-virt-014

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

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. The warning message disappears if the constraints are removed.



B.) Creating an avoidance constraint before moving resource.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs constraint location dummy1 avoids virt-031=INFINITY

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

[root@virt-014 ~]# pcs constraint location
Location Constraints:
  Resource: dummy1
    Disabled on:
      Node: virt-031 (score:-INFINITY)
[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. No warning message is displayed in case of manual avoid constraint creation.

[root@virt-014 ~]# pcs resource move-with-constraint dummy1
Warning: Creating location constraint 'cli-ban-dummy1-on-virt-014' with a score of -INFINITY for resource dummy1 on virt-014.
	This will prevent dummy1 from running on virt-014 until the constraint is removed
	This will be the case even if virt-014 is the last node in the cluster

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

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

> OK. After moving the 'dummy1' resource, the warning message is displayed.



C.) Moving multiple resources to the same cluster node.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs constraint location dummy2 prefers virt-015=INFINITY

[root@virt-014 ~]# pcs constraint location dummy3 prefers virt-031=INFINITY

[root@virt-014 ~]# pcs constraint location
Location Constraints:
  Resource: dummy2
    Enabled on:
      Node: virt-015 (score:INFINITY)
  Resource: dummy3
    Enabled on:
      Node: virt-031 (score:INFINITY)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. No warning message is displayed in case of manual prefers constraints creation.

[root@virt-014 ~]# pcs resource move-with-constraint dummy1
Warning: Creating location constraint 'cli-ban-dummy1-on-virt-014' with a score of -INFINITY for resource dummy1 on virt-014.
	This will prevent dummy1 from running on virt-014 until the constraint is removed
	This will be the case even if virt-014 is the last node in the cluster

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

> OK, pcs notify about constraint after 'pcs move-with-constraint' of 'dummy1' resource.

[root@virt-014 ~]# pcs constraint location dummy3 avoids virt-014=INFINITY

[root@virt-014 ~]# pcs constraint location
Location Constraints:
  Resource: dummy1
    Disabled on:
      Node: virt-014 (score:-INFINITY) (role:Started)
  Resource: dummy2
    Enabled on:
      Node: virt-015 (score:INFINITY)
  Resource: dummy3
    Enabled on:
      Node: virt-031 (score:INFINITY)
    Disabled on:
      Node: virt-014 (score:-INFINITY)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

> OK. No notification if avoidance constraint is created.

[root@virt-014 ~]# pcs resource move-with-constraint dummy3
Warning: Creating location constraint 'cli-ban-dummy3-on-virt-031' with a score of -INFINITY for resource dummy3 on virt-031.
	This will prevent dummy3 from running on virt-031 until the constraint is removed
	This will be the case even if virt-031 is the last node in the cluster

[root@virt-014 ~]# pcs status | grep "dummy"
Following resources have been moved and their move constraints are still in place: 'dummy1', 'dummy3'
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-015

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1', 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

> OK.



D.) Removing constraints by using the 'pcs resource clear' command.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs constraint location
Location Constraints:

[root@virt-014 ~]# pcs resource move-with-constraint dummy3
Warning: Creating location constraint 'cli-ban-dummy3-on-virt-031' with a score of -INFINITY for resource dummy3 on virt-031.
	This will prevent dummy3 from running on virt-031 until the constraint is removed
	This will be the case even if virt-031 is the last node in the cluster

[root@virt-014 ~]# pcs resource move-with-constraint dummy2
Warning: Creating location constraint 'cli-ban-dummy2-on-virt-015' with a score of -INFINITY for resource dummy2 on virt-015.
	This will prevent dummy2 from running on virt-015 until the constraint is removed
	This will be the case even if virt-015 is the last node in the cluster

[root@virt-014 ~]# pcs resource move-with-constraint dummy1
Warning: Creating location constraint 'cli-ban-dummy1-on-virt-014' with a score of -INFINITY for resource dummy1 on virt-014.
	This will prevent dummy1 from running on virt-014 until the constraint is removed
	This will be the case even if virt-014 is the last node in the cluster

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1', 'dummy2', 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs resource clear dummy3
Removing constraint: cli-ban-dummy3-on-virt-031

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1', 'dummy2'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs resource clear dummy1
Removing constraint: cli-ban-dummy1-on-virt-014

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy2'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs resource clear dummy2
Removing constraint: cli-ban-dummy2-on-virt-015
[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. The warning message works reliably and responds to the removal of constraints.



E.) Manual removal of constraints that were created by moving resources.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs constraint location
Location Constraints:

[root@virt-014 ~]# pcs resource move-with-constraint dummy2
Warning: Creating location constraint 'cli-ban-dummy2-on-virt-015' with a score of -INFINITY for resource dummy2 on virt-015.
	This will prevent dummy2 from running on virt-015 until the constraint is removed
	This will be the case even if virt-015 is the last node in the cluster

[root@virt-014 ~]# pcs resource move-with-constraint dummy3
Warning: Creating location constraint 'cli-ban-dummy3-on-virt-031' with a score of -INFINITY for resource dummy3 on virt-031.
	This will prevent dummy3 from running on virt-031 until the constraint is removed
	This will be the case even if virt-031 is the last node in the cluster

[root@virt-014 ~]# pcs resource move-with-constraint dummy1
Warning: Creating location constraint 'cli-ban-dummy1-on-virt-014' with a score of -INFINITY for resource dummy1 on virt-014.
	This will prevent dummy1 from running on virt-014 until the constraint is removed
	This will be the case even if virt-014 is the last node in the cluster

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1', 'dummy2', 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy1
    Disabled on:
      Node: virt-014 (score:-INFINITY) (role:Started) (id:cli-ban-dummy1-on-virt-014)
  Resource: dummy2
    Disabled on:
      Node: virt-015 (score:-INFINITY) (role:Started) (id:cli-ban-dummy2-on-virt-015)
  Resource: dummy3
    Disabled on:
      Node: virt-031 (score:-INFINITY) (role:Started) (id:cli-ban-dummy3-on-virt-031)

[root@virt-014 ~]# pcs constraint location delete cli-ban-dummy2-on-virt-015

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

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1', 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs constraint location delete cli-ban-dummy1-on-virt-014

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

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs constraint location delete cli-ban-dummy3-on-virt-031

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

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK.



2.) Checking the validity of warning message after the resource move (with specification of the destination node.)


A.) Check if the notification message responds correctly to the removal of the constraints that have been created by the move of dummy resources.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs resource move-with-constraint dummy2 virt-014
Warning: A move constraint has been created and the resource 'dummy2' may or may not move depending on other configuration

[root@virt-014 ~]# pcs resource move-with-constraint dummy3 virt-014
Warning: A move constraint has been created and the resource 'dummy3' may or may not move depending on other configuration

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy2
    Enabled on:
      Node: virt-014 (score:INFINITY) (role:Started) (id:cli-prefer-dummy2)
  Resource: dummy3
    Enabled on:
      Node: virt-014 (score:INFINITY) (role:Started) (id:cli-prefer-dummy3)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy2', 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

> OK.

[root@virt-014 ~]# pcs status | grep "dummy"
Following resources have been moved and their move constraints are still in place: 'dummy2', 'dummy3'
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-014

[root@virt-014 ~]# pcs resource clear dummy2
Removing constraint: cli-prefer-dummy2

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy3'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs resource clear dummy3
Removing constraint: cli-prefer-dummy3

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-014

[root@virt-014 ~]# pcs status | grep "WARNINGS"

> OK.



B.) Test how the manually created constraint affects the following move of 'dummy' resource.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-014

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:

[root@virt-014 ~]# pcs constraint location dummy avoids virt-015=INFINITY

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

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy
    Disabled on:
      Node: virt-015 (score:-INFINITY) (id:location-dummy-virt-015--INFINITY)

[root@virt-014 ~]# pcs resource move-with-constraint dummy virt-015
Warning: A move constraint has been created and the resource 'dummy' may or may not move depending on other configuration

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

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy
    Enabled on:
      Node: virt-015 (score:INFINITY) (role:Started) (id:cli-prefer-dummy)
    Disabled on:
      Node: virt-015 (score:-INFINITY) (id:location-dummy-virt-015--INFINITY)

[root@virt-014 ~]# pcs status | grep "dummy" -A 1
Following resources have been moved and their move constraints are still in place: 'dummy'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively
--
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-014

> OK. 'pcs status' displays warning message even in cases when the resource is not moved due to previous declared constraints.

[root@virt-014 ~]# pcs constraint location delete cli-prefer-dummy

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

[root@virt-014 ~]# pcs status | grep "dummy" -A 1
  * dummy	(ocf:heartbeat:Dummy):	 Started virt-014

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 1

> OK. After removing a constraint that was created by resource move, a warning message is no longer displayed.



3.) Checking that the 'pcs resource move' command does not actually create a warning message.



A.) Destination node is specified.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs resource move dummy2 virt-031
Location constraint to move resource 'dummy2' has been created
Waiting for the cluster to apply configuration changes...
Location constraint created to move resource 'dummy2' has been removed
Waiting for the cluster to apply configuration changes...
resource 'dummy2' is running on node 'virt-031'

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. No warning message is available to the user after 'pcs resource move'.

[root@virt-014 ~]# pcs constraint location dummy3 avoids virt-014=INFINITY

[root@virt-014 ~]# pcs resource move dummy3 virt-015
Location constraint to move resource 'dummy3' has been created
Waiting for the cluster to apply configuration changes...
Location constraint created to move resource 'dummy3' has been removed
Waiting for the cluster to apply configuration changes...
resource 'dummy3' is running on node 'virt-015'

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy3
    Disabled on:
      Node: virt-014 (score:-INFINITY) (id:location-dummy3-virt-014--INFINITY)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK.



B.) Destination node is not specified.

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs resource move dummy2
Location constraint to move resource 'dummy2' has been created
Waiting for the cluster to apply configuration changes...
Location constraint created to move resource 'dummy2' has been removed
Waiting for the cluster to apply configuration changes...
resource 'dummy2' is running on node 'virt-031'

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. No warning message is available after using the 'pcs resource move' command on 'dummy2' resource.

[root@virt-014 ~]# pcs constraint location dummy1 avoids virt-031=INFINITY

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy1
    Disabled on:
      Node: virt-031 (score:-INFINITY) (id:location-dummy1-virt-031--INFINITY)

[root@virt-014 ~]# pcs resource move dummy1
Location constraint to move resource 'dummy1' has been created
Waiting for the cluster to apply configuration changes...
Location constraint created to move resource 'dummy1' has been removed
Waiting for the cluster to apply configuration changes...
resource 'dummy1' is running on node 'virt-015'

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy1
    Disabled on:
      Node: virt-031 (score:-INFINITY) (id:location-dummy1-virt-031--INFINITY)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3

> OK. Forward constraint creation and following resource move do not affect the display of the warning message.

Comment 8 svalasti 2022-07-25 13:26:44 UTC
4.) Testing the display of a warning message in case of a temporary constraint (lifetime switch)

[root@virt-014 ~]# pcs status | grep "dummy"
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-014
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# pcs resource move-with-constraint dummy1 lifetime=PT1M
Migration will take effect until: 2022-07-25 14:26:08 +02:00
Warning: Creating location constraint 'cli-ban-dummy1-on-virt-014' with a score of -INFINITY for resource dummy1 on virt-014.
	This will prevent dummy1 from running on virt-014 until the constraint is removed
	This will be the case even if virt-014 is the last node in the cluster

[root@virt-014 ~]# date
Mon Jul 25 02:25:12 PM CEST 2022

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:
  Resource: dummy1
    Constraint: cli-ban-dummy1-on-virt-014
      Rule: boolean-op=and score=-INFINITY (id:cli-ban-dummy1-on-virt-014-rule)
        Expression: #uname eq string virt-014 (id:cli-ban-dummy1-on-virt-014-expr)
        Expression: date lt 2022-07-25 14:26:08 +02:00 (id:cli-ban-dummy1-on-virt-014-lifetime)

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

[root@virt-014 ~]# pcs status | grep "dummy"
Following resources have been moved and their move constraints are still in place: 'dummy1'
  * dummy1	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy2	(ocf:heartbeat:Dummy):	 Started virt-015
  * dummy3	(ocf:heartbeat:Dummy):	 Started virt-031

[root@virt-014 ~]# date
Mon Jul 25 02:26:38 PM CEST 2022

[root@virt-014 ~]# pcs constraint location --full
Location Constraints:

[root@virt-014 ~]# pcs status | grep "WARNINGS" -A 3
WARNINGS:
Following resources have been moved and their move constraints are still in place: 'dummy1'
Run 'pcs constraint location' or 'pcs resource clear <resource id>' to view or remove the constraints, respectively

> The warning message should not be available after the constraint expiration. As can be seen from this example, the warning message about the existence of the constraint after resource move is available to the user even after the constraint has expired.

Comment 13 Tomas Jelinek 2022-07-26 08:34:23 UTC
Re comment 8:

This is expected. Even when a constraint is expired, it is still in place (i.e. present in the CIB). It can be shown by 'pcs constraint location' and removed by 'pcs resource clear <resource id>'.

Comment 14 Nina Hostakova 2022-07-26 14:56:08 UTC
Considering a user's point of view, showing an expired location constraint in pcs status as a 'constraint in place' will not help the user, on the contrary might be confusing as the constraint is no longer in effect. Such a constraint is not present in 'pcs constraint location' after expiration, it can only be found in 'pcs constraint location --all' where is marked as expired. From the QA side we agreed on this should be fixed.

Comment 18 Tomas Jelinek 2022-07-27 15:12:30 UTC
After further discussion, the issue was moved to a separate BZ bz2111591.

Comment 19 Nina Hostakova 2022-07-27 15:21:58 UTC
Marking this bz verified based on comment7.

Comment 23 errata-xmlrpc 2022-11-15 09:48:38 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 (Moderate: 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-2022:7935


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