[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/site/luci/Extensions FenceHandler.p ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2007-01-19 19:41:27

Modified files:
	luci/site/luci/Extensions: FenceHandler.py cluster_adapters.py 

Log message:
	new, more generic and clean fence validation code

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.205&r2=1.206

--- conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/11 22:49:42	1.12
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/19 19:41:26	1.13
@@ -1,1562 +1,846 @@
-import os
-from ValidationError import ValidationError
-import MessageLibrary
-import ModelBuilder
-#from FenceDevice import FenceDevice
+import re
+from Device import Device
+from FenceDevice import FenceDevice
 from conga_constants import FD_VAL_SUCCESS, FD_VAL_FAIL
 
-INSTALLDIR="/usr/share/system-config-cluster"
+FD_NEW_SUCCESS = 'New %s successfully added to cluster'
+FD_UPDATE_SUCCESS = 'Fence device %s successfully updated'
+FD_NEW_FAIL = 'No agent type %s in shared device list'
+
+FI_NEW_FAIL = 'No instance type %s in fence instance list'
+
+FD_PROVIDE_AGENT = 'A valid agent type must be provided for each Fence Device'
+FD_PROVIDE_NAME = 'A unique name must be provided for each Fence Device'
+FD_PROVIDE_PATH = 'An xCAT path must be provided for each xCAT Fence Device'
+FD_PROVIDE_SERVER = 'A server address must be provided for this Fence Device'
+FD_PROVIDE_CSERVER = 'A cserver address must be provided for this Egenera Fence Device'
+FD_PROVIDE_IP = 'An IP address must be provided for this Fence Device'
+FD_PROVIDE_HOSTNAME = 'A host name must be provided for this Fence Device'
+FD_PROVIDE_LOGIN = 'A login name must be provided for this Fence Device'
+FD_PROVIDE_PASSWD = 'A password must be provided for this Fence Device'
+FD_PROVIDE_DEVICE = 'A device must be provided for this Fence Device'
+FD_PROVIDE_PORT = 'A port must be provided for this Fence Device'
+FD_PROVIDE_IPMILAN_AUTH = 'Authentication type must be "none" (or blank), "md5", or "password"'
+
+FI_PROVIDE_PARENT = 'A Fence Device name must be provided for this Fence'
+FI_PROVIDE_SWITCH = 'A switch address must be provided for this Fence'
+FI_PROVIDE_PORT = 'A port value must be provided for this Fence'
+FI_PROVIDE_BLADE = 'A Blade must be specified for this Fence'
+FI_PROVIDE_DOMAIN = 'A Domain must be specified for this Fence'
+FI_PROVIDE_IPADDRESS = 'An IP address must be provided for this Fence'
+FI_PROVIDE_ELPAN = 'A LPAN value must be provided for this Egenera Fence'
+FI_PROVIDE_EPSERVER = 'A PServer value must be provided for this Egenera Fence'
+FI_PROVIDE_NODENAME = 'A Node Name value must be provided for this SCSI Fence'
+
+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'
+}
+
+FI_VALIDATE = {
+	'fence_apc':			val_apc_fi,
+	'fence_wti':			val_wti_fi,
+	'fence_brocade':		val_brocade_fi,
+	'fence_vixel':			val_vixel_fi,
+	'fence_gnbd':			val_gnbd_fi,
+	'fence_sanbox2':		val_sanbox2_fi,
+	'fence_bladecenter':	val_bladecenter_fi,
+	'fence_mcdata':			val_mcdata_fi,
+	'fence_egenera':		val_egenera_fi,
+	'fence_bullpap':		val_bullpap_fi,
+	'fence_xvm':			val_xvm_fi,
+	'fence_scsi':			val_scsi_fi,
+	'fence_ilo':			val_noop_fi,
+	'fence_ipmilan':		val_noop_fi,
+	'fence_drac':			val_noop_fi,
+	'fence_rsa':			val_noop_fi,
+	'fence_rps10':			val_noop_fi,
+	'fence_manual':			val_noop_fi
+}
+
+FD_VALIDATE = {
+	'fence_apc':			val_apc_fd,
+	'fence_wti':			val_wti_fd,
+	'fence_brocade':		val_brocade_fd,
+	'fence_vixel':			val_vixel_fd,
+	'fence_gnbd':			val_gnbd_fd,
+	'fence_sanbox2':		val_sanbox2_fd,
+	'fence_bladecenter':	val_bladecenter_fd,
+	'fence_mcdata':			val_mcdata_fd,
+	'fence_egenera':		val_egenera_fd,
+	'fence_bullpap':		val_bullpap_fd,
+	'fence_xvm':			val_noop_fd,
+	'fence_scsi':			val_noop_fd,
+	'fence_ilo':			val_ilo_fd,
+	'fence_ipmilan':		val_ipmilan_fd,
+	'fence_drac':			val_drac_fd,
+	'fence_rsa':			val_rsa_fd,
+	'fence_rps10':			val_rps10_fd,
+	'fence_manual':			val_noop_fd
+}
+
+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', 'server'],
+	'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']
+}
+
+ILLEGAL_CHARS = re.compile(':| ')
+
+def makeNCName(name):
+	### name must conform to relaxNG ID type ##
+	return re.sub('_', name)
+
+def check_unique_fd_name(model, name):
+	fds = model.getFenceDevices()
+	for fd in fds:
+		if fd.getName() == name:
+			return False
+	return True
+
+def validateNewFenceDevice(form, model):
+	fencedev = FenceDevice()
+
+	try:
+		ret = validate_fencedevice(form, model, fencedev)
+		if ret is None:
+			fencedevptr = model.getFenceDevicePtr()
+			fencedevptr.addChild(fencedev)
+			model.setModified(True)
+			return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[fencedev.getAttribute('agent')])
+	except Exception, e:
+		ret = FD_PROVIDE_AGENT
 
