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 2054671 - [RFE] Generate UUID for each cluster
Summary: [RFE] Generate UUID for each cluster
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: pcs
Version: 9.0
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 9.1
Assignee: Michal Pospisil
QA Contact: cluster-qe@redhat.com
Steven J. Levine
URL:
Whiteboard:
: 2058250 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-15 13:10 UTC by Michal Pospisil
Modified: 2022-11-15 10:02 UTC (History)
16 users (show)

Fixed In Version: pcs-0.11.2-1.el9
Doc Type: Enhancement
Doc Text:
.Support for cluster UUID During cluster setup, the `pcs` command now generates a UUID for every cluster. Since a cluster name is not a unique cluster identifier, you can use the cluster UUID to identify clusters with the same name when you administer multiple clusters. You can display the current cluster UUID with the `pcs cluster config [show]` command. You can add a UUID to an existing cluster or regenerate a UUID if it already exists by using the `pcs cluster config uuid generate` command.
Clone Of: 1950551
Environment:
Last Closed: 2022-11-15 09:48:38 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CLUSTERQE-5826 0 None None None 2022-06-16 18:03:15 UTC
Red Hat Issue Tracker RHELPLAN-112332 0 None None None 2022-02-15 13:19:58 UTC
Red Hat Knowledge Base (Solution) 5973101 0 None None None 2022-05-29 00:03:46 UTC
Red Hat Product Errata RHSA-2022:7935 0 None None None 2022-11-15 09:48:58 UTC

Description Michal Pospisil 2022-02-15 13:10:42 UTC
+++ This bug was initially created as a clone of Bug #1950551 +++

Description of problem:

A customer is requesting a per-cluster UUID. Their use case is to uniquely identify each cluster within their CMDB.

The cluster name can serve as a unique identifier for the CMDB. But in an environment with a large number of clusters, an administrator may inadvertently (either manually or through an error in script logic) create two clusters with the same name.

