Add checkClusterTimeSync method
Related: PROD-26609 (PROD:26609)
Change-Id: I990bf96920b2c0ddf5250a26a90509cac4964395
(cherry picked from commit 232ad90b7e8b46d1d193b23111862782213d4bc6)
diff --git a/src/com/mirantis/mk/Openstack.groovy b/src/com/mirantis/mk/Openstack.groovy
index d2f6d8a..284adec 100644
--- a/src/com/mirantis/mk/Openstack.groovy
+++ b/src/com/mirantis/mk/Openstack.groovy
@@ -533,9 +533,11 @@
* of Salt mysql.status function. The result is then parsed, validated and outputed to the user.
*
* @param env Salt Connection object or pepperEnv
+ * @param slave Boolean value to enable slave checking (if master in unreachable)
+ * @param checkTimeSync Boolean value to enable time sync check
* @return resultCode int values used to determine exit status in the calling function
*/
-def verifyGaleraStatus(env, slave=false) {
+def verifyGaleraStatus(env, slave=false, checkTimeSync=false) {
def salt = new com.mirantis.mk.Salt()
def common = new com.mirantis.mk.Common()
def out = ""
@@ -573,6 +575,10 @@
common.errorMsg("No Galera slave was reachable.")
return 130
}
+ if (checkTimeSync && !salt.checkClusterTimeSync(env, "I@galera:master or I@galera:slave")) {
+ common.errorMsg("Time in cluster is desynchronized or it couldn't be detemined. You should fix this issue manually before proceeding.")
+ return 131
+ }
try {
out = salt.cmdRun(env, "I@salt:master", "salt -C '${testNode}' mysql.status")
} catch (Exception e) {
@@ -736,7 +742,7 @@
* @param env Salt Connection object or pepperEnv
* @return output of salt commands
*/
-def restoreGaleraDb(env) {
+def restoreGaleraDb(env, type) {
def salt = new com.mirantis.mk.Salt()
def common = new com.mirantis.mk.Common()
try {