cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2006-12-01 14:56 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2006-12-01 14:56 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-12-01 14:56:54

Modified files:
	luci/cluster   : fence_device.js form-macros 
	luci/homebase  : luci_homebase.css 

Log message:
	more fence device fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.117&r2=1.118
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.29&r2=1.30

--- conga/luci/cluster/fence_device.js	2006/11/29 18:39:50	1.1
+++ conga/luci/cluster/fence_device.js	2006/12/01 14:56:53	1.2
@@ -1,5 +1,5 @@
 function swap_fence_div(container_id, element_id) {
-	var container_element = document.getElementById(container_id)
+	var container_element = document.getElementById(container_id);
 	if (!container_element) {
 		return (-1);
 	}
@@ -17,3 +17,79 @@
 	target.id = null;
 	container_element.appendChild(target);
 }
+
+function swap_node_fence_div(container_id, fence_opt) {
+	var container_element = document.getElementById(container_id);
+	if (!container_element || !fence_opt || !fence_opt.value)
+		return (-1);
+
+	var fence_id = fence_opt.value;
+	var child_element = document.getElementById(fence_id);
+	if (container_element.firstChild)
+		container_element.removeChild(container_element.firstChild);
+
+	if (!child_element)
+		return (-1);
+
+	var target = child_element.cloneNode(1);
+	target.id = null;
+
+	var fence_type = fence_id;
+	if (fence_opt.className.match(/shared_fencedev/)) {
+		var input_tags = target.getElementsByTagName('input');
+		for (var i = 0 ; i < input_tags.length ; i++) {
+			if (input_tags[i].type != 'button') {
+				input_tags[i].disabled = true;
+				if (input_tags[i].name == 'fence_type')
+					fence_type = input_tags[i].value;
+			}
+		}	
+	}
+
+	var fi_form = document.getElementById(fence_type + '_instance');
+	if (fi_form)
+		target.appendChild(fi_form.cloneNode(1));
+	container_element.appendChild(target);
+}
+
+var num_fences_level = Array(0, 0)
+
+function add_node_fence_device(fence_level) {
+	var cont_name = 'fence_list_level' + fence_level;
+	var container = document.getElementById(cont_name);
+	if (!container)
+		return (-1);
+
+	var chooser_elem = document.getElementById('fence_selection_block');
+	if (!chooser_elem)
+		return (-1);
+
+	var div_elem = document.createElement('div');
+	if (!div_elem)
+		return (-1);
+	var level_num_fences = num_fences_level[fence_level];
+
+	div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
+	chooser_elem = chooser_elem.cloneNode(1);
+	chooser_elem.id = null;
+	chooser_elem.className = null;
+
+	var input_elems = chooser_elem.getElementsByTagName('input');
+	if (!input_elems || input_elems.length < 2)
+		return (-1);
+	for (var i = 0 ; i < input_elems.length ; i++) {
+		if (input_elems[i].name == 'fence_level')
+			input_elems[i].value = fence_level;
+		else if (input_elems[i].name == 'fence_num')
+			input_elems[i].value = level_num_fences++;
+	}
+
+	var select_elem = chooser_elem.getElementsByTagName('select');
+	if (!select_elem || select_elem.length != 1)
+		return (-1);
+	select_elem[0].setAttribute('onChange', "swap_node_fence_div('" + div_elem.id + "', this.options[this.selectedIndex])");
+
+	div_elem.appendChild(chooser_elem);
+	container.appendChild(div_elem);
+	num_fences_level[fence_level]++;
+}
--- conga/luci/cluster/form-macros	2006/11/30 22:31:22	1.117
+++ conga/luci/cluster/form-macros	2006/12/01 14:56:53	1.118
@@ -1141,7 +1141,7 @@
 
 	<div id="fence_apc" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>APC Power Switch</td>
 			</tr>
@@ -1183,7 +1183,7 @@
 
 	<div id="fence_mcdata" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>McData SAN Switch</td>
 			</tr>
@@ -1225,7 +1225,7 @@
 
 	<div id="fence_wti" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>WTI Power Switch</td>
 			</tr>
@@ -1260,7 +1260,7 @@
 
 	<div id="fence_ilo" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>HP iLO</td>
 			</tr>
@@ -1302,7 +1302,7 @@
 
 	<div id="fence_drac" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Dell Drac</td>
 			</tr>
@@ -1343,7 +1343,7 @@
 
 	<div id="fence_rsa" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>IBM RSA II</td>
 			</tr>
@@ -1385,7 +1385,7 @@
 
 	<div id="fence_brocade" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Brocade Fabric Switch</td>
 			</tr>
@@ -1427,7 +1427,7 @@
 
 	<div id="fence_sanbox2" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>QLogic SANbox2</td>
 			</tr>
@@ -1466,7 +1466,7 @@
 
 	<div id="fence_vixel" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Vixel SAN Switch</td>
 			</tr>
@@ -1501,7 +1501,7 @@
 
 	<div id="fence_gnbd" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>GNBD</td>
 			</tr>
@@ -1529,7 +1529,7 @@
 
 	<div id="fence_egenera" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Egenera SAN Controller</td>
 			</tr>
@@ -1564,7 +1564,7 @@
 
 	<div id="fence_bladecenter" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>IBM Blade Center</td>
 			</tr>
@@ -1606,7 +1606,7 @@
 
 	<div id="fence_bullpap" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Bull PAP</td>
 			</tr>
@@ -1648,7 +1648,7 @@
 
 	<div id="fence_rps10" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>RPS10 Serial Switch</td>
 			</tr>
@@ -1683,7 +1683,7 @@
 
 	<div id="fence_xvm" class="fencedev">
 	<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Virtual Machine Fencing</td>
 			</tr>
@@ -1703,7 +1703,7 @@
 
 	<div id="fence_scsi" class="fencedev">
 	<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>SCSI Reservation Fencing</td>
 			</tr>
@@ -1723,7 +1723,7 @@
 
 	<div id="fence_ipmilan" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>IPMI Lan</td>
 			</tr>
@@ -1769,7 +1769,7 @@
 
 	<div id="fence_manual" class="fencedev">
 		<table>
-			<tr tal:condition="exists: cur_fence_type">
+			<tr>
 				<td><strong class="cluster">Fence Type</strong></td>
 				<td>Manual Fencing</td>
 			</tr>
@@ -1863,7 +1863,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-apc">
-	<div id="fence_apc_instance" class="fencedev">
+	<div id="fence_apc_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1884,7 +1884,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-egenera">
-	<div id="fence_egenera_instance" class="fencedev">
+	<div id="fence_egenera_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>lpan</td>
@@ -1905,7 +1905,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-wti">
-	<div id="fence_wti_instance" class="fencedev">
+	<div id="fence_wti_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1919,7 +1919,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-brocade">
-	<div id="fence_brocade_instance" class="fencedev">
+	<div id="fence_brocade_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1933,7 +1933,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-vixel">
-	<div id="fence_vixel_instance" class="fencedev">
+	<div id="fence_vixel_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1947,7 +1947,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-sanbox2">
-	<div id="fence_sanbox2_instance" class="fencedev">
+	<div id="fence_sanbox2_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1961,7 +1961,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-mcdata">
-	<div id="fence_mcdata_instance" class="fencedev">
+	<div id="fence_mcdata_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -1975,7 +1975,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-gndb">
-	<div id="fence_gnbd_instance" class="fencedev">
+	<div id="fence_gnbd_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>IP Address</td>
@@ -1989,7 +1989,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-bladecenter">
-	<div id="fence_bladecenter_instance" class="fencedev">
+	<div id="fence_bladecenter_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Blade</td>
@@ -2003,7 +2003,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-bullpap">
-	<div id="fence_bullpap_instance" class="fencedev">
+	<div id="fence_bullpap_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Domain</td>
@@ -2017,7 +2017,7 @@
 </div>
 
 <div metal:define-macro="fence-instance-form-xvm">
-	<div id="fence_xvm_instance" class="fencedev">
+	<div id="fence_xvm_instance" class="fencedev_instance">
 		<table>
 			<tr>
 				<td>Domain</td>
@@ -2214,79 +2214,91 @@
 
 	<hr/>
 
-	<div id="invisible" class="invisible">
+	<div class="invisible" id="fence_device_list">
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-list" />
 	</div>
 
-	<table id="fence_devices" class="cluster node fencedev">
-		<tfoot class="fencedev">
-		<tr class="cluster node fencedev"><td class="cluster node fencedev">
-			<input type="button" value="Update fence properties"
-				onClick="validate_fence_properties('fence_devices')" />
-		</td></tr>
+	<div class="invisible" id="shared_fence_devices">
+		<tal:block tal:repeat="cur_fencedev fencedevinfo/fencedevs">
+			<tal:block metal:use-macro="here/form-macros/macros/shared-fence-device-list" />
+		</tal:block>
+	</div>
+
+	<div class="invisible" id="fence_instances">
+		<tal:block metal:use-macro="here/form-macros/macros/fence-instance-form-list" />
+	</div>
+
+	<div id="fence_selection_block" class="invisible">
+		<form name="main_fence_form">
+			<select name="select_div">
+				<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
+				<tal:block tal:repeat="f fencedevinfo/fencedevs">
+					<option class="shared_fencedev"
+						tal:attributes="value f/name"
+						tal:content="python: f['name'] + ' (' + f['pretty_name'] + ')'"
+					/>
+				</tal:block>
+				<option value="fence-form-new-instance">------ Create a new Fence Device ------</option>
+				<tal:block metal:use-macro="here/form-macros/macros/fence-option-list" />
+			</select>
+			<input type="hidden" name="fence_level" value="" />
+			<input type="hidden" name="fence_num" value="" />
+		</form>
+	</div>
+
+	<table id="fence_devices" class="cluster node fence">
+		<tfoot class="fence">
+			<tr class="cluster node fence"><td class="cluster node fence">
+				<input type="button" value="Update fence properties"
+					onClick="validate_fence_properties('fence_devices')" />
+			</td></tr>
 		</tfoot>
-		<tbody class="fencedev">
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fencedev">
-				<span class="fencedev">
+
+		<tbody class="fence">
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence">
+				<span class="fence">
 					<strong class="cluster node">Main Fencing Method</strong>
 				</span>
 			</td>
 			<td class="cluster node fence_backup">
-				<span class="fencedev">
+				<span class="fence">
 					<strong class="cluster node">Backup Fencing Method</strong>
 				</span>
 			</td>
 		</tr>
 
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fence_main fencedev">
-				<tal:block tal:repeat="cur_fencedev fencedevinfo/fencedevs">
-					<div class="invisible" id="shared_fence_devices">
-						<tal:block metal:use-macro="here/form-macros/macros/shared-fence-device-list" />
-					</div>
-				</tal:block>
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence_main fence"><div class="fence_container">
+				<div id="fence_list_level1">
+					<tal:comment tal:replace="nothing">
+						XXX - fill in any existing fence devices for this node
+						and update the counter number for this level
+					</tal:comment>
+				</div>
 
-				<form name="main_fence_form">
-				<select name="select_div"
-					onChange="swap_fence_div('fence_container',
-								this.options[this.selectedIndex].value)">
-					<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
-					<tal:block tal:repeat="f fencedevinfo/fencedevs">
-						<option class="shared_fencedev"
-							tal:attributes="value f/name"
-							tal:content="python: f['name'] + ' (' + f['pretty_name'] + ')'"
-						/>
-					</tal:block>
-					<option value="fence-form-new-instance">------ Create a new Fence Device ------</option>
-					<tal:block metal:use-macro="here/form-macros/macros/fence-option-list" />
-				</select>
-				</form>
-				<div id="fence_container">
+				<div class="fence_control">
+					<input type="button" value="Add a fence to this level"
+						onclick="add_node_fence_device(1);" />
 				</div>
-			</td>
-			<td class="cluster node fence_main fencedev">
-				<form name="backup_fence_form">
-				<select name="select_div"
-					onChange="swap_fence_div('fence_container_backup',
-						this.options[this.selectedIndex].value)">
-					<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
-					<option value="fence-form-new-instance">------ Create a new Fence Device ------</option>
-					<tal:block metal:use-macro="here/form-macros/macros/fence-option-list" />
-				</select>
-				</form>
-				<div id="fence_container_backup">
+			</div></td>
+
+			<td class="cluster node fence_main fence"><div class="fence_container">
+				<div id="fence_list_level2">
+					<tal:comment tal:replace="nothing">
+						XXX - fill in any existing fence devices for this node
+						and update the counter number for this level
+					</tal:comment>
 				</div>
-			</td>
+
+				<div class="fence_control">
+					<input type="button" value="Add a fence to this level"
+						onclick="add_node_fence_device(2)" />
+				</div>
+			</div></td>
 		</tr>
 		</tbody>
 	</table>
-	<script type="text/javascript">
-		swap_fence_div('fence_container',
-			document.main_fence_form.select_div.options[document.main_fence_form.select_div.selectedIndex].value);
-		swap_fence_div('fence_container_backup',
-			document.backup_fence_form.select_div.options[document.backup_fence_form.select_div.selectedIndex].value);
-	</script>
 </div>
 
 <div metal:define-macro="nodes-form">
@@ -3051,23 +3063,23 @@
 		<tal:block metal:use-macro="here/form-macros/macros/shared-fence-form-list" />
 	</div>
 
-	<table id="fence_devices" class="cluster node fencedev">
-		<tfoot class="fencedev">
-		<tr class="cluster node fencedev"><td class="cluster node fencedev">
+	<table id="fence_devices" class="cluster node fence">
+		<tfoot class="fence">
+		<tr class="cluster node fence"><td class="cluster node fence">
 			<input type="button" value="Add this shared fence device"
 				onClick="validate_fence_properties('fence_devices')" />
 		</td></tr>
 		</tfoot>
