Skip to content

Commit

Permalink
Merge pull request #755 from davidvossel/master
Browse files Browse the repository at this point in the history
Low: cts: randomly use reconnect-interval during pcmk remote tests
  • Loading branch information
davidvossel committed Jul 10, 2015
2 parents ef86b49 + 017a4d1 commit 29ed810
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
30 changes: 28 additions & 2 deletions cts/CTStests.py
Expand Up @@ -2648,6 +2648,7 @@ def __init__(self, cm):
self.remote_node_added = 0
self.remote_rsc_added = 0
self.remote_rsc = "remote-rsc"
self.remote_use_reconnect_interval = self.Env.RandomGen.choice(["true","false"])
self.cib_cmd = """cibadmin -C -o %s -X '%s' """

def del_rsc(self, node, rsc):
Expand Down Expand Up @@ -2688,7 +2689,24 @@ def add_primitive_rsc(self, node):
self.remote_rsc_added = 1

def add_connection_rsc(self, node):
rsc_xml = """
if self.remote_use_reconnect_interval == "true":
# use reconnect interval and make sure to set cluster-recheck-interval as well.
rsc_xml = """
<primitive class="ocf" id="%s" provider="pacemaker" type="remote">
<instance_attributes id="remote-instance_attributes"/>
<instance_attributes id="remote-instance_attributes">
<nvpair id="remote-instance_attributes-server" name="server" value="%s"/>
<nvpair id="remote-instance_attributes-reconnect_interval" name="reconnect_interval" value="60s"/>
</instance_attributes>
<operations>
<op id="remote-monitor-interval-60s" interval="60s" name="monitor"/>
<op id="remote-name-start-interval-0-timeout-120" interval="0" name="start" timeout="60"/>
</operations>
</primitive>""" % (self.remote_node, node)
self.rsh(node, self.templates["SetCheckInterval"] % ("45s"))
else:
# not using reconnect interval
rsc_xml = """
<primitive class="ocf" id="%s" provider="pacemaker" type="remote">
<instance_attributes id="remote-instance_attributes"/>
<instance_attributes id="remote-instance_attributes">
Expand All @@ -2699,6 +2717,7 @@ def add_connection_rsc(self, node):
<op id="remote-name-start-interval-0-timeout-120" interval="0" name="start" timeout="120"/>
</operations>
</primitive>""" % (self.remote_node, node)

self.add_rsc(node, rsc_xml)
if self.failed == 0:
self.remote_node_added = 1
Expand Down Expand Up @@ -2837,7 +2856,7 @@ def fail_connection(self, node):
self.CM.ns.WaitForNodeToComeUp(node, 120);

pats = [ ]
watch = self.create_watch(pats, 120)
watch = self.create_watch(pats, 200)
watch.setwatch()
pats.append(self.templates["Pat:RscOpOK"] % (self.remote_node, "start"))
if self.remote_rsc_added == 1:
Expand Down Expand Up @@ -2928,12 +2947,19 @@ def cleanup_metal(self, node):
pats.append(self.templates["Pat:RscOpOK"] % (self.remote_node, "stop"))

self.set_timer("remoteMetalCleanup")

if self.remote_use_reconnect_interval == "true":
self.debug("Cleaning up re-check interval")
self.rsh(node, self.templates["ClearCheckInterval"])
if self.remote_rsc_added == 1:
self.debug("Cleaning up dummy rsc put on remote node")
self.rsh(node, "crm_resource -U -r %s -N %s" % (self.remote_rsc, self.remote_node))
self.del_rsc(node, self.remote_rsc)
if self.remote_node_added == 1:
self.debug("Cleaning up remote node connection resource")
self.rsh(node, "crm_resource -U -r %s" % (self.remote_node))
self.del_rsc(node, self.remote_node)

watch.lookforall()
self.log_timer("remoteMetalCleanup")

Expand Down
3 changes: 3 additions & 0 deletions cts/patterns.py
Expand Up @@ -32,6 +32,9 @@ def __init__(self, name):

"UUIDQueryCmd" : "crmadmin -N",

"SetCheckInterval" : "cibadmin --modify -c --xml-text '<cluster_property_set id=\"cib-bootstrap-options\"><nvpair id=\"cts-recheck-interval-setting\" name=\"cluster-recheck-interval\" value=\"%s\"/></cluster_property_set>'",
"ClearCheckInterval" : "cibadmin --delete --xpath \"//nvpair[@name='cluster-recheck-interval']\"",

"MaintenanceModeOn" : "cibadmin --modify -c --xml-text '<cluster_property_set id=\"cib-bootstrap-options\"><nvpair id=\"cts-maintenance-mode-setting\" name=\"maintenance-mode\" value=\"true\"/></cluster_property_set>'",
"MaintenanceModeOff" : "cibadmin --delete --xpath \"//nvpair[@name='maintenance-mode']\"",

Expand Down

0 comments on commit 29ed810

Please sign in to comment.