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 1684676 - RFE: Add ability to tag resources to simplify display and information
Summary: RFE: Add ability to tag resources to simplify display and information
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: pcs
Version: 8.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: 8.0
Assignee: Miroslav Lisik
QA Contact: cluster-qe@redhat.com
Steven J. Levine
URL:
Whiteboard:
: 1513550 1730241 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-01 20:24 UTC by Chris Feist
Modified: 2020-11-11 20:32 UTC (History)
12 users (show)

Fixed In Version: pcs-0.10.6-1.el8
Doc Type: Enhancement
Doc Text:
.Support for tagging cluster resources It is now possible to tag cluster resources in a Pacemaker cluster with the `pcs tag` command. This feature allows you to administer a specified set of resources with a single command. You can also use the `pcs tag` command to remove or modify a resource tag, and to display the tag configuration. The `pcs resource enable`, `pcs resource disable`, `pcs resource manage`, and `pcs resource unmanage` commands accept tag IDs as arguments.
Clone Of:
Environment:
Last Closed: 2020-11-04 02:28:16 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed fix + tests (238.24 KB, patch)
2020-04-23 10:35 UTC, Miroslav Lisik
no flags Details | Diff
proposed fix2 + tests (117.51 KB, patch)
2020-04-29 17:37 UTC, Miroslav Lisik
no flags Details | Diff
proposed fix3 + tests (159.36 KB, patch)
2020-06-08 12:35 UTC, Miroslav Lisik
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5571041 0 None None None 2020-11-11 20:32:28 UTC
Red Hat Product Errata RHEA-2020:4617 0 None None None 2020-11-04 02:28:37 UTC

Description Chris Feist 2019-03-01 20:24:13 UTC
In large complex configurations it is sometimes difficult to easily view or act upon a subset of all of the resources.

This is a request to enable tagging of resources so that all resources with a specific tag could be viewed at once.

Something like : pcs resource show --tag XXX

It would also be nice to be able to disable them all at once:
pcs resource disable --tag XXX

Comment 2 Tomas Jelinek 2019-03-05 11:01:03 UTC
*** Bug 1513550 has been marked as a duplicate of this bug. ***

Comment 3 Tomas Jelinek 2019-03-05 11:05:58 UTC
Pacemaker supports tagging resources already. It would be best to use that feature: 1) it provides means for storing tags in CIB, 2) pacemaker can process those tags when displaying cluster status by crm_mon which is what pcs uses in 'pcs resource status'.


From the duplicate (now closed) RHEL 7 bz1513550:

Ken Gaillot:
Pacemaker supports tagging of XML elements:

http://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html-single/Pacemaker_Explained/index.html#_tagging_configuration_elements

This will be important for pcs primarily for nodes and resources, because tagging is expected to be part of the solution for Bug 1300597 and Bug 1300604. The idea is that the user will be able to tag certain nodes and/or resources, then use (not yet implemented) options to crm_mon to display the status of just those.

An example of how it might eventually work:

pcs resource tag myrsc1 special
pcs resource create myrsc2 Dummy --tag special
pcs status --resources=special # shows status of myrsc1 and myrsc2 only

This bz is just for the tagging functionality, which is already supported by pacemaker. A separate bz will be opened for the pcs status functionality once the crm_mon interface is finalized.

I can imagine tagging coming in handy in other situations in the future. Pacemaker implements tags mainly for UI use, so feel free to use tags elsewhere in pcs for any purpose.

FYI, because tags are XML IDs, they are guaranteed to be unique with respect to resource names and node IDs (sadly, not node names). That gives you the option of accepting tag names wherever a resource name can be used, rather than requiring a special syntax in that situation.


Jan Pokorný [poki]:
See also bottom of [bug 1441332 comment 5] + a link from the subsequent
comment.

Comment 4 Tomas Jelinek 2019-07-16 11:04:57 UTC
From the duplicate bz1730241:

Chris Feist 2019-07-16

Pacemaker allows tagging resources, but this isn't currently implemented in pcs.

Customers would like the ability to tag resources and then run commands on all resources with those tags.  To start with we would be looking at the following commands:
1.  View the status of resources with a specific tag
2.  Enable/disable resources with a specific tag
3.  Manage/Unmanage
4.  Move/unmove
5.  Anything else that would make sense to do to a group of resources