-		<tbody class="fencedev">
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fencedev">
-				<span class="fencedev">
+		<tbody class="fence">
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence">
+				<span class="fence">
 					<strong class="cluster node">Fencing Type</strong>
 				</span>
 			</td>
 		</tr>
-		<tr class="cluster node info_top fencedev">
-			<td class="cluster node fence_main fencedev">
+		<tr class="cluster node info_top fence">
+			<td class="cluster node fence_main fence">
 				<form name="main_fence_form">
 				<select name="select_div"
 					onChange="swap_fence_div('fence_container',
@@ -3208,7 +3220,7 @@
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-manual" />
 	</tal:block>
 
-	<div class="fencedev">
+	<div class="fence_submit">
 		<input class="hbInput" type="button" value="Submit" name="Submit" />
 	</div>
 	</div>
--- conga/luci/homebase/luci_homebase.css	2006/11/03 21:47:27	1.29
+++ conga/luci/homebase/luci_homebase.css	2006/12/01 14:56:54	1.30
@@ -14,27 +14,27 @@
 	background: #dee7ec;
 }
 
-div.fencedev {
+div.fence {
 	max-width: 700px;
 	padding: .5em;
 }
 
-*.fencedev {
+*.fence {
 	background: #dee7ec;
 }
 
-table.fencedev {
+table.fence {
 	padding: .618em;
 	width: 700px;
 }
 
-div.fencedev,
-td.fencedev {
+div.fence,
+td.fence {
 	padding-top: .309em;
 	padding-bottom: .309em;
 }
 
-td.fencedev {
+td.fence {
 	width: 50%;
 }
 
@@ -438,6 +438,21 @@
 	margin-bottom: .25em ! important;
 }
 
+div.fence_add {
+	margin-top: .25em ! important;
+	margin-bottom: .25em ! important;
+}
+
+div.fence_container {
+	border: thin solid #c9c9c9;
+}
+
+div.fence_control {
+	margin-top: 2em;
+	margin-bottom: .75em;
+	margin-left: .33em;
+}
+
 div.service_comp_list {
 	background: #dee7ec;
 	max-width: 700px;



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-01-05 23:44 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-01-05 23:44 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-05 23:44:11

Modified files:
	luci/cluster   : fence_device.js form-macros 
	luci/site/luci/Extensions: cluster_adapters.py 
	                           conga_constants.py 

Log message:
	more node-specific fencing updates

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.141&r2=1.142
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.193&r2=1.194
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.32&r2=1.33

--- conga/luci/cluster/fence_device.js	2007/01/05 23:26:11	1.3
+++ conga/luci/cluster/fence_device.js	2007/01/05 23:44:10	1.4
@@ -169,6 +169,5 @@
 	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
 
 	if (confirm('Submit: ' + master_form.fence_xml.value))
-		return;
-		//form.submit();
+		master_form.submit();
 }
--- conga/luci/cluster/form-macros	2007/01/05 23:26:11	1.141
+++ conga/luci/cluster/form-macros	2007/01/05 23:44:10	1.142
@@ -2863,9 +2863,10 @@
 						onclick="add_node_fence_device(1)" />
 				</div>
 				<div class="hbSubmit">
-					<form name="fence1_master">
+					<form name="fence1_master" method="post" action="">
 						<input type="hidden" name="fence_level" value="1" />
 						<input type="hidden" name="fence_xml" value="" />
+						<input type="hidden" name="pagetype" value="58" />
 						<input type="button"
 							value="Update fence properties"
 							onclick="validate_fence(this.form, 'fence_list_level1')" />
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/02 20:12:22	1.193
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/05 23:44:10	1.194
@@ -1433,6 +1433,51 @@
     errors.append(error_string)
     return (False, {'errors': errors, 'messages': messages})
 
+def validateNodeFenceConfig(self, request):
+	try:
+		form_xml = request['fence_xml']
+		if not form_xml:
+			raise KeyError, 'form_xml must not be blank'
+	except Exception, e:
+		luci_log.debug_verbose('vNFC0: no form_xml: %s' % str(e))
+		return (False, {'errors': ['No fence data was supplied.']})
+
+	try:
+		doc = minidom.parseString(form_xml)
+		forms = doc.getElementsByTagName('form')
+		if len(forms) < 1:
+			raise
+	except Exception, e:
+		luci_log.debug_verbose('vNFC1: error: %s' % str(e))
+		return (False, {'errors': ['The fence data submitted is not properly formed.']})
+
+	form_hash = {}
+	for i in forms:
+		form_id = i.getAttribute('name')
+		if not form_id:
+			continue
+		ielems = i.getElementsByTagName('input')
+		if not ielems or len(ielems) < 1:
+			continue
+
+		dummy_form = {}
+
+		for i in ielems:
+			try:
+				input_type = str(i.getAttribute('type'))
+			except:
+				continue
+			if not input_type or input_type == 'button':
+				continue
+			try:
+				dummy_form[str(i.getAttribute('name'))] = str(i.getAttribute('value'))
+			except Exception, e:
+				luci_log.debug_verbose('vNFC2: parsing XML: %s' % str(e))
+				pass
+
+			form_hash[form_id] = dummy_form
+	luci_log.debug_verbose('vNFC3: got xml: %s' % doc.toxml())
+	return (False, { 'errors': [ doc.toxml() ]})
 
 def deleteFenceDevice(self, request):
   errors = list()
@@ -1654,7 +1699,8 @@
 	51: validateFenceAdd,
 	50: validateFenceEdit,
 	55: validateDaemonProperties,
-  57: deleteFenceDevice
+	57: deleteFenceDevice,
+	58: validateNodeFenceConfig
 }
 
 def validatePost(self, request):
--- conga/luci/site/luci/Extensions/conga_constants.py	2006/12/21 21:26:20	1.32
+++ conga/luci/site/luci/Extensions/conga_constants.py	2007/01/05 23:44:11	1.33
@@ -45,6 +45,7 @@
 CLUSTER_DAEMON="55"
 SERVICE_DELETE = '56'
 FENCEDEV_DELETE = "57"
+FENCEDEV_NODE_CONFIG = '58'
 
 CONF_EDITOR = '80'
 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-01-08 21:58 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-01-08 21:58 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-08 21:58:34

Modified files:
	luci/cluster   : fence_device.js form-macros 
	luci/homebase  : luci_homebase.css 
	luci/site/luci/Extensions: homebase_adapters.py 

Log message:
	more per-node fence updates

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.144&r2=1.145
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.45&r2=1.46

--- conga/luci/cluster/fence_device.js	2007/01/05 23:44:10	1.4
+++ conga/luci/cluster/fence_device.js	2007/01/08 21:58:33	1.5
@@ -69,11 +69,19 @@
 		var cloned_iform = fi_form.cloneNode(1);
 		cloned_iform.id = container_id + '_0';
 		cloned_iform.name = cloned_iform.id;
-		cloned_iform.className = '';
+		cloned_iform.className = 'fence_instance';
 
 		var form_elem = document.createElement('form');
 		form_elem.name = cloned_iform.id;
 		form_elem.appendChild(cloned_iform);
+		var ielem = cloned_iform.getElementsByTagName('input');
+		for (var i = 0 ; i < ielem.length ; i++) {
+			if (ielem[i].type == 'button' && ielem[i].name == 'remove_fence') {
+				ielem[i].setAttribute('onclick',
+					'del_fence_instance(\'' + cloned_iform.id + '\')');
+				break;
+			}
+		}
 
 		idiv.appendChild(form_elem);
 		container_element.appendChild(idiv);
@@ -109,6 +117,7 @@
 	var level_num_fences = num_fences_level[fence_level - 1];
 
 	div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
+	div_elem.className = 'fence_level';
 	chooser_elem = chooser_elem.cloneNode(1);
 	chooser_elem.id = null;
 	chooser_elem.className = null;
@@ -168,6 +177,6 @@
 
 	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
 
-	if (confirm('Submit: ' + master_form.fence_xml.value))
+	if (confirm('Update this node\'s fence configuration?'))
 		master_form.submit();
 }
--- conga/luci/cluster/form-macros	2007/01/07 17:36:17	1.144
+++ conga/luci/cluster/form-macros	2007/01/08 21:58:33	1.145
@@ -1283,6 +1283,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_apc" />
 	</div>
 </div>
@@ -1341,6 +1351,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_mcdata" />
 	</div>
 </div>
@@ -1390,6 +1410,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_wti" />
 	</div>
 </div>
@@ -1594,6 +1624,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_brocade" />
 	</div>
 </div>
@@ -1647,6 +1687,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_sanbox2" />
 	</div>
 </div>
@@ -1696,6 +1746,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_vixel" />
 	</div>
 </div>
@@ -1736,6 +1796,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_gnbd" />
 	</div>
 </div>
@@ -1785,6 +1855,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_egenera" />
 	</div>
 </div>
@@ -1835,6 +1915,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_bladecenter" />
 	</div>
 </div>
@@ -1893,6 +1983,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_bullpap" />
 	</div>
 </div>
@@ -1966,6 +2066,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="xvm" />
 	</div>
 </div>
@@ -1997,6 +2107,16 @@
 		</tal:block>
 
 		<input type="hidden" name="sharable" value="1" />
+		<tal:block tal:condition="exists: cur_fencedev">
+			<tal:block tal:condition="exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances"
+					tal:attributes="
+						value python: len(cur_fencedev['instance_list'])" />
+			</tal:block>
+			<tal:block tal:condition="not:exists: cur_fencedev/instance_list">
+				<input type="hidden" name="num_instances" value="1" />
+			</tal:block>
+		</tal:block>
 		<input type="hidden" name="fence_type" value="scsi" />
 	</div>
 </div>
@@ -2834,8 +2954,9 @@
 				<div id="fence_list_level1" tal:define="global cur_fence_num python: 0">
 					<tal:block tal:condition="exists: fenceinfo/level1">
 
-						<div tal:repeat="cur_fencedev fenceinfo/level1"
-							 tal:attributes="id python: 'fence1_' + str(cur_fence_num)">
+						<div class="fence_level"
+							tal:repeat="cur_fencedev fenceinfo/level1"
+							tal:attributes="id python: 'fence1_' + str(cur_fence_num)">
 
 							<tal:block tal:define="
 								cur_fence_dev_id python: 'fence1_' + str(cur_fence_num);
@@ -2844,6 +2965,11 @@
 
 								<form tal:attributes="name cur_fence_dev_id | string:[unknown]">
 									<tal:block metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+									<tal:block tal:condition="exists: cur_fencedev/instance_list">
+										<input type="hidden"
+											name="num_instances"
+											tal:attributes="value python: len(cur_fencedev['instance_list'])" />
+									</tal:block>
 								</form>
 
 								<tal:block
@@ -2855,25 +2981,27 @@
 											<tal:block
 												tal:define="global cur_fence_instance_id python: cur_fence_dev_id + '_' + str(cur_instance_num)" />
 
-											<div tal:attributes="
-												name cur_fence_instance_id | nothing;
-												id cur_fence_instance_id | nothing">
+											<div class="fence_instance"
+												tal:attributes="
+													name cur_fence_instance_id | nothing;
+													id cur_fence_instance_id | nothing">
 
 												<form
 													tal:attributes="name cur_fence_instance_id | nothing">
 													<tal:block metal:use-macro="here/form-macros/macros/fencedev-instance-cond-ladder" />
 												</form>
 												<tal:block
-													tal:define="global cur_instance_num  python:cur_instance_num + 1" />
+													tal:define="global cur_instance_num python:cur_instance_num + 1" />
 											</div>
 										</tal:block>
 									</tal:block>
 								</div>
 								<div class="hbSubmit">
-									<input type="button" name="remove_fence"
-										value="Remove this fence device" />
+									<input type="button" name="remove_fence_dev"
+										value="Remove this fence device"
+										tal:attributes="
+											onclick python: 'del_fence(\'' + cur_fence_dev_id + '\')'" />
 								</div>
-
 								<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
 							</tal:block>
 						</div>
@@ -2887,16 +3015,6 @@
 					<input type="button" value="Add a fence to this level"
 						onclick="add_node_fence_device(1)" />
 				</div>
-				<div class="hbSubmit">
-					<form name="fence1_master" method="post" action="">
-						<input type="hidden" name="fence_level" value="1" />
-						<input type="hidden" name="fence_xml" value="" />
-						<input type="hidden" name="pagetype" value="58" />
-						<input type="button"
-							value="Update fence properties"
-							onclick="validate_fence(this.form, 'fence_list_level1')" />
-					</form>
-				</div>
 			</td>
 
 			<td class="cluster node fence_main fence">
@@ -2905,8 +3023,9 @@
 				<div id="fence_list_level2" tal:define="global cur_fence_num python: 0">
 					<tal:block tal:condition="exists: fenceinfo/level2">
 
-						<div tal:repeat="cur_fencedev fenceinfo/level2"
-							 tal:attributes="id python: 'fence2_' + str(cur_fence_num)">
+						<div class="fence_level"
+							tal:repeat="cur_fencedev fenceinfo/level2"
+							tal:attributes="id python: 'fence2_' + str(cur_fence_num)">
 
 							<tal:block tal:define="
 								cur_fence_dev_id python: 'fence2_' + str(cur_fence_num);
@@ -2926,23 +3045,26 @@
 											<tal:block
 												tal:define="global cur_fence_instance_id python: cur_fence_dev_id + '_' + str(cur_instance_num)" />
 
-											<div tal:attributes="
-												name cur_fence_instance_id | nothing;
-												id cur_fence_instance_id | nothing">
+											<div class="fence_instance"
+												tal:attributes="
+													name cur_fence_instance_id | nothing;
+													id cur_fence_instance_id | nothing">
 
 												<form
 													tal:attributes="name cur_fence_instance_id | nothing">
 													<tal:block metal:use-macro="here/form-macros/macros/fencedev-instance-cond-ladder" />
 												</form>
 												<tal:block
-													tal:define="global cur_instance_num  python:cur_instance_num + 1" />
+													tal:define="global cur_instance_num python:cur_instance_num + 1" />
 											</div>
 										</tal:block>
 									</tal:block>
 								</div>
 								<div class="hbSubmit">
-									<input type="button" name="remove_fence"
-										value="Remove this fence device" />
+									<input type="button" name="remove_fence_dev"
+										value="Remove this fence device"
+										tal:attributes="
+											onclick python: 'del_fence(\'' + cur_fence_dev_id + '\')'" />
 								</div>
 								<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
 							</tal:block>
@@ -2957,13 +3079,29 @@
 					<input type="button" value="Add a fence to this level"
 						onclick="add_node_fence_device(2)" />
 				</div>
-				<div class="hbSubmit">
+			</td>
+		</tr>
+		<tr>
+			<td>
+				<div class="fence_control">
+					<form name="fence1_master" method="post" action="">
+						<input type="hidden" name="fence_level" value="1" />
+						<input type="hidden" name="fence_xml" value="" />
+						<input type="hidden" name="pagetype" value="58" />
+						<input type="button"
+							value="Update main fence properties"
+							onclick="validate_fence(this.form, 'fence_list_level1')" />
+					</form>
+				</div>
+			</td>
+			<td>
+				<div class="fence_control">
 					<form name="fence2_master" method="post" action="">
 						<input type="hidden" name="fence_level" value="2" />
 						<input type="hidden" name="fence_xml" value="" />
 						<input type="hidden" name="pagetype" value="58" />
 						<input type="button"
-							value="Update fence properties"
+							value="Update backup fence properties"
 							onclick="validate_fence(this.form, 'fence_list_level2')" />
 					</form>
 				</div>
@@ -3128,7 +3266,7 @@
 
 		<h2>Add a node to <span tal:replace="cur_cluster_name | string:this cluster" /></h2>
 		<input type="hidden" name="clusterName"
-            tal:attributes="value cur_cluster_name | string:[unknown]" />
+			tal:attributes="value cur_cluster_name | string:[unknown]" />
 
 		<input name="pagetype" type="hidden"
 			tal:attributes="value request/form/pagetype | request/pagetype | string:15" />
@@ -3440,7 +3578,7 @@
 </div>
 
 <div metal:define-macro="xenvmprocess">
-  <span tal:define="retrn python:here.processXenVM(request)"/>
+	<span tal:define="retrn python:here.processXenVM(request)"/>
 </div>
 
 
--- conga/luci/homebase/luci_homebase.css	2006/12/21 05:08:48	1.31
+++ conga/luci/homebase/luci_homebase.css	2007/01/08 21:58:33	1.32
@@ -28,6 +28,17 @@
 	width: 700px;
 }
 
+div.fence_level {
+	padding: .4045em;
+	border-bottom: 1px solid #cccccc;
+}
+
+div.fence_instance {
+	margin-left: 1em;
+	padding-left: .4045em;
+	border-left: 1px solid #cccccc;
+}
+
 div.fence,
 td.fence {
 	padding-top: .309em;
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2007/01/08 19:46:50	1.45
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2007/01/08 21:58:34	1.46
@@ -794,6 +794,7 @@
 def validateAuthenticate(self, request):
 	try:
 		request.SESSION.delete('auth_systems')
+		request.SESSION.delete('auth_status')
 	except:
 		pass
 
@@ -874,7 +875,6 @@
 	else:
 		try:
 			request.SESSION.delete('auth_systems')
-			del auth_systems
 		except:
 			pass
 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-01-10 22:53 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-01-10 22:53 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-01-10 22:53:56

Modified files:
	luci/cluster   : fence_device.js form-macros 
	luci/homebase  : luci_homebase.css 
	luci/site/luci/Extensions: cluster_adapters.py 
	                           conga_constants.py 
	                           homebase_adapters.py 

Log message:
	fixes related to bz212021

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90.2.13&r2=1.90.2.14
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.28.2.3&r2=1.28.2.4
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.16&r2=1.120.2.17
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.19.2.5&r2=1.19.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.34.2.10&r2=1.34.2.11

--- conga/luci/cluster/fence_device.js	2006/12/12 13:37:24	1.2.2.1
+++ conga/luci/cluster/fence_device.js	2007/01/10 22:53:56	1.2.2.2
@@ -1,3 +1,46 @@
+var num_fences_level = Array(0, 0)
+var num_fence_instances = new Array()
+
+function del_fence_instance(fi_div_id) {
+	delete_element_id(fi_div_id);
+}
+
+function del_fence(fence_id) {
+	delete_element_id(fence_id);
+}
+
+function add_fence_instance(fi_cont_id, fence_type) {
+	var instance_div = document.getElementById(fi_cont_id + '_instances');
+	if (!instance_div)
+		return (-1);
+
+	var fi_form = document.getElementById(fence_type + '_instance');
+	if (fi_form) {
+		var cloned_iform = fi_form.cloneNode(1);
+		var fencei_name = fi_cont_id + '_' + num_fence_instances[fi_cont_id]++;
+		cloned_iform.id = fencei_name;
+		cloned_iform.name = fencei_name;
+		cloned_iform.className = 'fence_instance';
+
+		var form_elem = document.createElement('form');
+		form_elem.name = cloned_iform.id;
+		form_elem.appendChild(cloned_iform);
+		var ielem = cloned_iform.getElementsByTagName('input');
+		for (var i = 0 ; i < ielem.length ; i++) {
+			if (ielem[i].name == 'parent_fencedev') {
+				ielem[i].value = fi_cont_id;
+			} else if (	ielem[i].type == 'button' &&
+						ielem[i].name == 'remove_fence')
+			{
+				ielem[i].setAttribute('onclick',
+					'del_fence_instance(\'' + cloned_iform.id + '\')');
+			}
+		}
+
+		instance_div.appendChild(form_elem);
+	}
+}
+
 function swap_fence_div(container_id, element_id) {
 	var container_element = document.getElementById(container_id);
 	if (!container_element) {
@@ -25,14 +68,13 @@
 
 	var fence_id = fence_opt.value;
 	var child_element = document.getElementById(fence_id);
-	if (container_element.firstChild)
-		container_element.removeChild(container_element.firstChild);
-
 	if (!child_element)
 		return (-1);
+	if (container_element.firstChild)
+		container_element.removeChild(container_element.firstChild);
 
 	var target = child_element.cloneNode(1);
-	target.id = null;
+	target.id = '';
 
 	var fence_type = fence_id;
 	if (fence_opt.className.match(/shared_fencedev/)) {
@@ -46,13 +88,66 @@
 		}	
 	}
 
+	var target_form = document.createElement('form');
+	target_form.name = container_element.id;
+	target_form.appendChild(target);
+	container_element.appendChild(target_form);
+
 	var fi_form = document.getElementById(fence_type + '_instance');
-	if (fi_form)
-		target.appendChild(fi_form.cloneNode(1));
-	container_element.appendChild(target);
-}
+	var sharable = 0;
+	if (fi_form) {
+		var idiv = document.createElement('div');
+		idiv.id = container_id + '_instances';
+		idiv.name = idiv.id;
+
+		var cloned_iform = fi_form.cloneNode(1);
+		cloned_iform.id = container_id + '_0';
+		cloned_iform.name = cloned_iform.id;
+		cloned_iform.className = 'fence_instance';
+
+		var form_elem = document.createElement('form');
+		form_elem.name = cloned_iform.id;
+		form_elem.appendChild(cloned_iform);
+		var ielem = cloned_iform.getElementsByTagName('input');
+		for (var i = 0 ; i < ielem.length ; i++) {
+			if (ielem[i].name == 'parent_fencedev') {
+				ielem[i].value = container_id;
+			} else if (	ielem[i].type == 'button'
+						&& ielem[i].name == 'remove_fence')
+			{
+				ielem[i].setAttribute('onclick',
+					'del_fence_instance(\'' + cloned_iform.id + '\')');
+			}
+		}
+		idiv.appendChild(form_elem);
+		container_element.appendChild(idiv);
+		num_fence_instances[container_id] = 1;
+		sharable++;
+	}
 
-var num_fences_level = Array(0, 0)
+	var remove_div = document.createElement('div');
+	remove_div.className = 'hbSubmit';
+
+	var remove_button = document.createElement('input');
+	remove_button.setAttribute('type', 'button');
+	remove_button.setAttribute('value', 'Remove this device');
+	remove_button.setAttribute('onclick', "del_fence('" + container_element.id + "');");
+
+	if (sharable) {
+		var add_instance_button = document.createElement('input');
+		add_instance_button.setAttribute('type', 'button');
+		add_instance_button.setAttribute('name', 'add_fence_inst');
+		add_instance_button.setAttribute('value', 'Add an instance');
+		add_instance_button.setAttribute('onclick', "add_fence_instance('" + container_element.id + "','" + fence_type + "');");
+		add_instance_button.className = 'pad_left';
+	}
+
+	var remove_form = document.createElement('form');
+	remove_form.appendChild(remove_button);
+	remove_form.appendChild(add_instance_button);
+	remove_div.appendChild(remove_form);
+	container_element.appendChild(remove_div);
+}
 
 function add_node_fence_device(fence_level) {
 	var cont_name = 'fence_list_level' + fence_level;
@@ -67,9 +162,10 @@
 	var div_elem = document.createElement('div');
 	if (!div_elem)
 		return (-1);
-	var level_num_fences = num_fences_level[fence_level];
+	var level_num_fences = num_fences_level[fence_level - 1];
 
 	div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
+	div_elem.className = 'fence_level';
 	chooser_elem = chooser_elem.cloneNode(1);
 	chooser_elem.id = null;
 	chooser_elem.className = null;
@@ -91,5 +187,44 @@
 
 	div_elem.appendChild(chooser_elem);
 	container.appendChild(div_elem);
-	num_fences_level[fence_level]++;
+	num_fences_level[fence_level - 1]++;
+}
+
+function validate_fence(master_form, container_id) {
+	var errors = new Array();
+	var div_elem = document.getElementById(container_id);
+	if (!div_elem)
+		return (-1);
+	var form_xml = '';
+
+	var form = div_elem.getElementsByTagName('form');
+	for (var i = 0 ; i < form.length ; i++) {
+		var input_elem = form[i].getElementsByTagName('input');
+		var temp = '';
+		for (var j = 0 ; j < input_elem.length ; j++) {
+			var res_type = input_elem[j].type;
+			if (res_type == 'hidden' || res_type == 'text' ||
+				res_type == 'password')
+			{
+				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
+			} else if (res_type == 'checkbox' || res_type == 'radio') {
+				if (input_elem[j].checked)
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"';
+				if (res_type == 'radio')
+					temp += ' value="' + input_elem[j].value + '"';
+				temp += ' />';
+			}
+		}
+		var select_elem = form[i].getElementsByTagName('select');
+		for (var j = 0 ; j < select_elem.length ; j++) {
+			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
+		}
+
+		form_xml += '<form id="' + form[i].getAttribute('name') + '">' + temp + '</form>';
+	}
+
+	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
+
+	if (confirm('Update this node\'s fence configuration?'))
+		master_form.submit();
 }
--- conga/luci/cluster/form-macros	2007/01/04 00:22:13	1.90.2.13
+++ conga/luci/cluster/form-macros	2007/01/10 22:53:56	1.90.2.14
@@ -1166,6 +1166,7 @@
 </div>
 
 <div metal:define-macro="shared-fence-option-list">
+	<option>Select a shared fence device</option>
 	<option name="fence_apc" value="fence_apc">APC Power Switch</option>
 	<option name="fence_wti" value="fence_wti">WTI Power Switch</option>
 	<option name="fence_brocade" value="fence_brocade">Brocade Fabric Switch</option>
@@ -1182,6 +1183,7 @@
 </div>
 
 <div metal:define-macro="fence-option-list">
+	<option>Select a fence device</option>
 	<option name="fence_apc" value="fence_apc">APC Power Switch</option>
 	<option name="fence_wti" value="fence_wti">WTI Power Switch</option>
 	<option name="fence_brocade" value="fence_brocade">Brocade Fabric Switch</option>
@@ -1202,6 +1204,31 @@
 	<option name="fence_manual" value="fence_manual">Manual Fencing</option>
 </div>
 
+<div metal:define-macro="fence-form-unknown"
+	tal:attributes="id cur_fencedev/name | nothing">
+
+	<div id="fence_unknown" class="fencedev">
+		<table>
+			<tr>
+				<td><strong class="cluster">Fence Type</strong></td>
+				<td>[unknown]</td>
+			</tr>
+			<tr>
+				<td>Name</td>
+				<td>
+					<span tal:replace="cur_fencedev/name | nothing" />
+				</td>
+			</tr>
+		</table>
+
+		<tal:block tal:condition="exists: cur_fencedev">
+			<input type="hidden" name="existing_device" value="1" />
+			<input type="hidden" name="old_name"
+				tal:attributes="value cur_fencedev/name | nothing" />
+		</tal:block>
+	</div>
+</div>
+
 <div metal:define-macro="fence-form-apc"
 	tal:attributes="id cur_fencedev/name | nothing">
 
@@ -1223,7 +1250,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/ipaddr | nothing" />
@@ -1241,7 +1268,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1249,15 +1276,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-apc" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1290,7 +1308,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fendev/ipaddr | nothing" />
@@ -1308,7 +1326,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1316,15 +1334,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-mcdata" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1357,7 +1366,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/ipaddr | nothing" />
@@ -1366,7 +1375,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1374,15 +1383,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-wti" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1427,7 +1427,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value cur_fencedev/passwd | nothing" />
 				</td>
 			</tr>
@@ -1462,7 +1462,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="value cur_fencedev/ipaddr | nothing" />
 				</td>
 			</tr>
@@ -1476,7 +1476,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value cur_fencedev/passwd | nothing" />
 				</td>
 		</table>
@@ -1524,7 +1524,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value cur_fencedev/passwd | nothing" />
 				</td>
 			</tr>
@@ -1561,7 +1561,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/ipaddr | nothing" />
@@ -1579,7 +1579,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1587,15 +1587,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1627,7 +1618,12 @@
 			</tr>
 			<tr>
 				<td>IP Address</td>
-				<td><input name="hostname" type="text"/></td>
+				<td>
+					<input name="hostname" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/hostname | nothing" />
+				</td>
 			</tr>
 			<tr>
 				<td>Login</td>
@@ -1641,7 +1637,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1649,15 +1645,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-sanbox2" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1690,7 +1677,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/ipaddr | nothing" />
@@ -1699,7 +1686,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1707,15 +1694,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1756,15 +1734,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-gnbd" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1814,15 +1783,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-egenera" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -1853,7 +1813,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="value cur_fencedev/ipaddr | nothing" />
 				</td>
 			</tr>
@@ -1867,7 +1827,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value cur_fencedev/passwd | nothing" />
 				</td>
 			</tr>
@@ -1879,6 +1839,7 @@
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
+		<input type="hidden" name="sharable" value="1" />
 		<input type="hidden" name="fence_type" value="fence_bladecenter" />
 	</div>
 </div>
@@ -1904,7 +1865,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/ipaddr | nothing" />
@@ -1922,7 +1883,7 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="
 							disabled cur_fencedev/isShared | nothing;
 							value cur_fencedev/passwd | nothing" />
@@ -1930,15 +1891,6 @@
 			</tr>
 		</table>
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -2012,15 +1964,6 @@
 			</tr>
 		</table>	
 
-		<div name="instances">
-			<tal:block tal:condition="exists: cur_fence_instances">
-				<tal:block tal:repeat="cur_instance cur_fence_instances">
-					<tal:block
-						metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
-				</tal:block>
-			</tal:block>
-		</div>
-
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
 			<input type="hidden" name="old_name"
@@ -2082,7 +2025,7 @@
 			<tr>
 				<td>IP Address</td>
 				<td>
-					<input name="ip_addr" type="text"
+					<input name="ipaddr" type="text"
 						tal:attributes="value cur_fencedev/ipaddr | nothing" />
 				</td>
 			</tr>
@@ -2104,6 +2047,14 @@
 				<td>Authentication Type</td>
 				<td><input name="auth_type" type="text" Title="Options are to leave blank for none, password, md2, or md5"/></td>
 			</tr>
+			<tr>
+				<td>Use Lanplus</td>
+				<td>
+					<input name="lanplus" type="checkbox"
+						tal:attributes="checked cur_fencedev/lanplus | nothing"
+					/>
+				</td>
+			</tr>
 		</table>
 
 		<tal:block tal:condition="exists: cur_fencedev">
@@ -2219,8 +2170,11 @@
 </tal:block>
 </div>
 
-<div metal:define-macro="fence-instance-form-apc">
-	<div id="fence_apc_instance" name="fence_apc" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-apc"
+	tal:omit-tag="exists: cur_fence_dev_id">
+
+	<div id="fence_apc_instance" name="fence_apc" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -2230,21 +2184,39 @@
 				</td>
 			</tr>
 			<tr>
-				<td>Switch</td>
+				<td>Switch (optional)</td>
 				<td>
 					<input name="switch" type="text"
 						tal:attributes="value cur_instance/switch | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-egenera">
-	<div id="fence_egenera_instance" name="fence_egenera" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-egenera"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_egenera_instance" name="fence_egenera" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>lpan</td>
@@ -2260,15 +2232,33 @@
 						tal:attributes="value cur_instance/pserver | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-wti">
-	<div id="fence_wti_instance" name="fence_wti" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-wti"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_wti_instance" name="fence_wti" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -2277,15 +2267,33 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-brocade">
-	<div id="fence_brocade_instance" name="fence_brocade" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-brocade"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_brocade_instance" name="fence_brocade" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -2294,15 +2302,33 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-vixel">
-	<div id="fence_vixel_instance" name="fence_vixel" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-vixel"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_vixel_instance" name="fence_vixel" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -2311,15 +2337,33 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-sanbox2">
-	<div id="fence_sanbox2_instance" name="fence_sanbox2" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-sanbox2"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_sanbox2_instance" name="fence_sanbox2" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -2328,15 +2372,33 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-mcdata">
-	<div id="fence_mcdata_instance" name="fence_mcdata" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-mcdata"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_mcdata_instance" name="fence_mcdata" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Port</td>
@@ -2345,15 +2407,33 @@
 						tal:attributes="value cur_instance/port | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-gndb">
-	<div id="fence_gnbd_instance" name="fence_gnbd" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-gndb"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_gnbd_instance" name="fence_gnbd" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>IP Address</td>
@@ -2362,32 +2442,68 @@
 						tal:attributes="value cur_instance/ipaddress | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-bladecenter">
-	<div id="fence_bladecenter_instance" name="fence_bladecenter" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-bladecenter"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_bladecenter_instance" name="fence_bladecenter" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Blade</td>
 				<td>
-					<input name="ipaddress" type="text"
-						tal:attributes="value cur_instance/ipaddress | nothing" />
+					<input name="blade" type="text"
+						tal:attributes="value cur_instance/blade | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-bullpap">
-	<div id="fence_bullpap_instance" name="fence_bullpap" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-bullpap"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_bullpap_instance" name="fence_bullpap" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Domain</td>
@@ -2396,15 +2512,55 @@
 						tal:attributes="value cur_instance/domain | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
+		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
+	</div>
+</div>
+
+<div metal:define-macro="fence-instance-form-scsi"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_scsi_instance" name="fence_scsi" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
+		<table>
+			<tr>
+				<td>Node name</td>
+				<td>
+					<input type="text" name="nodename" disabled="disabled"
+						tal:attributes="value request/nodename | nothing" />
+				</td>
+			</tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-xvm">
-	<div id="fence_xvm_instance" name="fence_xvm" class="fencedev_instance">
+<div metal:define-macro="fence-instance-form-xvm"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_xvm_instance" name="fence_xvm" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
 		<table>
 			<tr>
 				<td>Domain</td>
@@ -2413,10 +2569,26 @@
 						tal:attributes="value cur_instance/domain | nothing" />
 				</td>
 			</tr>
-			<input tal:condition="exists: cur_instance"
-				type="hidden" name="existing_instance" value="1" />
-			<input type="hidden" name="parent_fencedev" value="" />
+			<tr><td colspan="2">
+				<div class="hbSubmit">
+					<tal:block tal:condition="exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance"
+							tal:attributes="onclick python: 'del_fence_instance(\'' + cur_fence_instance_id + '\')'" />
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fence_instance_id">
+						<input type="button" name="remove_fence"
+							value="Remove this instance" />
+					</tal:block>
+				</div>
+			</td></tr>
 		</table>
+
+		<input type="hidden" name="fence_instance" value="1" />
+		<input tal:condition="exists: cur_instance"
+			type="hidden" name="existing_instance" value="1" />
+		<input type="hidden" name="parent_fencedev"
+			tal:attributes="value cur_fence_dev_id | nothing" />
 	</div>
 </div>
 
@@ -2440,13 +2612,82 @@
 	<tal:block
 		metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
 	<tal:block
+		metal:use-macro="here/form-macros/macros/fence-instance-form-scsi" />
+	<tal:block
 		metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
 	<tal:block
 		metal:use-macro="here/form-macros/macros/fence-instance-form-bladecenter" />
 </div>
 
+<div metal:define-macro="fencedev-instance-cond-ladder"
+	tal:condition="exists: cur_fence_type">
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_apc'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-apc" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_mcdata'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-mcdata" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_wti'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-wti" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_brocade'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_sanbox2'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-sanbox2" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_vixel'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-vixel" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_gnbd'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-gnbd" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_egenera'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-egenera" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_scsi'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-scsi" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_xvm'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
+	</tal:block>
+
+    <tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
+		<tal:block
+			metal:use-macro="here/form-macros/macros/fence-instance-form-bladecenter" />
+	</tal:block>
+</div>
+
 <div metal:define-macro="node-form">
 	<script type="text/javascript"
+		src="/luci/homebase/homebase_common.js">
+	</script>
+	<script type="text/javascript"
 		src="/luci/cluster/fence_device.js">
 	</script>
 	<script type="text/javascript">
@@ -2647,13 +2888,6 @@
 	</div>
 
 	<table id="fence_devices" class="cluster node fence">
-		<tfoot class="fence">
-			<tr class="cluster node fence"><td class="cluster node fence">
-				<input type="button" value="Update fence properties"
-					onClick="validate_fence_properties('fence_devices')" />
-			</td></tr>
-		</tfoot>
-
 		<tbody class="fence">
 		<tr class="cluster node info_top fence">
 			<td class="cluster node fence">
@@ -2661,6 +2895,7 @@
 					<strong class="cluster node">Main Fencing Method</strong>
 				</span>
 			</td>
+
 			<td class="cluster node fence_backup">
 				<span class="fence">
 					<strong class="cluster node">Backup Fencing Method</strong>
@@ -2671,46 +2906,132 @@
 		<tr class="cluster node info_top fence">
 			<td class="cluster node fence_main fence">
 				<div class="fence_container">
+
 				<div id="fence_list_level1" tal:define="global cur_fence_num python: 0">
 					<tal:block tal:condition="exists: fenceinfo/level1">
-						<tal:block tal:repeat="cur_fencedev fenceinfo/level1">
+
+						<div class="fence_level"
+							tal:repeat="cur_fencedev fenceinfo/level1"
+							tal:attributes="id python: 'fence1_' + str(cur_fence_num)">
+
 							<tal:block tal:define="
-								cur_fence_instances cur_fencedev/instance_list | nothing;
+								cur_fence_dev_id python: 'fence1_' + str(cur_fence_num);
 								cur_fence_type cur_fencedev/agent | nothing;
-								cur_fence_level python: 1;">
-								<div tal:attributes="id python: 'fence1_' + str(cur_fence_num)">
-									<tal:block
-										metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+								cur_fence_level python: 1">
+
+								<form tal:attributes="name cur_fence_dev_id | string:[unknown]">
+									<tal:block metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+								</form>
+
+								<tal:block
+									tal:define="global cur_instance_num python:0" />
+
+								<div tal:attributes="id python: cur_fence_dev_id + '_instances'">
+									<tal:block tal:condition="exists: cur_fencedev/instance_list">
+										<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>num_fence_instances[\'' + cur_fence_dev_id + '\'] = ' + str(len(cur_fencedev['instance_list'])) + ';</script>'" />
+										<tal:block tal:repeat="cur_instance cur_fencedev/instance_list">
+											<tal:block
+												tal:define="global cur_fence_instance_id python: cur_fence_dev_id + '_' + str(cur_instance_num)" />
+
+											<div class="fence_instance"
+												tal:attributes="
+													name cur_fence_instance_id | nothing;
+													id cur_fence_instance_id | nothing">
+
+												<form
+													tal:attributes="name cur_fence_instance_id | nothing">
+													<tal:block metal:use-macro="here/form-macros/macros/fencedev-instance-cond-ladder" />
+												</form>
+												<tal:block
+													tal:define="global cur_instance_num python:cur_instance_num + 1" />
+											</div>
+										</tal:block>
+									</tal:block>
 								</div>
+								<div class="hbSubmit">
+									<input type="button" name="remove_fence_dev"
+										value="Remove this device"
+										tal:attributes="
+											onclick python: 'del_fence(\'' + cur_fence_dev_id + '\')'" />
+									<input tal:condition="exists: cur_fencedev/isShared"
+										name="add_instance" type="button"
+										value="Add an instance"
+										tal:attributes="onclick python: 'add_fence_instance(\'' + cur_fence_dev_id + '\',\'' + cur_fence_type + '\')'" />
+								</div>
+								<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
 							</tal:block>
-							<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
-						</tal:block>
+						</div>
 					</tal:block>
+
 					<tal:block
 						tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>num_fences_level[0] = ' + str(cur_fence_num) + ';</script>'" />
 				</div>
 
 				<div class="fence_control">
 					<input type="button" value="Add a fence to this level"
-						onclick="add_node_fence_device(1);" />
-				</div>
+						onclick="add_node_fence_device(1)" />
 				</div>
 			</td>
 
 			<td class="cluster node fence_main fence">
 				<div class="fence_container">
+
 				<div id="fence_list_level2" tal:define="global cur_fence_num python: 0">
 					<tal:block tal:condition="exists: fenceinfo/level2">
-						<tal:block tal:repeat="cur_fencedev fenceinfo/level2">
-							<tal:block tal:define="cur_fence_type cur_fencedev/agent | nothing">
-								<div tal:attributes="id python: 'fence2_' + str(cur_fence_num)">
-									<tal:block
-										metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+
+						<div class="fence_level"
+							tal:repeat="cur_fencedev fenceinfo/level2"
+							tal:attributes="id python: 'fence2_' + str(cur_fence_num)">
+
+							<tal:block tal:define="
+								cur_fence_dev_id python: 'fence2_' + str(cur_fence_num);
+								cur_fence_type cur_fencedev/agent | nothing;
+								cur_fence_level python: 2">
+
+								<form tal:attributes="name cur_fence_dev_id | string:[unknown]">
+									<tal:block metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+								</form>
+
+								<tal:block
+									tal:define="global cur_instance_num python:0" />
+
+								<div tal:attributes="id python: cur_fence_dev_id + '_instances'">
+									<tal:block tal:condition="exists: cur_fencedev/instance_list">
+										<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>num_fence_instances[\'' + cur_fence_dev_id + '\'] = ' + str(len(cur_fencedev['instance_list'])) + ';</script>'" />
+										<tal:block tal:repeat="cur_instance cur_fencedev/instance_list">
+											<tal:block
+												tal:define="global cur_fence_instance_id python: cur_fence_dev_id + '_' + str(cur_instance_num)" />
+
+											<div class="fence_instance"
+												tal:attributes="
+													name cur_fence_instance_id | nothing;
+													id cur_fence_instance_id | nothing">
+
+												<form
+													tal:attributes="name cur_fence_instance_id | nothing">
+													<tal:block metal:use-macro="here/form-macros/macros/fencedev-instance-cond-ladder" />
+												</form>
+												<tal:block
+													tal:define="global cur_instance_num python:cur_instance_num + 1" />
+											</div>
+										</tal:block>
+									</tal:block>
+								</div>
+								<div class="hbSubmit">
+									<input type="button" name="remove_fence_dev"
+										value="Remove this device"
+										tal:attributes="
+											onclick python: 'del_fence(\'' + cur_fence_dev_id + '\')'" />
+									<input tal:condition="exists: cur_fencedev/isShared"
+										name="add_instance" type="button"
+										value="Add an instance"
+										tal:attributes="onclick python: 'add_fence_instance(\'' + cur_fence_dev_id + '\',\'' + cur_fence_type + '\')'" />
 								</div>
+								<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
 							</tal:block>
-							<tal:block tal:define="global cur_fence_num python: cur_fence_num + 1" />
-						</tal:block>
+						</div>
 					</tal:block>
+
 					<tal:block
 						tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>num_fences_level[1] = ' + str(cur_fence_num) + ';</script>'" />
 				</div>
@@ -2719,12 +3040,46 @@
 					<input type="button" value="Add a fence to this level"
 						onclick="add_node_fence_device(2)" />
 				</div>
+			</td>
+		</tr>
+		<tr>
+			<td>
+				<div class="fence_control">
+					<form name="fence1_master" method="post" action="">
+						<input type="hidden" name="clustername"
+							tal:attributes="value request/clustername | nothing" />
+						<input type="hidden" name="nodename"
+							tal:attributes="value request/nodename | nothing" />
+						<input type="hidden" name="fence_level" value="1" />
+						<input type="hidden" name="fence_xml" value="" />
+						<input type="hidden" name="pagetype" value="58" />
+						<input type="button"
+							value="Update main fence properties"
+							onclick="validate_fence(this.form, 'fence_list_level1')" />
+					</form>
+				</div>
+			</td>
+			<td>
+				<div class="fence_control">
+					<form name="fence2_master" method="post" action="">
+						<input type="hidden" name="clustername"
+							tal:attributes="value request/clustername | nothing" />
+						<input type="hidden" name="nodename"
+							tal:attributes="value request/nodename | nothing" />
+						<input type="hidden" name="fence_level" value="2" />
+						<input type="hidden" name="fence_xml" value="" />
+						<input type="hidden" name="pagetype" value="58" />
+						<input type="button"
+							value="Update backup fence properties"
+							onclick="validate_fence(this.form, 'fence_list_level2')" />
+					</form>
 				</div>
 			</td>
 		</tr>
 		</tbody>
 	</table>
 	</tal:block>
+
 	<tal:block tal:condition="python: 'ricci_error' in nodeinfo">
 		<hr/>
 		<strong class="errmsgs">
@@ -2880,7 +3235,7 @@
 
 		<h2>Add a node to <span tal:replace="cur_cluster_name | string:this cluster" /></h2>
 		<input type="hidden" name="clusterName"
-            tal:attributes="value cur_cluster_name | string:[unknown]" />
+			tal:attributes="value cur_cluster_name | string:[unknown]" />
 
 		<input name="pagetype" type="hidden"
 			tal:attributes="value request/form/pagetype | request/pagetype | string:15" />
@@ -3192,7 +3547,7 @@
 </div>
 
 <div metal:define-macro="xenvmprocess">
-  <span tal:define="retrn python:here.processXenVM(request)"/>
+	<span tal:define="retrn python:here.processXenVM(request)"/>
 </div>
 
 
@@ -3707,19 +4062,24 @@
 		<tr class="cluster node info_top fence">
 			<td class="cluster node fence_main fence">
 				<form name="main_fence_form">
-				<select name="select_div"
-					onChange="swap_fence_div('fence_container',
-								this.options[this.selectedIndex].value)">
-					<tal:block metal:use-macro="here/form-macros/macros/shared-fence-option-list" />
-				</select>
+					<select name="select_div"
+						onChange="swap_fence_div('fence_container',
+									this.options[this.selectedIndex].value)">
+						<tal:block metal:use-macro="here/form-macros/macros/shared-fence-option-list" />
+					</select>
+				</form>
+
+				<form name="fencedevaddform" action="" method="post">
+					<div id="fence_container">
+					</div>
+					<div class="hbSubmit">
+						<input type="submit"
+							value="Add this shared fence device" />
+						<input type="hidden" name="pagetype"
+							value="51" id="pagetype" />
+						<input type="hidden" name="clustername" id="pagetype"
+							tal:attributes="value request/clustername" />
 				</form>
-        <form name="fencedevaddform" action="" method="post">
-				<div id="fence_container">
-				</div>
-			  <input type="submit" value="Add this shared fence device"/>
-        <input type="hidden" name="pagetype" value="51" id="pagetype" />
-        <input type="hidden" name="clustername" value="" id="pagetype" tal:attributes="value request/clustername"/>
-        </form>
 			</td>
 		</tr>
 		</tbody>
@@ -3740,7 +4100,7 @@
 
 	<tal:block tal:define="fencedevs python: here.getFenceInfo(modelb, None)">
 
-	<tal:block tal:condition="fencedevs/fencedevs">
+	<tal:block tal:condition="exists: fencedevs/fencedevs">
 		<table class="systemsTable">
 	        <thead class="systemsTable">
 				<tr class="systemsTable">
@@ -3837,40 +4197,57 @@
 	<tal:block tal:condition="python: cur_fence_type == 'fence_manual'">
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-manual" />
 	</tal:block>
+
+    <tal:block tal:condition="exists:cur_fencedev/unknown">
+		<tal:block metal:use-macro="here/form-macros/macros/fence-form-unknown" />
+	</tal:block>
 </div>
 
 
 <div metal:define-macro="fencedev-form">
 	<h2>Fence Device Form</h2>
 
-	<div class="cluster fencedev">
+	<div class="cluster fencedev fence">
 		<tal:block tal:define="
 			global cur_fencename request/fencename | nothing;
 			global cur_cluster request/clustername | nothing;
-			global cur_fence_type python: 'fence_apc'"/>
+			global cur_fence_type nothing" />
 
-		<span tal:condition="cur_fencename">
-			<span tal:define="
+		<tal:block tal:condition="cur_fencename">
+			<tal:block tal:define="
 					global cur_fencedev python:here.getFence(modelb,request);
-					global cur_fence_type cur_fencedev/agent" />
-		</span>
+					global cur_fence_type cur_fencedev/agent | nothing" />
+		</tal:block>
 
-  <form name="fencedeveditform" action="" method="post">	
-		<tal:block
-			metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
-    <input type="submit" value="Update this fence device"/>
-    <input type="hidden" name="pagetype" value="54" id="pagetype" />
-    <input type="hidden" name="clustername" value="" id="pagetype" tal:attributes="value request/clustername"/>
-    <input type="hidden" name="orig_name" value="" id="orig_name" tal:attributes="value request/fencename"/>
-  <input type="hidden" name="fencename" value="" id="fencename" tal:attributes="value request/fencename"/>
-  </form>
-  <form name="fencedevdeleteform" action="" method="post">
-  <input type="submit" value="Delete this fence device"/>
-  <input type="hidden" name="pagetype" value="57" id="pagetype"/>
-  <input type="hidden" name="clustername" value="" id="pagetype" tal:attributes="value request/clustername"/>
-  <input type="hidden" name="fencename" value="" id="fencename" tal:attributes="value request/fencename"/>
-    <input type="hidden" name="orig_name" value="" id="orig_name" tal:attributes="value request/fencename"/>
-  </form>
+		<form name="fencedeveditform" action="" method="post">	
+			<tal:block
+				metal:use-macro="here/form-macros/macros/fencedev-cond-ladder" />
+
+			<input type="hidden" name="pagetype" value="54" />
+			<input type="hidden" name="clustername"
+				tal:attributes="value request/clustername" />
+			<input type="hidden" name="orig_name"
+				tal:attributes="value request/fencename"/>
+  			<input type="hidden" name="fencename"
+				tal:attributes="value request/fencename" />
+
+			<div class="hbSubmit">
+				<input type="submit" value="Update this fence device" />
+			</div>
+		</form>
+
+		<form name="fencedevdeleteform" action="" method="post">
+			<input type="hidden" name="pagetype" value="57" />
+			<input type="hidden" name="clustername"
+				tal:attributes="value request/clustername" />
+			<input type="hidden" name="fencename"
+				tal:attributes="value request/fencename" />
+			<input type="hidden" name="orig_name"
+				tal:attributes="value request/fencename" />
+			<div class="hbSubmit">
+				<input type="submit" value="Delete this fence device" />
+			</div>
+		</form>
 	</div>
 </div>
 
--- conga/luci/homebase/luci_homebase.css	2006/12/22 17:50:16	1.28.2.3
+++ conga/luci/homebase/luci_homebase.css	2007/01/10 22:53:56	1.28.2.4
@@ -14,6 +14,10 @@
 	background: #dee7ec;
 }
 
