From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 30 Jul 2007 05:06:48 -0000 Subject: [Cluster-devel] conga/luci/site/luci/Extensions/ClusterModel D ... Message-ID: <20070730050648.950.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe at sourceware.org 2007-07-30 05:06:47 Modified files: luci/site/luci/Extensions/ClusterModel: Device.py ModelBuilder.py Log message: Fixes for 249086 from HEAD Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/Device.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.1&r2=1.1.4.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.3&r2=1.1.4.4 --- conga/luci/site/luci/Extensions/ClusterModel/Device.py 2007/06/18 18:39:33 1.1.4.1 +++ conga/luci/site/luci/Extensions/ClusterModel/Device.py 2007/07/30 05:06:47 1.1.4.2 @@ -9,16 +9,18 @@ from TagObject import TagObject TAG_NAME = "device" +OPTION = "option" #New Power Controller Fence Agent names should be added to #the list below -power_controller_list = ["fence_wti", "fence_apc"] +power_controller_list = [ "fence_wti", "fence_apc", "fence_apc_snmp" ] class Device(TagObject): def __init__(self): TagObject.__init__(self) self.TAG_NAME = TAG_NAME self.agent_type = "" + self.has_native_option_set = False self.fi_attrs = FenceHandler.FENCE_FI_ATTRS self.pretty_fence_names = FenceHandler.FENCE_OPTS self.pretty_name_attrs = FenceHandler.PRETTY_NAME_ATTRS @@ -29,9 +31,17 @@ def setAgentType(self, agent_type): self.agent_type = agent_type + def hasNativeOptionSet(self): + return self.has_native_option_set + def isPowerController(self): for item in power_controller_list: if self.agent_type == item: return True return False + + def addAttribute(self, name, value): + if name == OPTION: + self.has_native_option_set = True + self.attr_hash[name] = value --- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2007/07/26 05:57:42 1.1.4.3 +++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2007/07/30 05:06:47 1.1.4.4 @@ -1090,6 +1090,8 @@ kids = level.getChildren() l = list() for kid in kids: + if kid.hasNativeOptionSet() == True: + continue if kid.isPowerController() is True: l.append(kid) if len(l) > 1: #Means we found multiple PCs in the same level @@ -1116,6 +1118,13 @@ for level in levels: kids = level.getChildren() for kid in kids: #kids are actual fence instance objects + #Need to pass over this device if: + ##1) It is not a power controller, or + ##2) It had an initial option attr when the model was constructed + if not kid.isPowerController(): + continue + if kid.hasNativeOptionSet(): + continue res = kid.getAttribute("option") if res is not None: if res == "off":