There are certainly workarounds that make cluster name a viable solution as-is (e.g., check a new cluster's name against a database of existing names before building the new cluster). A UUID is a nice-to-have feature, acting as (nearly) a guarantee of uniqueness.

I'm not very familiar with the process of generating UUIDs and thus whether this is feasible for clusters. It looks like it might be, using something like timestamp at cluster creation and some identifier of a host (e.g., MAC address of a cluster's original node 1).
  - Universally Unique IDentifier (UUID) URN Namespace (https://tools.ietf.org/html/rfc4122)


I'm opening this against corosync as that seems like the most logical place to put this feature. CC'ing Ken for Pacemaker visibility.

--- Additional comment from Chris Feist on 2021-04-17 21:37:15 UTC ---

Moving this to pacemaker since I think that is probably the best place for this uuid to live (feel free to move it back if you think it belongs somewhere else).

Ken,

I'm wondering if we can just create a cluster property (that pacemaker ignores) where we can set the UUID (maybe as part of pcs cluster create?).  (Or maybe there is something in there that gets auto-generated on cluster creation).

Thanks,
Chris

--- Additional comment from Reid Wahl on 2021-04-17 23:35:23 UTC ---

(In reply to Chris Feist from comment #1)
> Moving this to pacemaker since I think that is probably the best place for
> this uuid to live (feel free to move it back if you think it belongs
> somewhere else).
> 
> Ken,
> 
> I'm wondering if we can just create a cluster property (that pacemaker
> ignores) where we can set the UUID (maybe as part of pcs cluster create?). 
> (Or maybe there is something in there that gets auto-generated on cluster
> creation).

It occurred to me later that there's no clear point-in-time of "cluster creation" from corosync's perspective, AFAIK. I believe corosync just reads corosync.conf (or the specified config file) on daemon startup.

If we're okay with not making this a built-in part of pacemaker or corosync tied to the particular cluster, then a straightforward method would be to create a cluster property during `pcs cluster setup`. There might be some corner cases to consider, like removing node 1 from a 3-node cluster, leaving nodes 2a and 3a in the original cluster, and then adding nodes 2b and 3b to node 1's current one-node cluster, without ever doing a pcs cluster setup or destroy. If I'm thinking about this right, it might leave two clusters with the same UUID.

--- Additional comment from Jan Friesse on 2021-04-19 07:09:14 UTC ---

What about some option for pcs which would generate unique cluster name (let's say cluster_name_prefix-UUID_postfix) during cluster create? That would allow UUID functionality with no change in corosync/pcmk.

Of course even corosync could generate UUID (if no exists yet) and store it alongside with ringid and present it in some form (probably cmap). But it would be problematic for corosync to have it synchronized across the nodes. So pcmk cib (which is synchronized by default) seems to be really better choice here.

--- Additional comment from Jan Friesse on 2021-04-19 07:35:46 UTC ---

Just one more comment what can be used without any change. Corosync "ignores" unknown entries in corosync.conf and just stores them in cmap. So if someone uses this example file snip:
```
totem {
    version: 2
    transport: knet
    cluster_name: mycluster
    cluster_uuid: 6f41ea47-dba9-4860-a1fc-64484dc05d69
...
```

can then call corosync-cmapctl:
```
# corosync-cmapctl  -g totem.cluster_uuid
totem.cluster_uuid (str) = 6f41ea47-dba9-4860-a1fc-64484dc05d69
```

to get uuid back.

--- Additional comment from Ken Gaillot on 2021-04-19 13:47:34 UTC ---

I would just recommend that the administrator run uuidgen to generate their cluster name. Possibly via a wrapper script that calls pcs cluster create with whatever their preferred defaults are.

--- Additional comment from Jan Friesse on 2021-04-19 15:31:43 UTC ---

I was thinking a bit more about of this and I think having "standardized" cluster_uuid stored (as shown in my previous comment) in corosync.conf makes sense. Basically only pcs would need to be changed (for now).

--- Additional comment from Ken Gaillot on 2021-04-19 16:19:48 UTC ---

Reassigning to pcs for consideration

--- Additional comment from Tomas Jelinek on 2021-04-21 12:30:52 UTC ---

It seems reasonable for pcs to create a random UUID and store it in corosync.conf as shown in #comment 4 as a part of 'pcs cluster setup' command.

Comment 1 Tomas Jelinek 2022-02-24 16:14:16 UTC
*** Bug 2058250 has been marked as a duplicate of this bug. ***

Comment 2 Michal Pospisil 2022-03-18 14:59:11 UTC
Feature merged into upstream master: https://github.com/ClusterLabs/pcs/commit/d3363a81ca1be43bd2420f0b5826c603fc0349ff

New clusters created with "pcs cluster setup" are going to get a UUID by default. Anyone wishing to create a cluster without UUID can use the "--no-cluster-uuid"
switch on cluster setup. This UUID is being stored in the totem section of corosync.conf under "cluster_uuid" key. The generated UUID is compliant with RFC4122 [1], UUID version 4.

Command "pcs cluster config [show]" can be used to display the UUID. For existing clusters without the UUID, one can be generated by using "pcs cluster config uuid generate". In case of an UUID collision in an external system, like a CMDB (configuration management database [2]), the UUID can be regenerated with "pcs cluster config uuid generate --force". The "--force" is needed for overwriting an existing UUID in this case.  


[1] https://datatracker.ietf.org/doc/html/rfc4122.html
[2] https://en.wikipedia.org/wiki/Configuration_management_database


ENVIRONMENT PREPARATION:
- any cluster (do not use "--no-cluster-uuid" on setup)

DEV TEST:
## Generate a UUID and verify it's there
# pcs cluster config uuid generate
# pcs cluster config
Cluster Name: cluster4
Cluster UUID: ad4ae07dcafe4066b01f1cc9391f34f5
Transport: knet
Nodes:
  c4n1-el9-0:
    Link 0 address: c4n1-el9-0
    nodeid: 1
  c4n2-el9-0:
    Link 0 address: c4n2-el9-0
    nodeid: 2
Crypto Options:
  cipher: aes256
  hash: sha256

Comment 4 Milind 2022-05-19 17:23:22 UTC
will this be backported in RHEL8 ?

Comment 5 Miroslav Lisik 2022-05-19 17:28:14 UTC
(In reply to Milind from comment #4)
> will this be backported in RHEL8 ?

Yes, it will be. There is a BZ bz1950551.

Comment 6 Miroslav Lisik 2022-05-19 17:29:22 UTC
DevTestResults:

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

[root@r91-1 ~]# pcs cluster config | grep "Cluster UUID:"
Cluster UUID: 286e17ce5161457bbf5825dc0fa9a372
[root@r91-1 ~]# pcs cluster config uuid generate
Error: Cluster UUID has already been set, use --force to override
Error: Errors have occurred, therefore pcs is unable to continue
[root@r91-1 ~]# pcs cluster config uuid generate --force
Warning: Cluster UUID has already been set
Sending updated corosync.conf to nodes...
r91-1: Succeeded
r91-2: Succeeded
r91-1: Corosync configuration reloaded
[root@r91-1 ~]# pcs cluster config | grep "Cluster UUID:"
Cluster UUID: 252a298451e0468eb4f71eca1d90b6eb

Comment 13 svalasti 2022-06-30 10:12:12 UTC
Marking as VERIFIED for pcs-0.11.2-1.el9 based on comment 10, comment 12.

Comment 21 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.