+input.pad_left {
+	margin-left: +.3333em;
+}
+
 div.fence {
 	max-width: 700px;
 	padding: .5em;
@@ -28,6 +32,17 @@
 	width: 700px;
 }
 
+div.fence_level {
+	padding: .4045em;
+	border-bottom: 1px solid #cccccc;
+}
+
+div.fence_instance {
+	margin-left: 1em;
+	padding-left: .4045em;
+	border-left: 1px solid #cccccc;
+}
+
 div.fence,
 td.fence {
 	padding-top: .309em;
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/02 20:21:26	1.120.2.16
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/10 22:53:56	1.120.2.17
@@ -23,6 +23,10 @@
 from QuorumD import QuorumD
 from Heuristic import Heuristic
 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
 from GeneralError import GeneralError
 from homebase_adapters import manageCluster, createClusterSystems, havePermCreateCluster, setNodeFlag, delNodeFlag, userAuthenticated, getStorageNode, getClusterNode, delCluster, parseHostForm
@@ -1433,6 +1437,327 @@
     errors.append(error_string)
     return (False, {'errors': errors, 'messages': messages})
 
+def validateNodeFenceConfig(self, request):
+	try:
+		form_xml = request['fence_xml']
+		if not form_xml:
+			raise KeyError, 'form_xml must not be blank'
+	except Exception, e:
+		luci_log.debug_verbose('vNFC0: no form_xml: %s' % str(e))
+		return (False, {'errors': ['No fence data was supplied.']})
+
+	try:
+		fence_level = int(request.form['fence_level'].strip())
+	except Exception, e:
+		luci_log.debug_verbose('vNFC1: no fence level: %s' % str(e))
+		return (False, {'errors': ['No fence level was supplied.']})
+
+	try:
+		nodename = request['nodename']
+		if not nodename:
+			raise Exception, 'nodename is blank'
+	except Exception, e:
+		luci_log.debug_verbose('vNFC2: no nodename: %s' % str(e))
+		return (False, {'errors': ['No node name was given.']})
+
+	try:
+		clustername = request['clustername']
+		if not clustername:
+			raise Exception, 'clustername is blank'
+	except Exception, e:
+		luci_log.debug_verbose('vNFC3: no clustername: %s' % str(e))
+		return (False, {'errors': ['No cluster name was given.']})
+
+	try:
+		model = request.SESSION.get('model')
+		if not model:
+			raise Exception, 'model is none'
+	except Exception, e:
+		model = None
+		try:
+			model = getModelForCluster(self, clustername)
+		except:
+			model = None
+
+	if model is None:
+		luci_log.debug_verbose('vNFC4: unable to get model for cluster %s' % clustername)
+		return (False, {'errors': ['No cluster model was found.']})
+
+	try:
+		doc = minidom.parseString(form_xml)
+	except Exception, e:
+		luci_log.debug_verbose('vNFC5: error: %s' % str(e))
+		return (False, {'errors': ['The fence data submitted is not properly formed.']})
+
+	try:
+		node = model.retrieveNodeByName(nodename)
+	except GeneralError, e:
+		luci_log.debug_verbose('vNFC6: unable to find node name %s in current node list' % (str(nodename), str(e)))
+		return (False, {'errors': ['Unable to find the cluster node %s in the node list.' % str(nodename) ]})
+
+	fence_level_num = int(fence_level)
+	levels = node.getFenceLevels()
+	try:
+		method_id = levels[fence_level_num - 1].getAttribute('name')
+		if not method_id:
+			raise Exception, 'No method ID'
+		fence_method = Method()
+		fence_method.addAttribute('name', str(method_id))
+		levels[fence_level_num - 1] = fence_method
+	except Exception, e:
+		method_id = fence_level
+		fence_method = Method()
+		fence_method.addAttribute('name', str(method_id))
+
+	forms = doc.getElementsByTagName('form')
+	if len(forms) < 1:
+		delete_target = None
+		for l in levels:
+			# delete the fence level
+			if l.getAttribute('name') == method_id:
+				delete_target = l
+				break
+		if delete_target is not None:
+			try:
+				node.getChildren()[0].removeChild(l)
+			except Exception, e:
+				luci_log.debug_verbose('vNFC6a: %s: %s' % (method_id, str(e)))
+				return (False, {'errors': ['An error occurred while deleting fence method %s' % method_id ]}) 
+		else:
+			return (True, {'messages': ['No changes were made.'] })
+
+	form_hash = {}
+	for i in forms:
+		form_id = i.getAttribute('id')
+		if not form_id:
+			continue
+		ielems = i.getElementsByTagName('input')
+		if not ielems or len(ielems) < 1:
+			continue
+
+		dummy_form = {}
+
+		for i in ielems:
+			try:
+				input_type = str(i.getAttribute('type'))
+			except Exception, e:
+				luci_log.debug_verbose('vNFC7: input type: %s' % str(e))
+				continue
+
+			if not input_type or input_type == 'button':
+				continue
+
+			try:
+				dummy_form[str(i.getAttribute('name'))] = str(i.getAttribute('value'))
+			except Exception, e:
+				luci_log.debug_verbose('vNFC8: parsing XML: %s' % str(e))
+
+		if len(dummy_form) < 1:
+			continue
+
+		if 'fence_instance' in dummy_form:
+			try:
+				parent = dummy_form['parent_fencedev']
+			except:
+				luci_log.debug_verbose('vNFC9: no parent for instance')
+				return (False, {'errors': [ 'Unable to determine what device the current instance uses.' ]})
+
+			try:
+				parent_form = form_hash[parent][1].append(dummy_form)
+				del dummy_form['fence_instance']
+			except Exception, e:
+				luci_log.debug_verbose('vNFC10: no parent for instance')
+				return (False, {'errors': [ 'Unable to determine what device the current instance uses.' ]})
+		else:
+			form_hash[form_id] = (dummy_form, list())
+
+	fh_keys = form_hash.keys()
+	fh_keys.sort()
+	for i in fh_keys:
+		fencedev_name = None
+		fencedev_unknown = False
+		fencedev_obj = None
+
+		try:
+			fence_form, instance_list = form_hash[i]
+		except Exception, e:
+			luci_log.debug_verbose('vNFC11: %s' % str(e))
+			continue
+
+		try:
+			fence_type = fence_form['fence_type']
+			if not fence_type:
+				raise Exception, 'fence type is blank'
+			fence_form['agent'] = fence_type
+		except Exception, e:
+			luci_log.debug_verbose('vNFC12: %s %s' % (i, str(e)))
+			fence_type = None
+
+		try:
+			del fence_form['fence_type']
+		except:
+			pass
+
+		if 'existing_device' in fence_form:
+			del fence_form['existing_device']
+			fencedev_name = fence_form['name']
+
+			if fence_type is None:
+				# An unknown device. Pull the data out of
+				# the model and persist it and all instances.
+				# All we care about is its name.
+				fencedev_unknown = True
+			else:
+				if 'sharable' in fence_form:
+					# If it's a shared fence device that already exists, the
+					# user could not have edited it (without playing dirty
+					# games), so it's safe to pull the existing entry from
+					# the model. All we need is the device name.
+					pass
+				else:
+					# An existing non-shared device; build up the device
+					# from scratch since the user could have edited it.
+					try:
+						old_name = fence_form['old_name']
+						if not old_name:
+							raise Exception, 'old name is blank'
+						del fence_form['old_name']
+					except Exception, e:
+						luci_log.debug_verbose('vNFC12: no old name for %s %s' \
+							% (fence_form['name'], str(e)))
+						return (False, {'errors': [ 'Unable to determine the original name for the device now named %s' % fencedev_name ]})
+
+					fencedev_obj = None
+					fence_dev_list = model.getFenceDevices()
+					for fd in fence_dev_list:
+						if fd.getAttribute('name') == old_name:
+							fencedev_obj = fd
+							break
+
+					if fencedev_obj is None:
+						luci_log.debug_verbose('vNFC14: no fence device named %s was found' % old_name)
+						return (False, {'errors': ['No fence device named %s was found' % old_name ] })
+					else:
+						try:
+							model.fencedevices_ptr.removeChild(fd)
+						except Exception, e:
+							luci_log.debug_verbose('VNFC8a: %s: %s' \
+								% (old_name, str(e)))
+							return (False, {'errors': [ 'Unable to remove old fence device %s' % old_name ]})
+
+					for k in fence_form.keys():
+						if fence_form[k]:
+							fencedev_obj.addAttribute(k, str(fence_form[k]))
+
+					# Add back the tags under the method block
+					# for the fence instance
+					instance_list.append({'name': fencedev_name })
+		else:
+			# The user created a new fence device.
+			fencedev_name = fence_form['name']
+			fencedev_obj = FenceDevice()
+			for k in fence_form.keys():
+				if fence_form[k]:
+					fencedev_obj.addAttribute(k, str(fence_form[k]))
+
+			# If it's not shared, we need to create an instance form
+			# so the appropriate XML goes into the <method> block inside
+			# <node><fence>. All we need for that is the device name.
+			if not 'sharable' in fence_form:
+				instance_list.append({'name': fencedev_name })
+
+		if fencedev_obj is not None:
+			# If a device with this name exists in the model
+			# already, replace it with the current object. If
+			# this block is not executed, we don't need to make
+			# any changes to the fencedevices block for this
+			# device
+			fence_dev_list = model.getFenceDevices()
+			for fd in fence_dev_list:
+				if fencedev_name == fd.getAttribute('name'):
+					luci_log.debug_verbose('vNFC15: fence ident %s already in use' % fencedev_name)
+					return (False, {'errors': ['There is already a fence device named %s' % fencedev_name ] })
+			model.fencedevices_ptr.addChild(fencedev_obj)
+
+		if fencedev_unknown is True:
+			# Save any instances for this fence device.
+			pass
+
+		for inst in instance_list:
+			try:
+				del inst['parent_fencedev']
+			except:
+				pass
+			try:
+				del inst['new_instance']
+			except:
+				pass
+			try:
+				del inst['name']
+			except:
+				pass
+			try:
+				del inst['existing_instance']
+			except:
+				pass
+
+			device_obj = Device()
+			device_obj.setAgentType(fence_type)
+			device_obj.addAttribute('name', fencedev_name)
+			for k in inst.keys():
+				if inst[k]:
+					device_obj.addAttribute(k, str(inst[k]))
+			fence_method.addChild(device_obj)
+
+		if len(node.getChildren()) > 0:
+			# There's already a <fence> block
+			found_target = False
+			for idx in xrange(len(levels)):
+				if levels[idx].getAttribute('name') == method_id:
+					found_target = True
+					break
+
+			if found_target is False:
+				# There's a fence block, but no relevant method
+				# block
+				node.getChildren()[0].addChild(fence_method)
+		else:
+			# There is no <fence> tag under the node yet.
+			fence_node = Fence()
+			fence_node.addChild(fence_method)
+			node.addChild(fence_node)
+
+	try:
+		cp = model.getClusterPtr()
+		cp.incrementConfigVersion()
+		model.setModified(True)
+		conf = str(model.exportModelAsString())
+		if not conf:
+			raise Exception, 'model string is blank'
+		luci_log.debug_verbose('vNFC16: exported \"%s\"' % conf)
+	except Exception, e:
+		luci_log.debug_verbose('vNFC17: exportModelAsString failed: %s' \
+			% str(e))
+		return (False, {'errors': [ 'An error occurred while constructing the new cluster configuration.' ]})
+
+	rc = getRicciAgent(self, clustername)
+	if not rc:
+		luci_log.debug_verbose('vNFC18: unable to find a ricci agent for cluster %s' % clustername)
+		return (False, {'errors': ['Unable to find a ricci agent for the %s cluster' % clustername ]})
+	ragent = rc.hostname()
+
+	batch_number, result = setClusterConf(rc, conf)
+	if batch_number is None or result is None:
+		luci_log.debug_verbose('vNFC19: missing batch and/or result')
+		return (False, {'errors': [ 'An error occurred while constructing the new cluster configuration.' ]})
+
+	try:
+		set_node_flag(self, clustername, ragent, str(batch_number), FENCEDEV_NODE_CONFIG, "Updating fence configuration for node \'%s\'" % nodename)
+	except Exception, e:
+		luci_log.debug_verbose('vNFC20: failed to set flags: %s' % str(e))
+
+	response = request.RESPONSE
+	response.redirect(request['URL'] + "?pagetype=" + NODE + "&clustername=" + clustername + '&nodename=' + nodename + '&busyfirst=true')
 
 def deleteFenceDevice(self, request):
   errors = list()
@@ -1654,7 +1979,8 @@
 	51: validateFenceAdd,
 	50: validateFenceEdit,
 	55: validateDaemonProperties,
-  57: deleteFenceDevice
+	57: deleteFenceDevice,
+	58: validateNodeFenceConfig
 }
 
 def validatePost(self, request):
