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 1741056 - [RFE] Make it possible to set custom (promotable) clone id
Summary: [RFE] Make it possible to set custom (promotable) clone id
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: pcs
Version: 8.1
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: 8.4
Assignee: Miroslav Lisik
QA Contact: cluster-qe@redhat.com
Steven J. Levine
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-14 07:37 UTC by Tomas Jelinek
Modified: 2021-05-19 16:54 UTC (History)
9 users (show)

Fixed In Version: pcs-0.10.7-1.el8
Doc Type: Enhancement
Doc Text:
.Ability to specify a custom clone ID when creating a clone resource or promotable clone resource When you create a clone resource or a promotable clone resource, the clone resource is named _resource-id_ `-clone` by default. If that ID is already in use, PCS adds the suffix -_integer_, starting with an integer value of `1` and incrementing by one for each additional clone. You can now override this default by specifying a name for a clone resource ID or promotable clone resource ID with the _clone-id_ option when creating a clone resource with the `pcs resource create` or the `pcs resource clone` command. For information on creating clone resources, see link:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_high_availability_clusters/assembly_creating-multinode-resources-configuring-and-managing-high-availability-clusters[Creating cluster resources that are active on multiple nodes].
Clone Of:
Environment:
Last Closed: 2021-05-18 15:12:05 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed fix + tests (51.84 KB, patch)
2020-09-21 15:11 UTC, Miroslav Lisik
no flags Details | Diff
additional fix (928 bytes, patch)
2020-09-22 11:54 UTC, Miroslav Lisik
no flags Details | Diff

Description Tomas Jelinek 2019-08-14 07:37:51 UTC
Description of problem:
When creating a (promotable) clone resource, pcs automatically sets its id to <primitive resource name>-clone. If that id is already taken, pcs adds -<integer> suffix to the id to make it unique starting with <integer> == 1 and counting up.

This causes issues when scripting as one must figure out what the clone id is. It would be much easier for scripts to be able to set custom clone id.

This feature was requested in upstream IRC.


Version-Release number of selected component (if applicable):
pcs-0.10.2


How reproducible:
always, easily


Actual results:
No way to set custom (promotable) clone id.


Expected results:
Be able to set custom (promotable) clone id.


Additional info:

Proposed syntax variants:

1. clone | promotable <resource id> [<clone id>] [<clone options>]
To distinguish clone id from the first clone options, look for = in the first arg after resource id. That means clone id cannot contain =.

2. clone | promotable <resource id> [id=<clone id>] [<clone options>]
Clone id is effectively a clone option. This will not work if there is an actual id option.

Comment 1 Miroslav Lisik 2020-09-21 15:11:33 UTC
Created attachment 1715552 [details]
proposed fix + tests

Affected commands:
* pcs resource create ... clone
* pcs resource create ... promotable
* pcs resource clone
* pcs resource promotable

Test:

[root@r8-node-01 pcs]# pcs resource create c1 ocf:pacemaker:Dummy clone MyCloneId globally-unique=true
[root@r8-node-01 pcs]# pcs resource create p1 ocf:pacemaker:Stateful promotable MyPromotableId
[root@r8-node-01 pcs]# pcs resource
  * Clone Set: MyCloneId [c1] (unique):
    * c1:0      (ocf::pacemaker:Dummy):  Started r8-node-01
    * c1:1      (ocf::pacemaker:Dummy):  Started r8-node-02
  * Clone Set: MyPromotableId [p1] (promotable):
    * Masters: [ r8-node-01 ]
    * Slaves: [ r8-node-02 ]
[root@r8-node-01 pcs]# pcs resource unclone MyCloneId
[root@r8-node-01 pcs]# pcs resource unclone MyPromotableId
[root@r8-node-01 pcs]# pcs resource
  * c1  (ocf::pacemaker:Dummy):  Started r8-node-01
  * p1  (ocf::pacemaker:Stateful):       Started r8-node-02
[root@r8-node-01 pcs]# pcs resource clone c1 ClonedDummy
[root@r8-node-01 pcs]# pcs resource clone p1 PromotableStateful
[root@r8-node-01 pcs]# pcs resource
  * Clone Set: ClonedDummy [c1]:
    * Started: [ r8-node-01 r8-node-02 ]
  * Clone Set: PromotableStateful [p1]:
    * Started: [ r8-node-01 r8-node-02 ]
[root@r8-node-01 pcs]# pcs resource create c2 ocf:pacemaker:Dummy clone ClonedDummy
Error: 'ClonedDummy' already exists
Error: Errors have occurred, therefore pcs is unable to continue
[root@r8-node-01 pcs]# echo $?
1

Comment 2 Miroslav Lisik 2020-09-22 11:54:13 UTC
Created attachment 1715687 [details]
additional fix

Add missing '>' to the 'pcs resource clone' help.

[root@r8-node-01 pcs]# pcs resource clone --help

Usage: pcs resource clone...
    clone <resource id | group id> [<clone id>] [clone options]... [--wait[=n]]
        Set up the specified resource or group as a clone. If --wait is
        specified, pcs will wait up to 'n' seconds for the operation to finish
        (including starting clone instances if appropriate) and then return 0
        on success or 1 on error. If 'n' is not specified it defaults to 60
        minutes.

Comment 6 Miroslav Lisik 2020-10-14 13:50:05 UTC
Test:

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

[root@r8-node-01 ~]# pcs resource create c1 ocf:pacemaker:Dummy clone MyCloneId globally-unique=true
[root@r8-node-01 ~]# pcs resource
  * Clone Set: MyCloneId [c1] (unique):
    * c1:0      (ocf::pacemaker:Dummy):  Started r8-node-01
    * c1:1      (ocf::pacemaker:Dummy):  Started r8-node-02

Comment 15 errata-xmlrpc 2021-05-18 15:12:05 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-2021:1737


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