diff --git a/cts/CIB.py.in b/cts/CIB.py.in index c9b7b7b55b..417a1c17d6 100644 --- a/cts/CIB.py.in +++ b/cts/CIB.py.in @@ -1,273 +1,273 @@ #!@PYTHON@ '''CTS: Cluster Testing System: CIB generator ''' __copyright__=''' Author: Jia Ming Pan Copyright (C) 2006 International Business Machines ''' from UserDict import UserDict import sys, time, types, syslog, os, struct, string, signal, traceback from CTS import ClusterManager from CM_hb import HeartbeatCM class CIB: cib_option_template = ''' ''' dc_ipaddr_resource_template = ''' - - + + ''' clustermon_resource_template = ''' - - + + ''' dc_ipaddr_location_constraint = ''' ''' clustermon_location_constraint = ''' ''' lsb_resource = ''' - + ''' master_slave_resource = ''' - - + + ''' resource_group_template = ''' - + - + - + ''' per_node_resource_template = ''' - - + + ''' per_node_constraint_template = ''' ''' stonith_resource_template = """ - - + + """ cib_template =''' %s %s %s ''' def NextIP(self): fields = string.split(self.CM.Env["IPBase"], '.') fields[3] = str(int(fields[3])+1) ip = string.join(fields, '.') self.CM.Env["IPBase"]=ip return ip def __init__(self, CM): self.CM = CM #make up crm config cib_options = self.cib_option_template % CM.Env["DoFencing"] #create resources and their constraints resources = "" constraints = "" if self.CM.Env["DoBSC"] == 1: cib_options = cib_options + ''' ''' if self.CM.Env["CIBResource"] != 1: # generate cib self.cts_cib = self.cib_template % (cib_options, resources, constraints) return self.CM.log("Enabling DC resource") resources += self.dc_ipaddr_resource_template % self.CM.Env["IPBase"] constraints += self.dc_ipaddr_location_constraint if self.CM.cluster_monitor == 1: resources += self.clustermon_resource_template constraints += self.clustermon_location_constraint ip1=self.NextIP() ip2=self.NextIP() ip3=self.NextIP() resources += self.resource_group_template % (ip1, ip1, ip1, ip1, ip2, ip2, ip2, ip2, ip3, ip3, ip3, ip3) # lsb resource resources += self.lsb_resource # per node resource fields = string.split(self.CM.Env["IPBase"], '.') for node in self.CM.Env["nodes"]: ip = self.NextIP() per_node_resources = self.per_node_resource_template % \ ("rsc_"+node, "rsc_"+node, "rsc_"+node, "rsc_"+node, "rsc_"+node, ip) per_node_constraint = self.per_node_constraint_template % \ ("rsc_"+node, "rsc_"+node, "rsc_"+node, "rsc_"+node, node) resources += per_node_resources constraints += per_node_constraint # fencing resource nodelist = "" len = 0 for node in self.CM.Env["nodes"]: nodelist += node + " " len = len + 1 stonith_resource = self.stonith_resource_template % (len, nodelist) resources += stonith_resource #master slave resource resources += self.master_slave_resource % (2*len, 2, len, 1) # generate cib self.cts_cib = self.cib_template % (cib_options, resources, constraints) def cib(self): return self.cts_cib