@@ -3922,6 +4248,7 @@
       try:
         map['pretty_name'] = FENCE_OPTS[fencedev.getAgentType()]
       except:
+        map['unknown'] = True
         map['pretty_name'] = fencedev.getAgentType()
 
       nodes_used = list()
@@ -4036,7 +4363,11 @@
       if fd is not None:
         if fd.isShared() == False:  #Not a shared dev...build struct and add
           fencedev = {}
-          fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+          try:
+            fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+          except:
+            fencedev['unknown'] = True
+            fencedev['prettyname'] = fd.getAgentType()
           fencedev['isShared'] = False
           fencedev['id'] = str(major_num)
           major_num = major_num + 1
@@ -4073,7 +4404,11 @@
             continue
           else: #Shared, but not used above...so we need a new fencedev struct
             fencedev = {}
-            fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+            try:
+              fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+            except:
+              fencedev['unknown'] = True
+              fencedev['prettyname'] = fd.getAgentType()
             fencedev['isShared'] = True
             fencedev['cfgurl'] = baseurl + "?clustername=" + clustername + "&fencename=" + fd.getName().strip() + "&pagetype=" + FENCEDEV 
             fencedev['id'] = str(major_num)
@@ -4111,7 +4446,11 @@
         shared_struct['name'] = fd.getName().strip()
         agentname = fd.getAgentType()
         shared_struct['agent'] = agentname
