[Cluster-devel] conga/luci cluster/cluster_config-macros clust ...

rmccabe at sourceware.org rmccabe at sourceware.org
Tue Feb 17 20:49:31 UTC 2009


CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe at sourceware.org	2009-02-17 20:49:29

Modified files:
	luci/cluster   : cluster_config-macros fence-macros 
	                 validate_fence.js 
	luci/plone-custom: conga_ajax.js validate_auth.js 
	luci/site/luci/Extensions: FenceHandler.py LuciClusterInfo.py 
	                           LuciValidation.py ResourceHandler.py 
	luci/site/luci/Extensions/ClusterModel: FenceDaemon.py 
	                                        FenceDeviceAttr.py 
	                                        ModelBuilder.py 
	                                        QuorumD.py 
	luci/site/luci/var: Data.fs 

Log message:
	Backport fixes from RHEL5

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_config-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.4.2.2&r2=1.4.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.6&r2=1.2.4.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.8&r2=1.3.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga_ajax.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.2&r2=1.3.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/validate_auth.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.4.2&r2=1.1.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.17.2.10&r2=1.17.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.7&r2=1.10.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.3&r2=1.9.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ResourceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.6&r2=1.2.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/FenceDaemon.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.4.1&r2=1.5.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.6&r2=1.5.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/QuorumD.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/var/Data.fs.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.20.2.27&r2=1.20.2.28

--- conga/luci/cluster/cluster_config-macros	2008/11/10 21:02:43	1.4.2.2
+++ conga/luci/cluster/cluster_config-macros	2009/02/17 20:48:57	1.4.2.3
@@ -454,6 +454,18 @@
 							tal:attributes="value clusterinfo/pjd" />
 					</td>
 				</tr>
+
+				<tr tal:condition="clusterinfo/has_ignore_undef_fence"
+					class="systemsTable">
+
+					<td class="systemsTable">Skip nodes with undefined fencing</td>
+					<td class="systemsTable">
+						<input type="checkbox" name="skip_undefined"
+							tal:attributes="checked python: clusterinfo.get('skip_undefined') and 'checked' or ''" />
+					</td>
+				</tr>
+
+
 				<tr class="systemsTable">
 					<td class="systemsTable">
 						<span class="cluster_help" title="Enable if you will be running a VM cluster on this physical cluster">Run XVM fence daemon</td>
--- conga/luci/cluster/fence-macros	2008/11/10 21:02:43	1.2.4.6
+++ conga/luci/cluster/fence-macros	2009/02/17 20:48:57	1.2.4.7
@@ -218,6 +218,14 @@
 		<tal:block metal:use-macro="here/fence-macros/macros/fence-form-egenera" />
 	</tal:block>
 
+	<tal:block tal:condition="python: cur_fence_type == 'fence_lpar'">
+		<tal:block metal:use-macro="here/fence-macros/macros/fence-form-lpar" />
+	</tal:block>
+	
+	<tal:block tal:condition="python: cur_fence_type == 'fence_vmware'">
+		<tal:block metal:use-macro="here/fence-macros/macros/fence-form-vmware" />
+	</tal:block>
+
 	<tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
 		<tal:block metal:use-macro="here/fence-macros/macros/fence-form-bladecenter" />
 	</tal:block>
@@ -325,6 +333,8 @@
 	<option name="fence_bullpap" value="fence_bullpap">Bull PAP</option>
 	<option name="fence_xvm" value="fence_xvm">Virtual Machine Fencing</option>
 	<option name="fence_scsi" value="fence_scsi">SCSI Fencing</option>
+	<option name="fence_vmware" value="fence_vmware">VMWare Fencing</option>
+	<option name="fence_lpar" value="fence_lpar">LPAR Fencing</option>
 </div>
 
 <div metal:define-macro="fence-option-list">
@@ -347,6 +357,8 @@
 	<option name="fence_ipmilan" value="fence_ipmilan">IPMI Lan</option>
 	<option name="fence_xvm" value="fence_xvm">Virtual Machine Fencing</option>
 	<option name="fence_scsi" value="fence_scsi">SCSI Fencing</option>
+	<option name="fence_vmware" value="fence_vmware">VMWare Fencing</option>
+	<option name="fence_lpar" value="fence_lpar">LPAR Fencing</option>
 	<option name="fence_manual" value="fence_manual">Manual Fencing</option>
 </div>
 
@@ -1084,6 +1096,175 @@
 	</div>
 </div>
 
