[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
Branch: 	RHEL5
Changes by:	rmccabe sourceware org	2007-07-26 04:36:34

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

Log message:
	Part of the fix for bz249066

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.7&r2=1.4.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.32&r2=1.120.2.33

--- conga/luci/site/luci/Extensions/FenceHandler.py	2007/07/24 15:00:30	1.4.2.7
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2007/07/26 04:36:34	1.4.2.8
@@ -6,6 +6,8 @@
 # Free Software Foundation.
 
 from ClusterModel.Device import Device
+from conga_constants import LUCI_DEBUG_MODE
+from LuciSyslog import get_logger
 
 FD_VAL_FAIL = 1
 FD_VAL_SUCCESS = 0
@@ -152,6 +154,7 @@
 	'fence_manual': ['name']
 }
 
+luci_log = get_logger()
 
 def makeNCName(name):
 	### name must conform to relaxNG ID type ##
@@ -178,6 +181,8 @@
 			model.setModified(True)
 			return (FD_VAL_SUCCESS, fencedev.getAttribute('name'))
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VNFD0: %r %s' % (e, str(e)))
 		ret = [ FD_PROVIDE_AGENT ]
 
 	return (FD_VAL_FAIL, ret)
@@ -188,6 +193,8 @@
 		if not old_fence_name:
 			raise Exception, 'blank'
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VFD0: %r %s' % (e, str(e)))
 		return (FD_VAL_FAIL, [ FD_PROVIDE_NAME ])
 
 	fencedev = None
@@ -200,6 +207,8 @@
 		if fencedev is None:
 			raise Exception, 'fencedev is None'
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VFD1: %r %s' % (e, str(e)))
 		return (FD_VAL_FAIL, [ FD_PROVIDE_NAME ])
 
 	try:
@@ -208,6 +217,8 @@
 			model.setModified(True)
 			return (FD_VAL_SUCCESS, fencedev.getAttribute('name'))
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('VFD2: %r %s' % (e, str(e)))
 		ret = [ FD_PROVIDE_NAME ]
 
 	return (FD_VAL_FAIL, ret)
@@ -219,6 +230,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -226,6 +238,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -257,8 +270,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_wti_fd(form, fencedev):
@@ -268,6 +279,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -299,7 +311,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
 	return errors
 
 def val_brocade_fd(form, fencedev):
@@ -309,6 +320,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -316,6 +328,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -347,8 +360,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_vixel_fd(form, fencedev):
@@ -358,6 +369,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -389,7 +401,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
 	return errors
 
 def val_mcdata_fd(form, fencedev):
@@ -399,6 +410,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -406,6 +418,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -437,8 +450,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_gnbd_fd(form, fencedev):
@@ -448,10 +459,10 @@
 		server = form['servers'].strip()
 		if not server:
 			raise Exception, 'blank'
+		fencedev.addAttribute('servers', server)
 	except Exception, e:
 		errors.append(FD_PROVIDE_SERVER)
 
-	fencedev.addAttribute('servers', server)
 	return errors
 
 def val_egenera_fd(form, fencedev):
@@ -461,10 +472,10 @@
 		cserver = form['cserver'].strip()
 		if not cserver:
 			raise Exception, 'blank'
+		fencedev.addAttribute('cserver', cserver)
 	except Exception, e:
 		errors.append(FD_PROVIDE_CSERVER)
 
-	fencedev.addAttribute('cserver', cserver)
 	return errors
 
 def val_sanbox2_fd(form, fencedev):
@@ -474,6 +485,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -481,6 +493,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -512,8 +525,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_bladecenter_fd(form, fencedev):
@@ -523,6 +534,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -530,6 +542,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -561,8 +574,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_bullpap_fd(form, fencedev):
@@ -572,6 +583,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -579,6 +591,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -610,8 +623,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_noop_fd(dummy, _dummy):
@@ -626,6 +637,7 @@
 		hostname = form['hostname'].strip()
 		if not hostname:
 			raise Exception, 'blank'
+		fencedev.addAttribute('hostname', hostname)
 	except Exception, e:
 		errors.append(FD_PROVIDE_HOSTNAME)
 
@@ -633,6 +645,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -664,8 +677,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('hostname', hostname)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_drac_fd(form, fencedev):
@@ -675,6 +686,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -682,6 +694,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -713,8 +726,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_rps10_fd(form, fencedev):
@@ -724,6 +735,7 @@
 		device = form['device'].strip()
 		if not device:
 			raise Exception, 'blank'
+		fencedev.addAttribute('device', device)
 	except Exception, e:
 		errors.append(FD_PROVIDE_DEVICE)
 
@@ -731,11 +743,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fencedev.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FD_PROVIDE_PORT)
 
-	fencedev.addAttribute('device', device)
-	fencedev.addAttribute('port', port)
 	return errors
 
 def val_ipmilan_fd(form, fencedev):