-        shared_struct['prettyname'] = FENCE_OPTS[agentname]
+        try:
+          shared_struct['prettyname'] = FENCE_OPTS[agentname]
+        except:
+          shared_struct['unknown'] = True
+          shared_struct['prettyname'] = agentname
         shared1.append(shared_struct)
     map['shared1'] = shared1
 
@@ -4131,7 +4470,11 @@
       if fd is not None:
         if fd.isShared() == False:  #Not a shared dev...build struct and add
           fencedev = {}
-          fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+          try:
+            fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+          except:
+            fencedev['unknown'] = True
+            fencedev['prettyname'] = fd.getAgentType()
           fencedev['isShared'] = False
           fencedev['id'] = str(major_num)
           major_num = major_num + 1
@@ -4168,7 +4511,11 @@
             continue
           else: #Shared, but not used above...so we need a new fencedev struct
             fencedev = {}
-            fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+            try:
+              fencedev['prettyname'] = FENCE_OPTS[fd.getAgentType()]
+            except:
+              fencedev['unknown'] = True
+              fencedev['prettyname'] = fd.getAgentType()
             fencedev['isShared'] = True
             fencedev['cfgurl'] = baseurl + "?clustername=" + clustername + "&fencename=" + fd.getName().strip() + "&pagetype=" + FENCEDEV 
             fencedev['id'] = str(major_num)
