|
|
0240e4 |
From 94ebc967f2e74301ef5e10ed102832168503c7d9 Mon Sep 17 00:00:00 2001
|
|
|
0240e4 |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
0240e4 |
Date: Thu, 1 Oct 2015 12:00:26 -0500
|
|
|
0240e4 |
Subject: [PATCH] Test: CTS: get Reattach test working again and up-to-date
|
|
|
0240e4 |
|
|
|
0240e4 |
Prevously, Reattach relied on command lines being logged,
|
|
|
0240e4 |
which 8dae683 removed. Now, it doesn't.
|
|
|
0240e4 |
|
|
|
0240e4 |
Previously, Reattach used the now-deprecated is-managed-default cluster option;
|
|
|
0240e4 |
now, it uses the is-managed option in rsc_defaults.
|
|
|
0240e4 |
---
|
|
|
0240e4 |
cts/CTStests.py | 59 ++++++++++++++++++++++++++++-----------------------------
|
|
|
0240e4 |
1 file changed, 29 insertions(+), 30 deletions(-)
|
|
|
0240e4 |
|
|
|
0240e4 |
diff --git a/cts/CTStests.py b/cts/CTStests.py
|
|
|
0240e4 |
index ddd8c4a..e4207aa 100644
|
|
|
0240e4 |
--- a/cts/CTStests.py
|
|
|
0240e4 |
+++ b/cts/CTStests.py
|
|
|
0240e4 |
@@ -1693,6 +1693,19 @@ class Reattach(CTSTest):
|
|
|
0240e4 |
self.stopall = SimulStopLite(cm)
|
|
|
0240e4 |
self.is_unsafe = 0 # Handled by canrunnow()
|
|
|
0240e4 |
|
|
|
0240e4 |
+ def _is_managed(self, node):
|
|
|
0240e4 |
+ is_managed = self.rsh(node, "crm_attribute -t rsc_defaults -n is-managed -Q -G -d true", 1)
|
|
|
0240e4 |
+ is_managed = is_managed[:-1] # Strip off the newline
|
|
|
0240e4 |
+ return is_managed == "true"
|
|
|
0240e4 |
+
|
|
|
0240e4 |
+ def _set_unmanaged(self, node):
|
|
|
0240e4 |
+ self.debug("Disable resource management")
|
|
|
0240e4 |
+ self.rsh(node, "crm_attribute -t rsc_defaults -n is-managed -v false")
|
|
|
0240e4 |
+
|
|
|
0240e4 |
+ def _set_managed(self, node):
|
|
|
0240e4 |
+ self.debug("Re-enable resource management")
|
|
|
0240e4 |
+ self.rsh(node, "crm_attribute -t rsc_defaults -n is-managed -D")
|
|
|
0240e4 |
+
|
|
|
0240e4 |
def setup(self, node):
|
|
|
0240e4 |
attempt = 0
|
|
|
0240e4 |
if not self.startall(None):
|
|
|
0240e4 |
@@ -1717,17 +1730,11 @@ class Reattach(CTSTest):
|
|
|
0240e4 |
start = StartTest(self.CM)
|
|
|
0240e4 |
start(node)
|
|
|
0240e4 |
|
|
|
0240e4 |
- is_managed = self.rsh(node, "crm_attribute -Q -G -t crm_config -n is-managed-default -d true", 1)
|
|
|
0240e4 |
- is_managed = is_managed[:-1] # Strip off the newline
|
|
|
0240e4 |
- if is_managed != "true":
|
|
|
0240e4 |
- self.logger.log("Attempting to re-enable resource management on %s (%s)" % (node, is_managed))
|
|
|
0240e4 |
- managed = self.create_watch(["is-managed-default"], 60)
|
|
|
0240e4 |
- managed.setwatch()
|
|
|
0240e4 |
-
|
|
|
0240e4 |
- self.rsh(node, "crm_attribute -V -D -n is-managed-default")
|
|
|
0240e4 |
-
|
|
|
0240e4 |
- if not managed.lookforall():
|
|
|
0240e4 |
- self.logger.log("Patterns not found: " + repr(managed.unmatched))
|
|
|
0240e4 |
+ if not self._is_managed(node):
|
|
|
0240e4 |
+ self.logger.log("Attempting to re-enable resource management on %s" % node)
|
|
|
0240e4 |
+ self._set_managed(node)
|
|
|
0240e4 |
+ self.CM.cluster_stable()
|
|
|
0240e4 |
+ if not self._is_managed(node):
|
|
|
0240e4 |
self.logger.log("Could not re-enable resource management")
|
|
|
0240e4 |
return 0
|
|
|
0240e4 |
|
|
|
0240e4 |
@@ -1744,11 +1751,12 @@ class Reattach(CTSTest):
|
|
|
0240e4 |
self.incr("calls")
|
|
|
0240e4 |
|
|
|
0240e4 |
pats = []
|
|
|
0240e4 |
- managed = self.create_watch(["is-managed-default"], 60)
|
|
|
0240e4 |
+ # Conveniently, pengine will display this message when disabling management,
|
|
|
0240e4 |
+ # even if fencing is not enabled, so we can rely on it.
|
|
|
0240e4 |
+ managed = self.create_watch(["Delaying fencing operations"], 60)
|
|
|
0240e4 |
managed.setwatch()
|
|
|
0240e4 |
|
|
|
0240e4 |
- self.debug("Disable resource management")
|
|
|
0240e4 |
- self.rsh(node, "crm_attribute -V -n is-managed-default -v false")
|
|
|
0240e4 |
+ self._set_unmanaged(node)
|
|
|
0240e4 |
|
|
|
0240e4 |
if not managed.lookforall():
|
|
|
0240e4 |
self.logger.log("Patterns not found: " + repr(managed.unmatched))
|
|
|
0240e4 |
@@ -1767,37 +1775,28 @@ class Reattach(CTSTest):
|
|
|
0240e4 |
self.debug("Shutting down the cluster")
|
|
|
0240e4 |
ret = self.stopall(None)
|
|
|
0240e4 |
if not ret:
|
|
|
0240e4 |
- self.debug("Re-enable resource management")
|
|
|
0240e4 |
- self.rsh(node, "crm_attribute -V -D -n is-managed-default")
|
|
|
0240e4 |
+ self._set_managed(node)
|
|
|
0240e4 |
return self.failure("Couldn't shut down the cluster")
|
|
|
0240e4 |
|
|
|
0240e4 |
self.debug("Bringing the cluster back up")
|
|
|
0240e4 |
ret = self.startall(None)
|
|
|
0240e4 |
time.sleep(5) # allow ping to update the CIB
|
|
|
0240e4 |
if not ret:
|
|
|
0240e4 |
- self.debug("Re-enable resource management")
|
|
|
0240e4 |
- self.rsh(node, "crm_attribute -V -D -n is-managed-default")
|
|
|
0240e4 |
+ self._set_managed(node)
|
|
|
0240e4 |
return self.failure("Couldn't restart the cluster")
|
|
|
0240e4 |
|
|
|
0240e4 |
if self.local_badnews("ResourceActivity:", watch):
|
|
|
0240e4 |
- self.debug("Re-enable resource management")
|
|
|
0240e4 |
- self.rsh(node, "crm_attribute -V -D -n is-managed-default")
|
|
|
0240e4 |
+ self._set_managed(node)
|
|
|
0240e4 |
return self.failure("Resources stopped or started during cluster restart")
|
|
|
0240e4 |
|
|
|
0240e4 |
watch = self.create_watch(pats, 60, "StartupActivity")
|
|
|
0240e4 |
watch.setwatch()
|
|
|
0240e4 |
|
|
|
0240e4 |
- managed = self.create_watch(["is-managed-default"], 60)
|
|
|
0240e4 |
- managed.setwatch()
|
|
|
0240e4 |
-
|
|
|
0240e4 |
- self.debug("Re-enable resource management")
|
|
|
0240e4 |
- self.rsh(node, "crm_attribute -V -D -n is-managed-default")
|
|
|
0240e4 |
-
|
|
|
0240e4 |
- if not managed.lookforall():
|
|
|
0240e4 |
- self.logger.log("Patterns not found: " + repr(managed.unmatched))
|
|
|
0240e4 |
- return self.failure("Resource management not enabled")
|
|
|
0240e4 |
-
|
|
|
0240e4 |
+ # Re-enable resource management (and verify it happened).
|
|
|
0240e4 |
+ self._set_managed(node)
|
|
|
0240e4 |
self.CM.cluster_stable()
|
|
|
0240e4 |
+ if not self._is_managed(node):
|
|
|
0240e4 |
+ return self.failure("Could not re-enable resource management")
|
|
|
0240e4 |
|
|
|
0240e4 |
# Ignore actions for STONITH resources
|
|
|
0240e4 |
ignore = []
|
|
|
0240e4 |
--
|
|
|
0240e4 |
1.8.3.1
|
|
|
0240e4 |
|