Bug 1284044

Summary: add commands for checking constraints existence
Product: Red Hat Enterprise Linux 7 Reporter: Tomas Jelinek <tojeline>
Component: pcsAssignee: Tomas Jelinek <tojeline>
Status: CLOSED WONTFIX QA Contact: cluster-qe <cluster-qe>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.2CC: cfeist, cluster-maint, fdinitto, gfidente, kgaillot, michele, tojeline
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:38:41 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:

Description Tomas Jelinek 2015-11-20 16:06:07 UTC
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}
fi
pcs cluster cib-push cib.xml
then the process of add-if-missing will be atomic.

Comment 5 Michele Baldessari 2016-10-19 12:50:55 UTC
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 :)

thanks,
Michele

Comment 7 RHEL Program Management 2020-12-15 07:38:41 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.