Reorder colocation creation

A colocation constraint may reference a clone resource (which
percona-cluster charm does). So, the colocation must be created
after the clones.

Closes-Bug: #1808166
Change-Id: I304df954b2f81477535fe64687af11055b932c27
This commit is contained in:
Liam Young 2018-12-12 14:43:56 +00:00
parent 81b386d379
commit 2ca245127e
1 changed files with 12 additions and 8 deletions

View File

@ -378,14 +378,6 @@ def ha_relation_changed():
pcmk.commit(cmd)
log('%s' % cmd, level=DEBUG)
log('Configuring Colocations: %s' % colocations, level=DEBUG)
for col_name, col_params in colocations.iteritems():
if not pcmk.crm_opt_exists(col_name):
cmd = 'crm -w -F configure colocation %s %s' % (col_name,
col_params)
pcmk.commit(cmd)
log('%s' % cmd, level=DEBUG)
log('Configuring Clones: %s' % clones, level=DEBUG)
for cln_name, cln_params in clones.iteritems():
if not pcmk.crm_opt_exists(cln_name):
@ -394,6 +386,18 @@ def ha_relation_changed():
pcmk.commit(cmd)
log('%s' % cmd, level=DEBUG)
# Ordering is important here, colocation and location constraints
# reference resources. All resources referenced by the constraints
# need to exist otherwise constraint creation will fail.
log('Configuring Colocations: %s' % colocations, level=DEBUG)
for col_name, col_params in colocations.iteritems():
if not pcmk.crm_opt_exists(col_name):
cmd = 'crm -w -F configure colocation %s %s' % (col_name,
col_params)
pcmk.commit(cmd)
log('%s' % cmd, level=DEBUG)
log('Configuring Locations: %s' % locations, level=DEBUG)
for loc_name, loc_params in locations.iteritems():
if not pcmk.crm_opt_exists(loc_name):