Comment 5 Tomas Jelinek 2019-07-16 11:05:14 UTC
*** Bug 1730241 has been marked as a duplicate of this bug. ***

Comment 7 Miroslav Lisik 2020-04-23 10:35:25 UTC
Created attachment 1681060 [details]
proposed fix + tests

Feature is not completed yet.

New commands added:
* pcs tag config|list
* pcs tag create
* pcs tag delete|remove

Modified commands:
* pcs resource delete -- aware of resources referenced in tags


Test:

[root@r8-node-01]# pcs resource create d-01 ocf:pacemaker:Dummy
[root@r8-node-01]# pcs resource create d-02 ocf:pacemaker:Dummy
[root@r8-node-01]# pcs tag create special-resources d-01 d-02
[root@r8-node-01]# pcs tag config
special-resources
  d-01
  d-02
[root@r8-node-01]# pcs resource delete d-01
Error: Unable to remove resource 'd-01' because it is referenced in the tag: special-resources
[root@r8-node-01]# pcs tag remove special-resources
[root@r8-node-01]# pcs tag
 No tags defined
[root@r8-node-01 ]# pcs resource delete d-01
Attempting to stop: d-01... Stopped
[root@r8-node-01]# pcs resource
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-01

Comment 8 Miroslav Lisik 2020-04-29 17:37:52 UTC
Created attachment 1683025 [details]
proposed fix2 + tests

Feature is not completed yet.

New command added:
* pcs tag update

[root@r8-node-01 ~]# pcs tag update -h

Usage: pcs tag <command>
    update <tag id> [add <id> [<id>]... [--before <id> | --after <id>]]
            [remove <id> [<id>]...]
        Update a tag using the specified ids. Ids can be added, removed or
        moved in a tag. You can use --before or --after to specify the position
        of the added ids relatively to some id already existing in the tag. By
        adding ids to a tag they are already in and specifying --after or
        --before you can move the ids in the tag.

Test:

[root@r8-node-01 ~]# pcs resource
  * d1  (ocf::pacemaker:Dummy): Started r8-node-01
  * d2  (ocf::pacemaker:Dummy): Started r8-node-01
  * d3  (ocf::pacemaker:Dummy): Started r8-node-01
  * d4  (ocf::pacemaker:Dummy): Started r8-node-01
  * d5  (ocf::pacemaker:Dummy): Started r8-node-01
  * d6  (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 ~]# pcs tag
special-resources
  d1
  d2
  d3
[root@r8-node-01 ~]# pcs tag update special-resources add d{4..6} --before d1
[root@r8-node-01 ~]# pcs tag config
special-resources
  d4
  d5
  d6
  d1
  d2
  d3
[root@r8-node-01 ~]# pcs tag update special-resources add d4 d5 --after d3 remove d6
[root@r8-node-01 ~]# pcs tag list
special-resources
  d1
  d2
  d3
  d4
  d5

Comment 10 Ken Gaillot 2020-05-29 21:14:20 UTC
FYI: While working on Bug 1300604, it was discovered that pacemaker's CIB schema prevented tagging nodes. The issue arises because node IDs are not XML IDs -- they are determined by the cluster layer, which for corosync is integers, which are not legal XML IDs. Thus the schema was modified to allow any text in an <obj_ref id=ID/> inside a tag.

This means that CIBs with validate-with below 3.3 will need to be upgraded before tagging a node will work.

Comment 11 Miroslav Lisik 2020-06-08 12:35:52 UTC
Created attachment 1696055 [details]
proposed fix3 + tests

Modified commands:
* pcs resource enable/disable
* pcs resource manage/unmanage
* pcs resource unclone
* pcs resource ungroup
* pcs resource group delete|remove

Test:

1) resource disable/enable/unmanage/manage

[root@r8-node-01 ~]# lpcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 ~]# lpcs tag
MyTag
  d-01
  d-02
[root@r8-node-01 ~]# lpcs resource disable MyTag
[root@r8-node-01 ~]# lpcs resource
  * d-01        (ocf::pacemaker:Dummy): Stopped (disabled)
  * d-02        (ocf::pacemaker:Dummy): Stopped (disabled)
[root@r8-node-01 ~]# lpcs resource enable MyTag
[root@r8-node-01 ~]# lpcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 ~]# lpcs resource unmanage MyTag
[root@r8-node-01 ~]# lpcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01 (unmanaged)
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-01 (unmanaged)
[root@r8-node-01 ~]# lpcs resource manage MyTag
[root@r8-node-01 ~]# lpcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-01