@@ -745,6 +756,7 @@
 		ip = form['ipaddr'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
 	except Exception, e:
 		errors.append(FD_PROVIDE_IP)
 
@@ -752,6 +764,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -764,6 +777,7 @@
 				fencedev.addAttribute('passwd', form['passwd'])
 			else:
 				raise Exception, 'blank'
+
 		fencedev.addAttribute('passwd', pwd)
 		has_passwd = True
 	except Exception, e:
@@ -809,8 +823,6 @@
 	except Exception, e:
 		fencedev.removeAttribute('lanplus')
 
-	fencedev.addAttribute('ipaddr', ip)
-	fencedev.addAttribute('login', log)
 	return errors
 
 def val_ilo_fd(form, fencedev):
@@ -820,6 +832,7 @@
 		hostname = form['hostname'].strip()
 		if not hostname:
 			raise Exception, 'blank'
+		fencedev.addAttribute('hostname', hostname)
 	except Exception, e:
 		errors.append(FD_PROVIDE_HOSTNAME)
 
@@ -827,6 +840,7 @@
 		log = form['login'].strip()
 		if not log:
 			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
 	except Exception, e:
 		errors.append(FD_PROVIDE_LOGIN)
 
@@ -858,8 +872,6 @@
 	if not has_passwd:
 		errors.append(FD_PROVIDE_PASSWD)
 
-	fencedev.addAttribute('hostname', hostname)
-	fencedev.addAttribute('login', log)
 	return errors
 
 FD_VALIDATE = {
@@ -923,10 +935,15 @@
 		if len(ret) < 1 and name_change is True:
 			try:
 				model.rectifyNewFencedevicenameWithFences(old_fence_name, fence_name)
-			except:
+			except Exception, e:
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('vfd0: %s %r %s' \
+						% (fence_agent, e, str(e)))
 				return [ FD_NEW_FAIL % fence_agent ]
 		return ret
-	except:
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('vfd1: %s %r %s' % (fence_agent, e, str(e)))
 		return [ FD_NEW_FAIL % fence_agent ]
 
 # Validation Methods for Fence Instances
@@ -938,6 +955,7 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
@@ -952,7 +970,6 @@
 	except Exception, e:
 		errors.append(FI_PROVIDE_SWITCH)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_wti_fi(form, fenceinst):
@@ -962,10 +979,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_brocade_fi(form, fenceinst):
@@ -975,10 +992,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_vixel_fi(form, fenceinst):
@@ -988,10 +1005,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_gnbd_fi(form, fenceinst):
@@ -1001,10 +1018,10 @@
 		ip = form['ipaddress'].strip()
 		if not ip:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('ipaddress', ip)
 	except Exception, e:
 		errors.append(FI_PROVIDE_IPADDRESS)
 
-	fenceinst.addAttribute('ipaddress', ip)
 	return errors
 
 def val_sanbox2_fi(form, fenceinst):
@@ -1014,10 +1031,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_bladecenter_fi(form, fenceinst):
@@ -1027,10 +1044,10 @@
 		blade = form['blade'].strip()
 		if not blade:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('blade', blade)
 	except Exception, e:
 		errors.append(FI_PROVIDE_BLADE)
 
-	fenceinst.addAttribute('blade', blade)
 	return errors
 
 def val_mcdata_fi(form, fenceinst):
@@ -1040,10 +1057,10 @@
 		port = form['port'].strip()
 		if not port:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
 	except Exception, e:
 		errors.append(FI_PROVIDE_PORT)
 
-	fenceinst.addAttribute('port', port)
 	return errors
 
 def val_egenera_fi(form, fenceinst):
@@ -1053,6 +1070,7 @@
 		lpan = form['lpan'].strip()
 		if not lpan:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('lpan', lpan)
 	except Exception, e:
 		errors.append(FI_PROVIDE_ELPAN)
 
@@ -1060,11 +1078,10 @@
 		pserver = form['pserver'].strip()
 		if not pserver:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('pserver', pserver)
 	except Exception, e:
 		errors.append(FI_PROVIDE_ELPAN)
 
-	fenceinst.addAttribute('lpan', lpan)
-	fenceinst.addAttribute('pserver', pserver)
 	return errors
 
 def val_bullpap_fi(form, fenceinst):
@@ -1074,10 +1091,10 @@
 		domain = form['domain'].strip()
 		if not domain:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('domain', domain)
 	except Exception, e:
 		errors.append(FI_PROVIDE_DOMAIN)
 
-	fenceinst.addAttribute('domain', domain)
 	return errors
 
 def val_xvm_fi(form, fenceinst):
@@ -1087,10 +1104,10 @@
 		domain = form['domain'].strip()
 		if not domain:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('domain', domain)
 	except Exception, e:
 		errors.append(FI_PROVIDE_DOMAIN)
 
-	fenceinst.addAttribute('domain', domain)
 	return errors
 
 def val_scsi_fi(form, fenceinst):
@@ -1100,10 +1117,10 @@
 		nodename = form['nodename'].strip()
 		if not nodename:
 			raise Exception, 'blank'
+		fenceinst.addAttribute('nodename', nodename)
 	except Exception, e:
 		errors.append(FI_PROVIDE_NODENAME)
 
-	fenceinst.addAttribute('nodename', nodename)
 	return errors
 
 def val_noop_fi(dummy, _dummy):
@@ -1150,6 +1167,8 @@
 		if len(ret) > 0:
 			return (FD_VAL_FAIL, ret)
 	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('vfi0: %s: %r %s' % (fence_agent, e, str(e)))
 		return (FD_VAL_FAIL, [ FI_NEW_FAIL % fence_agent ])
 
 	return (FD_VAL_SUCCESS, fenceinst)
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/06/27 06:19:22	1.120.2.32
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/07/26 04:36:34	1.120.2.33
@@ -832,7 +832,7 @@
 			recovery = None
 		else:
 			if recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
-				errors.append('You entered an invalid recovery option: "%s" Valid options are "restart" "relocate" and "disable."')
+				errors.append('You entered an invalid recovery option: "%s" Valid options are "restart" "relocate" and "disable"')
 	except:
 		recovery = None
 
@@ -2591,7 +2591,8 @@
 	54: validateFenceEdit,
 	55: validateDaemonProperties,
 	57: deleteFenceDevice,
-	58: validateNodeFenceConfig
+	58: validateNodeFenceConfig,
+	80: process_cluster_conf_editor
 }
 
 def validatePost(self, request):


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