@@ -4206,7 +4553,11 @@
         shared_struct['name'] = fd.getName().strip()
         agentname = fd.getAgentType()
         shared_struct['agent'] = agentname
-        shared_struct['prettyname'] = FENCE_OPTS[agentname]
+        try:
+          shared_struct['prettyname'] = FENCE_OPTS[agentname]
+        except:
+          shared_struct['unknown'] = True
+          shared_struct['prettyname'] = agentname
         shared2.append(shared_struct)
     map['shared2'] = shared2
 
@@ -4237,6 +4588,7 @@
       try:
         fencedev['pretty_name'] = FENCE_OPTS[fd.getAgentType()]
       except:
+        fencedev['unknown'] = True
         fencedev['pretty_name'] = fd.getAgentType()
       fencedev['agent'] = fd.getAgentType()
       #Add config url for this fencedev
--- conga/luci/site/luci/Extensions/conga_constants.py	2007/01/08 15:29:09	1.19.2.5
+++ conga/luci/site/luci/Extensions/conga_constants.py	2007/01/10 22:53:56	1.19.2.6
@@ -45,6 +45,7 @@
 CLUSTER_DAEMON="55"
 SERVICE_DELETE = '56'
 FENCEDEV_DELETE = "57"
+FENCEDEV_NODE_CONFIG = '58'
 
 CONF_EDITOR = '80'
 
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2007/01/08 19:49:20	1.34.2.10
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2007/01/10 22:53:56	1.34.2.11
@@ -794,6 +794,7 @@
 def validateAuthenticate(self, request):
 	try:
 		request.SESSION.delete('auth_systems')