2) resource unclone/ungroup/group delete/group remove

[root@r8-node-01 ~]# lpcs resource
  * Clone Set: AGroup-clone [AGroup]:
    * Started: [ r8-node-01 ]
[root@r8-node-01 ~]# lpcs tag
CloneTag
  AGroup-clone
GroupTag
  AGroup
[root@r8-node-01 ~]# lpcs resource unclone AGroup-clone
[root@r8-node-01 ~]# lpcs resource
  * Resource Group: AGroup:
    * d-01      (ocf::pacemaker:Dummy): Started r8-node-01
    * d-02      (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 ~]# lpcs tag
GroupTag
  AGroup
[root@r8-node-01 ~]# lpcs resource
  * Resource Group: AGroup:
    * d-01      (ocf::pacemaker:Dummy): Started r8-node-01
    * d-02      (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 ~]# lpcs resource ungroup AGroup
[root@r8-node-01 ~]# lpcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 ~]# lpcs tag
 No tags defined

Commands 'resource ungroup' and 'resource group delete|remove' are aliases.

Comment 12 Miroslav Lisik 2020-06-08 12:36:45 UTC
SUMMARY
=======

New commands for management of pacemaker tags:
* pcs tag config|list
* pcs tag create
* pcs tag delete|remove
* pcs tag update

Allowed usage of tag ids in these commands:
* pcs resource enable/disable
* pcs resource manage/unmanage

Modified commands do not produce invalid cib when used with resources which are included in tags:
* pcs resource delete
* pcs resource unclone
* pcs resource ungroup
* pcs resource group delete|remove

NOT IMPLEMENTED:
* View the status of resources with a specific tag
* Move/unmove

New BZs will be created for not implemented features and they will be addressed in the next releases.