-FD_NEW_SUCCESS = "New %s successfully added to cluster"
-FD_UPDATE_SUCCESS = "Fence device %s successfully updated"
-FD_NEW_FAIL = "No agent type %s in shared device list"
-FD_PROVIDE_NAME = "A unique name must be provided for each Fence Device"
-
-FD_PROVIDE_PATH = "An xCAT path must be provided for each xCAT Fence Device"
-FD_PROVIDE_SERVER = "A server address must be provided for this Fence Device"
-FD_PROVIDE_CSERVER = "A cserver address must be provided for this Egenera Fence Device"
-FD_PROVIDE_IP = "An IP address must be provided for this Fence Device"
-FD_PROVIDE_HOSTNAME = "A host name must be provided for this Fence Device"
-FD_PROVIDE_LOGIN = "A login name must be provided for this Fence Device"
-FD_PROVIDE_PASSWD = "A password must be provided for this Fence Device"
-FI_PROVIDE_XCATNODENAME = "An xCAT Nodename must be provided for this Fence"
-FI_PROVIDE_SWITCH = "A switch address must be provided for this Fence"
-FI_PROVIDE_PORT = "A port value must be provided for this Fence"
-FI_PROVIDE_BLADE = "A Blade must be specified for this Fence"
-FI_PROVIDE_DOMAIN = "A Domain must be specified for this Fence"
-FI_PROVIDE_IPADDRESS = "An IP address must be provided for this Fence"
-FI_PROVIDE_ELPAN = "A LPAN value must be provided for this Egenera Fence"
-FI_PROVIDE_EPSERVER = "A PServer value must be provided for this Egenera Fence"
-
-ILLEGAL_CHARS_REPLACED = "Illegal characters were replaced by underscores. Feel free to set a new value."
-ILLEGAL_CHARS = [':', ' ']
-
-#ADDING A NEW FENCE: fence instance form should be named the same as its agent
-#in gladefile. Then add agent name to this list.
-#
-#In Glade File, fence device form should be added to 'fence_device_container'
-#and fence instance form to fence_instance_container
-#
-#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_ilo":"HP ILO Device",
-              "fence_rsa":"IBM RSA II 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_drac":"DRAC",
-              "fence_xvm":"Virtual Machine Fencing",
-              "fence_scsi":"SCSI Reservation",
-              "fence_ipmilan":"IPMI Lan",
-              "fence_manual":"Manual Fencing" }
-
-FENCE_SHARED = {"fence_apc":True,
-              "fence_wti":True,
-              "fence_brocade":True,
-              "fence_vixel":True,
-              "fence_gnbd":True,
-              "fence_ilo":False,
-              "fence_rsa":False,
-              "fence_sanbox2":True,
-              "fence_bladecenter":True,
-              "fence_mcdata":True,
-              "fence_egenera":True,
-              "fence_bullpap":True,
-              "fence_drac":False,
-              "fence_xvm":True,
-              "fence_scsi":True,
-              "fence_ipmilan":False,
-              "fence_manual":False }
-
-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","server"],
-              "fence_ilo":["name","hostname","login","passwd"],
-              "fence_sanbox2":["name","ipaddr","login","passwd"],
-              "fence_bladecenter":["name","ipaddr","login","passwd"],
-              "fence_mcdata":["name","ipaddr","login","passwd"],
-              "fence_egenera":["name","cserver"],
-              "fence_ipmilan":["name","ipaddr","login","passwd"],
-              "fence_bullpap":["name","ipaddr","login","passwd"],
-              "fence_manual":["name"] }
-
-FENCE_FI_ATTRS = {"fence_apc":["port","switch"],
-              "fence_wti":["port"],
-              "fence_brocade":["port"],
-              "fence_vixel":["port"],
-              "fence_gnbd":["ipaddress"],
-              "fence_ilo":[],
-              "fence_sanbox2":["port"],
-              "fence_bladecenter":["blade"],
-              "fence_mcdata":["port"],
-              "fence_egenera":["lpan","pserver"],
-              "fence_ipmilan":[],
-              "fence_bullpap":["domain"],
-              "fence_manual":[] }
-
-PRETTY_NAME_ATTRS = {"port":"Port",
-                     "blade":"Blade", 
-                     "switch":"Switch",
-                     "ipaddr":"IP Address",
-                     "nodename":"Nodename",
-                     "lpan":"LPAN",
-                     "pserver":"PServer",
-                     "login":"Login",
-                     "passwd":"Password",
-                     "name":"Name",
-                     "server":"Server",
-                     "domain":"Domain",
-                     "hostname":"Hostname",
-                     "path":"Path",
-                     "cserver":"CServer" }  
-
-class FenceHandler:
-  def __init__(self, fi_proxy_widget, fd_proxy_widget, model_builder):
-    self.fi_proxy_widget = fi_proxy_widget
-    self.fd_proxy_widget = fd_proxy_widget
-    self.model_builder = model_builder
-    gladepath = "fence.glade"
-    if not os.path.exists(gladepath):
-      gladepath = "%s/%s" % (INSTALLDIR,gladepath)
-                                                                                
-    #gtk.glade.bindtextdomain(PROGNAME)
-    self.fence_xml = gtk.glade.XML (gladepath, domain="NULL")
-
-    #Generate hash table for agent --> fence instance form
-    self.fi_hash = { }
-    fence_opt_keys = FENCE_OPTS.keys()
-    for fence in fence_opt_keys:
-      self.fi_hash[fence] = self.fence_xml.get_widget(fence)
-
-    #Generate hash table for agent --> fence device form
-    self.fd_hash = { }
-    fence_opt_keys = FENCE_OPTS.keys()
-    for fence in fence_opt_keys:
-      self.fd_hash[fence] = self.fence_xml.get_widget(fence + "_d")
-
-    self.pretty_agentname_hash = FENCE_OPTS
-
-    self.fi_container = self.fence_xml.get_widget('fence_instance_container')
-    children = self.fi_container.get_children()
-    for child in children:
-      child.reparent(self.fi_proxy_widget)
-    
-    self.fi_container2 = self.fence_xml.get_widget('fence_instance_container2')
-    children2 = self.fi_container2.get_children()
-    for child in children2:
-      child.reparent(self.fi_proxy_widget)
-    
-    self.fd_container = self.fence_xml.get_widget('fence_device_container')
-    children = self.fd_container.get_children()
-    for child in children:
-      child.reparent(self.fd_proxy_widget)
-    
-    self.fd_container2 = self.fence_xml.get_widget('fence_device_container2')
-    children2 = self.fd_container2.get_children()
-    for child in children2:
-      child.reparent(self.fd_proxy_widget)
-    
-    #For testing...
-    #self.fence_xml.get_widget('fi_wti').show()
-
-    self.fi_populate = {"fence_apc":self.pop_apc,
-              "fence_wti":self.pop_wti,
-              "fence_brocade":self.pop_brocade,
-              "fence_vixel":self.pop_vixel,
-              "fence_gnbd":self.pop_gnbd,
-              "fence_ilo":self.pop_ilo,
-              "fence_sanbox2":self.pop_sanbox2,
-              "fence_bladecenter":self.pop_bladecenter,
-              "fence_mcdata":self.pop_mcdata,
-              "fence_egenera":self.pop_egenera,
-              "fence_ipmilan":self.pop_ipmilan,
-              "fence_bullpap":self.pop_bullpap,
-              "fence_manual":self.pop_manual }
-
-    self.fd_populate = {"fence_apc":self.pop_apc_fd,
-              "fence_wti":self.pop_wti_fd,
-              "fence_brocade":self.pop_brocade_fd,
-              "fence_vixel":self.pop_vixel_fd,
-              "fence_gnbd":self.pop_gnbd_fd,
-              "fence_ilo":self.pop_ilo_fd,
-              "fence_sanbox2":self.pop_sanbox2_fd,
-              "fence_bladecenter":self.pop_bladecenter_fd,
-              "fence_mcdata":self.pop_mcdata_fd,
-              "fence_egenera":self.pop_egenera_fd,
-              "fence_ipmilan":self.pop_ipmilan_fd,
-              "fence_bullpap":self.pop_bullpap_fd,
-              "fence_manual":self.pop_manual_fd }
-
-    self.fi_validate = {"fence_apc":self.val_apc,
-              "fence_wti":self.val_wti,
-              "fence_brocade":self.val_brocade,
-              "fence_vixel":self.val_vixel,
-              "fence_gnbd":self.val_gnbd,
-              "fence_ilo":self.val_ilo,
-              "fence_sanbox2":self.val_sanbox2,
-              "fence_bladecenter":self.val_bladecenter,
-              "fence_mcdata":self.val_mcdata,
-              "fence_egenera":self.val_egenera,
-              "fence_ipmilan":self.val_ipmilan,
-              "fence_bullpap":self.val_bullpap,
-              "fence_manual":self.val_manual }
-
-    self.fd_validate = {"fence_apc":self.val_apc_fd,
-              "fence_wti":self.val_wti_fd,
-              "fence_brocade":self.val_brocade_fd,
-              "fence_vixel":self.val_vixel_fd,
-              "fence_gnbd":self.val_gnbd_fd,
-              "fence_ilo":self.val_ilo_fd,
-              "fence_sanbox2":self.val_sanbox2_fd,
-              "fence_bladecenter":self.val_bladecenter_fd,
-              "fence_mcdata":self.val_mcdata_fd,
-              "fence_egenera":self.val_egenera_fd,
-              "fence_ipmilan":self.val_ipmilan_fd,
-              "fence_bullpap":self.val_bullpap_fd,
-              "fence_manual":self.val_manual_fd }
-
-    self.process_widgets()
-
-  def get_fence_instance_hash(self):
-    return self.fi_hash
-
-  def get_fence_device_hash(self):
-    return self.fd_hash
-
-  def populate_fi_form(self, agent_type, *attrs):
-    apply(self.fi_populate[agent_type], attrs)
-
-  def populate_fd_form(self, agent_type, *attrs):
-    apply(self.fd_populate[agent_type], attrs)
-
-  def pop_apc(self, attrs):
-    self.apc_port.set_text(attrs["port"]) 
-    self.apc_switch.set_text(attrs["switch"]) 
- 
-  def pop_wti(self, attrs):
-    self.wti_port.set_text(attrs["port"])
- 
-  def pop_brocade(self, attrs):
-    self.brocade_port.set_text(attrs["port"])
- 
-  def pop_ilo(self, attrs):
-    pass
- 
-  def pop_vixel(self, attrs):
-    self.vixel_port.set_text(attrs["port"])
- 
-  def pop_mcdata(self, attrs):
-    self.mcdata_port.set_text(attrs["port"])
- 
-  def pop_manual(self, attrs):
-    pass
- 
-  def pop_gnbd(self, attrs):
-    self.gnbd_ip.set_text(attrs["ipaddress"])
- 
-  def pop_egenera(self, attrs):
-    self.egenera_lpan.set_text(attrs["lpan"])
-    self.egenera_pserver.set_text(attrs["pserver"])
- 
-  def pop_sanbox2(self, attrs):
-    self.sanbox2_port.set_text(attrs["port"])
-
-  def pop_bladecenter(self, attrs):
-    self.bladecenter_blade.set_text(attrs["blade"])
-
-  def pop_bullpap(self, attrs):
-    self.bullpap_domain.set_text(attrs["domain"])
-
-  def pop_ipmilan(self, attrs):
-    pass
- 
-  def clear_fi_forms(self):
-    self.apc_port.set_text("") 
-    self.apc_switch.set_text("") 
-    self.wti_port.set_text("") 
-    self.brocade_port.set_text("")
-    self.vixel_port.set_text("")
-    self.gnbd_ip.set_text("") 
-    self.sanbox2_port.set_text("")
-    self.bladecenter_blade.set_text("")
-    self.mcdata_port.set_text("")
-    self.egenera_lpan.set_text("")
-    self.egenera_pserver.set_text("")
-    self.bullpap_domain.set_text("")
-
-
-  def clear_fd_forms(self):
-    self.apc_fd_name.set_text("") 
-    self.apc_fd_ip.set_text("")
-    self.apc_fd_login.set_text("")
-    self.apc_fd_passwd.set_text("")
-    self.wti_fd_ip.set_text("")
-    self.wti_fd_name.set_text("")
-    self.wti_fd_passwd.set_text("")
-    self.brocade_fd_name.set_text("")
-    self.brocade_fd_ip.set_text("")
-    self.brocade_fd_login.set_text("")
-    self.brocade_fd_passwd.set_text("")
-    self.ilo_fd_name.set_text("")
-    self.ilo_fd_login.set_text("")
-    self.ilo_fd_passwd.set_text("")
-    self.ilo_fd_hostname.set_text("")
-    self.vixel_fd_name.set_text("")
-    self.vixel_fd_ip.set_text("")
-    self.vixel_fd_passwd.set_text("")
-    self.manual_fd_name.set_text("")
-    self.mcdata_fd_name.set_text("")
-    self.mcdata_fd_ip.set_text("")
-    self.mcdata_fd_login.set_text("")
-    self.mcdata_fd_passwd.set_text("")
-    self.gnbd_fd_name.set_text("")
-    self.gnbd_fd_server.set_text("")
-    self.egenera_fd_name.set_text("")
-    self.egenera_fd_cserver.set_text("")
-    self.sanbox2_fd_name.set_text("")
-    self.sanbox2_fd_ip.set_text("")
-    self.sanbox2_fd_login.set_text("")
-    self.sanbox2_fd_passwd.set_text("")
-    self.bladecenter_fd_name.set_text("")
-    self.bladecenter_fd_ip.set_text("")
-    self.bladecenter_fd_login.set_text("")
-    self.bladecenter_fd_passwd.set_text("")
-    self.ipmilan_fd_name.set_text("")
-    self.ipmilan_fd_login.set_text("")
-    self.ipmilan_fd_passwd.set_text("")
-    self.ipmilan_fd_ip.set_text("")
-    self.bullpap_fd_name.set_text("")
-    self.bullpap_fd_login.set_text("")
-    self.bullpap_fd_passwd.set_text("")
-    self.bullpap_fd_ip.set_text("")
-
-  #Populate form methods for Fence Devices
-  def pop_apc_fd(self, attrs):
-    self.apc_fd_name.set_text(attrs["name"]) 
-    self.apc_fd_ip.set_text(attrs["ipaddr"])
-    self.apc_fd_login.set_text(attrs["login"])
-    self.apc_fd_passwd.set_text(attrs["passwd"])
-
- 
-  def pop_wti_fd(self, attrs):
-    self.wti_fd_ip.set_text(attrs["ipaddr"])
-    self.wti_fd_name.set_text(attrs["name"])
-    self.wti_fd_passwd.set_text(attrs["passwd"])
- 
-  def pop_brocade_fd(self, attrs):
-    self.brocade_fd_name.set_text(attrs["name"])
-    self.brocade_fd_ip.set_text(attrs["ipaddr"])
-    self.brocade_fd_login.set_text(attrs["login"])
-    self.brocade_fd_passwd.set_text(attrs["passwd"])
+	return (FD_VAL_FAIL, ret)
 