+		request.SESSION.delete('auth_status')
 	except:
 		pass
 
@@ -874,7 +875,6 @@
 	else:
 		try:
 			request.SESSION.delete('auth_systems')
-			del auth_systems
 		except:
 			pass
 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-01-10 23:47 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-01-10 23:47 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-10 23:47:11

Modified files:
	luci/cluster   : fence_device.js form-macros 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	small node fence cleanups

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.150&r2=1.151
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.200&r2=1.201

--- conga/luci/cluster/fence_device.js	2007/01/10 20:02:16	1.8
+++ conga/luci/cluster/fence_device.js	2007/01/10 23:47:11	1.9
@@ -208,13 +208,19 @@
 			{
 				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
 			} else if (res_type == 'checkbox' || res_type == 'radio') {
-				if (input_elem[j].checked)
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"';
-				if (res_type == 'radio')
-					temp += ' value="' + input_elem[j].value + '"';
-				temp += ' />';
+				if (input_elem[j].checked) {
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '"';
+					if (res_type == 'checkbox')
+						temp += ' value="1"';
+					else if (res_type == 'radio')
+						temp += ' value="' + input_elem[j].value + '"';
+					temp += ' />';
+				} else if (res_type == 'checkbox') {
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="0" />';
+				}
 			}
 		}
+
 		var select_elem = form[i].getElementsByTagName('select');
 		for (var j = 0 ; j < select_elem.length ; j++) {
 			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
--- conga/luci/cluster/form-macros	2007/01/10 21:40:05	1.150
+++ conga/luci/cluster/form-macros	2007/01/10 23:47:11	1.151
@@ -2039,20 +2039,28 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value cur_fencedev/passwd | nothing" />
 				</td>
 			</tr>
 			<tr>
 				<td>Authentication Type</td>
-				<td><input name="auth_type" type="text" Title="Options are to leave blank for none, password, md2, or md5"/></td>
+				<td>
+					<input name="auth_type" type="text" title="Options are to leave blank for none, password, md2, or md5"
+						tal:attributes="value cur_fencedev/auth_type | nothing" />
+				</td>
 			</tr>
 			<tr>
 				<td>Use Lanplus</td>
 				<td>
-					<input name="lanplus" type="checkbox"
-						tal:attributes="checked cur_fencedev/lanplus | nothing"
-					/>
+					<tal:block tal:condition="exists: cur_fencedev">
+						<input name="lanplus" type="checkbox"
+							tal:attributes="checked python: ('lanplus' in cur_fencedev and cur_fencedev['lanplus'] == '1') and 'checked' or ''"
+						/>
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fencedev">
+						<input name="lanplus" type="checkbox" />
+					</tal:block>
 				</td>
 			</tr>
 		</table>
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/10 23:33:27	1.200
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/10 23:47:11	1.201
@@ -1613,7 +1613,7 @@
 					# user could not have edited it (without playing dirty
 					# games), so it's safe to pull the existing entry from
 					# the model. All we need is the device name.
-					pass
+					del fence_form['sharable']
 				else:
 					# An existing non-shared device; build up the device
 					# from scratch since the user could have edited it.
@@ -1665,6 +1665,8 @@
 			# <node><fence>. All we need for that is the device name.
 			if not 'sharable' in fence_form:
 				instance_list.append({'name': fencedev_name })
+			else:
+				del fence_form['sharable']
 
 		if fencedev_obj is not None:
 			# If a device with this name exists in the model



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-01-10 23:49 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-01-10 23:49 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-01-10 23:49:19

Modified files:
	luci/cluster   : fence_device.js form-macros 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	fixes related to bz212021

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90.2.14&r2=1.90.2.15
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.17&r2=1.120.2.18

--- conga/luci/cluster/fence_device.js	2007/01/10 22:53:56	1.2.2.2
+++ conga/luci/cluster/fence_device.js	2007/01/10 23:49:18	1.2.2.3
@@ -208,13 +208,19 @@
 			{
 				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
 			} else if (res_type == 'checkbox' || res_type == 'radio') {
-				if (input_elem[j].checked)
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"';
-				if (res_type == 'radio')
-					temp += ' value="' + input_elem[j].value + '"';
-				temp += ' />';
+				if (input_elem[j].checked) {
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '"';
+					if (res_type == 'checkbox')
+						temp += ' value="1"';
+					else if (res_type == 'radio')
+						temp += ' value="' + input_elem[j].value + '"';
+					temp += ' />';
+				} else if (res_type == 'checkbox') {
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="0" />';
+				}
 			}
 		}
+
 		var select_elem = form[i].getElementsByTagName('select');
 		for (var j = 0 ; j < select_elem.length ; j++) {
 			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
--- conga/luci/cluster/form-macros	2007/01/10 22:53:56	1.90.2.14
+++ conga/luci/cluster/form-macros	2007/01/10 23:49:18	1.90.2.15
@@ -2039,20 +2039,28 @@
 			<tr>
 				<td>Password</td>
 				<td>
-					<input name="password" type="password" autocomplete="off"
+					<input name="passwd" type="password" autocomplete="off"
 						tal:attributes="value cur_fencedev/passwd | nothing" />
 				</td>
 			</tr>
 			<tr>
 				<td>Authentication Type</td>
-				<td><input name="auth_type" type="text" Title="Options are to leave blank for none, password, md2, or md5"/></td>
+				<td>
+					<input name="auth_type" type="text" title="Options are to leave blank for none, password, md2, or md5"
+						tal:attributes="value cur_fencedev/auth_type | nothing" />
+				</td>
 			</tr>
 			<tr>
 				<td>Use Lanplus</td>
 				<td>
-					<input name="lanplus" type="checkbox"
-						tal:attributes="checked cur_fencedev/lanplus | nothing"
-					/>
+					<tal:block tal:condition="exists: cur_fencedev">
+						<input name="lanplus" type="checkbox"
+							tal:attributes="checked python: ('lanplus' in cur_fencedev and cur_fencedev['lanplus'] == '1') and 'checked' or ''"
+						/>
+					</tal:block>
+					<tal:block tal:condition="not:exists:cur_fencedev">
+						<input name="lanplus" type="checkbox" />
+					</tal:block>
 				</td>
 			</tr>
 		</table>
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/10 22:53:56	1.120.2.17
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/10 23:49:18	1.120.2.18
@@ -1613,7 +1613,7 @@
 					# user could not have edited it (without playing dirty
 					# games), so it's safe to pull the existing entry from
 					# the model. All we need is the device name.
-					pass
+					del fence_form['sharable']
 				else:
 					# An existing non-shared device; build up the device
 					# from scratch since the user could have edited it.
@@ -1665,6 +1665,8 @@
 			# <node><fence>. All we need for that is the device name.
 			if not 'sharable' in fence_form:
 				instance_list.append({'name': fencedev_name })
+			else:
+				del fence_form['sharable']
 
 		if fencedev_obj is not None:
 			# If a device with this name exists in the model
@@ -4387,7 +4389,7 @@
           last_kid_fd = None
           level1.append(fencedev)
         else:  #This dev is shared
-          if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd.getName().strip()):  #just append a new instance struct to last_kid_fd
+          if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd['name'].strip()):  #just append a new instance struct to last_kid_fd
             instance_struct = {}
             instance_struct['id'] = str(minor_num)
             minor_num = minor_num + 1
@@ -4400,7 +4402,7 @@
             #Now just add this struct to last_kid_fd and reset last_kid_fd
             ilist = last_kid_fd['instance_list']
             ilist.append(instance_struct)
-            last_kid_fd = fd
+            #last_kid_fd = fd
             continue
           else: #Shared, but not used above...so we need a new fencedev struct
             fencedev = {}
@@ -4428,7 +4430,7 @@
               instance_struct[kee] = kidattrs[kee]
             inlist.append(instance_struct) 
             level1.append(fencedev)
-            last_kid_fd = fd
+            last_kid_fd = fencedev
             continue
     map['level1'] = level1
 
@@ -4494,7 +4496,7 @@
           last_kid_fd = None
           level2.append(fencedev)
         else:  #This dev is shared
-          if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd.getName().strip()):  #just append a new instance struct to last_kid_fd
+          if (last_kid_fd is not None) and (fd.getName().strip() == last_kid_fd['name'].strip()):  #just append a new instance struct to last_kid_fd
             instance_struct = {}
             instance_struct['id'] = str(minor_num)
             minor_num = minor_num + 1
@@ -4507,7 +4509,7 @@
             #Now just add this struct to last_kid_fd and reset last_kid_fd
             ilist = last_kid_fd['instance_list']
             ilist.append(instance_struct)
-            last_kid_fd = fd
+            #last_kid_fd = fd
             continue
           else: #Shared, but not used above...so we need a new fencedev struct
             fencedev = {}
@@ -4535,7 +4537,7 @@
               instance_struct[kee] = kidattrs[kee]
             inlist.append(instance_struct) 
             level2.append(fencedev)
-            last_kid_fd = fd
+            last_kid_fd = fencedev
             continue
     map['level2'] = level2
 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-01-25 21:03 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-01-25 21:03 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-25 21:03:47

Modified files:
	luci/cluster   : fence_device.js form-macros validate_fence.js 
	luci/homebase  : homebase_common.js 

Log message:
	more frontend fence validation

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.160&r2=1.161
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.15&r2=1.16

--- conga/luci/cluster/fence_device.js	2007/01/17 03:52:16	1.10
+++ conga/luci/cluster/fence_device.js	2007/01/25 21:03:46	1.11
@@ -190,48 +190,3 @@
 	container.appendChild(div_elem);
 	num_fences_level[fence_level - 1]++;
 }
-
-function validate_fence(master_form, container_id) {
-	var errors = new Array();
-	var div_elem = document.getElementById(container_id);
-	if (!div_elem)
-		return (-1);
-	var form_xml = '';
-
-	var form = div_elem.getElementsByTagName('form');
-	for (var i = 0 ; i < form.length ; i++) {
-		var input_elem = form[i].getElementsByTagName('input');
-		var temp = '';
-		for (var j = 0 ; j < input_elem.length ; j++) {
-			var res_type = input_elem[j].type;
-			if (res_type == 'hidden' || res_type == 'text' ||
-				res_type == 'password')
-			{
-				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
-			} else if (res_type == 'checkbox' || res_type == 'radio') {
-				if (input_elem[j].checked) {
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '"';
-					if (res_type == 'checkbox')
-						temp += ' value="1"';
-					else if (res_type == 'radio')
-						temp += ' value="' + input_elem[j].value + '"';
-					temp += ' />';
-				} else if (res_type == 'checkbox') {
-					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="0" />';
-				}
-			}
-		}
-
-		var select_elem = form[i].getElementsByTagName('select');
-		for (var j = 0 ; j < select_elem.length ; j++) {
-			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
-		}
-
-		form_xml += '<form id="' + form[i].getAttribute('name') + '">' + temp + '</form>';
-	}
-
-	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
-
-	if (confirm('Update this node\'s fence configuration?'))
-		master_form.submit();
-}
--- conga/luci/cluster/form-macros	2007/01/25 19:55:08	1.160
+++ conga/luci/cluster/form-macros	2007/01/25 21:03:47	1.161
@@ -2270,6 +2270,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_apc" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2312,6 +2313,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_egenera" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2347,6 +2349,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_wti" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2382,6 +2385,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_brocade" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2417,6 +2421,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_vixel" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2452,6 +2457,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_sanbox2" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2487,6 +2493,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_mcdata" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2522,6 +2529,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_gnbd" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2557,6 +2565,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_bladecenter" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2592,6 +2601,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_bullpap" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2614,6 +2624,7 @@
 			</tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_scsi" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2649,6 +2660,7 @@
 			</td></tr>
 		</table>
 
+		<input type="hidden" name="fence_type" value="fence_xvm" />
 		<input type="hidden" name="fence_instance" value="1" />
 		<input tal:condition="exists: cur_instance"
 			type="hidden" name="existing_instance" value="1" />
@@ -2755,6 +2767,9 @@
 	<script type="text/javascript"
 		src="/luci/cluster/fence_device.js">
 	</script>
+	<script type="text/javascript"
+		src="/luci/cluster/validate_fence.js">
+	</script>
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? nodes ??? properties');
 	</script>
@@ -2866,7 +2881,8 @@
 		<tfoot class="systemsTable">
 			<tr class="systemsTable"><td class="systemsTable" colspan="3">
 				<div class="systemsTableEnd">
-					<input type="Submit" value="Update node daemon properties" />
+					<input type="button" value="Update node daemon properties"
+						onclick="if (confirm('Update daemon properties?')) this.form.submit()" />
 				</div>
 			</td></tr>
 		</tfoot>
@@ -3137,7 +3153,7 @@
 						<input type="hidden" name="pagetype" value="58" />
 						<input type="button"
 							value="Update main fence properties"
-							onclick="validate_fence(this.form, 'fence_list_level1')" />
+							onclick="validate_node_fence_form(this.form, 'fence_list_level1')" />
 					</form>
 				</div>
 			</td>
@@ -3153,7 +3169,7 @@
 						<input type="hidden" name="pagetype" value="58" />
 						<input type="button"
 							value="Update backup fence properties"
-							onclick="validate_fence(this.form, 'fence_list_level2')" />
+							onclick="validate_node_fence_form(this.form, 'fence_list_level2')" />
 					</form>
 				</div>
 			</td>
@@ -4371,7 +4387,8 @@
 			<input type="hidden" name="orig_name"
 				tal:attributes="value request/fencename" />
 			<div class="hbSubmit">
-				<input type="submit" value="Delete this fence device" />
+				<input type="button" value="Delete this fence device"
+					onclick="if (confirm('Delete this fence device?')) this.form.submit()" />
 			</div>
 		</form>
 	</div>
