All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
Date: 16 Feb 2007 02:12:47 -0000	[thread overview]
Message-ID: <20070216021247.13254.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe at sourceware.org	2007-02-16 02:12:46

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/site/luci/Extensions: ModelBuilder.py cluster_adapters.py 
Added files:
	luci/site/luci/Extensions: LVM.py Totem.py 

Log message:
	- Add support for the <totem> tag
	- Add support for the LVM resource agent
	- Fixes for the other new resource agents

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.10&r2=1.176.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.31.2.1&r2=1.31.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.29.2.1&r2=1.29.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LVM.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Totem.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.19.2.3&r2=1.19.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.227.2.7&r2=1.227.2.8

--- conga/luci/cluster/form-macros	2007/02/14 15:06:15	1.176.2.10
+++ conga/luci/cluster/form-macros	2007/02/16 02:12:46	1.176.2.11
@@ -755,6 +755,16 @@
 
 						<tr class="systemsTable">
 							<td class="systemsTable">
+								<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#send_join', 55, 65);">Maximum time to wait before sending a join message</a> (ms)
+							</td>
+							<td class="systemsTable">
+								<input type="text" size="10" name="send_join"
+									tal:attributes="value string:0" />
+							</td>
+						</tr>
+
+						<tr class="systemsTable">
+							<td class="systemsTable">
 								<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#consensus', 55, 65);">Consensus Timeout</a> (ms)
 							</td>
 							<td class="systemsTable">
@@ -4296,6 +4306,10 @@
 		<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
 	</tal:block>
 
+	<tal:block tal:condition="python: type == 'lvm'">
+		<div metal:use-macro="here/resource-form-macros/macros/lvm_macro" />
+	</tal:block>
+
 	<tal:block tal:condition="python: type == 'postgres-8'">
 		<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
 	</tal:block>
--- conga/luci/cluster/resource-form-macros	2007/02/08 15:59:20	1.31.2.1
+++ conga/luci/cluster/resource-form-macros	2007/02/16 02:12:46	1.31.2.2
@@ -122,6 +122,7 @@
 			<tal:block
 				tal:condition="python: os_version and os_version == 'rhel4'">
 				<option name="APACHE" value="APACHE">Apache</option>
+				<option name="LVM" value="LVM">LVM</option>
 				<option name="MYSQL" value="MYSQL">MySQL</option>
 				<option name="OPENLDAP" value="OPENLDAP">Open LDAP</option>
 				<option name="POSTGRES-8" value="POSTGRES-8">
@@ -143,14 +144,12 @@
 		<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-
-		<tal:block tal:condition="python: os_version and os_version == 'rhel4'">
-			<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
-			<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
-			<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
-			<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
-			<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
-		</tal:block>
+		<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/lvm_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
 	</div>
 </div>
 
@@ -173,6 +172,7 @@
 			<tal:block
 				tal:condition="python: os_version and os_version == 'rhel4'">
 				<option name="APACHE" value="APACHE">Apache</option>
+				<option name="LVM" value="LVM">LVM</option>
 				<option name="MYSQL" value="MYSQL">MySQL</option>
 				<option name="OPENLDAP" value="OPENLDAP">Open LDAP</option>
 				<option name="POSTGRES-8" value="POSTGRES-8">
@@ -217,6 +217,12 @@
 		<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/lvm_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
 	</div>
 </div>
 
@@ -874,7 +880,7 @@
 				<input type="text" size="20" name="config_file"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/config_file | string:/var/lib/pgsql/data/postgresql.conf" />
+						value res/attrs/config_file | string:/var/lib/pgsql/data/postgresql.conf" />
 			</td>
 		</tr>
 
@@ -884,7 +890,7 @@
 				<input type="text" size="20" name="postmaster_user"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/postmaster_user | string:postgres" />
+						value res/attrs/postmaster_user | string:postgres" />
 			</td>
 		</tr>
 
@@ -894,7 +900,7 @@
 				<input type="text" size="20" name="postmaster_options"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/postmaster_options | nothing" />
