All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
Date: 20 Jan 2007 04:50:22 -0000	[thread overview]
Message-ID: <20070120045022.31536.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-20 04:50:20

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : luci_homebase.css 
	luci/site/luci/Extensions: Apache.py Clusterfs.py 
	                           FenceHandler.py Fs.py MySQL.py 
	                           NFSExport.py Netfs.py OpenLDAP.py 
	                           Postgres8.py Samba.py Script.py 
	                           Tomcat5.py Vm.py cluster_adapters.py 

Log message:
	fence and resource fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.155&r2=1.156
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Apache.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Clusterfs.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Fs.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/MySQL.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/NFSExport.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Netfs.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/OpenLDAP.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Postgres8.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Samba.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Script.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Tomcat5.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Vm.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.207&r2=1.208

--- conga/luci/cluster/form-macros	2007/01/16 17:37:26	1.155
+++ conga/luci/cluster/form-macros	2007/01/20 04:50:19	1.156
@@ -1223,7 +1223,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 	</div>
@@ -1278,7 +1278,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1336,7 +1336,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1385,7 +1385,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1435,7 +1435,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1483,7 +1483,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1532,7 +1532,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1589,7 +1589,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1647,7 +1647,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1696,7 +1696,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1736,7 +1736,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1785,7 +1785,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1835,7 +1835,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1893,7 +1893,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1936,7 +1936,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1966,7 +1966,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1997,7 +1997,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -2067,7 +2067,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -2094,7 +2094,7 @@
 		</table>
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_manual" />
--- conga/luci/cluster/resource-form-macros	2007/01/18 02:49:29	1.27
+++ conga/luci/cluster/resource-form-macros	2007/01/20 04:50:19	1.28
@@ -256,7 +256,7 @@
 		</thead>
 		<tr class="systemsTable">
 			<td class="systemsTable" tal:content="res/name" />
-			<td class="systemsTable" tal:content="res/tag_name" />
+			<td class="systemsTable" tal:content="res/type" />
 			<td>
 				<a class="cluster resource"
 					tal:content="string: configure"
@@ -266,7 +266,6 @@
 	</table>
 </div>
 
-
 <div metal:define-macro="resourceprocess-form">
 	<h2>Resource <span tal:replace="python: ('edit' in request and request['edit']) and 'Edited' or 'Added'" /></h2>
 
@@ -325,6 +324,30 @@
 		<tal:block tal:condition="python: type == 'script'">
 			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</tal:block>
+
+		<tal:block tal:condition="python: type == 'vm'">
+			<div metal:use-macro="here/resource-form-macros/macros/vm_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'apache'">
+			<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'openldap'">
+			<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'mysql'">
+			<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'postgres-8'">
+			<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'tomcat-5'">
+			<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
+		</tal:block>
 	</div>
 	</tal:block>
 </div>
@@ -1280,20 +1303,21 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Recovery Options</td>
 			<td class="systemsTable">
-				<select name="recovery">
+				<select name="recovery"
 					tal:attributes="disabled python: editDisabled"
 					tal:define="recovery_opt res/recovery | string:relocate">
-					<option name="relocate"
+
+					<option name="relocate" value="relocate"
+						tal:content="string:Relocate"
 						tal:attributes="
-							content string:Relocate
 							selected python: recovery_opt == 'relocate' and 'selected' or ''" />
-					<option name="restart"
+					<option name="restart" value="restart"
+						tal:content="string:Restart"
 						tal:attributes="
-							content string:Restart
 							selected python: recovery_opt == 'restart' and 'selected' or ''" />
-					<option name="disable"
+					<option name="disable" value="disable"
+						tal:content="string:Disable"
 						tal:attributes="
-							content string:Disable
 							selected python: recovery_opt == 'disable' and 'selected' or ''" />
 				</select>
 			</td>
