[Cluster-devel] conga/luci/site/luci/Extensions FenceDevice.py ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Mon Nov 27 19:11:42 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-11-27 19:11:42
Modified files:
luci/site/luci/Extensions: FenceDevice.py cluster_adapters.py
Log message:
fence agents can contain a full path to the agent script. strip off
all but the basename when using this value as an index into hashes.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceDevice.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.166&r2=1.167
--- conga/luci/site/luci/Extensions/FenceDevice.py 2006/10/04 15:11:10 1.2
+++ conga/luci/site/luci/Extensions/FenceDevice.py 2006/11/27 19:11:41 1.3
@@ -19,7 +19,12 @@
def getAgentType(self):
- return self.attr_hash["agent"]
+ agent = self.attr_hash["agent"]
+ try:
+ return agent[agent.rfind('/') + 1:]
+ except:
+ pass
+ return agent
def isShared(self):
agent = self.getAgentType()
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/27 18:15:31 1.166
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/27 19:11:41 1.167
@@ -3057,9 +3057,17 @@
def getFenceInfo(self, model, request):
try:
clustername = request['clustername']
+ except:
+ try:
+ clustername = request.form['clustername']
+ except:
+ luci_log.debug_verbose('getFenceInfo0: unable to determine cluster name')
+ return {}
+
+ try:
baseurl = request['URL']
except Exception, e:
- luci_log.debug_verbose('getFenceInfo0: error: %s' % str(e))
+ luci_log.debug_verbose('getFenceInfo1: no request.URL')
return {}
map = {}
@@ -3077,10 +3085,13 @@
try:
nodename = request['nodename']
- except KeyError, e:
- luci_log.debug_verbose('getFenceInfo1: unable to extract nodename: %s' \
- % str(e))
- return {}
+ except:
+ try:
+ nodename = request.form['nodename']
+ except:
+ luci_log.debug_verbose('getFenceInfo2: unable to extract nodename: %s' \
+ % str(e))
+ return {}
#Here we need to get fences for a node - just the first two levels
#Each level has its own list of fence devs used in that level
@@ -3090,7 +3101,7 @@
try:
node = model.retrieveNodeByName(nodename)
except GeneralError, e:
- luci_log.debug_verbose('getFenceInfo2: unabel to find node name %s in current node list' % (str(nodename), str(e)))
+ luci_log.debug_verbose('getFenceInfo3: unabel to find node name %s in current node list' % (str(nodename), str(e)))
return {}
fds = model.getFenceDevices()
@@ -3176,9 +3187,9 @@
level1.append(fencedev)
last_kid_fd = fd
continue
+ map['level1'] = level1
#level1 list is complete now, but it is still necessary to build shared1
- sharednames = list()
for fd in fds:
isUnique = True
if fd.isShared() == False:
@@ -3194,6 +3205,7 @@
shared_struct['agent'] = agentname
shared_struct['prettyname'] = FENCE_OPTS[agentname]
shared1.append(shared_struct)
+ map['shared1'] = shared1
#YUK: This next section violates the DRY rule, :-(
if len_levels >= 2:
@@ -3270,9 +3282,9 @@
level2.append(fencedev)
last_kid_fd = fd
continue
+ map['level2'] = level2
#level2 list is complete but like above, we need to build shared2
- sharednames = list()
for fd in fds:
isUnique = True
if fd.isShared() == False:
@@ -3288,6 +3300,7 @@
shared_struct['agent'] = agentname
shared_struct['prettyname'] = FENCE_OPTS[agentname]
shared2.append(shared_struct)
+ map['shared2'] = shared2
return map
@@ -3296,7 +3309,7 @@
baseurl = request['URL']
map = {}
fencedevs = list() #This is for the fencedev list page
- map['fencedevs'] = fencedevs
+
#Get list of fence devices
fds = model.getFenceDevices()
nodes_used = list() #This section determines which nodes use the dev
@@ -3336,7 +3349,8 @@
fencedev['nodesused'] = nodes_used
fencedevs.append(fencedev)
-
+
+ map['fencedevs'] = fencedevs
return map
More information about the Cluster-devel
mailing list