+						value res/attrs/postmaster_options | nothing" />
 			</td>
 		</tr>
 
@@ -904,7 +910,7 @@
 				<input type="text" size="20" name="shutdown_wait"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/shutdown_wait | string:0" />
+						value res/attrs/shutdown_wait | string:0" />
 			</td>
 		</tr>
 	</table>
@@ -967,7 +973,7 @@
 				<input type="text" size="20" name="server_root"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/server_root | string:/etc/httpd" />
+						value res/attrs/server_root | string:/etc/httpd" />
 			</td>
 		</tr>
 
@@ -977,7 +983,7 @@
 				<input type="text" size="20" name="config_file"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/config_file | string:conf/httpd.conf" />
+						value res/attrs/config_file | string:conf/httpd.conf" />
 			</td>
 		</tr>
 
@@ -987,7 +993,7 @@
 				<input type="text" size="20" name="httpd_options"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/httpd_options | nothing" />
+						value res/attrs/httpd_options | nothing" />
 			</td>
 		</tr>
 
@@ -997,7 +1003,7 @@
 				<input type="text" size="20" name="shutdown_wait"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/shutdown_wait | string:0" />
+						value res/attrs/shutdown_wait | string:0" />
 			</td>
 		</tr>
 	</table>
@@ -1060,7 +1066,7 @@
 				<input type="text" size="20" name="config_file"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/config_file | string:/etc/openldap/slapd.conf" />
+						value res/attrs/config_file | string:/etc/openldap/slapd.conf" />
 			</td>
 		</tr>
 
@@ -1070,7 +1076,7 @@
 				<input type="text" size="20" name="url_list"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/url_list | string:ldap:///" />
+						value res/attrs/url_list | string:ldap:///" />
 			</td>
 		</tr>
 
@@ -1080,7 +1086,7 @@
 				<input type="text" size="20" name="slapd_options"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/slapd_options | nothing" />
+						value res/attrs/slapd_options | nothing" />
 			</td>
 		</tr>
 
@@ -1090,10 +1096,83 @@
 				<input type="text" size="20" name="shutdown_wait"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/shutdown_wait | string:0" />
+						value res/attrs/shutdown_wait | string:0" />
+			</td>
+		</tr>
+	</table>
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
+	</form>
+</div>
+
+<div class="rescfg" name="LVM"
+	tal:attributes="id res/name | nothing" metal:define-macro="lvm_macro">
+
+	<p class="reshdr">LVM Resource Configuration</p>
+
+	<form method="post"
+		tal:attributes="name res/parent_uuid | nothing"
+		tal:define="editDisabled resourceIsRef | nothing">
+
+	<input name="immutable" type="hidden" value="true"
+		tal:condition="editDisabled" />
+
+	<input name="edit" type="hidden" value="true"
+		tal:condition="python: ptype == '33' and True or False" />
+
+	<input name="pagetype" type="hidden"
+		tal:attributes="value python: ptype" />
+
+	<input name="global" type="hidden"
+		tal:attributes="value resourceIsRef | nothing" />
+
+	<input name="parent_uuid" type="hidden"
+		tal:attributes="value res/parent_uuid | nothing" />
+
+	<input name="uuid" type="hidden"
+		tal:attributes="value res/uuid | nothing" />
+
+	<input name="tree_level" type="hidden"
+		tal:attributes="value res/indent_ctr | string:0" />
+
+	<input name="clustername" type="hidden"
+		tal:attributes="
+			value request/clustername | request/form/clustername | nothing" />
+
+	<input name="oldname" type="hidden"
+		tal:attributes="value res/name | nothing" />
+
+	<input name="type" type="hidden" value="lvm" />
+
+	<table class="systemsTable">
+		<tr class="systemsTable">
+			<td class="systemsTable">Name</td>
+			<td class="systemsTable">
+				<input type="text" size="20" name="resourceName"
+					tal:attributes="
+						disabled python: editDisabled;
+						value res/name | nothing" />
+			</td>
+		</tr>
+		<tr class="systemsTable">
+			<td class="systemsTable">Volume Group Name</td>
+			<td class="systemsTable">
+				<input type="text" size="20" name="vg_name"
+					tal:attributes="
+						disabled python: editDisabled;
+						value res/attrs/vg_name | nothing" />
+			</td>
+		</tr>
+		<tr class="systemsTable">
+			<td class="systemsTable">Logical Volume Name</td>
+			<td class="systemsTable">
+				<input type="text" size="20" name="lv_name"
+					tal:attributes="
+						disabled python: editDisabled;
+						value res/attrs/lv_name | nothing" />
 			</td>
 		</tr>
 	</table>
