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:06:14 -0000	[thread overview]
Message-ID: <20070216020614.28720.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-02-16 02:06:11

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 

Log message:
	Support for the new lvm rgmanager script

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.189&r2=1.190
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LVM.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ModelBuilder.py.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.239&r2=1.240

--- conga/luci/cluster/form-macros	2007/02/15 22:44:02	1.189
+++ conga/luci/cluster/form-macros	2007/02/16 02:06:08	1.190
@@ -4306,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 16:00:36	1.32
+++ conga/luci/cluster/resource-form-macros	2007/02/16 02:06:08	1.33
@@ -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 16:00:36	1.31
+++ conga/luci/cluster/resource_form_handlers.js	2007/02/16 02:06:08	1.32
@@ -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
--- conga/luci/site/luci/Extensions/LVM.py
+++ -	2007-02-16 02:06:13.283361000 +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
--- conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/15 22:44:02	1.24
+++ conga/luci/site/luci/Extensions/ModelBuilder.py	2007/02/16 02:06:09	1.25
@@ -26,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
@@ -67,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,
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/15 22:44:02	1.239
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/16 02:06:09	1.240
@@ -29,6 +29,7 @@
 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
@@ -6895,9 +6896,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)
@@ -6994,9 +6995,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)
@@ -7093,9 +7094,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)
@@ -7192,9 +7193,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)
@@ -7301,9 +7302,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)
@@ -7313,6 +7314,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,
@@ -7326,6 +7401,7 @@
 	'postgres-8': addPostgres8,
 	'apache': addApache,
 	'openldap': addOpenLDAP,
+	'lvm': addLVM,
 	'mysql': addMySQL
 }
 



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

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16  2:06 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:12 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=20070216020614.28720.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.