[Cluster-devel] conga/luci/site/luci/Extensions/ClusterModel D ...
jparsons at sourceware.org
jparsons at sourceware.org
Fri Jul 27 17:02:35 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Changes by: jparsons at sourceware.org 2007-07-27 17:02:35
Modified files:
luci/site/luci/Extensions/ClusterModel: Device.py
ModelBuilder.py
Log message:
Part of fix for bz249066
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/Device.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
--- conga/luci/site/luci/Extensions/ClusterModel/Device.py 2007/06/25 16:03:39 1.2
+++ conga/luci/site/luci/Extensions/ClusterModel/Device.py 2007/07/27 17:02:35 1.3
@@ -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/03 17:06:00 1.4
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2007/07/27 17:02:35 1.5
@@ -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":
More information about the Cluster-devel
mailing list