+<div metal:define-macro="fence-form-lpar"
+	tal:attributes="id cur_fencedev/name | nothing">
+
+	<div id="fence_lpar" class="fencedev">
+		<table>
+			<tr>
+				<td><strong class="cluster">Fence Type</strong></td>
+				<td>LPAR</td>
+			</tr>
+			<tr>
+				<td>Name</td>
+				<td>
+					<input name="name" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/name | nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>Hostname</td>
+				<td>
+					<input name="ipaddr" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/ipaddr | nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>Login</td>
+				<td>
+					<input name="login" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/login | nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>Password</td>
+				<td>
+					<input name="passwd" type="password" autocomplete="off"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
+		</table>
+
+		<tal:block tal:condition="exists: cur_fencedev">
+			<input type="hidden" name="existing_device" value="1" />
+			<input type="hidden" name="orig_name"
+				tal:attributes="value cur_fencedev/name | nothing" />
+		</tal:block>
+
+		<input type="hidden" name="sharable" value="1" />
+		<input type="hidden" name="fence_type" value="fence_lpar" />
+	</div>
+</div>
+
+<div metal:define-macro="fence-form-vmware"
+	tal:attributes="id cur_fencedev/name | nothing">
+
+	<div id="fence_vmware" class="fencedev">
+		<table>
+			<tr>
+				<td><strong class="cluster">Fence Type</strong></td>
+				<td>VMWare</td>
+			</tr>
+			<tr>
+				<td>Name</td>
+				<td>
+					<input name="name" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/name | nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>Hostname</td>
+				<td>
+					<input name="ipaddr" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/ipaddr | nothing" />
+				</td>
+			</tr>
+
+			<tr>
+				<td>Login</td>
+				<td>
+					<input name="login" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/login | nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>Password</td>
+				<td>
+					<input name="passwd" type="password" autocomplete="off"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="passwd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/passwd_script | nothing" />
+				</td>
+			</tr>
+
+			<tr>
+				<td>VMware ESX Management Login</td>
+				<td>
+					<input name="vmlogin" type="text"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/vmlogin | nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>VMware ESX Management Password</td>
+				<td>
+					<input name="vmpasswd" type="password" autocomplete="off"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value nothing" />
+				</td>
+			</tr>
+			<tr>
+				<td>
+					<span title="Full path to a script to generate VMware ESX Management password">VMware ESX Management Password Script (optional)</span>
+				</td>
+				<td>
+					<input type="text" name="vmpasswd_script"
+						tal:attributes="
+							disabled cur_fencedev/isShared | nothing;
+							value cur_fencedev/vmpasswd_script | nothing" />
+				</td>
+			</tr>
+		</table>
+
+		<tal:block tal:condition="exists: cur_fencedev">
+			<input type="hidden" name="existing_device" value="1" />
+			<input type="hidden" name="orig_name"
+				tal:attributes="value cur_fencedev/name | nothing" />
+		</tal:block>
+
+		<input type="hidden" name="sharable" value="1" />
+		<input type="hidden" name="fence_type" value="fence_vmware" />
+	</div>
+</div>
+
 <div metal:define-macro="fence-form-egenera"
 	tal:attributes="id cur_fencedev/name | nothing">
 
@@ -1491,6 +1672,8 @@
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-ipmilan" />
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-xvm" />
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-scsi" />
+	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-lpar" />
+	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-vmware" />
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-manual" />
 </div>
 
@@ -1507,6 +1690,8 @@
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-bullpap" />
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-xvm" />
 	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-scsi" />
+	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-lpar" />
+	<tal:block metal:use-macro="here/fence-macros/macros/fence-form-vmware" />
 </div>
 
 <div metal:define-macro="shared-fence-device-list">
@@ -1609,6 +1794,101 @@
 	</div>
 </div>
 
