galera: Honor "safe_to_bootstrap" flag in grastate.dat
With version 3.19 galera introduced the "safe_to_bootstrap" flag to the
grastate.dat file [1]. When all nodes of a cluster are shutdown cleanly,
the last node shutting down gets this flag set to 1. (All others get a
0).
This commit enhances the galera resource agent to make use of that flag
when selecting an appropriate node for bootstrapping the cluster. When
any of the cluster nodes has the "safe_to_bootstrap" flag set to 1, that
node is immediately selected as the boostrap node of the cluster.
When all nodes have safe_to_bootstrap=0 or the flag is not present the
current bootstrap behaviour mostly unchanged. We just set
"safe_to_bootstrap" to 1 in grastate.dat on the selected bootstrap node
to a allow for galera to start, as outlined in the galera documentation
[2].
Fixes: #915
[1] http://galeracluster.com/2016/11/introducing-the-safe-to-bootstrap-feature-in-galera-cluster
[2] http://galeracluster.com/documentation-webpages/restartingcluster.html#safe-to-bootstrap-protection