- 
-  def pop_ilo_fd(self, attrs):
-    self.ilo_fd_name.set_text(attrs["name"])
-    self.ilo_fd_login.set_text(attrs["login"])
-    self.ilo_fd_passwd.set_text(attrs["passwd"])
-    self.ilo_fd_hostname.set_text(attrs["hostname"])
-
- 
-  def pop_vixel_fd(self, attrs):
-    self.vixel_fd_name.set_text(attrs["name"])
-    self.vixel_fd_ip.set_text(attrs["ipaddr"])
-    self.vixel_fd_passwd.set_text(attrs["passwd"])
-
- 
-  def pop_mcdata_fd(self, attrs):
-    self.mcdata_fd_name.set_text(attrs["name"])
-    self.mcdata_fd_ip.set_text(attrs["ipaddr"])
-    self.mcdata_fd_login.set_text(attrs["login"])
-    self.mcdata_fd_passwd.set_text(attrs["passwd"])
-
- 
-  def pop_manual_fd(self, attrs):
-    self.manual_fd_name.set_text(attrs["name"])
- 
-  def pop_gnbd_fd(self, attrs):
-    self.gnbd_fd_name.set_text(attrs["name"])
-    self.gnbd_fd_server.set_text(attrs["server"])
-
- 
-  def pop_egenera_fd(self, attrs):
-    self.egenera_fd_name.set_text(attrs["name"])
-    self.egenera_fd_cserver.set_text(attrs["cserver"])
-
- 
-  def pop_sanbox2_fd(self, attrs):
-    self.sanbox2_fd_name.set_text(attrs["name"])
-    self.sanbox2_fd_ip.set_text(attrs["ipaddr"])
-    self.sanbox2_fd_login.set_text(attrs["login"])
-    self.sanbox2_fd_passwd.set_text(attrs["passwd"])
-
-  def pop_bladecenter_fd(self, attrs):
-    self.bladecenter_fd_name.set_text(attrs["name"])
-    self.bladecenter_fd_ip.set_text(attrs["ipaddr"])
-    self.bladecenter_fd_login.set_text(attrs["login"])
-    self.bladecenter_fd_passwd.set_text(attrs["passwd"])
-
-  def pop_ipmilan_fd(self, attrs):
-    self.ipmilan_fd_name.set_text(attrs["name"])
-    self.ipmilan_fd_login.set_text(attrs["login"])
-    self.ipmilan_fd_passwd.set_text(attrs["passwd"])
-    self.ipmilan_fd_ip.set_text(attrs["ipaddr"])
-
-  def pop_bullpap_fd(self, attrs):
-    self.bullpap_fd_name.set_text(attrs["name"])
-    self.bullpap_fd_login.set_text(attrs["login"])
-    self.bullpap_fd_passwd.set_text(attrs["passwd"])
-    self.bullpap_fd_ip.set_text(attrs["ipaddr"])
-
-
-  def process_widgets(self):
-    ##Fence Instance Form Fields
-    self.apc_port = self.fence_xml.get_widget('entry1') 
-    self.apc_switch = self.fence_xml.get_widget('entry2') 
-    self.wti_port = self.fence_xml.get_widget('entry3') 
-    self.brocade_port = self.fence_xml.get_widget('entry4') 
-    self.vixel_port = self.fence_xml.get_widget('entry5') 
-    self.gnbd_ip = self.fence_xml.get_widget('entry6') 
-    self.ilo_port = self.fence_xml.get_widget('entry7') 
-    self.sanbox2_port = self.fence_xml.get_widget('entry8') 
-    self.bladecenter_blade = self.fence_xml.get_widget('entry41') 
-    self.mcdata_port = self.fence_xml.get_widget('entry9') 
-    self.egenera_lpan = self.fence_xml.get_widget('entry10') 
-    self.egenera_pserver = self.fence_xml.get_widget('entry11')
-    self.bullpap_domain = self.fence_xml.get_widget('entry51') 
-
-    ##Fence Device Forms
-    self.apc_fd_name = self.fence_xml.get_widget('entry12')
-    self.apc_fd_ip = self.fence_xml.get_widget('entry13')
-    self.apc_fd_login = self.fence_xml.get_widget('entry14')
-    self.apc_fd_passwd = self.fence_xml.get_widget('entry15')
-
-    self.wti_fd_ip = self.fence_xml.get_widget('entry17')
-    self.wti_fd_name = self.fence_xml.get_widget('entry16')
-    self.wti_fd_passwd = self.fence_xml.get_widget('entry18')
-
-    self.brocade_fd_name = self.fence_xml.get_widget('entry19')
-    self.brocade_fd_ip = self.fence_xml.get_widget('entry20')
-    self.brocade_fd_login = self.fence_xml.get_widget('entry21')
-    self.brocade_fd_passwd = self.fence_xml.get_widget('entry22')
-
-    self.vixel_fd_name = self.fence_xml.get_widget('entry23')
-    self.vixel_fd_ip = self.fence_xml.get_widget('entry24')
-    self.vixel_fd_passwd = self.fence_xml.get_widget('entry25')
-
-    self.gnbd_fd_name = self.fence_xml.get_widget('entry26')
-    self.gnbd_fd_server = self.fence_xml.get_widget('entry27')
-
-    self.ilo_fd_name = self.fence_xml.get_widget('entry28')
-    self.ilo_fd_login = self.fence_xml.get_widget('entry29')
-    self.ilo_fd_passwd = self.fence_xml.get_widget('entry30')
-    self.ilo_fd_hostname = self.fence_xml.get_widget('entry31')
-
-    self.sanbox2_fd_name = self.fence_xml.get_widget('entry32')
-    self.sanbox2_fd_ip = self.fence_xml.get_widget('entry33')
-    self.sanbox2_fd_login = self.fence_xml.get_widget('entry46')
-    self.sanbox2_fd_passwd = self.fence_xml.get_widget('entry47')
-
-    self.bladecenter_fd_name = self.fence_xml.get_widget('entry42')
-    self.bladecenter_fd_ip = self.fence_xml.get_widget('entry43')
-    self.bladecenter_fd_login = self.fence_xml.get_widget('entry44')
-    self.bladecenter_fd_passwd = self.fence_xml.get_widget('entry45')
-
-    self.mcdata_fd_name = self.fence_xml.get_widget('entry34')
-    self.mcdata_fd_ip = self.fence_xml.get_widget('entry35')
-    self.mcdata_fd_login = self.fence_xml.get_widget('entry36')
-    self.mcdata_fd_passwd = self.fence_xml.get_widget('entry37')
-
-    self.egenera_fd_name = self.fence_xml.get_widget('entry38')
-    self.egenera_fd_cserver = self.fence_xml.get_widget('entry39')
-
-    self.manual_fd_name = self.fence_xml.get_widget('entry40')
-
-    self.ipmilan_fd_name = self.fence_xml.get_widget('entry55')
-    self.ipmilan_fd_ip = self.fence_xml.get_widget('entry48')
-    self.ipmilan_fd_login = self.fence_xml.get_widget('entry49')
-    self.ipmilan_fd_passwd = self.fence_xml.get_widget('entry50')
-
-    self.bullpap_fd_name = self.fence_xml.get_widget('entry56')
-    self.bullpap_fd_ip = self.fence_xml.get_widget('entry52')
-    self.bullpap_fd_login = self.fence_xml.get_widget('entry53')
-    self.bullpap_fd_passwd = self.fence_xml.get_widget('entry54')
-
-  #####  Validation Methods
-  def validate_fencedevice(self, agent_type, name=None):
-    try:
-      args = list()
-      args.append(name)
-      returnlist = apply(self.fd_validate[agent_type], args)
-    except ValidationError, e:
-      MessageLibrary.errorMessage(e.getMessage())
-      return None
-
-    return returnlist
-
-    
-  def val_apc_fd(self, name):
-    rectify_fence_name = False
-    if self.apc_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.apc_fd_name)
-    if name != self.apc_fd_name.get_text():
-      res = self.check_unique_fd_name(self.apc_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-    
-    if self.apc_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-    if self.apc_fd_login.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-    if self.apc_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.apc_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.apc_fd_name.get_text()
-    fields["ipaddr"] = self.apc_fd_ip.get_text()
-    fields["login"] = self.apc_fd_login.get_text()
-    fields["passwd"] = self.apc_fd_passwd.get_text()
-
-    return fields
- 
- 
-  def val_wti_fd(self, name):
-    rectify_fence_name = False
-    if self.wti_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.wti_fd_name)
-    if name != self.wti_fd_name.get_text():
-      res = self.check_unique_fd_name(self.wti_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.wti_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-    if self.wti_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.wti_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.wti_fd_name.get_text()
-    fields["ipaddr"] = self.wti_fd_ip.get_text()
-    fields["passwd"] = self.wti_fd_passwd.get_text()
-
-    return fields
- 
- 
-  def val_brocade_fd(self, name):
-    rectify_fence_name = False
-    if self.brocade_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.brocade_fd_name)
-    if name != self.brocade_fd_name.get_text():
-      res = self.check_unique_fd_name(self.brocade_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.brocade_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-    if self.brocade_fd_login.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-    if self.brocade_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.brocade_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.brocade_fd_name.get_text()
-    fields["ipaddr"] = self.brocade_fd_ip.get_text()
-    fields["login"] = self.brocade_fd_login.get_text()
-    fields["passwd"] = self.brocade_fd_passwd.get_text()
-
-    return fields
- 
- 
-  def val_ilo_fd(self, name):
-    rectify_fence_name = False
-    if self.ilo_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.ilo_fd_name)
-    if name != self.ilo_fd_name.get_text():
-      res = self.check_unique_fd_name(self.ilo_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.ilo_fd_login.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-    if self.ilo_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-    if self.ilo_fd_hostname.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_HOSTNAME)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.ilo_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.ilo_fd_name.get_text()
-    fields["hostname"] = self.ilo_fd_hostname.get_text()
-    fields["login"] = self.ilo_fd_login.get_text()
-    fields["passwd"] = self.ilo_fd_passwd.get_text()
-
-    return fields
- 
- 
-  def val_vixel_fd(self, name):
-    rectify_fence_name = False
-    if self.vixel_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.vixel_fd_name)
-    if name != self.vixel_fd_name.get_text():
-      res = self.check_unique_fd_name(self.vixel_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.vixel_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-    if self.vixel_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.vixel_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.vixel_fd_name.get_text()
-    fields["ipaddr"] = self.vixel_fd_ip.get_text()
-    fields["passwd"] = self.vixel_fd_passwd.get_text()
-
-    return fields
- 
- 
-  def val_mcdata_fd(self, name):
-    rectify_fence_name = False
-    if self.mcdata_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.mcdata_fd_name)
-    if name != self.mcdata_fd_name.get_text():
-      res = self.check_unique_fd_name(self.mcdata_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.mcdata_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-    if self.mcdata_fd_login.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-    if self.mcdata_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.mcdata_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.mcdata_fd_name.get_text()
-    fields["ipaddr"] = self.mcdata_fd_ip.get_text()
-    fields["login"] = self.mcdata_fd_login.get_text()
-    fields["passwd"] = self.mcdata_fd_passwd.get_text()
-
-    return fields
- 
-  def val_manual_fd(self, name):
-    rectify_fence_name = False
-    if self.manual_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.manual_fd_name)
-    if name != self.manual_fd_name.get_text():
-      res = self.check_unique_fd_name(self.manual_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.manual_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.manual_fd_name.get_text()
-
-    return fields
- 
-  def val_gnbd_fd(self, name):
-    rectify_fence_name = False
-    if self.gnbd_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.gnbd_fd_name)
-    if name != self.gnbd_fd_name.get_text():
-      res = self.check_unique_fd_name(self.gnbd_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.gnbd_fd_server.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_SERVER)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.gnbd_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.gnbd_fd_name.get_text()
-    fields["server"] = self.gnbd_fd_server.get_text()
-
-    return fields
- 
-  def val_egenera_fd(self, name):
-    rectify_fence_name = False
-    if self.egenera_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.egenera_fd_name)
-    if name != self.egenera_fd_name.get_text():
-      res = self.check_unique_fd_name(self.egenera_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.egenera_fd_cserver.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_CSERVER)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.egenera_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.egenera_fd_name.get_text()
-    fields["cserver"] = self.egenera_fd_cserver.get_text()
-
-    return fields
-
- 
-  def val_sanbox2_fd(self, name):
-    rectify_fence_name = False
-    if self.sanbox2_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.sanbox2_fd_name)
-    if name != self.sanbox2_fd_name.get_text():
-      res = self.check_unique_fd_name(self.sanbox2_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.sanbox2_fd_ip.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_IP)
-
-    if self.sanbox2_fd_login.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-
-    if self.sanbox2_fd_passwd.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.sanbox2_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.sanbox2_fd_name.get_text()
-    fields["ipaddr"] = self.sanbox2_fd_ip.get_text()
-    fields["login"] = self.sanbox2_fd_login.get_text()
-    fields["passwd"] = self.sanbox2_fd_passwd.get_text()
-
-    return fields
-
-  def val_bladecenter_fd(self, name):
-    rectify_fence_name = False
-    if self.bladecenter_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.bladecenter_fd_name)
-    if name != self.bladecenter_fd_name.get_text():
-      res = self.check_unique_fd_name(self.bladecenter_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.bladecenter_fd_ip.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_IP)
-
-    if self.bladecenter_fd_login.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-
-    if self.bladecenter_fd_passwd.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.bladecenter_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.bladecenter_fd_name.get_text()
-    fields["ipaddr"] = self.bladecenter_fd_ip.get_text()
-    fields["login"] = self.bladecenter_fd_login.get_text()
-    fields["passwd"] = self.bladecenter_fd_passwd.get_text()
-
-    return fields
-
-  def val_ipmilan_fd(self, name):
-    rectify_fence_name = False
-    if self.ipmilan_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.ipmilan_fd_name)
-    if name != self.ipmilan_fd_name.get_text():
-      res = self.check_unique_fd_name(self.ipmilan_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.ipmilan_fd_login.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-    if self.ipmilan_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-    if self.ipmilan_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.ipmilan_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.ipmilan_fd_name.get_text()
-    fields["ipaddr"] = self.ipmilan_fd_ip.get_text()
-    fields["login"] = self.ipmilan_fd_login.get_text()
-    fields["passwd"] = self.ipmilan_fd_passwd.get_text()
-
-    return fields
- 
- 
-  def val_bullpap_fd(self, name):
-    rectify_fence_name = False
-    if self.bullpap_fd_name.get_text() == "":
-      raise ValidationError('FATAL', FD_PROVIDE_NAME)
-    self.validateNCName(self.bullpap_fd_name)
-    if name != self.bullpap_fd_name.get_text():
-      res = self.check_unique_fd_name(self.bullpap_fd_name.get_text())
-      if res == False:  #name is already used
-        raise ValidationError('FATAL', FD_PROVIDE_NAME)
-      rectify_fence_name = True
-
-    if self.bullpap_fd_login.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_LOGIN)
-    if self.bullpap_fd_passwd.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_PASSWD)
-    if self.bullpap_fd_ip.get_text() == "":
-        raise ValidationError('FATAL', FD_PROVIDE_IP)
-
-    if rectify_fence_name == True:
-      self.model_builder.rectifyNewFencedevicenameWithFences(name,self.bullpap_fd_name.get_text())
-
-    fields = {}
-    fields["name"] = self.bullpap_fd_name.get_text()
-    fields["ipaddr"] = self.bullpap_fd_ip.get_text()
-    fields["login"] = self.bullpap_fd_login.get_text()
-    fields["passwd"] = self.bullpap_fd_passwd.get_text()
-
-    return fields
- 
- 
-  #Validation Methods for Fence Instances 
-  def validate_fenceinstance(self, agent_type):
-    try:
-      returnlist = apply(self.fi_validate[agent_type])
-    except ValidationError, e:
-      MessageLibrary.errorMessage(e.getMessage())
-      return None
-
-    return returnlist
-
-  def val_apc(self):
-    if self.apc_port.get_text() == "": 
-      raise ValidationError('FATAL', FI_PROVIDE_PORT)
-    if self.apc_switch.get_text() == "": 
-      raise ValidationError('FATAL', FI_PROVIDE_SWITCH)
-
-    fields = {}
-    fields["port"] = self.apc_port.get_text()
-    fields["switch"] = self.apc_switch.get_text()
-
-    return fields
-
-  def val_wti(self):
-    if self.wti_port.get_text() == "":
-      raise ValidationError('FATAL', FI_PROVIDE_PORT)
-
-    fields = {}
-    fields["port"] = self.wti_port.get_text()
-
-    return fields
-
-  def val_brocade(self):
-    if self.brocade_port.get_text() == "":
-      raise ValidationError('FATAL', FI_PROVIDE_PORT)
-
-    fields = {}
-    fields["port"] = self.brocade_port.get_text()
-
-    return fields
-
-  def val_vixel(self):
-    if self.vixel_port.get_text() == "": 
-      raise ValidationError('FATAL', FI_PROVIDE_PORT)
-
-    fields = {}
-    fields["port"] = self.vixel_port.get_text()
-
-    return fields
-
-  def val_gnbd(self):
-    if self.gnbd_ip.get_text() == "": 
-      raise ValidationError('FATAL', FI_PROVIDE_IPADDRESS)
-
-    fields = {}
-    fields["ipaddress"] = self.gnbd_ip.get_text()
-
-    return fields
-
-  def val_ilo(self):
-
-    fields = {}
-
-    return fields
-
-  def val_sanbox2(self):
-    if self.sanbox2_port.get_text() == "": 
-      raise ValidationError('FATAL', FI_PROVIDE_PORT)
-
-    fields = {}
-    fields["port"] = self.sanbox2_port.get_text()
-
-    return fields
-
-  def val_bladecenter(self):
-    if self.bladecenter_blade.get_text() == "": 
-      raise ValidationError('FATAL', FI_PROVIDE_BLADE)
-
-    fields = {}
-    fields["blade"] = self.bladecenter_blade.get_text()
-
-    return fields
-
-  def val_mcdata(self):
-    if self.mcdata_port.get_text() == "":
-      raise ValidationError('FATAL', FI_PROVIDE_PORT)
-
-    fields = {}
-    fields["port"] = self.mcdata_port.get_text()
-
-    return fields
-
-  def val_egenera(self):
-    if self.egenera_lpan.get_text() == "":
-      raise ValidationError('FATAL', FI_PROVIDE_ELPAN)
-    if self.egenera_pserver.get_text() == "":
-      raise ValidationError('FATAL', FI_PROVIDE_EPSERVER)
-
-    fields = {}
-    fields["lpan"] = self.egenera_lpan.get_text()
-    fields["pserver"] = self.egenera_pserver.get_text()
-
-    return fields
-
-  def val_manual(self): 
-
-    fields = {}
-    return fields
-
-  def val_ipmilan(self):
-
-    fields = {}
-
-    return fields
-
-  def val_bullpap(self):
-    if self.bullpap_domain.get_text() == "":
-      raise ValidationError('FATAL', FI_PROVIDE_DOMAIN)
-
-    fields = {}
-    fields["domain"] = self.bullpap_domain.get_text()
-
-    return fields
-
-  def check_unique_fd_name(self, name):
-    fds = self.model_builder.getFenceDevices()
-    for fd in fds:
-      if fd.getName() == name:
-        return False
-
-    return True
-
-  def getFENCE_OPTS(self):
-    return FENCE_OPTS
-
-  def set_model(self, model_builder):
-    self.model_builder = model_builder
-
-
-
-  ### name must conform to relaxNG ID type ##
-  def isNCName(self, name):
-    for ch in ILLEGAL_CHARS:
-      if ch in name:
-        return False
-    return True
-  
-  def makeNCName(self, name):
-    new_name = ''
-    for ch in name:
-      if ch in ILLEGAL_CHARS:
-        new_name = new_name + '_'
-      else:
-        new_name = new_name + ch
-    return new_name
-
-  def validateNCName(self, gtkentry):
-    name = gtkentry.get_text().strip()
-    gtkentry.set_text(name)
-    if not self.isNCName(name):
-      name = self.makeNCName(name)
-      gtkentry.set_text(name)
-      # select text
-      raise ValidationError('FATAL', ILLEGAL_CHARS_REPLACED)
-
-def validateNewFenceDevice(form, model): 
-  from FenceDevice import FenceDevice
-  try:
-    agent_type = form['fence_type']
-  except KeyError, e:
-    return (FD_VAL_FAIL, "No agent type in form submission")
-
-  ##Now that we have an agent type, we should check the fencedev name
-  ##before wasting any time checking other fields.
-  try:
-    fencedev_name = form['name']
-    fencedev_name = fencedev_name.strip()
-  except KeyError, e:
-    return (FD_VAL_FAIL, "No device name in form submission")
-
-  if fencedev_name == "":
-    return (1, "A unique name is required for every fence device")
-
-  fencedevs = model.getFenceDevices()
-  for fd in fencedevs:
-    if fd.getName().strip() == fencedev_name:
-      return (FD_VAL_FAIL, FD_PROVIDE_NAME)
-
-  if agent_type == "fence_apc":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_wti":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_brocade":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_vixel":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-
-  elif agent_type == "fence_mcdata":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-
-  elif agent_type == "fence_gnbd":
-    try:
-      server = form['server']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_SERVER)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("server",server)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_egenera":
-    try:
-      cserver = form['cserver']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_CSERVER)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("cserver",cserver)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-
-  elif agent_type == "fence_sanbox2":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_bladecenter":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_bullpap":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-
-  elif agent_type == "fence_xvm":
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  elif agent_type == "fence_scsi":
-
-    fencedev = FenceDevice()
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedevptr = model.getFenceDevicePtr()
-    fencedevptr.addChild(fencedev)
-    return (FD_VAL_SUCCESS, FD_NEW_SUCCESS % FENCE_OPTS[agent_type])
-
-  #Oh-oh...no agent match
-  else:
-    return (FD_VAL_FAIL, FD_NEW_FAIL % agent_type)
-  
 def validateFenceDevice(form, model): 