+<div metal:define-macro="fence-instance-form-lpar"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_lpar_instance" name="fence_lpar" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
+		<table>
+			<tr>
+				<td>Partition</td>
+				<td>
+					<input name="partition" type="text"
+						tal:attributes="
+							value cur_instance/partition | nothing" />
+				</td>
+			</tr>
+
+			<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="option" tal:condition="exists:cur_instance"
+			tal:attributes="value cur_instance/option |nothing" />
+		<input type="hidden" name="fence_type" value="fence_lpar" />
+		<input type="hidden" name="fence_instance" value="1" />
+		<input type="hidden" name="secure" 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-vmware"
+	tal:omit-tag="exists: cur_fence_dev_id">
+	<div id="fence_vmware_instance" name="fence_vmware" class="fencedev_instance"
+		tal:omit-tag="exists: cur_fence_dev_id">
+		<table>
+			<tr>
+				<td>Port</td>
+				<td>
+					<input name="port" type="text"
+						tal:attributes="
+							value cur_instance/port | nothing" />
+				</td>
+			</tr>
+
+			<tr tal:condition="exists:clusterinfo/has_fence_ssh">
+				<td>
+					<span title="Enable SSH operation">Use SSH</span>
+				</td>
+				<td>
+					<input tal:condition="exists:cur_instance"
+						type="checkbox" name="secure"
+						tal:attributes="
+							checked python:(cur_instance and cur_instance.has_key('secure') and (cur_instance['secure'] == '1' or cur_instance['secure'].lower() == 'true')) and 'checked' or ''" />
+					<input tal:condition="not:exists:cur_instance"
+						type="checkbox" name="secure" />
+				</td>
+			</tr>
+
+			<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="option" tal:condition="exists:cur_instance"
+			tal:attributes="value cur_instance/option |nothing" />
+		<input type="hidden" name="fence_type" value="fence_vmware" />
+		<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"
 	tal:omit-tag="exists: cur_fence_dev_id">
 	<div id="fence_egenera_instance" name="fence_egenera" class="fencedev_instance"
@@ -2053,6 +2333,10 @@
 	<tal:block
 		metal:use-macro="here/fence-macros/macros/fence-instance-form-egenera" />
 	<tal:block
+		metal:use-macro="here/fence-macros/macros/fence-instance-form-lpar" />
+	<tal:block
+		metal:use-macro="here/fence-macros/macros/fence-instance-form-vmware" />
+	<tal:block
 		metal:use-macro="here/fence-macros/macros/fence-instance-form-wti" />
 	<tal:block
 		metal:use-macro="here/fence-macros/macros/fence-instance-form-brocade" />
@@ -2117,6 +2401,16 @@
 			metal:use-macro="here/fence-macros/macros/fence-instance-form-egenera" />
 	</tal:block>
 
+	<tal:block tal:condition="python: cur_fence_type == 'fence_lpar'">
+		<tal:block
+			metal:use-macro="here/fence-macros/macros/fence-instance-form-lpar" />
+	</tal:block>
+
+	<tal:block tal:condition="python: cur_fence_type == 'fence_vmware'">
+		<tal:block
+			metal:use-macro="here/fence-macros/macros/fence-instance-form-vmware" />
+	</tal:block>
+
 	<tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
 		<tal:block
 			metal:use-macro="here/fence-macros/macros/fence-instance-form-bullpap" />
--- conga/luci/cluster/validate_fence.js	2008/04/23 17:22:59	1.3.2.8
+++ conga/luci/cluster/validate_fence.js	2009/02/17 20:48:57	1.3.2.9
@@ -20,6 +20,8 @@
 fence_inst_validator['vixel'] = [ 'port' ];
 fence_inst_validator['wti'] = [ 'port', 'secure' ];
 fence_inst_validator['xvm'] = [ 'domain' ];