Comment 13 Miroslav Lisik 2020-06-08 15:19:42 UTC
(In reply to Miroslav Lisik from comment #11)
s/lpcs/pcs - I forgot to change my alias to local development version of pcs.

Comment 14 Miroslav Lisik 2020-06-08 15:25:44 UTC
Currently pcs only supports resource IDs in tag commands. In the future it could be able to tag nodes or some other xml ID references.

Comment 15 Miroslav Lisik 2020-06-11 14:05:26 UTC
Test:

[root@r8-node-01 ~]# rpm -q pcs
pcs-0.10.6-1.el8.x86_64

[root@r8-node-01 pcs]# pcs tag create TAG1 d-01 d-02
[root@r8-node-01 pcs]# pcs tag
TAG1
  d-01
  d-02
[root@r8-node-01 pcs]# pcs tag update TAG1 add d-03 --after d-01 remove d-02
[root@r8-node-01 pcs]# pcs tag
TAG1
  d-01
  d-03
[root@r8-node-01 pcs]# pcs resource delete d-03
Error: Unable to remove resource 'd-03' because it is referenced in the tag: 'TAG1'
[root@r8-node-01 pcs]# echo $?
1
[root@r8-node-01 pcs]# pcs tag update TAG1 remove d-03
[root@r8-node-01 pcs]# pcs resource delete d-03
Attempting to stop: d-03... Stopped
[root@r8-node-01 pcs]# echo $?
0
[root@r8-node-01 pcs]# pcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02
[root@r8-node-01 pcs]# pcs tag
TAG1
  d-01
[root@r8-node-01 pcs]# pcs resource disable TAG1 d-02
[root@r8-node-01 pcs]# pcs resource
  * d-01        (ocf::pacemaker:Dummy): Stopped (disabled)
  * d-02        (ocf::pacemaker:Dummy): Stopped (disabled)
[root@r8-node-01 pcs]# pcs resource enable d-02 TAG1
[root@r8-node-01 pcs]# pcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02
[root@r8-node-01 pcs]# pcs resource unmanage d-02 TAG1
[root@r8-node-01 pcs]# pcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01 (unmanaged)
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02 (unmanaged)
[root@r8-node-01 pcs]# pcs resource manage TAG1 d-02
[root@r8-node-01 pcs]# pcs resource
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02
[root@r8-node-01 pcs]# pcs resource clone G1
[root@r8-node-01 pcs]# pcs resource
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02
  * Clone Set: G1-clone [G1]:
    * Started: [ r8-node-01 r8-node-02 ]
[root@r8-node-01 pcs]# pcs tag create GroupTag G1
[root@r8-node-01 pcs]# pcs tag create CloneTag G1-clone
[root@r8-node-01 pcs]# pcs tag
TAG1
  d-01
GroupTag
  G1
CloneTag
  G1-clone
[root@r8-node-01 pcs]# pcs resource unclone G1
[root@r8-node-01 pcs]# pcs resource
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02
  * Resource Group: G1:
    * d-01      (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 pcs]# pcs tag
TAG1
  d-01
GroupTag
  G1
[root@r8-node-01 pcs]# pcs resource group delete G1
[root@r8-node-01 pcs]# pcs resource
  * d-02        (ocf::pacemaker:Dummy): Started r8-node-02
  * d-01        (ocf::pacemaker:Dummy): Started r8-node-01
[root@r8-node-01 pcs]# pcs tag
TAG1
  d-01
[root@r8-node-01 pcs]# pcs tag remove TAG1
[root@r8-node-01 pcs]# pcs tag
 No tags defined

Comment 28 Michal Mazourek 2020-07-16 13:24:41 UTC
[root@virt-125 ~]# rpm -q pcs
pcs-0.10.6-2.el8.x86_64


[root@virt-125 ~]# pcs tag --help

Usage: pcs tag <command>
Manage pacemaker tags.

Commands:
    [config|list [<tag id>...]]
        Display configured tags.

    create <tag id> <id> [<id>]...
        Create a tag containing the specified ids.

    delete <tag id>...
        Delete specified tags.

    remove <tag id>...
        Delete specified tags.

    update <tag id> [add <id> [<id>]... [--before <id> | --after <id>]]
            [remove <id> [<id>]...]
        Update a tag using the specified ids. Ids can be added, removed or
        moved in a tag. You can use --before or --after to specify the position
        of the added ids relatively to some id already existing in the tag. By
        adding ids to a tag they are already in and specifying --after or
        --before you can move the ids in the tag.

[root@virt-125 ~]# pcs resource --help | grep tag 
    enable <resource id | tag id>... [--wait[=n]]
    disable <resource id | tag id>... [--safe [--no-strict]]
    safe-disable <resource id | tag id>... [--no-strict] [--simulate [--brief]]
    manage <resource id | tag id>... [--monitor]
    unmanage <resource id | tag id>... [--monitor]

> OK, new command is well documented


## Preparing resources

[root@virt-125 ~]# pcs resource create dummy1 ocf:heartbeat:Dummy
[root@virt-125 ~]# pcs resource create dummy2 ocf:heartbeat:Dummy
[root@virt-125 ~]# pcs resource create dummy3 ocf:heartbeat:Dummy
[root@virt-125 ~]# pcs resource create dummy4 ocf:heartbeat:Dummy
[root@virt-125 ~]# pcs resource
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-126


## Creating tags

[root@virt-125 ~]# pcs tag create special_resources_1 dummy1 dummy2
[root@virt-125 ~]# echo $?
0
[root@virt-125 ~]# pcs tag
special_resources_1
  dummy1
  dummy2
[root@virt-125 ~]# pcs tag create special_resources_2 dummy3 dummy4
[root@virt-125 ~]# pcs tag
special_resources_1
  dummy1
  dummy2
special_resources_2
  dummy3
  dummy4

> OK


## Displaying tags

[root@virt-125 ~]# pcs tag list
special_resources_1
  dummy1
  dummy2
special_resources_2
  dummy3
  dummy4
[root@virt-125 ~]# pcs tag config
special_resources_1
  dummy1
  dummy2
special_resources_2
  dummy3
  dummy4
[root@virt-125 ~]# pcs tag list special_resources_1
special_resources_1
  dummy1
  dummy2
[root@virt-125 ~]# pcs config | grep Tags -A 6
Tags:
 special_resources_1
   dummy1
   dummy2
 special_resources_2
   dummy3
   dummy4

> OK


## Destroying tags

[root@virt-125 ~]# pcs tag delete special_resources_1
[root@virt-125 ~]# pcs tag
special_resources_2
  dummy3
  dummy4
[root@virt-125 ~]# pcs tag remove special_resources_2
[root@virt-125 ~]# pcs tag
 No tags defined

[root@virt-125 ~]# pcs tag create special_resources_1 dummy1 dummy2 
[root@virt-125 ~]# pcs tag create special_resources_2 dummy3 dummy4
[root@virt-125 ~]# pcs tag remove special_resources_1 special_resources_2
[root@virt-125 ~]# pcs tag
 No tags defined

> OK


## Updating tags

[root@virt-125 ~]# pcs tag create special_resources dummy1 dummy2 dummy3
[root@virt-125 ~]# pcs tag
special_resources
  dummy1
  dummy2
  dummy3
[root@virt-125 ~]# pcs tag update special_resources add dummy4
[root@virt-125 ~]# pcs tag
special_resources
  dummy1
  dummy2
  dummy3
  dummy4

[root@virt-125 ~]# pcs tag update special_resources remove dummy1
[root@virt-125 ~]# pcs tag
special_resources
  dummy2
  dummy3
  dummy4

[root@virt-125 ~]# pcs tag update special_resources add dummy1 --before dummy3
[root@virt-125 ~]# pcs tag
special_resources
  dummy2
  dummy1
  dummy3
  dummy4

[root@virt-125 ~]# pcs tag update special_resources remove dummy4
[root@virt-125 ~]# pcs tag update special_resources add dummy4 --after dummy2
[root@virt-125 ~]# pcs tag
special_resources
  dummy2
  dummy4
  dummy1
  dummy3

[root@virt-125 ~]# pcs tag update special_resources remove dummy1 dummy2
[root@virt-125 ~]# pcs tag 
special_resources
  dummy4
  dummy3

[root@virt-125 ~]# pcs tag update special_resources add dummy1 dummy2
[root@virt-125 ~]# pcs tag
special_resources
  dummy4
  dummy3
  dummy1
  dummy2

[root@virt-125 ~]# pcs tag update special_resources remove dummy1
[root@virt-125 ~]# pcs tag update special_resources add dummy1 --before dummy2 remove dummy4
[root@virt-125 ~]# pcs tag
special_resources
  dummy3
  dummy1
  dummy2

[root@virt-125 ~]# pcs tag update special_resources add dummy1 --after dummy2
[root@virt-125 ~]# pcs tag
special_resources
  dummy3
  dummy2
  dummy1


> OK


## Error cases

# Add/remove non-existing resource

[root@virt-125 ~]# pcs tag update special_resources add dummy5
Error: bundle/clone/group/resource 'dummy5' does not exist
Error: Errors have occurred, therefore pcs is unable to continue
[root@virt-125 ~]# echo $?
1

[root@virt-125 ~]# pcs tag update special_resources remove dummy5
Error: Tag 'special_resources' does not contain id: 'dummy5'
Error: Errors have occurred, therefore pcs is unable to continue


> OK


# Adding already added resource

[root@virt-125 ~]# pcs tag update special_resources add dummy1
Error: Cannot add reference id already in the tag 'special_resources': 'dummy1'
Error: Errors have occurred, therefore pcs is unable to continue

> OK


# Creating a tag without resources

[root@virt-125 ~]# pcs tag create special_resources

Usage: pcs tag <command>
    create <tag id> <id> [<id>]...
        Create a tag containing the specified ids.

> OK


# Removing non-existing tag

[root@virt-125 ~]# pcs tag remove special_resources_2
Error: tag 'special_resources_2' does not exist
Error: Errors have occurred, therefore pcs is unable to continue

> OK


# Creating a tag with one non-existing resource

[root@virt-125 ~]# pcs tag remove special_resources
[root@virt-125 ~]# pcs tag create special_resources_1 dummy1 dummy2 dummy6
Error: bundle/clone/group/resource 'dummy6' does not exist
Error: Errors have occurred, therefore pcs is unable to continue
[root@virt-125 ~]# pcs tag
 No tags defined

> OK


# Creating a tag with the same id as one of the resource

[root@virt-125 ~]# pcs tag create dummy1 dummy2
Error: 'dummy1' already exists
Error: Errors have occurred, therefore pcs is unable to continue

> OK


# Creating a tag with special character in name

[root@virt-125 ~]# pcs tag create special_resources_# dummy1
Error: invalid id 'special_resources_#', '#' is not a valid character for a id
Error: Errors have occurred, therefore pcs is unable to continue

> OK


# Adding to tag with both options, --before and --after

[root@virt-125 ~]# pcs tag create special_resources dummy1 dummy2
[root@virt-125 ~]# pcs tag update special_resources add dummy3 --before dummy1 --after dummy2
Error: Cannot specify both --before and --after

> OK


# Adding/moving and removing resource at the same time

[root@virt-125 ~]# pcs tag update special_resources add dummy3 --after dummy2 remove dummy3
Error: Ids cannot be added and removed at the same time: 'dummy3'
Error: Tag 'special_resources' does not contain id: 'dummy3'
Error: Errors have occurred, therefore pcs is unable to continue

[root@virt-125 ~]# pcs tag update special_resources add dummy1 --after dummy2 remove dummy1
Error: Ids cannot be added and removed at the same time: 'dummy1'
Error: Errors have occurred, therefore pcs is unable to continue

> OK


## Tagging group/clone resources

[root@virt-125 ~]# pcs tag remove special_resources
[root@virt-125 ~]# pcs resource group add G1 dummy1 dummy2
[root@virt-125 ~]# pcs resource clone dummy3
[root@virt-125 ~]# pcs resource
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-125
  * Resource Group: G1:
    * dummy1	(ocf::heartbeat:Dummy):	 Started virt-126
    * dummy2	(ocf::heartbeat:Dummy):	 Started virt-126
  * Clone Set: dummy3-clone [dummy3]:
    * Started: [ virt-125 virt-126 ]

[root@virt-125 ~]# pcs tag create GroupTag G1
[root@virt-125 ~]# pcs tag
GroupTag
  G1
[root@virt-125 ~]# pcs tag create GroupResourcesTag dummy1 dummy2
[root@virt-125 ~]# pcs tag
GroupTag
  G1
GroupResourcesTag
  dummy1
  dummy2

[root@virt-125 ~]# pcs resource ungroup G1
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2

> OK


[root@virt-125 ~]# pcs tag create CloneTag dummy3-clone
[root@virt-125 ~]# pcs tag create CloneResourceTag dummy3
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2
CloneTag
  dummy3-clone
CloneResourceTag
  dummy3

[root@virt-125 ~]# pcs resource unclone dummy3
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2
CloneResourceTag
  dummy3

> OK


## Creating a mixed tag with a clone/resource group and another resource

[root@virt-125 ~]# pcs resource clone dummy3
[root@virt-125 ~]# pcs tag create CloneTag dummy3-clone dummy4
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2
CloneResourceTag
  dummy3
CloneTag
  dummy3-clone
  dummy4

[root@virt-125 ~]# pcs resource unclone dummy3
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2
CloneResourceTag
  dummy3

> NOK, non-empty CloneTag was deleted after removing the clone

[root@virt-125 ~]# pcs resource group add G1 dummy1 dummy2
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2
CloneResourceTag
  dummy3
GroupTag
  G1
  dummy3

[root@virt-125 ~]# pcs resource ungroup G1
[root@virt-125 ~]# pcs tag
GroupResourcesTag
  dummy1
  dummy2
CloneResourceTag
  dummy3

> NOK, non-empty GroupTag was deleted after removing the resource group
> This problem will be addresed in new bz


## Deleting resources, that have tag

[root@virt-125 ~]# pcs resource delete dummy1
Error: Unable to remove resource 'dummy1' because it is referenced in the tag: 'GroupResourcesTag'
[root@virt-125 ~]# pcs tag list GroupResourcesTag
GroupResourcesTag
  dummy1
  dummy2

> OK


## Deleting resources, that doesn't have tag

[root@virt-125 ~]# pcs resource delete dummy4
Attempting to stop: dummy4... Stopped

> OK


## Enabling/disabling tags

[root@virt-125 ~]# pcs tag list GroupResourcesTag
GroupResourcesTag
  dummy1
  dummy2
[root@virt-125 ~]# pcs resource
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-125

[root@virt-125 ~]# pcs resource disable GroupResourcesTag
[root@virt-125 ~]# pcs resource
  * dummy1	(ocf::heartbeat:Dummy):	 Stopped (disabled)
  * dummy2	(ocf::heartbeat:Dummy):	 Stopped (disabled)
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-125

> OK


[root@virt-125 ~]# pcs resource enable GroupResourcesTag
[root@virt-125 ~]# pcs resource
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-125

> OK


## Safe-disabling tags without constraints

[root@virt-125 ~]# pcs resource safe-disable GroupResourcesTag
[root@virt-125 ~]# pcs resource
  * dummy1	(ocf::heartbeat:Dummy):	 Stopped (disabled)
  * dummy2	(ocf::heartbeat:Dummy):	 Stopped (disabled)
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-125

> OK


## Safe-disabling tags with single constraint

[root@virt-125 ~]# pcs resource enable GroupResourcesTag
[root@virt-125 ~]# pcs constraint order start dummy1 then start dummy3
Adding dummy1 dummy3 (kind: Mandatory) (Options: first-action=start then-action=start)

[root@virt-125 ~]# pcs resource safe-disable GroupResourcesTag
Error: Disabling specified resources would have an effect on other resources

2 of 5 resource instances DISABLED and 0 BLOCKED from further action due to failure

Current cluster status:
Online: [ virt-125 virt-126 ]

 fence-virt-125	(stonith:fence_xvm):	 Started virt-125
 fence-virt-126	(stonith:fence_xvm):	 Started virt-126
 dummy1	(ocf::heartbeat:Dummy):	 Started virt-125 (disabled)
 dummy2	(ocf::heartbeat:Dummy):	 Started virt-126 (disabled)
 dummy3	(ocf::heartbeat:Dummy):	 Started virt-125

Transition Summary:
 * Stop       dummy1     ( virt-125 )   due to node availability
 * Stop       dummy2     ( virt-126 )   due to node availability
 * Stop       dummy3     ( virt-125 )   due to required dummy1 start

Executing cluster transition:
 * Resource action: dummy2          stop on virt-126
 * Resource action: dummy3          stop on virt-125
 * Resource action: dummy1          stop on virt-125

Revised cluster status:
Online: [ virt-125 virt-126 ]

 fence-virt-125	(stonith:fence_xvm):	 Started virt-125
 fence-virt-126	(stonith:fence_xvm):	 Started virt-126
 dummy1	(ocf::heartbeat:Dummy):	 Stopped (disabled)
 dummy2	(ocf::heartbeat:Dummy):	 Stopped (disabled)
 dummy3	(ocf::heartbeat:Dummy):	 Stopped

[root@virt-125 ~]# pcs resource
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-125

> OK


[root@virt-125 ~]# pcs resource safe-disable --simulate GroupResourcesTag --brief
dummy3

> OK


## Safe-disabling tags with multiple constraints

[root@virt-125 ~]# pcs resource create dummy4 ocf:heartbeat:Dummy
[root@virt-125 ~]# pcs constraint order start dummy2 then start dummy4
Adding dummy2 dummy4 (kind: Mandatory) (Options: first-action=start then-action=start)

[root@virt-125 ~]# pcs resource safe-disable --simulate GroupResourcesTag --brief
dummy3
dummy4

[root@virt-125 ~]# pcs resource safe-disable GroupResourcesTag
Error: Disabling specified resources would have an effect on other resources
{...}

[root@virt-125 ~]# pcs resource
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-125

> OK

[root@virt-125 ~]# pcs constraint remove order-dummy1-dummy3-mandatory
[root@virt-125 ~]# pcs constraint remove order-dummy1-dummy4-mandatory


## Managing/unmanaging tag

[root@virt-125 ~]# pcs resource unmanage GroupResourcesTag
[root@virt-125 ~]# pcs resource
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125 (unmanaged)
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-125 (unmanaged)
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-126

> OK


[root@virt-125 ~]# pcs resource manage GroupResourcesTag
[root@virt-125 ~]# pcs resource
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-126

> OK


## Managing/unmanaging multiple tags

[root@virt-125 ~]# pcs resource unmanage GroupResourcesTag CloneResourceTag
[root@virt-125 ~]# pcs resource
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-126 (unmanaged)
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125 (unmanaged)
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-125 (unmanaged)
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-126

> OK


[root@virt-125 ~]# pcs resource manage GroupResourcesTag CloneResourceTag
[root@virt-125 ~]# pcs resource
  * dummy3	(ocf::heartbeat:Dummy):	 Started virt-126
  * dummy1	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy2	(ocf::heartbeat:Dummy):	 Started virt-125
  * dummy4	(ocf::heartbeat:Dummy):	 Started virt-126

> OK


RESULT:
=======

One problem was found, described in comment 22. New bz was created for this issue: bz1857295
Based on comment 12, view the status of resources with a specific tag and move/unmove tags will be implemented in the next releases.

Marking as VERIFIED in pcs-0.10.6-2.el8

Comment 31 errata-xmlrpc 2020-11-04 02:28:16 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 (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-2020:4617


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