-  from FenceDevice import FenceDevice
-  namechange = False
+	try:
+		old_fence_name = form['orig_name'].strip()
+		if not old_fence_name:
+			raise Exception, 'blank'
+	except Exception, e:
+		return (FD_VAL_FAIL, FD_PROVIDE_NAME)
+
+	fencedev = None
+	try:
+		fencedevs = model.getFenceDevices()
+		for fd in fencedevs:
+			if fd.getName().strip() == old_fence_name:
+				fencedev = fd
+				break
+		if fencedev is None:
+			raise Exception, 'fencedev is None'
+	except Exception, e:
+		return (FD_VAL_FAIL, FD_PROVIDE_NAME)
+
+	try:
+		ret = validate_fencedevice(form, model, fencedev, fence_edit=True)
+		if ret is None:
+			model.setModified(True)
+			return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % FENCE_OPTS[fencedev.getAttribute('name')])
+	except Exception, e:
+		ret = FD_PROVIDE_NAME
+
+	return (FD_VAL_FAIL, ret)
+
+def validate_fencedevice(form, model, fencedev, fence_edit=False):
+	try:
+		fence_name = form['name'].strip()
+		if not fence_name:
+			raise Exception, 'blank'
+		fence_name = makeNCName(fence_name)
+	except Exception, e:
+		return FD_PROVIDE_NAME
+
+	name_change = False
+	if fence_edit is True:
+		try:
+			old_fence_name = form['orig_name'].strip()
+			if not old_fence_name:
+				raise Exception, 'blank'
+		except Exception, e:
+			return FD_PROVIDE_NAME
+		if old_fence_name != fence_name:
+			if check_unique_fd_name(model, fence_name) is False:
+				return FD_PROVIDE_NAME
+			name_change = True
+	else:
+		if check_unique_fd_name(model, fence_name) is False:
+			return FD_PROVIDE_NAME
+
+	try:
+		fence_agent = form['agent'].strip()
+		if not fence_agent:
+			raise Exception, 'blank agent'
+	except Exception, e:
+		return FD_PROVIDE_AGENT
+
+	fencedev.addAttribute('name', fence_name)
+	fencedev.addAttribute('agent', fence_agent)
+
+	try:
+		ret = FD_VALIDATE[fence_agent](form, fencedev)
+		if ret is None and name_change is True:
+			try:
+				model.rectifyNewFencedevicenameWithFences(old_fence_name, fence_name)
+			except:
+				return FD_NEW_FAIL % fence_agent
+		return ret
+	except:
+		return FD_NEW_FAIL % fence_agent
+
+def val_apc_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_wti_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+ 
+def val_brocade_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+ 
+def val_vixel_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+ 
+def val_mcdata_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+ 
+def val_gnbd_fd(form, fencedev):
+	try:
+		server = form['server'].strip()
+		if not server:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_SERVER
+
+	fencedev.addAttribute('server', server)
+	return None
+ 
+def val_egenera_fd(form, fencedev):
+	try:
+		cserver = form['cserver'].strip()
+		if not cserver:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_CSERVER
+
+	fencedev.addAttribute('cserver', cserver)
+	return None
+ 
+def val_sanbox2_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_bladecenter_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_bullpap_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_noop_fd(dummy, dummy):
+	return None
+
+# non-shared devices
+
+def val_rsa_fd(form, fencedev):
+	try:
+		hostname = form['hostname'].strip()
+		if not hostname:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_HOSTNAME
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('hostname', hostname)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_drac_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_rps10_fd(form, fencedev):
+	try:
+		device = form['device'].strip()
+		if not device:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_DEVICE
+
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PORT
+
+	fencedev.addAttribute('device', device)
+	fencedev.addAttribute('port', port)
+	return None
+
+def val_ipmilan_fd(form, fencedev):
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_IP
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	try:
+		auth_type = form['auth_type'].strip().lower()
+		if not auth_type or auth_type == 'none':
+			fencedev.removeAttribute('auth_type')
+		elif auth_type == 'password' or auth_type == 'md5':
+			fencedev.setAttribute('auth_type', auth_type)
+		else:
+			return FD_PROVIDE_IPMILAN_AUTH
+	except KeyError, e:
+		fencedev.removeAttribute('auth_type')
+	except Exception, e:
+		return FD_PROVIDE_IPMILAN_AUTH
+
+	try:
+		lanplus = form['lanplus'].strip().lower()
+		if not lanplus or lanplus == '0' or lanplus == 'false' or lanplus == 'off':
+			fencedev.removeAttribute('lanplus')
+		else:
+			fencedev.setAttribute('lanplus', '1')
+	except Exception, e:
+		fencedev.removeAttribute('lanplus')
+
+	fencedev.addAttribute('ipaddr', ip)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+def val_ilo_fd(form, fencedev):
+	try:
+		hostname = form['hostname'].strip()
+		if not hostname:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_HOSTNAME
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FD_PROVIDE_LOGIN
+
+	try:
+		pwd = form['passwd'].strip()
+	except Exception, e:
+		return FD_PROVIDE_PASSWD
+
+	fencedev.addAttribute('hostname', hostname)
+	fencedev.addAttribute('login', log)
+	fencedev.addAttribute('passwd', pwd)
+	return None
+
+# Validation Methods for Fence Instances 
+
+def validate_fenceinstance(form, parent_name):
+	try:
+		fence_agent = form['fence_type'].strip()
+		if not fence_agent:
+			raise Exception, 'blank'
+	except:
+		return FD_PROVIDE_AGENT
+
+	try:
+		if not parent_name.strip():
+			return FI_PROVIDE_PARENT
+	except:
+		return FI_PROVIDE_PARENT
+
+	fenceinst = Device()
+	fenceinst.addAttribute('name', parent_name)
+
+	try:
+		ret = FI_VALIDATE[fence_agent](form, fenceinst)
+		if ret is not None:
+			return (FD_VAL_FAIL, ret)
+	except Exception, e:
+		return (FD_VAL_FAIL, FI_NEW_FAIL % fence_agent)
+
+	return (FD_VAL_SUCCESS, fenceinst)
+
+def val_apc_fi(form, fenceinst):
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_PORT
+
+	try:
+		switch = form['switch'].strip()
+		if not switch:
+			raise KeyError, 'blank'
+		fenceinst.addAttribute('switch', switch)
+	except KeyError, e:
+		# switch is optional
+		fenceinst.removeAttribute('switch')
+
+	fenceinst.addAttribute('port', port)
+	return None
+
+def val_wti_fi(form, fenceinst):
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_PORT
+
+	fenceinst.addAttribute('port', port)
+	return None
+
+def val_brocade_fi(form, fenceinst):
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_PORT
+
+	fenceinst.addAttribute('port', port)
+	return None
+
+def val_vixel_fi(form, fenceinst):
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_PORT
+
+	fenceinst.addAttribute('port', port)
+	return None
+
+def val_gnbd_fi(form, fenceinst):
+	try:
+		ip = form['ipaddress'].strip()
+		if not ip:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_IPADDRESS
+
+	fenceinst.addAttribute('ipaddress', ip)
+	return None
+
+def val_sanbox2_fi(form, fenceinst):
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_PORT
+
+	fenceinst.addAttribute('port', port)
+	return None
+
+def val_bladecenter_fi(form, fenceinst):
+	try:
+		blade = form['blade'].strip()
+		if not blade:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_BLADE
+
+	fenceinst.addAttribute('blade', blade)
+	return None
+
+def val_mcdata_fi(form, fenceinst):
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_PORT
+
+	fenceinst.addAttribute('port', port)
+	return None
+
+def val_egenera_fi(form, fenceinst):
+	try:
+		lpan = form['lpan'].strip()
+		if not lpan:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_ELPAN
+
+	try:
+		pserver = form['pserver'].strip()
+		if not pserver:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_ELPAN
+
+	fenceinst.addAttribute('lpan', lpan)
+	fenceinst.addAttribute('pserver', pserver)
+	return None
+
+def val_bullpap_fi(form, fenceinst):
+	try:
+		domain = form['domain'].strip()
+		if not domain:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_DOMAIN
+
+	fenceinst.addAttribute('domain', domain)
+	return None
+
+def val_xvm_fi(form, fenceinst):
+	try:
+		domain = form['domain'].strip()
+		if not domain:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_DOMAIN
+
+	fenceinst.addAttribute('domain', domain)
+	return None
+
+def val_scsi_fi(form, fenceinst):
+	try:
+		nodename = form['nodename'].strip()
+		if not nodename:
+			raise Exception, 'blank'
+	except Exception, e:
+		return FI_PROVIDE_NODENAME
+
+	fenceinst.addAttribute('nodename', nodename)
+	return None
 
