Bug 1284044 - add commands for checking constraints existence
add commands for checking constraints existence
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs (Show other bugs)
Unspecified Unspecified
medium Severity unspecified
: rc
: ---
Assigned To: Tomas Jelinek
Depends On:
  Show dependency treegraph
Reported: 2015-11-20 11:06 EST by Tomas Jelinek
Modified: 2017-11-01 20:02 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Tomas Jelinek 2015-11-20 11:06:07 EST
There are scripts which need to ensure certain cluster constraints exist (they may or may not exist before the upgrade). Pcs rejects constraints which already exist (and using --force results in duplicates). It would be nice to have an add-if-missing option or a possibility to check a constraint's existence.

Current solution is to try adding a constraint and check the return value and the output. If the return value is not 0 and the output contains "duplicate constraint already exists", then the constraint already exists. This does not work in a case when the constraint should not be created if it is missing.

We may want to add commands like "pcs constraint location|colocation|order exists" to pcs which will check if the specified constraint already exists. If the
work-flow is like this
pcs cluster cib cib.xml
if not pcs -f cib.xml constraint location exists {constraint definition}
pcs -f cib.xml constraint location {constraint definition}
pcs cluster cib-push cib.xml
then the process of add-if-missing will be atomic.
Comment 5 Michele Baldessari 2016-10-19 08:50:55 EDT
Hi Tomas,

I think it is a nice to have in general. No, not urgent for us as we have reduced constraint usage quite a lot in osp. (First time you hear "not urgent" from me, ha :)


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