+
 	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
@@ -1153,7 +1232,7 @@
 				<input type="text" size="20" name="config_file"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/config_file | string:/etc/my.cnf" />
+						value res/attrs/config_file | string:/etc/my.cnf" />
 			</td>
 		</tr>
 
@@ -1163,7 +1242,7 @@
 				<input type="text" size="20" name="listen_address"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/listen_address | nothing" />
+						value res/attrs/listen_address | nothing" />
 			</td>
 		</tr>
 
@@ -1173,7 +1252,7 @@
 				<input type="text" size="20" name="mysqld_options"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/mysqld_options | nothing" />
+						value res/attrs/mysqld_options | nothing" />
 			</td>
 		</tr>
 
@@ -1183,7 +1262,7 @@
 				<input type="text" size="20" name="shutdown_wait"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/shutdown_wait | string:0" />
+						value res/attrs/shutdown_wait | string:0" />
 			</td>
 		</tr>
 	</table>
@@ -1246,7 +1325,7 @@
 				<input type="text" size="20" name="config_file"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/config_file | string:/etc/tomcat5/tomcat5.conf" />
+						value res/attrs/config_file | string:/etc/tomcat5/tomcat5.conf" />
 			</td>
 		</tr>
 
@@ -1256,7 +1335,7 @@
 				<input type="text" size="20" name="tomcat_user"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/tomcat_user | string:tomcat" />
+						value res/attrs/tomcat_user | string:tomcat" />
 			</td>
 		</tr>
 
@@ -1266,7 +1345,7 @@
 				<input type="text" size="20" name="catalina_options"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/catalina_options | nothing" />
+						value res/attrs/catalina_options | nothing" />
 			</td>
 		</tr>
 
@@ -1276,7 +1355,7 @@
 				<input type="text" size="20" name="catalina_base"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/catalina_base | string:/usr/share/tomcat5" />
+						value res/attrs/catalina_base | string:/usr/share/tomcat5" />
 			</td>
 		</tr>
 
@@ -1286,7 +1365,7 @@
 				<input type="text" size="20" name="shutdown_wait"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/shutdown_wait | string:30" />
+						value res/attrs/shutdown_wait | string:30" />
 			</td>
 		</tr>
 	</table>
--- conga/luci/cluster/resource_form_handlers.js	2007/02/08 15:59:20	1.29.2.1
+++ conga/luci/cluster/resource_form_handlers.js	2007/02/16 02:12:46	1.29.2.2
@@ -118,6 +118,11 @@
 	return (errors);
 }
 
