Comment 0 for bug 1615983

Revision history for this message
Michele Baldessari (michele) wrote : boostrap_node if checks are fragile

We currently litter our code with the following if checks:
if $::hostname == downcase($bootstrap_node) {
  $sync_db = true
} else {
  $sync_db = false
}

We do so for a bunch of reasons, but mainly for:
1) Creating pacemaker resources only from a single node
2) Call sync_db commands to create sql tables and fixup sql data in general

When we merged commit b345dbea16ad3edd600c62848d8ee116f4df16ee
"Combine BootstrapNodeDeployment with AllNodesDeployment" we added a bootstrap
node id not not only for controller nodes but for each type of nodes.

This is problematic. Imagine the following scenario as an example:
- Both Controllers and Compute nodes are configured with service aodh-api
- Both controllers and computes will include the following snippet:
"""
  if $::hostname == downcase($bootstrap_node) {
    $sync_db = true
  } else {
    $sync_db = false
  }

  if $step >= 3 and $sync_db {
    include ::aodh::db::mysql
  }
"""
- The if statement will hold true for both the controller 0 *and* compute 0, which means that
  they can be called at the same time, thereby opening up a race condition