Fix procedure of masterNode determine in MySQL upgrade pipeline
If stopped servers have the same seqno in /var/lib/mysql/grastate.dat
then master became the last checked instead of the last stopped
Current behavior changed to use the getGaleraLastShutdownNode method
PROD-36755
Change-Id: I1dfbb51f2c4c1b3383c329db8facfc6789332e09
(cherry picked from commit 34603b305344258cf618f9e83b591024ac38d063)
diff --git a/openstack-galera-upgrade.groovy b/openstack-galera-upgrade.groovy
index f124051..64dbbad 100644
--- a/openstack-galera-upgrade.groovy
+++ b/openstack-galera-upgrade.groovy
@@ -133,17 +133,7 @@
}
}
- for (target in upgradeTargets) {
- out = salt.cmdRun(env, target, 'cat /var/lib/mysql/grastate.dat | grep "seqno" | cut -d ":" -f2', true, null, false).get('return')[0].values()[0].replaceAll('Salt command execution success', '').trim()
- common.infoMsg("Get seqno: ${out} for node ${target}")
- if (!out.isNumber()){
- out = -2
- }
- targetSecMapping[out.toInteger()] = target
- secNoList.add(out.toInteger())
- }
-
- def masterNode = targetSecMapping[secNoList.max()]
+ def masterNode = salt.getMinionsSorted(env, galera.getGaleraLastShutdownNode(env))[0]
common.infoMsg("Master node is: ${masterNode}")
// Make sure we start upgrade always from master node