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

[Cluster-devel] conga/luci cluster/fence_device.js cluster/for ...



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe 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
 


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