Skip to contentSkip to conversation

conga/luci cluster/cluster_config-macros clust ...

Cluster-devel [email protected] 1 participant 1 message Feb 17, 2009

lore
Share & tools
lore
#0 lore raw

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

luci/cluster/cluster_config-macros +12 -0
@@ -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>
luci/cluster/fence-macros +294 -0

348 lines not on this page · raw message

luci/cluster/validate_fence.js +14 -3
@@ -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) {
 			}
 		}
 	}
luci/plone-custom/conga_ajax.js +10 -1
@@ -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;
 				}
luci/plone-custom/validate_auth.js +13 -0
@@ -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) {
luci/site/luci/Extensions/FenceHandler.py +194 -0

230 lines not on this page · raw message

luci/site/luci/Extensions/LuciClusterInfo.py +46 -40

129 lines not on this page · raw message

luci/site/luci/Extensions/LuciValidation.py +7 -0
@@ -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 })
 
luci/site/luci/Extensions/ResourceHandler.py +3 -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
@@ -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
 
luci/site/luci/Extensions/ClusterModel/FenceDaemon.py +10 -0
@@ -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)
 
luci/site/luci/Extensions/ClusterModel/FenceDeviceAttr.py +10 -0
@@ -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':
luci/site/luci/Extensions/ClusterModel/ModelBuilder.py +31 -8
@@ -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,
luci/site/luci/Extensions/ClusterModel/QuorumD.py +10 -1
@@ -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