Bug 1862966
Summary: | [RFE] Full rules support in resource and operation defaults | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Tomas Jelinek <tojeline> | ||||||||
Component: | pcs | Assignee: | Tomas Jelinek <tojeline> | ||||||||
Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | ||||||||
Severity: | high | Docs Contact: | Steven J. Levine <slevine> | ||||||||
Priority: | high | ||||||||||
Version: | 8.3 | CC: | cfeist, cluster-maint, idevat, mlisik, mmazoure, mpospisi, omular, slevine, tojeline | ||||||||
Target Milestone: | rc | Keywords: | FutureFeature | ||||||||
Target Release: | 8.4 | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | pcs-0.10.7-1.el8 | Doc Type: | Enhancement | ||||||||
Doc Text: |
Feature:
Support node attribute expressions and date expressions in resource and operation defaults rules.
Reason:
The first implementation of resource and operation defaults only supported 'resource' and 'op' expressions, including 'and' and 'or' operators and parenthesis. With this patch, all other rule expressions are fully supported.
Result:
All rule expressions provided by Pacemaker are fully supported in 'pcs resource defaults set create rule' and 'pcs resource op defaults set create rule' commands.
By default, pcs does not list expired resources and operations defaults sets. To list all sets, use the --all flag: 'pcs resource [op] defaults config --all'. To skip evaluating rules and speed up the listing, use the --no-expire-check flag: 'pcs resource [op] defaults config --no-expire-check'.
|
Story Points: | --- | ||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2021-05-18 15:12:08 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: | 1817547 | ||||||||||
Bug Blocks: | 1250744, 2019471 | ||||||||||
Attachments: |
|
Description
Tomas Jelinek
2020-08-03 10:43:33 UTC
Created attachment 1715377 [details]
proposed fix + tests part1
Created attachment 1715378 [details]
proposed fix + tests part2
Created attachment 1715379 [details]
proposed fix + tests part3
Following rule expressions are now supported in 'pcs resource defaults set create rule' and 'pcs resource op defaults set create rule' commands: defined|not_defined <node attribute> <node attribute> lt|gt|lte|gte|eq|ne [string|integer|number|version] <value> date gt|lt <date> date in_range [<date>] to <date> date in_range <date> to duration <duration options> date-spec <date-spec options> CLI tests: https://github.com/ClusterLabs/pcs/blob/d7ec6d4184dc5bbaf7fb0f7ccafb77d3321cb86c/pcs_test/tier1/test_cib_options.py#L365-L478 https://github.com/ClusterLabs/pcs/blob/d7ec6d4184dc5bbaf7fb0f7ccafb77d3321cb86c/pcs_test/tier1/test_cib_options.py#L82-L167 Expired rules support: By default, pcs does not list expired resources and operations defaults sets. To list all sets, use the --all flag: 'pcs resource [op] defaults config --all'. To skip evaluating rules and speed up the listing, use the --no-expire-check flag: 'pcs resource [op] defaults config --no-expire-check'. CLI tests: https://github.com/ClusterLabs/pcs/blob/d7ec6d4184dc5bbaf7fb0f7ccafb77d3321cb86c/pcs_test/tier1/test_cib_options.py#L169-L246 Test:
[root@r8-node-01 ~]# rpm -q pcs
pcs-0.10.7-1.el8.x86_64
[root@r8-node-01 ~]# pcs resource defaults set create id=mine score=10 meta nam1=val1 nam2=val2 \
> rule \(defined attr1 or attr2 gte number 12 \
> or attr3 lt version 3.2.1 \
> or attr4 ne string test \
> or attr5 lt 3\)\
> and \(date gt 2018-05-17T13:28:19\
> or date in_range 2019-01-01 to 2019-03-15 \
> or date in_range 2019-05-01 to duration months=2 \
> or date-spec years=2019 months=7-8 weekdays=6-7 \
> or date in_range to 2019-12-15\)
Warning: Defaults do not apply to resources which override them with their own defined values
[root@r8-node-01 ~]# pcs resource defaults
Meta Attrs: mine score=10
nam1=val1
nam2=val2
Rule: boolean-op=and score=INFINITY
Rule: boolean-op=or score=0
Expression: defined attr1
Expression: attr2 gte number 12
Expression: attr3 lt version 3.2.1
Expression: attr4 ne string test
Expression: attr5 lt 3
Rule: boolean-op=or score=0
Expression: date gt 2018-05-17T13:28:19
Expression: date in_range 2019-01-01 to 2019-03-15
Expression: date in_range 2019-05-01 to duration
Duration: months=2
Expression:
Date Spec: months=7-8 weekdays=6-7 years=2019
Expression: date in_range to 2019-12-15
AFTER: ====== [root@virt-134 ~]# rpm -q pcs pcs-0.10.7-1.el8.x86_64 [root@virt-134 ~]# pcs resource defaults set create --help Usage: pcs resource defaults set create... defaults set create [<set options>] [meta [<name>=<value>]...] [rule [<expression>]] Create a new set of default values for resources. You may specify a rule describing resources to which the set applies. Set options are: id, score Expression looks like one of the following: resource [<standard>]:[<provider>]:[<type>] defined|not_defined <node attribute> <node attribute> lt|gt|lte|gte|eq|ne [string|integer|number|version] <value> date gt|lt <date> date in_range [<date>] to <date> date in_range <date> to duration <duration options> date-spec <date-spec options> <expression> and|or <expression> (<expression>) You may specify all or any of 'standard', 'provider' and 'type' in a resource expression. For example: 'resource ocf::' matches all resources of 'ocf' standard, while 'resource ::Dummy' matches all resources of 'Dummy' type regardless of their standard and provider. Dates are expected to conform to ISO 8601 format. Duration options are: hours, monthdays, weekdays, yearsdays, months, weeks, years, weekyears, moon. Value for these options is an integer. Date-spec options are: hours, monthdays, weekdays, yearsdays, months, weeks, years, weekyears, moon. Value for these options is an integer or a range written as integer-integer. NOTE: Defaults do not apply to resources which override them with their own defined values. [root@virt-134 ~]# pcs resource op defaults set create --help Usage: pcs resource op defaults set create... op defaults set create [<set options>] [meta [<name>=<value>]...] [rule [<expression>]] Create a new set of default values for resource operations. You may specify a rule describing resources and / or operations to which the set applies. Set options are: id, score Expression looks like one of the following: op <operation name> [interval=<interval>] resource [<standard>]:[<provider>]:[<type>] defined|not_defined <node attribute> <node attribute> lt|gt|lte|gte|eq|ne [string|integer|number|version] <value> date gt|lt <date> date in_range [<date>] to <date> date in_range <date> to duration <duration options> date-spec <date-spec options> <expression> and|or <expression> (<expression>) You may specify all or any of 'standard', 'provider' and 'type' in a resource expression. For example: 'resource ocf::' matches all resources of 'ocf' standard, while 'resource ::Dummy' matches all resources of 'Dummy' type regardless of their standard and provider. Dates are expected to conform to ISO 8601 format. Duration options are: hours, monthdays, weekdays, yearsdays, months, weeks, years, weekyears, moon. Value for these options is an integer. Date-spec options are: hours, monthdays, weekdays, yearsdays, months, weeks, years, weekyears, moon. Value for these options is an integer or a range written as integer-integer. NOTE: Defaults do not apply to resources which override them with their own defined values. > OK: new expressions are well documented 1. Testing node attributes expressions for resource defaults and resource op defaults ## Preparing node attribute [root@virt-134 ~]# pcs node attribute virt-135 test_attr=100 [root@virt-134 ~]# pcs node attribute virt-134 test_attr=50 [root@virt-134 ~]# pcs node attribute Node Attributes: virt-134: test_attr=50 virt-135: test_attr=100 ## Creating default rules with 'defined' attribute 'test_attr' for dummy resource [root@virt-134 ~]# pcs resource defaults set create id=res_defined score=10 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and defined test_attr Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_defined score=10 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: defined test_attr > Syntax for resource defaults OK [root@virt-134 ~]# pcs resource op defaults set create id=op_defined score=10 meta timeout=5s rule op monitor and resource ocf:heartbeat:Dummy and defined test_attr Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource op defaults Meta Attrs: op_defined score=10 timeout=5s Rule: boolean-op=and score=INFINITY Expression: op monitor Expression: resource ocf:heartbeat:Dummy Expression: defined test_attr > Syntax for operation defaults OK ## fucntionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > FAIL: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. The rule should apply and d2 resource should have stayed on virt-135. This problem is with all node attributes expressions and has been reported as bz1891929 [root@virt-134 ~]# pcs resource op defaults set remove res_defined [root@virt-134 ~]# pcs resource op defaults set remove op_defined 2. Testing 'date gt|lt <date>' for resource defaults and resource op defaults [root@virt-134 ~]# date Thu 22 Oct 10:24:53 CEST 2020 ## Creating default rule with date lt date in the future for dummy resource [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date lt 2020-10-23 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date lt 2020-10-23 > Syntax for resource defaults OK [root@virt-134 ~]# pcs resource op defaults set create id=op_def score=10 meta timeout=5s rule op monitor and resource ocf:heartbeat:Dummy and date lt 2020-10-23 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource op defaults Meta Attrs: op_def score=10 timeout=5s Rule: boolean-op=and score=INFINITY Expression: op monitor Expression: resource ocf:heartbeat:Dummy Expression: date lt 2020-10-23 > Syntax for operation defaults OK ## functionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def [root@virt-134 ~]# pcs resource op defaults set remove op_def ## Creating default rule with date gt date in the future for dummy resource [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date gt 2020-10-23 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs (not yet in effect): res_def score=1 resource-stickiness=100 Rule (not yet in effect): boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date gt 2020-10-23 ## functionality check (this rule should not apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def ## Creating default rule with date in the past [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date lt 2020-10-21 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults [root@virt-134 ~]# echo $? 0 [root@virt-134 ~]# pcs cluster cib | grep \<rsc_defaults\> -A 8 <rsc_defaults> <meta_attributes id="res_def" score="1"> <rule boolean-op="and" id="res_def-rule" score="INFINITY"> <rsc_expression id="res_def-rule-rsc-ocf-heartbeat-Dummy" class="ocf" provider="heartbeat" type="Dummy"/> <date_expression id="res_def-rule-expr" operation="lt" end="2020-10-21"/> </rule> <nvpair id="res_def-resource-stickiness" name="resource-stickiness" value="100"/> </meta_attributes> </rsc_defaults> > OK: Date in the past, which can't apply (date lt date in the past) is not shown in the list, however still exists in the cib (message 'No defaults set' is not present in this case) [root@virt-134 ~]# pcs resource defaults set remove res_def [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date gt 2020-10-21 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date gt 2020-10-21 > OK: Date in the past, which apply (date gt date in the past) is shown in the list [root@virt-134 ~]# pcs resource defaults set remove res_def ## Testing invalid date inputs [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date lt 2020-10-2 Error: '2020-10-2' is not a valid date value, use ISO 8601 date Error: Errors have occurred, therefore pcs is unable to continue [root@virt-134 ~]# echo $? 1 [root@virt-134 ~]# pcs resource defaults No defaults set > OK [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date lt 2020-13-20 Error: '2020-13-20' is not a valid date value, use ISO 8601 date Error: Errors have occurred, therefore pcs is unable to continue [root@virt-134 ~]# echo $? 1 [root@virt-134 ~]# pcs resource defaults No defaults set > OK [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date at 2020-13-20 Error: 'resource ocf:heartbeat:Dummy and date at 2020-13-20' is not a valid rule expression, parse error near or after line 1 column 30 resource ocf:heartbeat:Dummy and date at 2020-13-20 -----------------------------^ Error: Errors have occurred, therefore pcs is unable to continue [root@virt-134 ~]# echo $? 1 [root@virt-134 ~]# pcs resource defaults No defaults set > OK [root@virt-134 ~]# pcs resource op defaults set create id=op_def score=10 meta timeout=5s rule op monitor and resource ocf:heartbeat:Dummy and date lt 2020-13-20 Error: '2020-13-20' is not a valid date value, use ISO 8601 date Error: Errors have occurred, therefore pcs is unable to continue [root@virt-134 ~]# echo $? 1 [root@virt-134 ~]# pcs resource op defaults No defaults set > OK 3. Testing 'date in_range [<date>] to <date>' for resource defaults and resource op defaults [root@virt-134 ~]# date Thu 22 Oct 13:28:07 CEST 2020 ## Creating default rule 'date in range <date> to <date>' where present date is within the entered range for dummy resource [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date in_range 2020-10-22T13:00:00 to 2020-10-22T18:00:00 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date in_range 2020-10-22T13:00:00 to 2020-10-22T18:00:00 > Syntax for resource defaults OK [root@virt-134 ~]# pcs resource op defaults set create id=op_def score=10 meta timeout=5s rule op monitor and resource ocf:heartbeat:Dummy and date in_range 2020-10-22T13:00:00 to 2020-10-22T18:00:00 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource op defaults Meta Attrs: op_def score=10 timeout=5s Rule: boolean-op=and score=INFINITY Expression: op monitor Expression: resource ocf:heartbeat:Dummy Expression: date in_range 2020-10-22T13:00:00 to 2020-10-22T18:00:00 > Syntax for operation defaults OK ## functionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def [root@virt-134 ~]# pcs resource defaults set remove res_def ## Creating default rule 'date in range <date> to <date>' where present date is not within the entered range, which is in the future, for dummy resource [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date in_range 2020-10-23 to 2020-10-24 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs (not yet in effect): res_def score=1 resource-stickiness=100 Rule (not yet in effect): boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date in_range 2020-10-23 to 2020-10-24 > OK: Rule, which should not apply is still present in the list, as it will apply in the future ## functionality check (this rule should not apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def ## Creating default rule 'date in range <date> to <date>' where present date is not within the entered range, which is in the past, for dummy resource [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date in_range 2020-01-23 to 2020-01-24 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults > OK: The past date which should not apply is not even present in the list, but still is in cib ## functionality check (this rule should not apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def ## Creating rule 'date in_range [<date>] to <date>', where is the first <date> ommited. bz1222691 covers this issue in depth [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date in_range to 2020-10-23 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date in_range to 2020-10-23 ## functionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def 4. Testing 'date in_range <date> to duration <duration options>' for resource defaults and resource op defaults [root@virt-134 ~]# date Fri 23 Oct 12:34:20 CEST 2020 ## Creating rule, that will apply in future for duration of one hour [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date in_range 2020-10-23T12:50:00 to duration hours=1 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs (not yet in effect): res_def score=1 resource-stickiness=100 Rule (not yet in effect): boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date in_range 2020-10-23T12:50:00 to duration Duration: hours=1 > Syntax for resource defaults OK [root@virt-134 ~]# pcs resource op defaults set create id=op_def score=10 meta timeout=5s rule op monitor and resource ocf:heartbeat:Dummy and date in_range 2020-10-23T12:50:00 to duration hours=1 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource op defaults Meta Attrs (not yet in effect): op_def score=10 timeout=5s Rule (not yet in effect): boolean-op=and score=INFINITY Expression: op monitor Expression: resource ocf:heartbeat:Dummy Expression: date in_range 2020-10-23T12:50:00 to duration Duration: hours=1 > Syntax for operation defaults OK ## functionality check (this rule should not apply yet) [root@virt-134 ~]# date Fri 23 Oct 12:38:09 CEST 2020 + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. ## Keeping the same rule, but with time within the entered duration [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: date in_range 2020-10-23T12:50:00 to duration Duration: hours=1 [root@virt-134 ~]# date Fri 23 Oct 13:04:36 CEST 2020 ## functionality check (this rule should apply now) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. ## Keeping te same rule, but with expired duration [root@virt-134 ~]# pcs resource defaults [root@virt-134 ~]# date Fri 23 Oct 14:03:34 CEST 2020 > Expired rule is not visible in the list ## functionality check (this rule shoud not apply anymore) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def [root@virt-134 ~]# pcs resource op defaults set remove op_def ## Creating rule with various duration options [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and \(date in_range 2020-10-23T12:50:00 to duration hours=1 or date in_range 2020-10-23T12:50:00 to duration monthdays=5 or date in_range 2020-10-23T12:50:00 to duration weekdays=1 or date in_range 2020-10-23T12:50:00 to duration months=10 or date in_range 2020-10-23T12:50:00 to duration years=1\) Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Rule: boolean-op=or score=0 Expression: date in_range 2020-10-23T12:50:00 to duration Duration: hours=1 Expression: date in_range 2020-10-23T12:50:00 to duration Duration: monthdays=5 Expression: date in_range 2020-10-23T12:50:00 to duration Duration: weekdays=1 Expression: date in_range 2020-10-23T12:50:00 to duration Duration: months=10 Expression: date in_range 2020-10-23T12:50:00 to duration Duration: years=1 > Resource default syntax OK ## functionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def 5. Testing 'date-spec <date-spec options>' for resource defaults and resource op defaults [root@virt-134 ~]# date Mon 26 Oct 12:03:20 CET 2020 ## Creating rule where current date is within date-spec [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date-spec hours=11-13 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: Date Spec: hours=11-13 > Syntax for resource defaults OK [root@virt-134 ~]# pcs resource op defaults set create id=op_def score=10 meta timeout=5s rule op monitor and resource ocf:heartbeat:Dummy and date-spec hours=11-13 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource op defaults Meta Attrs: op_def score=10 timeout=5s Rule: boolean-op=and score=INFINITY Expression: op monitor Expression: resource ocf:heartbeat:Dummy Expression: Date Spec: hours=11-13 > Syntax for operation defaults OK ## functionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def [root@virt-134 ~]# pcs resource op defaults set remove op_def ## Creating rule where current date is not within date-spec [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date-spec monthdays=1-25 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: Date Spec: monthdays=1-25 ## functionality check (this rule should not apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-134 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness did not apply for ocf:heartbeat:Dummy (d2), which moved from virt-135 after d1 was moved there. [root@virt-134 ~]# pcs resource defaults set remove res_def ## Creating rule with various date-spec options [root@virt-134 ~]# pcs resource defaults set create id=res_def score=1 meta resource-stickiness=100 rule resource ocf:heartbeat:Dummy and date-spec hours=8-16 monthdays=1-28 weekdays=1-5 months=10-12 years=2020 Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=1 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Expression: resource ocf:heartbeat:Dummy Expression: Date Spec: hours=8-16 monthdays=1-28 months=10-12 weekdays=1-5 years=2020 > Syntax OK [root@virt-134 ~]# date Mon 26 Oct 15:27:45 CET 2020 ## functionality check (this rule should apply) + pcs resource create d1 ocf:pacemaker:Dummy + pcs resource create d2 ocf:heartbeat:Dummy + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-134 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource move d1 virt-135 + pcs resource * Clone Set: locking-clone [locking]: * Started: [ virt-134 virt-135 ] * d1 (ocf::pacemaker:Dummy): Started virt-135 * d2 (ocf::heartbeat:Dummy): Started virt-135 + pcs resource delete d1 Attempting to stop: d1... Stopped + pcs resource delete d2 Attempting to stop: d2... Stopped > OK: Default rule with resource stickiness applied for ocf:heartbeat:Dummy (d2), which didn't move from virt-135 after d1 was moved there. 6. Trying multiple expressions at once [root@virt-134 ~]# pcs resource defaults set create id=res_def score=10 meta resource-stickiness=100 rule \(defined attr1 or attr2 gte number 12 or attr3 lt version 3.2.1 or attr4 ne string test or attr5 lt 3\) and \(date gt 2018-05-17T13:28:19 or date in_range 2019-01-01 to 2019-03-15 or date in_range 2019-05-01 to duration months=2 or date-spec years=2019 months=7-8 weekdays=6-7 or date in_range to 2019-12-15\) Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource defaults Meta Attrs: res_def score=10 resource-stickiness=100 Rule: boolean-op=and score=INFINITY Rule: boolean-op=or score=0 Expression: defined attr1 Expression: attr2 gte number 12 Expression: attr3 lt version 3.2.1 Expression: attr4 ne string test Expression: attr5 lt 3 Rule: boolean-op=or score=0 Expression: date gt 2018-05-17T13:28:19 Expression: date in_range 2019-01-01 to 2019-03-15 Expression: date in_range 2019-05-01 to duration Duration: months=2 Expression: Date Spec: months=7-8 weekdays=6-7 years=2019 Expression: date in_range to 2019-12-15 [root@virt-134 ~]# pcs resource op defaults set create id=op_def score=10 meta timeout=5s rule \(defined attr1 or attr2 gte number 12 or attr3 lt version 3.2.1 or attr4 ne string test or attr5 lt 3\) and \(date gt 2018-05-17T13:28:19 or date in_range 2019-01-01 to 2019-03-15 or date in_range 2019-05-01 to duration months=2 or date-spec years=2019 months=7-8 weekdays=6-7 or date in_range to 2019-12-15\) Warning: Defaults do not apply to resources which override them with their own defined values [root@virt-134 ~]# pcs resource op defaults Meta Attrs: op_defined score=10 timeout=5s Rule: boolean-op=and score=INFINITY Expression: op monitor Expression: resource ocf:heartbeat:Dummy Expression: defined test_attr Meta Attrs: op_defaults-meta_attributes Rule: boolean-op=and score=INFINITY Expression: resource ::Dummy Rule: boolean-op=or score=0 Expression: op start Expression: op stop Meta Attrs: op_def score=10 timeout=5s Rule: boolean-op=and score=INFINITY Rule: boolean-op=or score=0 Expression: defined attr1 Expression: attr2 gte number 12 Expression: attr3 lt version 3.2.1 Expression: attr4 ne string test Expression: attr5 lt 3 Rule: boolean-op=or score=0 Expression: date gt 2018-05-17T13:28:19 Expression: date in_range 2019-01-01 to 2019-03-15 Expression: date in_range 2019-05-01 to duration Duration: months=2 Expression: Date Spec: months=7-8 weekdays=6-7 years=2019 Expression: date in_range to 2019-12-15 > OK The verification will continue after resolving found issue with node attributes expressions (point 1 of the verification) in pacemaker - bz1891929. To allign with the pacemaker bz, which is now at ITM 15, switching this bz to ITM 15 as well. After discussion, the issue described in comment 11 will not be resolved in pacemaker, but rather in pcs - bz1896458. Based on comment 11 and bz1896458 marking as VERIFIED for pcs-0.10.7-1.el8. 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 (pcs 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/RHEA-2021:1737 |