[Cluster-devel] conga ./conga.spec.in.in luci/site/luci/Extens ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Thu Sep 20 22:37:34 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-09-20 22:37:32
Modified files:
. : conga.spec.in.in
luci/site/luci/Extensions: FenceHandler.py LuciClusterInfo.py
cluster_adapters.py
luci/site/luci/Extensions/ClusterModel: Device.py FenceDevice.py
ModelBuilder.py
Added files:
luci/site/luci/Extensions/ClusterModel: FenceDeviceAttr.py
Log message:
Fix bz253223 (When deleting a node from conga, the fence device isn't deleted)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.270&r2=1.271
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/Device.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/FenceDevice.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.9&r2=1.10
--- conga/conga.spec.in.in 2007/09/20 21:03:16 1.83
+++ conga/conga.spec.in.in 2007/09/20 22:37:32 1.84
@@ -293,6 +293,7 @@
- Fixed bz277661 (RFE: Better instructions on the luci login page if luci_admin not run.)
- Fixed bz277711 (RFE: luci_admin should check that luci is running before asking for the password)
- Fixed bz295771 (RFE: add ability to set self_fence attribute for clusterfs resources)
+- Fixed bz253223 (When deleting a node from conga, the fence device isn't deleted)
* Mon Aug 27 2007 Ryan McCabe <rmccabe at redhat.com> 0.10.0-6
- Fixed bz253783
--- conga/luci/site/luci/Extensions/FenceHandler.py 2007/08/08 21:26:37 1.22
+++ conga/luci/site/luci/Extensions/FenceHandler.py 2007/09/20 22:37:32 1.23
@@ -43,117 +43,6 @@
ILLEGAL_CHARS_REPLACED = 'Illegal characters were replaced by underscores. Feel free to set a new value.'
-# For every new fence added, there will be a fence instance and fence device
-# form needed. There will also be a populate and a validate method for each
-# form. The methods will need to be added to this file, and the four hash
-# tables (self.fi_populate, self.fi_validate, self.fd_populate,
-# self.fd_validate) must be updated. The methods will use fields in the
-# forms to set_text and to check.
-
-FENCE_OPTS = {
- 'fence_apc': 'APC Power Device',
- 'fence_wti': 'WTI Power Device',
- 'fence_brocade': 'Brocade Switch',
- 'fence_vixel': 'Vixel SAN Switch',
- 'fence_gnbd': 'Global Network Block Device',
- 'fence_sanbox2': 'QLogic SANBox2',
- 'fence_bladecenter': 'IBM Blade Center',
- 'fence_mcdata': 'McDATA SAN Switch',
- 'fence_egenera': 'Egenera SAN Controller',
- 'fence_bullpap': 'Bull PAP',
- 'fence_xvm': 'Virtual Machine Fencing',
- 'fence_scsi': 'SCSI Reservation',
- 'fence_ilo': 'HP ILO Device',
- 'fence_ipmilan': 'IPMI Lan',
- 'fence_drac': 'Dell DRAC',
- 'fence_rsa': 'IBM RSA II Device',
- 'fence_rps10': 'RPS10 Serial Switch',
- 'fence_manual': 'Manual Fencing'
-}
-
-FENCE_SHARED = {
- 'fence_apc': True,
- 'fence_wti': True,
- 'fence_brocade': True,
- 'fence_vixel': True,
- 'fence_gnbd': True,
- 'fence_sanbox2': True,
- 'fence_bladecenter': True,
- 'fence_mcdata': True,
- 'fence_egenera': True,
- 'fence_bullpap': True,
- 'fence_xvm': True,
- 'fence_scsi': True,
- 'fence_ilo': False,
- 'fence_ipmilan': False,
- 'fence_drac': False,
- 'fence_rsa': False,
- 'fence_rps10': False,
- 'fence_manual': False
-}
-
-PRETTY_NAME_ATTRS = {
- 'port': 'Port',
- 'blade': 'Blade',
- 'switch': 'Switch',
- 'ipaddr': 'IP Address',
- 'ipaddress': 'IP Address',
- 'nodename': 'Node Name',
- 'lpan': 'LPAN',
- 'lanplus': 'Lanplus',
- 'pserver': 'PServer',
- 'login': 'Login',
- 'passwd': 'Password',
- 'name': 'Name',
- 'server': 'Server',
- 'domain': 'Domain',
- 'hostname': 'Hostname',
- 'path': 'Path',
- 'cserver': 'CServer'
-}
-
-FENCE_FI_ATTRS = {
- 'fence_apc': ['port', 'switch'],
- 'fence_wti': ['port'],
- 'fence_brocade': ['port'],
- 'fence_vixel': ['port'],
- 'fence_gnbd': ['ipaddress'],
- 'fence_sanbox2': ['port'],
- 'fence_bladecenter': ['blade'],
- 'fence_mcdata': ['port'],
- 'fence_egenera': ['lpan', 'pserver'],
- 'fence_bullpap': ['domain'],
- 'fence_xvm': ['domain'],
- 'fence_scsi': ['nodename'],
- 'fence_ilo': [],
- 'fence_ipmilan': [],
- 'fence_drac': [],
- 'fence_rsa': [],
- 'fence_rps10': [],
- 'fence_manual': []
-}
-
-FENCE_FD_ATTRS = {
- 'fence_apc': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_wti': ['name', 'ipaddr', 'passwd'],
- 'fence_brocade': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_vixel': ['name', 'ipaddr', 'passwd'],
- 'fence_gnbd': ['name', 'servers'],
- 'fence_sanbox2': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_bladecenter': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_mcdata': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_egenera': ['name', 'cserver'],
- 'fence_bullpap': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_xvm': ['name'],
- 'fence_scsi': ['name'],
- 'fence_ilo': ['name', 'hostname', 'login', 'passwd'],
- 'fence_ipmilan': ['name', 'ipaddr', 'login', 'passwd', 'lanplus', 'auth'],
- 'fence_drac': ['name', 'ipaddr', 'login', 'passwd'],
- 'fence_rsa': ['name', 'hostname', 'login', 'passwd'],
- 'fence_rps10': ['name', 'device', 'port'],
- 'fence_manual': ['name']
-}
-
luci_log = get_logger()
def makeNCName(name):
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py 2007/09/11 16:04:33 1.13
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py 2007/09/20 22:37:32 1.14
@@ -7,9 +7,9 @@
from Products.Archetypes.utils import make_uuid
from ClusterModel.ModelBuilder import ModelBuilder
+from ClusterModel.FenceDeviceAttr import FENCE_OPTS
import RicciQueries as rq
from ricci_communicator import RicciCommunicator
-from FenceHandler import FENCE_OPTS
from LuciSyslog import get_logger
from LuciDB import resolve_nodename
from LuciZope import GetReqVars
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/09/11 16:04:33 1.270
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/09/20 22:37:32 1.271
@@ -1796,6 +1796,7 @@
if fencedev_name is None:
return (False, {'errors': ['No device name in form submission']})
+ # XXX - FIXME: use new model calls to do this.
fdev_to_delete = None
fdevs = model.getFenceDevices()
for fdev in fdevs:
/cvs/cluster/conga/luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py,v --> standard output
revision 1.1
--- conga/luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py
+++ - 2007-09-20 22:37:33.804688000 +0000
@@ -0,0 +1,130 @@
+# Copyright (C) 2007 Red Hat, Inc.
+#
+# This program is free software; you can redistribute
+# it and/or modify it under the terms of version 2 of the
+# GNU General Public License as published by the
+# Free Software Foundation.
+
+FENCE_POWER_CONTROLLERS = [ 'fence_wti', 'fence_apc', 'fence_apc_snmp' ]
+
+FENCE_OPTS = {
+ 'fence_apc': 'APC Power Device',
+ 'fence_wti': 'WTI Power Device',
+ 'fence_brocade': 'Brocade Switch',
+ 'fence_vixel': 'Vixel SAN Switch',
+ 'fence_gnbd': 'Global Network Block Device',
+ 'fence_sanbox2': 'QLogic SANBox2',
+ 'fence_bladecenter': 'IBM Blade Center',
+ 'fence_mcdata': 'McDATA SAN Switch',
+ 'fence_egenera': 'Egenera SAN Controller',
+ 'fence_bullpap': 'Bull PAP',
+ 'fence_xvm': 'Virtual Machine Fencing',
+ 'fence_scsi': 'SCSI Reservation',
+ 'fence_ilo': 'HP iLO Device',
+ 'fence_ipmilan': 'IPMI Lan',
+ 'fence_drac': 'Dell DRAC',
+ 'fence_rsa': 'IBM RSA II Device',
+ 'fence_rps10': 'RPS10 Serial Switch',
+ 'fence_manual': 'Manual Fencing'
+}
+
+FENCE_SHARED = {
+ 'fence_apc': True,
+ 'fence_wti': True,
+ 'fence_brocade': True,
+ 'fence_vixel': True,
+ 'fence_gnbd': True,
+ 'fence_sanbox2': True,
+ 'fence_bladecenter': True,
+ 'fence_mcdata': True,
+ 'fence_egenera': True,
+ 'fence_bullpap': True,
+ 'fence_xvm': True,
+ 'fence_scsi': True,
+ 'fence_ilo': False,
+ 'fence_ipmilan': False,
+ 'fence_drac': False,
+ 'fence_rsa': False,
+ 'fence_rps10': False,
+ 'fence_manual': False
+}
+
+PRETTY_NAME_ATTRS = {
+ 'port': 'Port',
+ 'blade': 'Blade',
+ 'switch': 'Switch',
+ 'ipaddr': 'IP Address',
+ 'ipaddress': 'IP Address',
+ 'nodename': 'Node Name',
+ 'lpan': 'LPAN',
+ 'lanplus': 'Lanplus',
+ 'pserver': 'PServer',
+ 'login': 'Login',
+ 'passwd': 'Password',
+ 'name': 'Name',
+ 'server': 'Server',
+ 'domain': 'Domain',
+ 'hostname': 'Hostname',
+ 'path': 'Path',
+ 'cserver': 'CServer'
+}
+
+FENCE_FI_ATTRS = {
+ 'fence_apc': [ 'port', 'switch' ],
+ 'fence_wti': [ 'port' ],
+ 'fence_brocade': [ 'port' ],
+ 'fence_vixel': [ 'port' ],
+ 'fence_gnbd': [ 'ipaddress' ],
+ 'fence_sanbox2': [ 'port' ],
+ 'fence_bladecenter': [ 'blade' ],
+ 'fence_mcdata': [ 'port' ],
+ 'fence_egenera': [ 'lpan', 'pserver' ],
+ 'fence_bullpap': [ 'domain' ],
+ 'fence_xvm': [ 'domain' ],
+ 'fence_scsi': [ 'nodename' ],
+ 'fence_ilo': [ ],
+ 'fence_ipmilan': [ ],
+ 'fence_drac': [ ],
+ 'fence_rsa': [ ],
+ 'fence_rps10': [ ],
+ 'fence_manual': [ ]
+}
+
+FENCE_FD_ATTRS = {
+ 'fence_apc':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_wti':
+ [ 'name', 'ipaddr', 'passwd' ],
+ 'fence_brocade':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_vixel':
+ [ 'name', 'ipaddr', 'passwd' ],
+ 'fence_gnbd':
+ [ 'name', 'servers' ],
+ 'fence_sanbox2':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_bladecenter':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_mcdata':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_egenera':
+ [ 'name', 'cserver' ],
+ 'fence_bullpap':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_xvm':
+ [ 'name' ],
+ 'fence_scsi':
+ [ 'name' ],
+ 'fence_ilo':
+ [ 'name', 'hostname', 'login', 'passwd' ],
+ 'fence_ipmilan':
+ [ 'name', 'ipaddr', 'login', 'passwd', 'lanplus', 'auth' ],
+ 'fence_drac':
+ [ 'name', 'ipaddr', 'login', 'passwd' ],
+ 'fence_rsa':
+ [ 'name', 'hostname', 'login', 'passwd' ],
+ 'fence_rps10':
+ [ 'name', 'device', 'port' ],
+ 'fence_manual':
+ [ 'name' ]
+}
--- conga/luci/site/luci/Extensions/ClusterModel/Device.py 2007/08/08 21:00:08 1.4
+++ conga/luci/site/luci/Extensions/ClusterModel/Device.py 2007/09/20 22:37:32 1.5
@@ -5,25 +5,21 @@
# GNU General Public License as published by the
# Free Software Foundation.
-import FenceHandler
+import FenceDeviceAttr
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", "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
+ self.fi_attrs = FenceDeviceAttr.FENCE_FI_ATTRS
+ self.pretty_fence_names = FenceDeviceAttr.FENCE_OPTS
+ self.pretty_name_attrs = FenceDeviceAttr.PRETTY_NAME_ATTRS
def getAgentType(self):
return self.agent_type
@@ -35,7 +31,7 @@
return self.has_native_option_set
def isPowerController(self):
- for item in power_controller_list:
+ for item in FenceDeviceAttr.FENCE_POWER_CONTROLLERS:
if self.agent_type == item:
return True
--- conga/luci/site/luci/Extensions/ClusterModel/FenceDevice.py 2007/06/25 16:03:39 1.2
+++ conga/luci/site/luci/Extensions/ClusterModel/FenceDevice.py 2007/09/20 22:37:32 1.3
@@ -5,7 +5,7 @@
# GNU General Public License as published by the
# Free Software Foundation.
-import FenceHandler
+import FenceDeviceAttr
from TagObject import TagObject
TAG_NAME = "fencedevice"
@@ -15,12 +15,10 @@
def __init__(self):
TagObject.__init__(self)
self.TAG_NAME = TAG_NAME
- self.fd_attrs = FenceHandler.FENCE_FD_ATTRS
- self.pretty_fence_names = FenceHandler.FENCE_OPTS
- self.pretty_name_attrs = FenceHandler.PRETTY_NAME_ATTRS
- self.shared_fences = FenceHandler.FENCE_SHARED
-
-
+ self.fd_attrs = FenceDeviceAttr.FENCE_FD_ATTRS
+ self.pretty_fence_names = FenceDeviceAttr.FENCE_OPTS
+ self.pretty_name_attrs = FenceDeviceAttr.PRETTY_NAME_ATTRS
+ self.shared_fences = FenceDeviceAttr.FENCE_SHARED
def getAgentType(self):
agent = self.attr_hash["agent"]
@@ -30,6 +28,9 @@
pass
return agent
+ def getPrettyName(self):
+ return self.pretty_fence_names[self.attr_hash['name']]
+
def isShared(self):
agent = self.getAgentType()
if agent == "fence_drac": #2 variants of drac...
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2007/09/11 19:04:32 1.9
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2007/09/20 22:37:32 1.10
@@ -333,7 +333,14 @@
return obj_tree
-
+ def getFenceDeviceByName(self, name):
+ device = filter(lambda x: x.getName() == name, self.getFenceDevices())
+ if len(device) > 1:
+ raise Exception, '%d fence devices named %s exist' % (len(device), name)
+ if len(device) < 1:
+ return None
+ return device[0]
+
##Because fence devices are declared in a separate XML section
##in conf file, agent types for fence instances must be done in
##a separate pass, after the DOM is completely built. This method
@@ -527,12 +534,19 @@
self.isModified = True
def deleteNode(self, clusternode):
- #1) delete node
- #2) delete failoverdomainnodes with same name
- #3) delete lockserver nodes if GULM
+ #1) delete any non-shared fence devices used by this node
+ #2) delete node
+ #3) delete failoverdomainnodes with same name
+ #4) delete lockserver nodes if GULM
name = clusternode.getName()
+ for level in clusternode.getFenceLevels():
+ for fence in level.getChildren():
+ fdev = self.getFenceDeviceByName(fence.getName())
+ if fdev and not fdev.isShared():
+ self.deleteFenceDevice(fdev)
+
self.clusternodes_ptr.removeChild(clusternode)
found_one = True
@@ -607,6 +621,12 @@
self.cluster_ptr.removeChild(self.fence_xvmd_ptr)
self.fence_xvmd_ptr = None
+ def deleteFenceDevice(self, device):
+ if self.fencedevices_ptr is None or device is None:
+ return False
+ self.fencedevices_ptr.removeChild(device)
+ return True
+
def getFenceDevices(self):
if self.fencedevices_ptr is None:
return list()
More information about the Cluster-devel
mailing list