--- conga/luci/cluster/resource_form_handlers.js	2007/01/17 20:50:38	1.26
+++ conga/luci/cluster/resource_form_handlers.js	2007/01/20 04:50:19	1.27
@@ -99,23 +99,39 @@
 }
 
 function validate_apache(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_tomcat5(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_postgres8(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_mysql(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_openldap(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_vm(form) {
+	var errors = new Array();
+	return (errors);
 }
 
+function validate_nfs_export(form) {
+	var errors = new Array();
+	return (errors);
+}
 
 function validate_nfs_mount(form) {
 	var errors = new Array();
@@ -140,11 +156,6 @@
 	return (errors);
 }
 
-function validate_nfs_export(form) {
-	var errors = new Array();
-	return (errors);
-}
-
 function validate_nfs_client(form) {
 	var errors = new Array();
 
@@ -231,12 +242,12 @@
 }
 
 var required_children = new Array();
-var required_children['nfsx'] = [ 'nfsc' ];
+required_children['nfsx'] = [ 'nfsc' ];
 
 var forbidden_children = new Array();
-var forbidden_children['ip'] = [ 'nfsc', 'nfsx' ];
-var forbidden_children['netfs'] = [ 'nfsc', 'nfsx' ];
-var forbidden_children['nfsx'] = [ 'nfsx' ];
+forbidden_children['ip'] = [ 'nfsc', 'nfsx' ];
+forbidden_children['netfs'] = [ 'nfsc', 'nfsx' ];
+forbidden_children['nfsx'] = [ 'nfsx' ];
 
 var form_validators = new Array();
 form_validators['ip'] = validate_ip;
@@ -249,8 +260,8 @@
 form_validators['smb'] = validate_samba;
 form_validators['vm'] = validate_vm;
 form_validators['apache'] = validate_apache;
-form_validators['tomcat-5'] validate_tomcat5;
-form_validators['postgres-8'] validate_postgres8;
+form_validators['tomcat-5'] = validate_tomcat5;
+form_validators['postgres-8'] = validate_postgres8;
 form_validators['openldap'] = validate_openldap;
 form_validators['mysql'] = validate_mysql;
 
--- conga/luci/homebase/luci_homebase.css	2007/01/10 16:00:41	1.33
+++ conga/luci/homebase/luci_homebase.css	2007/01/20 04:50:19	1.34
@@ -333,8 +333,7 @@
 
 *.reshdr {
 	text-align: top;
-	font-size: 9pt;
-	letter-spacing: +.5px;
+	font-size: 10pt;
 	font-weight: 600;
 	padding-bottom: +1em;
 }
--- conga/luci/site/luci/Extensions/Apache.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/Apache.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "apache"
-RESOURCE_TYPE = _("Apache Server: ")
+RESOURCE_TYPE = _("Apache Server")
 
 class Apache(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Clusterfs.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Clusterfs.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "clusterfs"
-RESOURCE_TYPE = _("GFS: ")
+RESOURCE_TYPE = _("GFS")
 
 class Clusterfs(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/19 21:48:23	1.15
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/20 04:50:20	1.16
@@ -1,6 +1,5 @@
 import re
 from Device import Device
-from FenceDevice import FenceDevice
 from conga_constants import FD_VAL_SUCCESS, FD_VAL_FAIL
 
 FD_NEW_SUCCESS = 'New %s successfully added to cluster'
@@ -103,48 +102,6 @@
 	'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'],
@@ -191,7 +148,7 @@
 
 def makeNCName(name):
 	### name must conform to relaxNG ID type ##
-	return re.sub('_', name)
+	return ILLEGAL_CHARS.sub('_', name)
 
 def check_unique_fd_name(model, name):
 	fds = model.getFenceDevices()
@@ -201,6 +158,7 @@
 	return True
 
 def validateNewFenceDevice(form, model):
+	from FenceDevice import FenceDevice
 	fencedev = FenceDevice()
 
 	try:
@@ -216,6 +174,7 @@
 	return (FD_VAL_FAIL, ret)
 
 def validateFenceDevice(form, model):
+	from FenceDevice import FenceDevice
 	try:
 		old_fence_name = form['orig_name'].strip()
 		if not old_fence_name:
@@ -245,52 +204,6 @@
 
 	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 len(ret) < 1 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):
 	errors = list()
 
@@ -533,7 +446,7 @@
 	fencedev.addAttribute('passwd', pwd)
 	return errors
 
-def val_noop_fd(dummy, dummy):
+def val_noop_fd(dummy, _dummy):
 	return []
 
 # non-shared devices
@@ -695,33 +608,74 @@
 	fencedev.addAttribute('passwd', pwd)
 	return errors
 
-# Validation Methods for Fence Instances
+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
+}
 
-def validate_fenceinstance(form, parent_name):
+def validate_fencedevice(form, model, fencedev, fence_edit=False):
 	try:
-		fence_agent = form['fence_type'].strip()
-		if not fence_agent:
+		fence_name = form['name'].strip()
+		if not fence_name:
 			raise Exception, 'blank'
-	except:
-		return [ FD_PROVIDE_AGENT ]
+		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:
-		if not parent_name.strip():
-			return [ FI_PROVIDE_PARENT ]
-	except:
-		return [ FI_PROVIDE_PARENT ]
+		fence_agent = form['fence_type'].strip()
+		if not fence_agent:
+			raise Exception, 'blank agent'
+	except Exception, e:
+		return [ FD_PROVIDE_AGENT ]
 
-	fenceinst = Device()
-	fenceinst.addAttribute('name', parent_name)
+	fencedev.addAttribute('name', fence_name)
+	fencedev.addAttribute('agent', fence_agent)
 
 	try:
-		ret = FI_VALIDATE[fence_agent](form, fenceinst)
-		if len(ret) > 0:
-			return (FD_VAL_FAIL, ret)
-	except Exception, e:
-		return (FD_VAL_FAIL, [ FI_NEW_FAIL % fence_agent ])
+		ret = FD_VALIDATE[fence_agent](form, fencedev)
+		if len(ret) < 1 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 ]
 
-	return (FD_VAL_SUCCESS, fenceinst)
+# Validation Methods for Fence Instances
 
 def val_apc_fi(form, fenceinst):
 	errors = list()
@@ -898,5 +852,45 @@
 	fenceinst.addAttribute('nodename', nodename)
 	return errors
 
-def val_noop_fi(dummy, dummy):
+def val_noop_fi(dummy, _dummy):
 	return []
+
+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
+}
+
+def validate_fenceinstance(form, parent_name, fence_agent):
+	try:
+		if not parent_name.strip():
+			return (FD_VAL_FAIL, [ FI_PROVIDE_PARENT ])
+	except:
+		return (FD_VAL_FAIL, [ FI_PROVIDE_PARENT ])
+
+	fenceinst = Device()
+	fenceinst.addAttribute('name', parent_name)
+
+	try:
+		ret = FI_VALIDATE[fence_agent](form, fenceinst)
+		if len(ret) > 0:
+			return (FD_VAL_FAIL, ret)
+	except Exception, e:
+		return (FD_VAL_FAIL, [ FI_NEW_FAIL % fence_agent ])
+
+	return (FD_VAL_SUCCESS, fenceinst)
--- conga/luci/site/luci/Extensions/Fs.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Fs.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "fs"
-RESOURCE_TYPE = _("File System: ")
+RESOURCE_TYPE = _("File System")
 
 class Fs(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/MySQL.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/MySQL.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "mysql"
-RESOURCE_TYPE = _("MySQL Server: ")
+RESOURCE_TYPE = _("MySQL Server")
 
 class MySQL(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/NFSExport.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/NFSExport.py	2007/01/20 04:50:20	1.2
@@ -5,7 +5,7 @@
 import gettext
 _ = gettext.gettext
 
-RESOURCE_TYPE = _("NFS Export: ")
+RESOURCE_TYPE = _("NFS Export")
 TAG_NAME = "nfsexport"
 
 class NFSExport(BaseResource):
--- conga/luci/site/luci/Extensions/Netfs.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Netfs.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "netfs"
-RESOURCE_TYPE = _("NFS Mount: ")
+RESOURCE_TYPE = _("NFS Mount")
 
 class Netfs(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/OpenLDAP.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/OpenLDAP.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "openldap"
-RESOURCE_TYPE = _("Open LDAP Server: ")
+RESOURCE_TYPE = _("Open LDAP Server")
 
 class OpenLDAP(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Postgres8.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/Postgres8.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "postgres-8"
-RESOURCE_TYPE = _("PostgreSQL 8 Server: ")
+RESOURCE_TYPE = _("PostgreSQL 8 Server")
 
 class Postgres8(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Samba.py	2006/07/20 21:30:33	1.1
+++ conga/luci/site/luci/Extensions/Samba.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "smb"
-RESOURCE_TYPE = _("Samba Service: ")
+RESOURCE_TYPE = _("Samba Service")
 
 class Samba(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Script.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Script.py	2007/01/20 04:50:20	1.2
@@ -5,7 +5,7 @@
 import gettext
 _ = gettext.gettext
 
-RESOURCE_TYPE = _("Script: ")
+RESOURCE_TYPE = _("Script")
 TAG_NAME = "script"
 
 class Script(BaseResource):
--- conga/luci/site/luci/Extensions/Tomcat5.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/Tomcat5.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "tomcat-5"
-RESOURCE_TYPE = _("Tomcat 5 Server: ")
+RESOURCE_TYPE = _("Tomcat 5 Server")
 
 class Tomcat5(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Vm.py	2006/10/24 15:04:13	1.2
+++ conga/luci/site/luci/Extensions/Vm.py	2007/01/20 04:50:20	1.3
@@ -1,15 +1,16 @@
 import string
 from TagObject import TagObject
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
 
 TAG_NAME = "vm"
+RESOURCE_TYPE = _("Virtual Machine")
 
-class Vm(TagObject):
+class Vm(BaseResource):
   def __init__(self):
-    TagObject.__init__(self)
+    BaseResource.__init__(self)
     self.TAG_NAME = TAG_NAME
-    #Have autostart set by default
-    self.addAttribute("autostart","1")
-
-  def getProperties(self):
-    stringbuf = ""
-    return stringbuf
+    self.resource_type = RESOURCE_TYPE
+    self.addAttribute('autostart', '1')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/19 21:48:23	1.207
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/20 04:50:20	1.208
@@ -30,7 +30,6 @@
 from clusterOS import resolveOSType
 from Fence import Fence
 from Method import Method
-from FenceDevice import FenceDevice
 from Device import Device
 from FenceHandler import validateNewFenceDevice, FENCE_OPTS, validateFenceDevice, validate_fenceinstance
 from GeneralError import GeneralError
@@ -1295,7 +1294,6 @@
     luci_log.debug_verbose('VFE: no form was submitted')
     return (False, {'errors': ['No form was submitted']})
 
-  #fencehandler = FenceHandler()
   error_code, retobj = validateNewFenceDevice(form, model)
   if error_code == FD_VAL_SUCCESS:
     try:
@@ -1304,7 +1302,7 @@
         raise Exception, 'conf_str is none'
     except Exception, e:
       luci_log.debug_verbose('VFE: export model as string failed: %s' \
-      % str(e))
+        % str(e))
       errors.append('Unable to store the new cluster configuration')
 
     try:
@@ -1643,7 +1641,7 @@
 			pass
 
 		for inst in instance_list:
-			retcode, retobj = validate_fenceinstance(inst, fencedev_name)
+			retcode, retobj = validate_fenceinstance(inst, fencedev_name, fence_type)
 			if retcode != FD_VAL_SUCCESS:
 				errors.extend(retobj)
 				continue



             reply	other threads:[~2007-01-20  4:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-20  4:50 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-30  5:54 [Cluster-devel] conga/luci cluster/form-macros cluster/resourc rmccabe
2007-02-16  2:12 rmccabe
2007-02-16  2:06 rmccabe
2007-02-08 16:00 rmccabe
2007-02-08 15:59 rmccabe
2007-02-08  5:05 rmccabe
2007-01-26 17:56 rmccabe
2006-12-06 22:44 rmccabe
2006-12-05 23:32 rmccabe
2006-12-05  6:44 rmccabe
2006-09-23  4:04 rmccabe
2006-09-14 21:24 rmccabe
2006-09-13 17:50 rmccabe
2006-09-11 22:22 rmccabe
2006-09-05 21:25 rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070120045022.31536.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.