+fence_inst_validator['lpar'] = [ 'partition' ];
+fence_inst_validator['vmware'] = [ 'port' ];
 
 var fence_validator = [];
 fence_validator['apc'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
@@ -41,6 +43,8 @@
 fence_validator['unknown'] = [];
 fence_validator['vixel'] = [ 'ipaddr', 'passwd', 'passwd_script' ];
 fence_validator['wti'] = [ 'ipaddr', 'passwd', 'passwd_script' ];
+fence_validator['lpar'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
+fence_validator['vmware'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script', 'vmlogin' ];
 fence_validator['xvm'] = [];
 
 function validate_field_str(form, form_elem) {
@@ -120,12 +124,15 @@
 field_validator['ipaddr'] = validate_field_host;
 field_validator['hostname'] = validate_field_host;
 field_validator['login'] = validate_field_str;
+field_validator['vmlogin'] = validate_field_str;
 field_validator['passwd'] = validate_field_passwd;
+field_validator['vmpasswd'] = validate_field_noop;
 field_validator['servers'] = validate_field_str;
 field_validator['cserver'] = validate_field_str;
 field_validator['device'] = validate_field_str;
 field_validator['port'] = validate_field_str;
 field_validator['passwd_script'] = validate_field_noop;
+field_validator['vmpasswd_script'] = validate_field_noop;
 
 /* iLO, DRAC5, WTI, APC, Bladecenter */
 field_validator['secure'] = validate_field_noop;
@@ -143,6 +150,7 @@
 field_validator['lpan'] = validate_field_str;
 field_validator['pserver'] = validate_field_str;
 field_validator['domain'] = validate_field_str;
+field_validator['partition'] = validate_field_str;
 
 function validate_fence(form) {
 	var errors = [];
@@ -179,9 +187,12 @@
 	for (var i = 0 ; i < fields.length ; i++) {
 		var field_name = fields[i];
 		if (form[field_name]) {
-			var err = field_validator[field_name](form, form[field_name]);
-			if (err) {
-				errors = errors.concat(err);
+			try {
+				var err = field_validator[field_name](form, form[field_name]);
+				if (err) {
+					errors = errors.concat(err);
+				}
+			} catch (e) {
 			}
 		}
 	}
--- conga/luci/plone-custom/conga_ajax.js	2008/03/25 01:27:11	1.3.2.2
+++ conga/luci/plone-custom/conga_ajax.js	2009/02/17 20:49:00	1.3.2.3
@@ -12,15 +12,24 @@
 function get_xmlhttp_obj() {
 	xmlHttp_object = false;
 
-	if (!xmlHttp_object && typeof XMLHttpRequest != 'undefined') {
+	if (!xmlHttp_object) {
 		try {
 			xmlHttp_object = new XMLHttpRequest();
+			if (!xmlHttp_object) {
+				throw "no XMLHttpRequest";
+			}
 		} catch (e0) {
 			try {
 				xmlHttp_object = new ActiveXObject("Msxml2.XMLHTTP");
+				if (!xmlHttp_object) {
+					throw "no Msxml2.XMLHTTP";
+				}
 			} catch (e) {
 				try {
 					xmlHttp_object = new ActiveXObject("Microsoft.XMLHTTP");
+					if (!xmlHttp_object) {
+						throw "No Microsoft.XMLHTTP";
+					}
 				} catch (e2) {
 					xmlHttp_object = false;
 				}
--- conga/luci/plone-custom/validate_auth.js	2008/12/10 21:02:00	1.1.4.2
+++ conga/luci/plone-custom/validate_auth.js	2009/02/17 20:49:00	1.1.4.3
@@ -94,16 +94,22 @@
 	var msgs = [];
 	var systems_list = get_systems_list_offsets(errors);
 	var os_str = null;
+	var form_elem = null;
 
 	for (var i = 0 ; i < systems_list.length ; i++) {
 		var cur_node_props = node_props[systems_list[i][0]];
 		var cur_sys_name = systems_list[i][0];
 		var offset = systems_list[i][1];
+
 		try {
 			var addr_elem = document.getElementById('__SYSTEM' + offset + ':Addr');
 			var pwd_elem = document.getElementById('__SYSTEM' + offset + ':Passwd');
 			var fp_elem = document.getElementById('__SYSTEM' + offset + 'Fingerprint');
 
+			if (addr_elem) {
+				form_elem = addr_elem.form;
+			}
+
 			if (cur_node_props['available'] != 'True') {
 				set_form_err(addr_elem);
 				clr_form_err(pwd_elem);
@@ -160,6 +166,13 @@
 
 	if (errors.length > 0) {
 		display_msgs(err_div_id, errors);
+	} else if (form_elem !== null && os_version == 'rhel5') {
+		try {
+			if (form_elem.pagetype.value == '1003') {
+				validate_cluster_create(form_elem);
+			}
+		} catch (e) {
+		}
 	}
 
 	if (msgs.length > 0) {
--- conga/luci/site/luci/Extensions/FenceHandler.py	2008/06/10 14:48:30	1.17.2.10
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2009/02/17 20:49:01	1.17.2.11
@@ -30,6 +30,8 @@
 FD_PROVIDE_DEVICE = 'A device must be provided for this Fence Device'
 FD_PROVIDE_PORT = 'A port must be provided for this Fence Device'
 FD_PROVIDE_IPMILAN_AUTH = 'Authentication type must be "none" (or blank), "md5", or "password"'
+FD_PROVIDE_VMLOGIN = 'A VMware ESX management login name must be provided for this Fence Device'
+FD_PROVIDE_VMPASSWD = 'A VMware ESX management password must be provided for this Fence Device'
 
 FI_PROVIDE_PARENT = 'A Fence Device name must be provided for this Fence'
 FI_PROVIDE_SWITCH = 'A switch address must be provided for this Fence'
@@ -40,6 +42,7 @@
 FI_PROVIDE_ELPAN = 'A LPAN value must be provided for this Egenera Fence'
 FI_PROVIDE_EPSERVER = 'A PServer value must be provided for this Egenera Fence'
 FI_PROVIDE_NODENAME = 'A Node Name value must be provided for this SCSI Fence'
+FI_PROVIDE_PARTITION = 'A partition name must be provided for this LPAR Fence'
 
 ILLEGAL_CHARS_REPLACED = 'Illegal characters were replaced by underscores. Feel free to set a new value.'
 
@@ -534,6 +537,159 @@
 
 	return errors
 
+def val_lpar_fd(form, fencedev):
+	errors = list()
+
+	# fence_lpar currently requires the use of SSH
+	fencedev.addAttribute('secure', '1')
+
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
+	except Exception, e:
+		errors.append(FD_PROVIDE_IP)
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
+	except Exception, e:
+		errors.append(FD_PROVIDE_LOGIN)
+
+	has_passwd = False
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			# Allow passwords that consist of only spaces.
+			if not form.has_key('passwd') or form['passwd'] == '':
+				raise Exception, 'blank'
+			else:
+				pwd = form['passwd']
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
+		errors.append(FD_PROVIDE_PASSWD)
+	return errors
+
+def val_vmware_fd(form, fencedev):
+	errors = list()
+
+	try:
+		ip = form['ipaddr'].strip()
+		if not ip:
+			raise Exception, 'blank'
+		fencedev.addAttribute('ipaddr', ip)
+	except Exception, e:
+		errors.append(FD_PROVIDE_IP)
+
+	try:
+		log = form['login'].strip()
+		if not log:
+			raise Exception, 'blank'
+		fencedev.addAttribute('login', log)
+	except Exception, e:
+		errors.append(FD_PROVIDE_LOGIN)
+
+	has_passwd = False
+	try:
+		pwd = form['passwd'].strip()
+		if not pwd:
+			# Allow passwords that consist of only spaces.
+			if not form.has_key('passwd') or form['passwd'] == '':
+				raise Exception, 'blank'
+			else:
+				pwd = form['passwd']
+		fencedev.addAttribute('passwd', pwd)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd')
+		except:
+			pass
+
+	try:
+		pwd_script = form['passwd_script'].strip()
+		if not pwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('passwd_script', pwd_script)
+		has_passwd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('passwd_script')
+		except:
+			pass
+
+	if not has_passwd:
+		errors.append(FD_PROVIDE_PASSWD)
+	use_ssh = form.has_key('secure') and (form['secure'] == '1' or form['secure'].lower() == 'true')
+	if use_ssh:
+		fencedev.addAttribute('secure', '1')
+	else:
+		fencedev.removeAttribute('secure')
+
+	try:
+		vmlogin = form['vmlogin'].strip()
+		if not vmlogin:
+			raise Exception, 'blank'
+		fencedev.addAttribute('vmlogin', vmlogin)
+	except Exception, e:
+		errors.append(FD_PROVIDE_VMLOGIN)
+
+	has_vmpasswd = False
+	try:
+		vmpwd = form['vmpasswd'].strip()
+		if not vmpwd:
+			# Allow passwords that consist of only spaces.
+			if not form.has_key('vmpasswd') or form['vmpasswd'] == '':
+				raise Exception, 'blank'
+			else:
+				vmpwd = form['vmpasswd']
+		fencedev.addAttribute('vmpasswd', vmpwd)
+		has_vmpasswd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('vmpasswd')
+		except:
+			pass
+
+	try:
+		vmpwd_script = form['vmpasswd_script'].strip()
+		if not vmpwd_script:
+			raise Exception, 'blank'
+		fencedev.addAttribute('vmpasswd_script', vmpwd_script)
+		has_vmpasswd = True
+	except Exception, e:
+		try:
+			fencedev.removeAttribute('vmpasswd_script')
+		except:
+			pass
+
+	if not has_vmpasswd:
+		errors.append(FD_PROVIDE_VMPASSWD)
+
+	return errors
+
 def val_noop_fd(dummy, _dummy):
 	return []
 
@@ -830,6 +986,8 @@
 	'fence_mcdata':			val_mcdata_fd,
 	'fence_egenera':		val_egenera_fd,
 	'fence_bullpap':		val_bullpap_fd,
+	'fence_lpar':			val_lpar_fd,
+	'fence_vmware':			val_vmware_fd,
 	'fence_xvm':			val_noop_fd,
 	'fence_scsi':			val_noop_fd,
 	'fence_ilo':			val_ilo_fd,
@@ -1089,6 +1247,40 @@
 
 	return errors
 
+def val_lpar_fi(form, fenceinst):
+	errors = list()
+
+	try:
+		partition = form['partition'].strip()
+		if not partition:
+			raise Exception, 'blank'
+		fenceinst.addAttribute('partition', partition)
+	except Exception, e:
+		errors.append(FI_PROVIDE_PARTITION)
+
+	fenceinst.addAttribute('secure', '1')
+
+	return errors
+
+def val_vmware_fi(form, fenceinst):
+	errors = list()
+
+	try:
+		port = form['port'].strip()
+		if not port:
+			raise Exception, 'blank'
+		fenceinst.addAttribute('port', port)
+	except Exception, e:
+		errors.append(FI_PROVIDE_PORT)
+
+	use_ssh = form.has_key('secure') and (form['secure'] == '1' or form['secure'].lower() == 'true')
+	if use_ssh:
+		fenceinst.addAttribute('secure', '1')
+	else:
+		fenceinst.removeAttribute('secure')
+
+	return errors
+
 def val_manual_fi(form, fenceinst):
 	nodename = form.get('nodename')
 	if nodename:
@@ -1112,6 +1304,8 @@
 	'fence_manual':			val_manual_fi,
 	'fence_xvm':			val_xvm_fi,
 	'fence_scsi':			val_scsi_fi,
+	'fence_lpar':			val_lpar_fi,
+	'fence_vmware':			val_vmware_fi,
 	'fence_ilo':			val_noop_fi,
 	'fence_ipmilan':		val_noop_fi,
 	'fence_drac':			val_noop_fi,
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py	2008/11/10 21:02:43	1.10.2.7
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py	2009/02/17 20:49:01	1.10.2.8
@@ -317,10 +317,48 @@
 	rc_map['max_depth'] = child_depth
 	return child_depth + 1
 
-
 def get_fdom_names(model):
 	return map(lambda x: x.getName(), model.getFailoverDomains())
 
+def get_svc_recovery_info(svc, model, hmap):
+	try:
+		hmap['fdoms'] = get_fdom_names(model)
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('getServiceInfo1: %r %s' % (e, str(e)))
+		hmap['fdoms'] = list()
+
+	try:
+		hmap['domain'] = svc.getAttribute('domain')
+	except:
+		hmap['domain'] = None
+
+	try:
+		hmap['recovery'] = svc.getAttribute('recovery')
+	except:
+		hmap['recovery'] = None
+
+	try:
+		hmap['max_restarts'] = svc.getAttribute('max_restarts')
+		if not hmap['max_restarts']:
+			hmap['max_restarts'] = 0
+	except:
+		hmap['max_restarts'] = 0
+
+	try:
+		hmap['restart_expire_time'] = svc.getAttribute('restart_expire_time')
+		if not hmap['restart_expire_time']:
+			hmap['restart_expire_time'] = 0
+	except:
+		hmap['restart_expire_time'] = 0
+
+	try:
+		if int(svc.getAttribute('exclusive')):
+			hmap['exclusive'] = 'true'
+		else:
+			hmap['exclusive'] = 'false'
+	except:
+		hmap['exclusive'] = 'false'
 
 def getServiceInfo(self, status, model, req):
 	root_uuid = 'toplevel'
@@ -332,18 +370,11 @@
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('getServiceInfo0: no model: %r' % model)
 		return {}
+	cluname = fvars['clustername'] or model.getClusterName()
 
 	#set up struct for service config page
 	hmap = {}
 
-	try:
-		cluname = fvars['clustername'] or model.getClusterName()
-		hmap['fdoms'] = get_fdom_names(model)
-	except Exception, e:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('getServiceInfo1: %r %s' % (e, str(e)))
-		hmap['fdoms'] = list()
-
 	hmap['root_uuid'] = root_uuid
 	# uuids for the service page needed when new resources are created
 	hmap['uuid_list'] = map(lambda x: make_uuid('resource'), xrange(30))
@@ -412,37 +443,7 @@
 	# first get service by name from model
 
 	svc = model.getService(servicename)
-	try:
-		hmap['domain'] = svc.getAttribute('domain')
-	except:
-		hmap['domain'] = None
-
-	try:
-		hmap['recovery'] = svc.getAttribute('recovery')
-	except:
-		hmap['recovery'] = None
-
-	try:
-		hmap['max_restarts'] = svc.getAttribute('max_restarts')
-		if not hmap['max_restarts']:
-			hmap['max_restarts'] = 0
-	except:
-		hmap['max_restarts'] = 0
-
-	try:
-		hmap['restart_expire_time'] = svc.getAttribute('restart_expire_time')
-		if not hmap['restart_expire_time']:
-			hmap['restart_expire_time'] = 0
-	except:
-		hmap['restart_expire_time'] = 0
-
-	try:
-		if int(svc.getAttribute('exclusive')):
-			hmap['exclusive'] = 'true'
-		else:
-			hmap['exclusive'] = 'false'
-	except:
-		hmap['exclusive'] = 'false'
+	get_svc_recovery_info(svc, model, hmap)
 
 	resource_list = list()
 	if svc is not None:
@@ -601,6 +602,9 @@
 			clumap['os_minor'] = os_minor
 			if os_minor > 1:
 				clumap['vm_migration_choice'] = True
+			if os_minor > 2:
+				clumap['has_fence_ssh'] = True
+				clumap['has_ignore_undef_fence'] = True
 		elif cluster_os.find('Nahant') != -1:
 			clumap['os_major'] = 4
 			os_minor = int(cluster_os[cluster_os.find('Update ') + 7])
@@ -659,6 +663,7 @@
 		clumap['pjd'] = pjd
 		#post fail delay
 		clumap['pfd'] = pfd
+		clumap['skip_undefined'] = fdp.getSkipUndefined()
 
 		#-------------
 		#if multicast
@@ -1552,6 +1557,7 @@
 	attrs = vm.getAttributes()
 	if attrs:
 		vm_map.update(attrs)
+	get_svc_recovery_info(vm, model, vm_map)
 	return vm_map
 
 def getResourcesInfo(self, model, request):
--- conga/luci/site/luci/Extensions/LuciValidation.py	2008/11/10 21:02:44	1.9.2.3
+++ conga/luci/site/luci/Extensions/LuciValidation.py	2009/02/17 20:49:01	1.9.2.4
@@ -867,6 +867,7 @@
 	elif not run_xvmd:
 		model.delFenceXVM()
 
+	fd = None
 	try:
 		fd = model.getFenceDaemonPtr()
 		old_pj_delay = fd.getPostJoinDelay()
@@ -882,6 +883,12 @@
 			luci_log.debug_verbose('Unable to update fence daemon properties: %r %s' % (e, str(e)))
 		errors.append('An error occurred while attempting to update fence daemon properties: %s' % str(e))
 
+	skip_undef = form.has_key('skip_undefined')
+	if skip_undef is True:
+		fd.setSkipUndefined(True)
+	else:
+		fd.setSkipUndefined(False)
+
 	if len(errors) > 0:
 		return (False, {'errors': errors })
 
--- conga/luci/site/luci/Extensions/ResourceHandler.py	2008/05/12 18:04:12	1.2.2.6
+++ conga/luci/site/luci/Extensions/ResourceHandler.py	2009/02/17 20:49:01	1.2.2.7
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 Red Hat, Inc.
+# Copyright (C) 2006-2009 Red Hat, Inc.
 #
 # This program is free software; you can redistribute
 # it and/or modify it under the terms of version 2 of the
@@ -41,13 +41,13 @@
 
 def generate_fsid(model, name):
 	import binascii
-	from random import random
+	from random import randrange
 	fsid_list = get_fsid_list(model)
 
 	fsid = binascii.crc32(name) & 0xffff
 	dupe = fsid in fsid_list
 	while dupe is True:
-		fsid = (fsid + random.randrange(1, 0xfffe)) & 0xffff
+		fsid = (fsid + randrange(1, 0xfffe)) & 0xffff
 		dupe = fsid in fsid_list
 	return fsid
 
--- conga/luci/site/luci/Extensions/ClusterModel/FenceDaemon.py	2008/03/25 01:27:13	1.2.2.2
+++ conga/luci/site/luci/Extensions/ClusterModel/FenceDaemon.py	2009/02/17 20:49:02	1.2.2.3
@@ -33,6 +33,16 @@
     val = self.getAttribute('clean_start')
     return val
 
+  def getSkipUndefined(self):
+    val = self.getAttribute('skip_undefined')
+    return val
+
+  def setSkipUndefined(self, val):
+    if val:
+      self.addAttribute('skip_undefined', '1')
+    else:
+      self.removeAttribute('skip_undefined')
+
   def setPostJoinDelay(self, delay):
     self.addAttribute('post_join_delay', delay)
 
--- conga/luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py	2008/03/25 01:27:13	1.5.4.1
+++ conga/luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py	2009/02/17 20:49:02	1.5.4.2
@@ -29,6 +29,8 @@
 	'fence_drac':			'Dell DRAC',
 	'fence_rsa':			'IBM RSA II Device',
 	'fence_rps10':			'RPS10 Serial Switch',
+	'fence_lpar':			'LPAR Fencing',
+	'fence_vmware':			'VMware Fencing',
 	'fence_manual':			'Manual Fencing'
 }
 
@@ -45,6 +47,8 @@
 	'fence_bullpap':		True,
 	'fence_xvm':			True,
 	'fence_scsi':			True,
+	'fence_lpar':			True,
+	'fence_vmware':			True,
 	'fence_ilo':			False,
 	'fence_ipmilan':		False,
 	'fence_drac':			False,
@@ -86,6 +90,8 @@
 	'fence_bullpap':		( 'domain' ),
 	'fence_xvm':			( 'domain' ),
 	'fence_scsi':			( 'node' ),
+	'fence_lpar':			( 'partition' ),
+	'fence_vmware':			( 'port' ),
 	'fence_ilo':			( ),
 	'fence_ipmilan':		( ),
 	'fence_drac':			( ),
@@ -117,6 +123,10 @@
 		( 'name', 'ipaddr', 'login', 'passwd' ),
 	'fence_xvm':
 		( 'name' ),
+	'fence_lpar':
+		( 'name', 'ipaddr', 'login', 'passwd' ),
+	'fence_vmware':
+		( 'name', 'ipaddr', 'login', 'passwd', 'vmlogin', 'vmpasswd' ),
 	'fence_scsi':
 		( 'name' ),
 	'fence_ilo':
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2008/11/10 21:02:44	1.5.2.6
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py	2009/02/17 20:49:02	1.5.2.7
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 Red Hat, Inc.
+# Copyright (C) 2006-2009 Red Hat, Inc.
 #
 # This program is free software; you can redistribute
 # it and/or modify it under the terms of version 2 of the
@@ -1101,6 +1101,25 @@
           continue
       self.__removeReferences(tagobj, t)
 
+  def get_expected_votes(self):
+    node_votes = 0
+    qdisk_votes = 0
+
+    if self.quorumd_ptr is not None:
+      try:
+        qdisk_votes = int(self.quorumd_ptr.getVotes())
+      except:
+        qdisk_votes = 0
+
+    for i in self.getNodes():
+      try:
+        cur_votes = int(i.getVotes())
+      except:
+        cur_votes = 1
+      node_votes += cur_votes
+
+    return node_votes + qdisk_votes
+
   def updateReferences(self):
     self.__updateReferences(self.cluster_ptr)
   def __updateReferences(self, level):
@@ -1126,21 +1145,25 @@
     return True
 
   def check_two_node(self):
-    if self.getLockType() == DLM_TYPE and self.quorumd_ptr is None:
-      clusternodes_count = len(self.clusternodes_ptr.getChildren())
+    if self.getLockType() == DLM_TYPE:
+      clusternodes_count = len(self.getNodes())
       #Make certain that there is a cman tag in the file
       #If missing, it will not hurt to add it here
       if self.CMAN_ptr is None:
         cman = Cman()
         self.cluster_ptr.addChild(cman)
         self.CMAN_ptr = cman
-      if clusternodes_count == 2:
-        self.CMAN_ptr.addAttribute('two_node', '1')
-        self.CMAN_ptr.addAttribute('expected_votes', '1')
-      else:
-        if self.CMAN_ptr.getAttribute('expected_votes') in ('0', '1'):
+
+      if not self.quorumd_ptr:
+        if clusternodes_count == 2:
+          self.CMAN_ptr.addAttribute('two_node', '1')
+          self.CMAN_ptr.addAttribute('expected_votes', '1')
+        else:
+          self.CMAN_ptr.removeAttribute('two_node')
           self.CMAN_ptr.removeAttribute('expected_votes')
+      else:
         self.CMAN_ptr.removeAttribute('two_node')
+        self.CMAN_ptr.addAttribute('expected_votes', str(self.get_expected_votes()))
 
   def dual_power_fence_check(self):
     # if 2 or more power controllers reside in the same fence level,
--- conga/luci/site/luci/Extensions/ClusterModel/QuorumD.py	2008/03/25 01:27:13	1.2.2.2
+++ conga/luci/site/luci/Extensions/ClusterModel/QuorumD.py	2009/02/17 20:49:02	1.2.2.3
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 Red Hat, Inc.
+# Copyright (C) 2006-2009 Red Hat, Inc.
 #
 # This program is free software; you can redistribute
 # it and/or modify it under the terms of version 2 of the
@@ -13,3 +13,12 @@
   def __init__(self):
     TagObject.__init__(self)
     self.TAG_NAME = TAG_NAME
+
+  def getVotes(self):
+    try:
+      num_votes = self.getAttribute('votes')
+      if num_votes is not None:
+        return int(num_votes)
+    except:
+      pass
+    return 0
Binary files /cvs/cluster/conga/luci/site/luci/var/Data.fs	2008/12/10 21:02:01	1.20.2.27 and /cvs/cluster/conga/luci/site/luci/var/Data.fs	2009/02/17 20:49:02	1.20.2.28 differ
rcsdiff: /cvs/cluster/conga/luci/site/luci/var/Data.fs: diff failed




More information about the Cluster-devel mailing list