-  try:
-    agent_type = form['fence_type']
-  except KeyError, e:
-    return (FD_VAL_FAIL, "No agent type in form submission")
-
-  ##Now that we have an agent type, we should check the fencedev name
-  ##before wasting any time checking other fields.
-  try:
-    fencedev_name = form['name']
-    fencedev_name = fencedev_name.strip()
-  except KeyError, e:
-    return (FD_VAL_FAIL, "No device name in form submission")
-
-  if fencedev_name == "":
-    return (1, "No device name in form submission")
-
-  try:
-    orig_name = form['orig_name']
-  except KeyError, e:
-    return (FD_VAL_FAIL, "Cannot retrieve original fence device")
-
-  if orig_name != fencedev_name:
-    namechange = True
-
-    fencedevs = model.getFenceDevices()
-    for fd in fencedevs:
-      if fd.getName().strip() == fencedev_name:
-        return (FD_VAL_FAIL, FD_PROVIDE_NAME)
-  else:
-    fencedevs = model.getFenceDevices()
-
-  #Now we know name is unique...find device now
-  fencedev = None
-  for fd in fencedevs:
-    if fd.getName().strip() == orig_name:
-      fencedev = fd
-      break
-
-  if fencedev == None:
-    return (FD_VAL_FAIL, "Could not find fencedevice in current configuration")
-
-  if agent_type == "fence_apc":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_wti":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_brocade":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_vixel":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-
-  elif agent_type == "fence_mcdata":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-
-  elif agent_type == "fence_gnbd":
-    try:
-      server = form['server']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_SERVER)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("server",server)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_egenera":
-    try:
-      cserver = form['cserver']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_CSERVER)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("cserver",cserver)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-
-  elif agent_type == "fence_sanbox2":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_bladecenter":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_bullpap":
-    try:
-      ip = form['ipaddr']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_IP)
-    try:
-      log = form['login']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_LOGIN)
-    try:
-      pwd = form['passwd']
-    except KeyError, e:
-      return (FD_VAL_FAIL, FD_PROVIDE_PASSWD)
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    fencedev.addAttribute("ipaddr",ip)
-    fencedev.addAttribute("login",log)
-    fencedev.addAttribute("passwd",pwd)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-
-  elif agent_type == "fence_xvm":
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  elif agent_type == "fence_scsi":
-
-    fencedev.addAttribute("agent",agent_type)
-    fencedev.addAttribute("name",fencedev_name)
-    if namechange:
-      model.rectifyNewFencedevicenameWithFences(orig_name,fencedev_name)
-    return (FD_VAL_SUCCESS, FD_UPDATE_SUCCESS % orig_name)
-
-  #Oh-oh...no agent match
-  else:
-    return (FD_VAL_FAIL, FD_NEW_FAIL % agent_type)
+def val_noop_fi(dummy, dummy):
+	return None
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/18 02:48:37	1.205
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/19 19:41:26	1.206
@@ -6829,7 +6829,7 @@
 		clusterfolder = self.restrictedTraverse(path)
 		objs = clusterfolder.objectItems('Folder')
 	except Exception, e:
-		luci_log.info('RNN0: error for %s/%s: %s' \
+		luci_log.debug_verbose('RNN0: error for %s/%s: %s' \
 			% (nodename, clustername, str(e)))
 		return nodename
 
@@ -6840,7 +6840,7 @@
 		except:
 			continue
 
-	luci_log.info('RNN1: failed for %s/%s: nothing found' \
+	luci_log.debug_verbose('RNN1: failed for %s/%s: nothing found' \
 		% (nodename, clustername))
 	return nodename
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]