--- conga/luci/cluster/validate_fence.js	2007/01/25 19:55:09	1.2
+++ conga/luci/cluster/validate_fence.js	2007/01/25 21:03:47	1.3
@@ -67,7 +67,7 @@
 	if (!form_elem || str_is_blank(form_elem.value))
 		return (null);
 
-	var auth_type = form_elem.value.strip();
+	var auth_type = form_elem.value;
 	if (auth_type != 'none' && auth_type != 'password' && auth_type != 'md5') {
 		errors.push('Auth type must be either \'none\' (or blank), \'md5\' or \'password\'');
 		set_form_err(form_elem);
@@ -78,7 +78,7 @@
 	return (null);
 }
 
-var field_validator = new Object();
+var field_validator = new Array();
 field_validator['ipaddr'] = validate_field_host;
 field_validator['hostname'] = validate_field_host;
 field_validator['login'] = validate_field_str;
@@ -150,4 +150,82 @@
 
 function validate_fence_instance(form) {
 	var errors = new Array();
+
+	if (!form.fence_type || str_is_blank(form.fence_type.value))
+		errors.push('The fence device associated with this instance could not be determined.');
+
+	if (errors.length > 0)
+		return (errors);
+
+	var fence_type = form.fence_type.value.replace(/^fence_/, '');
+	var fields = fence_inst_validator[fence_type];
+	if (!fields)
+		errors.push('An unknown fence device type was given: \"' + fence_type + '.\"');
+
+	if (errors.length > 0)
+		return (errors);
+
+	for (var i = 0 ; i < fields.length ; i++) {
+		var field_name = fields[i];
+		var err = field_validator[field_name](form[field_name]);
+		if (err)
+			errors = errors.concat(err);
+	}
+
+	return (errors);
+}
+
+function validate_node_fence_form(master_form, container_id) {
+	var errors = new Array();
+	var div_elem = document.getElementById(container_id);
+	if (!div_elem)
+		return (-1);
+	var form_xml = '';
+
+	var form = div_elem.getElementsByTagName('form');
+	for (var i = 0 ; i < form.length ; i++) {
+		var err = null;
+		if (form[i].fence_instance)
+			err = validate_fence_instance(form[i]);
+		else if (form[i].fence_type)
+			err = validate_fence(form[i]);
+		if (err)
+			errors = errors.concat(err);
+		var input_elem = form[i].getElementsByTagName('input');
+		var temp = '';
+		for (var j = 0 ; j < input_elem.length ; j++) {
+			var res_type = input_elem[j].type;
+			if (res_type == 'hidden' || res_type == 'text' ||
+				res_type == 'password')
+			{
+				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
+			} else if (res_type == 'checkbox' || res_type == 'radio') {
+				if (input_elem[j].checked) {
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '"';
+					if (res_type == 'checkbox')
+						temp += ' value="1"';
+					else if (res_type == 'radio')
+						temp += ' value="' + input_elem[j].value + '"';
+					temp += ' />';
+				} else if (res_type == 'checkbox') {
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="0" />';
+				}
+			}
+		}
+
+		var select_elem = form[i].getElementsByTagName('select');
+		for (var j = 0 ; j < select_elem.length ; j++) {
+			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
+		}
+
+		form_xml += '<form id="' + form[i].getAttribute('name') + '">' + temp + '</form>';
+	}
+
+	master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
+
+	if (error_dialog(errors))
+		return (-1);
+
+	if (confirm('Update this node\'s fence configuration?'))
+		master_form.submit();
 }
--- conga/luci/homebase/homebase_common.js	2006/12/21 05:08:48	1.15
+++ conga/luci/homebase/homebase_common.js	2007/01/25 21:03:47	1.16
@@ -5,7 +5,7 @@
 
 function clr_form_err(ielem) {
 	if (ielem)
-		ielem.className = ielem.className.replace(/ formerror/, '');
+		ielem.className = ielem.className.replace(/( )?formerror/, '');
 }
 
 function toggle_visible(img_obj, elem_id, label_id) {



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...
@ 2007-08-08 21:18 rmccabe
  0 siblings, 0 replies; 8+ messages in thread
From: rmccabe @ 2007-08-08 21:18 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-08-08 21:18:46

Modified files:
	luci/cluster   : fence_device.js form-chooser form-macros 
	                 resource_form_handlers.js 
	                 validate_config_fence.js 
	                 validate_config_general.js 
	                 validate_config_gulm.js 
	                 validate_config_multicast.js 
	                 validate_config_qdisk.js 
	                 validate_create_gulm.js validate_fdom.js 
	                 validate_fence.js 
Added files:
	luci/cluster   : validate_xvm_key.js 
	luci/plone-custom: conga_ajax.js 

Log message:
	Fix 230451, pass 4
	- luci frontend support for managing fence_xvm keys, pass 1

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_xvm_key.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2.2.6&r2=1.2.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.12.2.5&r2=1.12.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90.2.27&r2=1.90.2.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.10&r2=1.20.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3&r2=1.3.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_general.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_gulm.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.4.1&r2=1.3.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_multicast.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3&r2=1.3.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.3&r2=1.4.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_create_gulm.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.1&r2=1.1.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fdom.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.4.1&r2=1.3.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.5&r2=1.1.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga_ajax.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.2.2.1

/cvs/cluster/conga/luci/cluster/validate_xvm_key.js,v  -->  standard output
revision 1.1.2.1
--- conga/luci/cluster/fence_device.js	2007/07/12 04:41:39	1.2.2.6
+++ conga/luci/cluster/fence_device.js	2007/08/08 21:18:46	1.2.2.7
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var num_fences_level = [ 0, 0 ];
 var num_fence_instances = [];
 
--- conga/luci/cluster/form-chooser	2007/03/12 04:22:25	1.12.2.5
+++ conga/luci/cluster/form-chooser	2007/08/08 21:18:46	1.12.2.6
@@ -152,11 +152,12 @@
     <span tal:omit-tag="" tal:condition="python: ptype == '55'">
      <div metal:use-macro="here/form-macros/macros/fencedevprocess-form"/>
     </span>
-
     <span tal:omit-tag="" tal:condition="python: ptype == '80'">
      <div metal:use-macro="here/form-macros/macros/conf_editor-form"/>
     </span>
-
+    <tal:block tal:condition="python: ptype == '1000'">
+     <div metal:use-macro="here/form-macros/macros/get-cluster-members-form"/>
+	</tal:block>
    </span>
   </metal:choose-form>
   </body>
--- conga/luci/cluster/form-macros	2007/07/26 20:31:05	1.90.2.27
+++ conga/luci/cluster/form-macros	2007/08/08 21:18:46	1.90.2.28
@@ -531,6 +531,12 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? Configure cluster properties');
 	</script>
+	<script type="text/javascript"
+		src="conga_ajax.js">
+	</script>
+	<script type="text/javascript"
+		src="validate_xvm_key.js">
+	</script>
 
 	<tal:block tal:define="
 		global ricci_agent ri_agent | python: here.getRicciAgentForCluster(request)" />
@@ -917,7 +923,7 @@
 	</div>
 
 	<div id="configTabContent" tal:condition="python: configTabNum == 2">
-		<form name="fencedaemon" method="post" action="">
+		<form name="fencedaemon" method="post" id="fence_config_form" action="">
 			<input type="hidden" name="configtype" value="fence" />
 			<input type="hidden" name="pagetype"
 				tal:attributes="value request/pagetype | request/form/pagetype"
@@ -967,6 +973,68 @@
 							tal:attributes="checked python: ('fence_xvmd' in clusterinfo and clusterinfo['fence_xvmd']) and 'checked' or ''" />
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable" colspan="2">
+						<div class="systemsTableTop">&nbsp;</div>
+						<strong>XVM fence daemon key distribution</strong>
+					</td>
+				</tr>
+
+				<tr id="fence_xvm_config" class="invisible">
+					<td class="systemsTable" colspan="2" id="fence_xvm_config">
+						<table class="systemsTable">
+							<tr class="systemsTable">
+								<td class="systemsTable">
+									<div id="fence_xvm_hosts" />
+								</td>
+							</tr>
+							<tr class="systemsTable">
+								<td class="systemsTable">
+									<input type="button" name="distribute"
+										value="Create and distribute keys"
+										onclick="validate_xvm_dist_form(this.form)"
+									/>
+								</td>
+							</tr>
+						</table>
+					</td>
+				</tr>
+
+				<tr class="systemsTable" id="fence_xvm_init">
+					<td class="systemsTable" colspan="2">
+						<table class="systemsTable">
+							<tr class="systemsTable">
+								<td class="systemsTable">
+									Enter a node hostname from the host cluster
+								</td>
+								<td>
+									<input type="text" value=""
+										name="host_cluster_name"
+										id="host_cluster_name" />
+								</td>
+							</tr>
+							<tr class="systemsTable">
+								<td class="systemsTable">
+									Enter a node hostname from the hosted (virtual) cluster
+								</td>
+								<td>
+									<input type="text" value=""
+										name="virt_cluster_name"
+										id="virt_cluster_name" />
+								</td>
+							</tr>
+							<tr class="systemsTable">
+								<td class="systemsTable" colspan="2">
+									<input type="button"
+										name="Retrieve cluster nodes"
+										value="Retrieve cluster nodes"
+										onclick="get_cluster_members(this.form)"
+									/>
+								</td>
+							</tr>
+						</table>
+					</td>
+				</tr>
 			</tbody>
 
 			<tfoot class="systemsTable">
@@ -974,7 +1042,8 @@
 					<td class="systemsTable" colspan="2">
 						<div class="systemsTableEnd">
 							<input type="button" value="Apply"
-								onClick="validate_form(this.form);" />
+								id="fence_config_submit"
+								onClick="validate_form(this.form)" />
 						</div>
 					</td>
 				</tr>
@@ -5301,6 +5370,10 @@
 	</form>
 </div>
 
+<div metal:define-macro="get-cluster-members-form">
+	<tal:block tal:define="ret python: here.get_cluster_nodes_async(request)" />
+</div>
+
 <div metal:define-macro="system-svc-update-form">
 	<tal:block tal:define="ret python: here.validate_manage_svc(request)" />
 </div>
--- conga/luci/cluster/resource_form_handlers.js	2007/07/27 19:11:32	1.20.2.10
+++ conga/luci/cluster/resource_form_handlers.js	2007/08/08 21:18:46	1.20.2.11
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function swap_in_global_res(container_id, sel, replace, form) {
 	sel.id = null;
 	var container = document.getElementById(container_id);
--- conga/luci/cluster/validate_config_fence.js	2006/10/04 16:39:07	1.3
+++ conga/luci/cluster/validate_config_fence.js	2007/08/08 21:18:46	1.3.2.1
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function validate_form(form) {
 	var errors = new Array();
 
--- conga/luci/cluster/validate_config_general.js	2007/03/01 00:31:08	1.3.2.1
+++ conga/luci/cluster/validate_config_general.js	2007/08/08 21:18:46	1.3.2.2
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function validate_form(form) {
 	var errors = new Array();
 	var name = null;
--- conga/luci/cluster/validate_config_gulm.js	2007/03/01 00:31:08	1.3.4.1
+++ conga/luci/cluster/validate_config_gulm.js	2007/08/08 21:18:46	1.3.4.2
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function validate_form(form) {
 	var errors = new Array();
 	var lscount = 0;
--- conga/luci/cluster/validate_config_multicast.js	2006/10/04 17:24:58	1.3
+++ conga/luci/cluster/validate_config_multicast.js	2007/08/08 21:18:46	1.3.2.1
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var prev_mcast_str = '';
 
 function disable_mcast(addrId) {
--- conga/luci/cluster/validate_config_qdisk.js	2007/07/12 04:41:39	1.4.2.3
+++ conga/luci/cluster/validate_config_qdisk.js	2007/08/08 21:18:46	1.4.2.4
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var heuristic_names = [ ':hprog', ':hinterval', ':hscore', ':hdel' ];
 
 function clear_heuristic(form, heur_num) {
--- conga/luci/cluster/validate_create_gulm.js	2007/03/01 00:31:08	1.1.4.1
+++ conga/luci/cluster/validate_create_gulm.js	2007/08/08 21:18:46	1.1.4.2
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var lockservers = new Array();
 
 function toggle_gulm(form, lock_type) {
--- conga/luci/cluster/validate_fdom.js	2007/03/01 00:31:08	1.3.4.1
+++ conga/luci/cluster/validate_fdom.js	2007/08/08 21:18:46	1.3.4.2
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 function fdom_set_prioritized(form, state) {
 	var prilist = form.getElementsByTagName('input');
 	if (!prilist)
--- conga/luci/cluster/validate_fence.js	2007/07/26 04:14:14	1.1.2.5
+++ conga/luci/cluster/validate_fence.js	2007/08/08 21:18:46	1.1.2.6
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
 var fence_inst_validator = [];
 fence_inst_validator['apc'] = [ 'port', 'switch' ];
 fence_inst_validator['bladecenter'] = [ 'blade' ];
/cvs/cluster/conga/luci/plone-custom/conga_ajax.js,v  -->  standard output
revision 1.2.2.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-08-08 21:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 21:58 [Cluster-devel] conga/luci cluster/fence_device.js cluster/for rmccabe
  -- strict thread matches above, loose matches on Subject: below --
2007-08-08 21:18 rmccabe
2007-01-25 21:03 rmccabe
2007-01-10 23:49 rmccabe
2007-01-10 23:47 rmccabe
2007-01-10 22:53 rmccabe
2007-01-05 23:44 rmccabe
2006-12-01 14:56 rmccabe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).