+function validate_lvm(form) {
+	var errors = new Array();
+	return (errors);
+}
+
 function validate_openldap(form) {
 	var errors = new Array();
 	return (errors);
@@ -258,6 +263,7 @@
 form_validators['postgres-8'] = validate_postgres8;
 form_validators['openldap'] = validate_openldap;
 form_validators['mysql'] = validate_mysql;
+form_validators['lvm'] = validate_lvm;
 
 function check_form(form) {
 	var valfn = form_validators[form.type.value];
/cvs/cluster/conga/luci/site/luci/Extensions/LVM.py,v  -->  standard output
revision 1.1.2.1
--- conga/luci/site/luci/Extensions/LVM.py
+++ -	2007-02-16 02:12:46.864267000 +0000
@@ -0,0 +1,15 @@
+import string
+from TagObject import TagObject
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
+
+TAG_NAME = "lvm"
+RESOURCE_TYPE = _("LVM")
+
+class LVM(BaseResource):
+  def __init__(self):
+    BaseResource.__init__(self)
+    self.TAG_NAME = TAG_NAME
+    self.resource_type = RESOURCE_TYPE
/cvs/cluster/conga/luci/site/luci/Extensions/Totem.py,v  -->  standard output
revision 1.1.2.1
--- conga/luci/site/luci/Extensions/Totem.py
+++ -	2007-02-16 02:12:46.949829000 +0000
@@ -0,0 +1,9 @@
+import string
+from TagObject import TagObject
+
+TAG_NAME = "totem"
+
+class Totem(TagObject):
+  def __init__(self):
+    TagObject.__init__(self)
+    self.TAG_NAME = TAG_NAME 
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/08 03:46:51	1.19.2.3
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/16 02:12:46	1.19.2.4
@@ -17,6 +17,7 @@
 from Method import Method
 from Device import Device
 from Cman import Cman
+from Totem import Totem
 from Gulm import Gulm
 from Lockserver import Lockserver
 from Ip import Ip
@@ -25,6 +26,12 @@
 from NFSExport import NFSExport
 from Fs import Fs
 from Samba import Samba
+from Apache import Apache
+from LVM import LVM
+from MySQL import MySQL
+from OpenLDAP import OpenLDAP
+from Postgres8 import Postgres8
+from Tomcat5 import Tomcat5
 from Multicast import Multicast
 from FenceDaemon import FenceDaemon
 from FenceXVMd import FenceXVMd
@@ -52,6 +59,7 @@
            'fencedevices':FenceDevices,
            'method':Method,
            'cman':Cman,
+           'totem':Totem,
            'gulm':Gulm,
            'lockserver':Lockserver,
            'rm':Rm,
@@ -65,6 +73,12 @@
            'ip':Ip,
            'fs':Fs,
            'smb':Samba,
+           'apache':Apache,
+           'lvm':LVM,
+           'mysql':MySQL,
+           'openldap':OpenLDAP,
+           'postgres-8':Postgres8,
+           'tomcat-5':Tomcat5,
            'fence_daemon':FenceDaemon,
            'multicast':Multicast,
            'clusterfs':Clusterfs,
@@ -91,6 +105,7 @@
 GULM_TAG_STR="gulm"
 MCAST_STR="multicast"
 CMAN_PTR_STR="cman"
+TOTEM_PTR_STR="totem"
 QUORUMD_PTR_STR="quorumd"
 ###-----------------------------------
 
@@ -113,6 +128,7 @@
     self.cluster_ptr = None
     self.GULM_ptr = None
     self.CMAN_ptr = None
+    self.TOTEM_ptr = None
     self.clusternodes_ptr = None
     self.failoverdomains_ptr = None
     self.fencedevices_ptr = None
@@ -219,6 +235,8 @@
         self.lock_type = GULM_TYPE
       elif parent_node.nodeName == CMAN_PTR_STR:
         self.CMAN_ptr = new_object
+      elif parent_node.nodeName == TOTEM_PTR_STR:
+        self.TOTEM_ptr = new_object
       elif parent_node.nodeName == MCAST_STR:
         self.usesMulticast = True
       elif parent_node.nodeName == FENCE_XVMD_STR:
@@ -597,6 +615,17 @@
 
     raise GeneralError('FATAL',"Couldn't find VM name %s in current list" % name)
 
+  def del_totem(self):
+    if self.TOTEM_ptr is not None:
+      self.cluster_ptr.removeChild(self.TOTEM_ptr)
+      self.TOTEM_ptr = None
+
+  def add_totem(self, obj):
+    self.del_totem()
+    if self.TOTEM_ptr is None:
+      self.cluster_ptr.addChild(obj)
+      self.TOTEM_ptr = obj
+
   def hasFenceXVM(self):
     return self.fence_xvmd_ptr is not None
 
@@ -796,6 +825,12 @@
   def getGULMPtr(self):
     return self.GULM_ptr
 
+  def getCMANPtr(self):
+    return self.CMAN_ptr
+
+  def getTotemPtr(self):
+    return self.TOTEM_ptr
+
   def getLockServer(self, name):
     children = self.GULM_ptr.getChildren()
     for child in children:
@@ -839,6 +874,8 @@
     if self.lock_type == DLM_TYPE:
       #remove <cman>
       self.cluster_ptr.removeChild(self.CMAN_ptr)
+      if self.TOTEM_ptr is not None:
+        self.del_totem()
       self.CMAN_ptr = None
 
       #add gulm tag
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/13 19:50:39	1.227.2.7
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/16 02:12:46	1.227.2.8
@@ -29,11 +29,13 @@
 from FenceXVMd import FenceXVMd
 from Script import Script
 from Samba import Samba
+from LVM import LVM
 from QuorumD import QuorumD
 from Heuristic import Heuristic
 from clusterOS import resolveOSType
 from Fence import Fence
 from Method import Method
+from Totem import Totem
 from Device import Device
 from FenceHandler import validateNewFenceDevice, FENCE_OPTS, validateFenceDevice, validate_fenceinstance
 from GeneralError import GeneralError
@@ -1183,6 +1185,377 @@
 			luci_log.debug_verbose('unable to update general properties: %s' % str(e))
 			errors.append('Unable to update the cluster configuration.')
 
+	try:
+		cluster_version = form['cluster_version'].strip()
+		if cluster_version != 'rhel5':
+			raise Exception, 'not rhel5'
+	except:
+		if len(errors) > 0:
+			return (False, {'errors': errors})
+		return (True, {})
+
+#	totem = model.getTotemPtr()
+#	if totem is None:
+#		cp = model.getClusterPtr()
+#		totem = Totem()
+#		cp.addChild(totem)
+	totem = Totem()
+
+	if form.has_key('secauth'):
+		totem.addAttribute('secauth', '1')
+	else:
+		totem.addAttribute('secauth', '0')
+
+	try:
+		rrp_mode = form['rrp_mode'].strip().lower()
+		if not rrp_mode:
+			raise KeyError, 'rrp_mode'
+		if rrp_mode != 'none' and rrp_mode != 'active' and 'rrp_mode' != 'passive':
+			raise Exception, '%s is an invalid value for redundant ring protocol mode' % rrp_mode
+		totem.addAttribute('rrp_mode', str(rrp_mode))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('rrp_mode')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		net_mtu = form['net_mtu'].strip()
+		if not net_mtu:
+			raise KeyError, 'net_mtu'
+		net_mtu = int(net_mtu)
+		if net_mtu < 1:
+			raise ValueError, '%d is an invalid value for network MTU' % net_mtu
+		totem.addAttribute('net_mtu', str(net_mtu))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('net_mtu')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		threads = form['threads'].strip()
+		if not threads:
+			raise KeyError, 'threads'
+		threads = int(threads)
+		if threads < 0:
+			raise ValueError, '%d is an invalid value for number of threads' % threads
+		totem.addAttribute('threads', str(threads))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('threads')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		vsftype = form['vsftype'].strip().lower()
+		if not vsftype:
+			raise KeyError, 'vsftype'
+		if vsftype != 'none' and vsftype != 'ykd':
+			raise ValueError, '%s is an invalid value for virtual synchrony type' % vsftype
+		totem.addAttribute('vsftype', str(vsftype))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('vsftype')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		token = form['token'].strip()
+		if not token:
+			raise KeyError, 'token'
+		token = int(token)
+		if token < 1:
+			raise ValueError, '%d is an invalid value for token timeout' % token
+		totem.addAttribute('token', str(token))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('token')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		token_retransmit = form['token_retransmit'].strip()
+		if not token_retransmit:
+			raise KeyError, 'token_retransmit'
+		token_retransmit = int(token_retransmit)
+		if token_retransmit < 1:
+			raise ValueError, '%d is an invalid value for token retransmit' % token_retransmit
+		totem.addAttribute('token_retransmit', str(token_retransmit))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('token_retransmit')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		hold = form['hold'].strip()
+		if not hold:
+			raise KeyError, 'hold'
+		hold = int(hold)
+		if hold < 1:
+			raise ValueError, '%d is not a valid value for hold token timeout' % hold
+		totem.addAttribute('hold', str(hold))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('hold')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		retransmits_before_loss = form['retransmits_before_loss'].strip()
+		if not retransmits_before_loss:
+			raise KeyError, 'retransmits_before_loss'
+		retransmits_before_loss = int(retransmits_before_loss)
+		if retransmits_before_loss < 1:
+			raise ValueError, '%d is an invalid value for number of retransmits before loss' % retransmits_before_loss
+		totem.addAttribute('retransmits_before_loss', str(retransmits_before_loss))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('retransmits_before_loss')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		join = form['join'].strip()
+		if not join:
+			raise KeyError, 'join'
+		join = int(join)
+		if join < 1:
+			raise ValueError, '%d is an invalid value for join timeout' % join
+		totem.addAttribute('join', str(join))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('join')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		send_join = form['send_join'].strip()
+		if not send_join:
+			raise KeyError, 'send_join'
+		send_join = int(send_join)
+		if send_join < 0:
+			raise ValueError, '%d is an invalid value for time to wait before sending a join message' % send_join
+		totem.addAttribute('send_join', str(send_join))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('send_join')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		consensus = form['consensus'].strip()
+		if not consensus:
+			raise KeyError, 'consensus'
+		consensus = int(consensus)
+		if consensus < 1:
+			raise ValueError, '%d is an invalid value for consensus timeout' % consensus
+		totem.addAttribute('consensus', str(consensus))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('consensus')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		merge = form['merge'].strip()
+		if not merge:
+			raise KeyError, 'merge'
+		merge = int(merge)
+		if merge < 1:
+			raise ValueError, '%d is an invalid value for merge detection timeout' % merge
+		totem.addAttribute('merge', str(merge))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('merge')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		downcheck = form['downcheck'].strip()
+		if not downcheck:
+			raise KeyError, 'downcheck'
+		downcheck = int(downcheck)
+		if downcheck < 1:
+			raise ValueError, '%d is an invalid value for interface down check timeout' % downcheck
+		totem.addAttribute('downcheck', str(downcheck))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('downcheck')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		fail_to_recv_const = form['fail_to_recv_const'].strip()
+		if not fail_to_recv_const:
+			raise KeyError, 'fail_to_recv_const'
+		fail_to_recv_const = int(fail_to_recv_const)
+		if fail_to_recv_const < 1:
+			raise ValueError, '%d is an invalid value for fail to receive constant' % fail_to_recv_const
+		totem.addAttribute('fail_to_recv_const', str(fail_to_recv_const))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('fail_to_recv_const')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		seqno_unchanged_const = form['seqno_unchanged_const'].strip()
+		if not seqno_unchanged_const:
+			raise KeyError, 'seqno_unchanged_const'
+		seqno_unchanged_const = int(seqno_unchanged_const)
+		if seqno_unchanged_const < 1:
+			raise ValueError, '%d is an invalid value for rotations with no multicast traffic before merge detection timeout started' % seqno_unchanged_const
+		totem.addAttribute('seqno_unchanged_const', str(seqno_unchanged_const))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('seqno_unchanged_const')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		heartbeat_failures_allowed = form['heartbeat_failures_allowed'].strip()
+		if not heartbeat_failures_allowed:
+			raise KeyError, 'heartbeat_failures_allowed'
+		heartbeat_failures_allowed = int(heartbeat_failures_allowed)
+		if heartbeat_failures_allowed < 0:
+			raise ValueError, '%d is an invalid value for number of heartbeat failures allowed' % heartbeat_failures_allowed
+		totem.addAttribute('heartbeat_failures_allowed', str(heartbeat_failures_allowed))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('heartbeat_failures_allowed')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		max_network_delay = form['max_network_delay'].strip()
+		if not max_network_delay:
+			raise KeyError, 'max_network_delay'
+		max_network_delay = int(max_network_delay)
+		if max_network_delay < 1:
+			raise ValueError, '%d is an invalid value for maximum network delay' % max_network_delay
+		totem.addAttribute('max_network_delay', str(max_network_delay))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('max_network_delay')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		window_size = form['window_size'].strip()
+		if not window_size:
+			raise KeyError, 'window_size'
+		window_size = int(window_size)
+		if window_size < 1:
+			raise ValueError, '%d is an invalid value for window size' % window_size
+		totem.addAttribute('window_size', str(window_size))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('window_size')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		max_messages = form['max_messages'].strip()
+		if not max_messages:
+			raise KeyError, 'max_messages'
+		max_messages = int(max_messages)
+		if max_messages < 1:
+			raise ValueError, '%d is an invalid value for maximum messages' % max_messages
+		totem.addAttribute('max_messages', str(max_messages))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('max_messages')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		rrp_problem_count_timeout = form['rrp_problem_count_timeout'].strip()
+		if not rrp_problem_count_timeout:
+			raise KeyError, 'rrp_problem_count_timeout'
+		rrp_problem_count_timeout = int(rrp_problem_count_timeout)
+		if rrp_problem_count_timeout < 1:
+			raise ValueError, '%d is an invalid value for RRP problem count timeout' % rrp_problem_count_timeout
+		totem.addAttribute('rrp_problem_count_timeout', str(rrp_problem_count_timeout))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('rrp_problem_count_timeout')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		rrp_problem_count_threshold = form['rrp_problem_count_threshold'].strip()
+		if not rrp_problem_count_threshold:
+			raise KeyError, 'rrp_problem_count_threshold'
+		rrp_problem_count_threshold = int(rrp_problem_count_threshold)
+		if rrp_problem_count_threshold < 1:
+			raise ValueError, '%d is an invalid value for RRP problem count threshold' % rrp_problem_count_threshold
+		totem.addAttribute('rrp_problem_count_threshold', str(rrp_problem_count_threshold))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('rrp_problem_count_threshold')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
+	try:
+		rrp_token_expired_timeout = form['rrp_token_expired_timeout'].strip()
+		if not rrp_token_expired_timeout:
+			raise KeyError, 'rrp_token_expired_timeout'
+		rrp_token_expired_timeout = int(rrp_token_expired_timeout)
+		if rrp_token_expired_timeout < 1:
+			raise ValueError, '%d is an invalid value for RRP token expired timeout' % rrp_token_expired_timeout
+		totem.addAttribute('rrp_token_expired_timeout', str(rrp_token_expired_timeout))
+	except KeyError, e:
+		try:
+			totem.removeAttribute('rrp_token_expired_timeout')
+		except:
+			pass
+	except Exception, e:
+		errors.append(str(e))
+
 	if len(errors) > 0:
 		return (False, {'errors': errors})
 	return (True, {})
@@ -2200,7 +2573,7 @@
 	try:
 		vm_path = request.form['vmpath'].strip()
 		if not vm_path:
-			raise 'blank'
+			raise Exception, 'blank'
 	except Exception, e:
 		luci_log.debug_verbose('validateVM1: no vm path: %s' % str(e))
 		errors.append('No path to the virtual machine configuration file was given.')
@@ -6524,9 +6897,9 @@
 
 	try:
 		shutdown_wait = int(form['shutdown_wait'].strip())
-		res.addAttribute('shutdown_wait', shutdown_wait)
+		res.addAttribute('shutdown_wait', str(shutdown_wait))
 	except KeyError, e:
-		res.addAttribute('shutdown_wait', 0)
+		res.addAttribute('shutdown_wait', '0')
 	except Exception, e:
 		err = str(e)
 		errors.append(err)
@@ -6623,9 +6996,9 @@
 
 	try:
 		shutdown_wait = int(form['shutdown_wait'].strip())
-		res.addAttribute('shutdown_wait', shutdown_wait)
+		res.addAttribute('shutdown_wait', str(shutdown_wait))
 	except KeyError, e:
-		res.addAttribute('shutdown_wait', 0)
+		res.addAttribute('shutdown_wait', '0')
 	except Exception, e:
 		err = str(e)
 		errors.append(err)
@@ -6722,9 +7095,9 @@
 
 	try:
 		shutdown_wait = int(form['shutdown_wait'].strip())
-		res.addAttribute('shutdown_wait', shutdown_wait)
+		res.addAttribute('shutdown_wait', str(shutdown_wait))
 	except KeyError, e:
-		res.addAttribute('shutdown_wait', 0)
+		res.addAttribute('shutdown_wait', '0')
 	except Exception, e:
 		err = str(e)
 		errors.append(err)
@@ -6821,9 +7194,9 @@
 
 	try:
 		shutdown_wait = int(form['shutdown_wait'].strip())
-		res.addAttribute('shutdown_wait', shutdown_wait)
+		res.addAttribute('shutdown_wait', str(shutdown_wait))
 	except KeyError, e:
-		res.addAttribute('shutdown_wait', 0)
+		res.addAttribute('shutdown_wait', '0')
 	except Exception, e:
 		err = str(e)
 		errors.append(err)
@@ -6930,9 +7303,9 @@
 
 	try:
 		shutdown_wait = int(form['shutdown_wait'].strip())
-		res.addAttribute('shutdown_wait', shutdown_wait)
+		res.addAttribute('shutdown_wait', str(shutdown_wait))
 	except KeyError, e:
-		res.addAttribute('shutdown_wait', 0)
+		res.addAttribute('shutdown_wait', '0')
 	except Exception, e:
 		err = str(e)
 		errors.append(err)
@@ -6942,6 +7315,80 @@
 		return [None, None, errors]
 	return [res, model, None]
 
+def addLVM(request, form=None):
+	errors = list()
+
+	if form is None:
+		form = request.form
+
+	if not form:
+		luci_log.debug_verbose('addLVM0: form is missing')
+		return None
+
+	model = request.SESSION.get('model')
+	if not model:
+		luci_log.debug_verbose('addLVM1: model is missing')
+		return None
+
+	res = None
+	if form.has_key('edit'):
+		try:
+			oldname = form['oldname'].strip()
+			if not oldname:
+				raise Exception, 'oldname is blank.'
+			try:
+				res = getResourceForEdit(model, oldname)
+			except KeyError, e:
+				errors.append('No LVM resource named \"%s\" exists.' % oldname)
+		except Exception, e:
+			errors.append('No original name was found for this LVM resource.')
+			luci_log.debug_verbose('addLVM2: %s' % str(e))
+	else:
+		try:
+			res = LVM()
+			if not res:
+				raise Exception, 'could not create LVM object'
+		except Exception, e:
+			errors.append('An error occurred while creating a LVM resource.')
+			luci_log.debug_verbose('addLVM3: %s' % str(e))
+
+	if not res:
+		return [None, None, errors]
+
+	try:
+		name = form['resourceName'].strip()
+		if not name:
+			raise Exception, 'No name was given for this LVM resource.'
+		res.addAttribute('name', name)
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addLVM4: %s' % err)
+
+	try:
+		vg_name = form['vg_name'].strip()
+		if not vg_name:
+			raise KeyError, 'No volume group name was given.'
+		res.addAttribute('vg_name', vg_name)
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addLVM5: %s' % err)
+
+	try:
+		lv_name = form['lv_name'].strip()
+		if not lv_name:
+			raise KeyError, 'No logical volume name was given.'
+		res.addAttribute('lv_name', lv_name)
+	except Exception, e:
+		err = str(e)
+		errors.append(err)
+		luci_log.debug_verbose('addLVM6: %s' % err)
+
+	if len(errors) > 1:
+		return [None, None, errors]
+	return [res, model, None]
+
 resourceAddHandler = {
 	'ip': addIp,
 	'fs': addFs,
@@ -6955,6 +7402,7 @@
 	'postgres-8': addPostgres8,
 	'apache': addApache,
 	'openldap': addOpenLDAP,
+	'lvm': addLVM,
 	'mysql': addMySQL
 }
 



             reply	other threads:[~2007-02-16  2:12 UTC|newest]

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

Reply instructions:

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

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

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

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

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

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

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