All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-02-08 16:00 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-02-08 16:00 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-02-08 16:00:36

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

Log message:
	Support fdoms, recovery, and running exclusive for services.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.183&r2=1.184
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.235&r2=1.236

--- conga/luci/cluster/form-macros	2007/02/08 05:05:21	1.183
+++ conga/luci/cluster/form-macros	2007/02/08 16:00:36	1.184
@@ -3820,6 +3820,41 @@
 				<p class="reshdr">Create a Virtual Machine Service</p>
 			</td></tr>
 		<tfoot class="systemsTable">
+			<tr class="systemsTable">
+				<td>Automatically start this service</td>
+				<td>
+					<input type="checkbox" name="autostart" checked="checked">
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Run exclusive</td>
+				<td>
+					<input type="checkbox" name="exclusive">
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Failover Domain</td>
+				<td>
+					<select name="domain">
+						<option value="" selected="selected">None</option>
+						<tal:block tal:repeat="f python:here.get_fdom_names(modelb)">
+							<option tal:content="f"
+								tal:attributes="value f" />
+						</tal:block>
+					</select>
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Recovery policy</td>
+				<td>
+					<select name="recovery">
+						<option value="">Select a recovery policy</option>
+						<option name="relocate" value="relocate">Relocate</option>
+						<option name="restart" value="restart">Restart</option>
+						<option name="disable" value="disable">Disable</option>
+					</select>
+				</td>
+			</tr>
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input type="submit" value="Create Virtual Machine Service" />
@@ -3861,6 +3896,52 @@
 				<p class="reshdr">Properties for <tal:block tal:replace="vminfo/name | string:virtual machine service"/></p>
 			</td></tr>
 		<tfoot class="systemsTable">
+			<tr class="systemsTable">
+				<td>Automatically start this service</td>
+				<td>
+					<input type="checkbox" name="autostart"
+						tal:attributes="checked python: ('autostart' in vminfo and vminfo['autostart'] != '0') and 'checked' or ''" />
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Run exclusive</td>
+				<td>
+					<input type="checkbox" name="exclusive"
+						tal:attributes="checked python: ('exclusive' in vminfo and vminfo['exclusive'] != '0') and 'checked' or ''" />
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Failover Domain</td>
+				<td>
+					<select name="domain">
+						<option value="" tal:content="string:None"
+							tal:attributes="selected python: (not 'domain' in vminfo or not vminfo['domain']) and 'selected' or ''" />
+						<tal:block tal:repeat="f python:here.get_fdom_names(modelb)">
+							<option tal:content="f"
+								tal:attributes="
+									value f;
+									selected python: ('domain' in vminfo and vminfo['domain'] == f) and 'selected' or ''" />
+						</tal:block>
+					</select>
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Recovery policy</td>
+				<td>
+					<select name="recovery">
+						<option value="">Select a recovery policy</option>
+						<option name="relocate" value="relocate"
+							tal:content="string:Relocate"
+							tal:attributes="selected python: ('recovery' in vminfo and vminfo['recovery'] == 'relocate') and 'selected' or ''" />
+						<option name="restart" value="restart"
+							tal:content="string:Restart"
+							tal:attributes="selected python: ('recovery' in vminfo and vminfo['recovery'] == 'restart') and 'selected' or ''" />
+						<option name="disable" value="disable"
+							tal:content="string:Disable"
+							tal:attributes="selected python: ('recovery' in vminfo and vminfo['recovery'] == 'disable') and 'selected' or ''" />
+					</select>
+				</td>
+			</tr>
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input name="submit" type="submit" value="Update Virtual Machine Service" />
@@ -3921,6 +4002,12 @@
 					</td>
 				</tr>
 				<tr class="systemsTable">
+					<td class="systemsTable">Run exclusive</td>
+					<td class="systemsTable">
+						<input type="checkbox" name="exclusive">
+					</td>
+				</tr>
+				<tr class="systemsTable">
 					<td class="systemsTable">Failover Domain</td>
 					<td class="systemsTable">
 						<select name="domain">
@@ -3932,6 +4019,17 @@
 						</select>
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">Recovery policy</td>
+					<td class="systemsTable">
+						<select name="recovery">
+							<option value="">Select a recovery policy</option>
+							<option name="relocate" value="relocate">Relocate</option>
+							<option name="restart" value="restart">Restart</option>
+							<option name="disable" value="disable">Disable</option>
+						</select>
+					</td>
+				</tr>
 			</table>
 		</form>
 	</div>
@@ -3956,8 +4054,10 @@
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="autostart" value="-1" />
-		<input type="hidden" name="form_xml" />
+		<input type="hidden" name="exclusive" value="-1" />
+		<input type="hidden" name="recovery" />
 		<input type="hidden" name="domain" />
+		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="add" />
 		</form>
 	</div>
@@ -4187,6 +4287,12 @@
 					</td>
 				</tr>
 				<tr>
+					<td>Run exclusive</td>
+					<td><input type="checkbox" name="exclusive"
+							tal:attributes="checked python: ('exclusive' in sinfo and sinfo['exclusive'].lower() != 'false') and 'checked'" />
+					</td>
+				</tr>
+				<tr>
 					<td>Failover Domain</td>
 					<td>
 						<select name="domain">
@@ -4201,6 +4307,23 @@
 						</select>
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td>Recovery policy</td>
+					<td>
+						<select name="recovery">
+							<option value="">Select a recovery policy</option>
+							<option name="relocate" value="relocate"
+								tal:content="string:Relocate"
+								tal:attributes="selected python: ('recovery' in sinfo and sinfo['recovery'] == 'relocate') and 'selected' or ''" />
+							<option name="restart" value="restart"
+								tal:content="string:Restart"
+								tal:attributes="selected python: ('recovery' in sinfo and sinfo['recovery'] == 'restart') and 'selected' or ''" />
+							<option name="disable" value="disable"
+								tal:content="string:Disable"
+								tal:attributes="selected python: ('recovery' in sinfo and sinfo['recovery'] == 'disable') and 'selected' or ''" />
+						</select>
+					</td>
+				</tr>
 			</table>
 			<input type="hidden" name="service_name"
 				tal:attributes="value sinfo/name | string:1" />
@@ -4223,8 +4346,10 @@
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="autostart" value="-1" />
-		<input type="hidden" name="form_xml" />
+		<input type="hidden" name="exclusive" value="-1" />
+		<input type="hidden" name="recovery" />
 		<input type="hidden" name="domain" />
+		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="edit" />
 		</form>
 	</div>
--- conga/luci/cluster/resource-form-macros	2007/01/29 16:56:50	1.31
+++ conga/luci/cluster/resource-form-macros	2007/02/08 16:00:36	1.32
@@ -129,11 +129,6 @@
 				</option>
 				<option name="TOMCAT-5" value="TOMCAT-5">Tomcat 5</option>
 			</tal:block>
-
-			<tal:block
-				tal:condition="python: os_version and os_version == 'rhel5'">
-				<option name="VM" value="VM">Virtual Machine</option>
-			</tal:block>
 		</select>
 		</form>
 	</p>
@@ -174,6 +169,17 @@
 			<option name="NFSX" value="NFSX">NFS export</option>
 			<option name="SCR" value="SCR">Script</option>
 			<option name="SMB" value="SMB">Samba</option>
+
+			<tal:block
+				tal:condition="python: os_version and os_version == 'rhel4'">
+				<option name="APACHE" value="APACHE">Apache</option>
+				<option name="MYSQL" value="MYSQL">MySQL</option>
+				<option name="OPENLDAP" value="OPENLDAP">Open LDAP</option>
+				<option name="POSTGRES-8" value="POSTGRES-8">
+					PostgreSQL 8
+				</option>
+				<option name="TOMCAT-5" value="TOMCAT-5">Tomcat 5</option>
+			</tal:block>
 		</select>
 		</form>
 	</p>
@@ -419,10 +425,10 @@
 
 					<option name="ext3" value="ext3"
 						tal:content="string: ext3"
-						tal:attributes="checked python: fstype == 'ext3' and 'checked'" />
+						tal:attributes="selected python: fstype == 'ext3' and 'selected'" />
 					<option name="ext2" value="ext2"
 						tal:content="string: ext2"
-						tal:attributes="checked python: fstype == 'ext2' and 'checked'" />
+						tal:attributes="selected python: fstype == 'ext2' and 'selected'" />
 				</select>
 			</td>
 		</tr>
--- conga/luci/cluster/resource_form_handlers.js	2007/02/08 05:05:21	1.30
+++ conga/luci/cluster/resource_form_handlers.js	2007/02/08 16:00:36	1.31
@@ -424,6 +424,8 @@
 	var svc_name = null;
 	var autostart = 1;
 	var domain = null;
+	var exclusive = 0;
+	var recovery = null;
 
 	var form = document.getElementsByTagName('form');
 	for (var i = 0 ; i < form.length ; i++) {
@@ -436,9 +438,21 @@
 				clr_form_err(form[i].service_name);
 				svc_name = form[i].service_name.value;
 			}
+
 			if (!form[i].autostart.checked)
 				autostart = 0;
 
+			if (!form[i].exclusive.checked)
+				exclusive = 0;
+			else
+				exclusive = 1;
+
+			if (form[i].recovery) {
+				recovery = form[i].recovery.options[form[i].recovery.options.selectedIndex].value;
+				if (str_is_blank(recovery))
+					recovery = null;
+			}
+
 			if (form[i].domain) {
 				domain = form[i].domain.options[form[i].domain.options.selectedIndex].value;
 				if (str_is_blank(domain))
@@ -487,6 +501,10 @@
 	if (!form_xml)
 		errors.push('No resource information was submitted.');
 
+	if (recovery && recovery != 'relocate' && recovery != 'restart' && recovery != 'disable') {
+		errors.push('You entered an invalid recovery option. Valid options are "relocate" "restart" and "disable"');
+	}
+
 	if (error_dialog(errors))
 		return (-1);
 
@@ -495,7 +513,10 @@
 	master_form.svc_name.value = svc_name;
 	if (domain)
 		master_form.domain.value = domain;
+	if (recovery)
+		master_form.recovery.value = recovery;
 	master_form.autostart.value = autostart;
+	master_form.exclusive.value = exclusive;
 
 	var confirm_msg = null;
 	if (master_form.action.value == 'add')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/08 05:05:22	1.235
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/08 16:00:36	1.236
@@ -783,6 +783,17 @@
 	except:
 		fdom = None
 
+	recovery = None
+	try:
+		recovery = request.form['recovery'].strip()
+		if not recovery:
+			recovery = None
+		else:
+			if recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
+				errors.append('You entered an invalid recovery option: \"%s\" Valid options are \"restart\" \"relocate\" and \"disable\"')
+	except:
+		recovery = None
+
 	try:
 		service_name = request.form['svc_name'].strip()
 	except Exception, e:
@@ -797,6 +808,15 @@
 		autostart = None
 		luci_log.debug_verbose('vSA5a: error getting autostart: %s' % str(e))
 
+	exclusive = "0"
+	try:
+		if not request.form.has_key('exclusive') or request.form['exclusive'] != "1":
+			exclusive = "0"
+		else:
+			exclusive = "1"
+	except Exception, e:
+		exclusive = "0"
+
 	try:
 		cur_service = model.retrieveServiceByName(service_name)
 	except GeneralError, e:
@@ -837,6 +857,9 @@
 	new_service.addAttribute('name', service_name)
 	if fdom:
 		new_service.addAttribute('domain', fdom)
+	if recovery:
+		new_service.addAttribute('recovery', recovery)
+	new_service.addAttribute('exclusive', str(exclusive))
 	if autostart is not None:
 		new_service.attr_hash['autostart'] = autostart
 
@@ -2179,6 +2202,43 @@
 		luci_log.debug_verbose('validateVM1: no vm path: %s' % str(e))
 		errors.append('No path to the virtual machine configuration file was given.')
 
+	autostart = 1
+	try:
+		if request.form.has_key('autostart'):
+			autostart = 1
+		else:
+			autostart = 0
+	except:
+		autostart = 1
+
+	exclusive = 0
+	try:
+		if request.form.has_key('exclusive'):
+			exclusive = 1
+		else:
+			exclusive = 0
+	except:
+		exclusive = 0
+
+	recovery = None
+	try:
+		recovery = request.form['recovery'].strip()
+		if not recovery:
+			recovery = None
+		else:
+			if recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
+				errors.append('You entered an invalid recovery option: \"%s\" Valid options are \"restart\" \"relocate\" and \"disable\"')
+	except:
+		recovery = None
+
+	fdom = None
+	try:
+		fdom = request.form['domain'].strip()
+		if not fdom:
+			raise Exception, 'blank'
+	except:
+		fdom = None
+
 	if len(errors) > 0:
 		return (False, {'errors': errors })
 
@@ -2218,6 +2278,24 @@
 			xvm.addAttribute('name', vm_name)
 			xvm.addAttribute('path', vm_path)
 
+	xvm.addAttribute('autostart', str(autostart))
+	xvm.addAttribute('exclusive', str(exclusive))
+	if fdom:
+		xvm.addAttribute('domain', fdom)
+	else:
+		try:
+			xvm.removeAttribute('domain')
+		except:
+			pass
+
+	if recovery:
+		xvm.addAttribute('recovery', recovery)
+	else:
+		try:
+			xvm.removeAttribute('recovery')
+		except:
+			pass
+
 	try:
 		model.setModified(True)
 		stringbuf = str(model.exportModelAsString())
@@ -3240,9 +3318,15 @@
 		if item['type'] == "service":
 			itemmap = {}
 			itemmap['name'] = item['name']
+
 			if item['running'] == "true":
 				itemmap['running'] = "true"
 				itemmap['nodename'] = item['nodename']
+				itemmap['disableurl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + item['name'] + "&pagetype=" + SERVICE_STOP
+				itemmap['restarturl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + item['name'] + "&pagetype=" + SERVICE_RESTART
+			else:
+				itemmap['enableurl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + item['name'] + "&pagetype=" + SERVICE_START
+
 			itemmap['autostart'] = item['autostart']
 
 			try:
@@ -3267,6 +3351,9 @@
 	map['services'] = maplist
 	return map
 
+def get_fdom_names(model):
+	return map(lambda x: x.getName(), model.getFailoverDomains())
+
 def getServiceInfo(self, status, model, req):
 	#set up struct for service config page
 	hmap = {}
@@ -3280,7 +3367,7 @@
 		baseurl = '/luci/cluster/index_html'
 
 	try:
-		hmap['fdoms'] = map(lambda x: x.getName(), model.getFailoverDomains())
+		hmap['fdoms'] = get_fdom_names(model)
 	except:
 		hmap['fdoms'] = list()
 
@@ -3354,6 +3441,19 @@
 	except:
 		hmap['domain'] = None
 
+	try:
+		hmap['recovery'] = svc.getAttribute('recovery')
+	except:
+		hmap['recovery'] = None
+
+	try:
+		if int(svc.getAttribute('exclusive')):
+			hmap['exclusive'] = 'true' 
+		else:
+			hmap['exclusive'] = 'false'
+	except:
+		hmap['exclusive'] = 'false'
+
 	resource_list = list()
 	if svc is not None:
 		indent_ctr = 0
@@ -5107,7 +5207,7 @@
       % vmname)
     return map
 
-  attrs= vm.getAttributes()
+  attrs = vm.getAttributes()
   keys = attrs.keys()
   for key in keys:
     map[key] = attrs[key]



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-05-30  5:54 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-05-30  5:54 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	EXPERIMENTAL
Changes by:	rmccabe at sourceware.org	2007-05-30 05:54:03

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	luci/logs      : log_provider 
	luci/site/luci/Extensions: LuciClusterActions.py LuciDB.py 
	                           LuciZopeExternal.py RicciQueries.py 
	                           cluster_adapters.py 
	                           conga_constants.py 
	                           homebase_adapters.py 
	luci/site/luci/Extensions/ClusterModel: ModelBuilder.py 

Log message:
	- More cleanups
	- Sort log entries chronologically

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.198.2.2&r2=1.198.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.37&r2=1.37.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/logs/log_provider.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1&r2=1.1.6.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterActions.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.6&r2=1.1.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.12&r2=1.1.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeExternal.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.5&r2=1.1.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.10&r2=1.255.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.39.2.4&r2=1.39.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.50.2.7&r2=1.50.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.5&r2=1.1.2.6

--- conga/luci/cluster/form-macros	2007/05/18 02:36:59	1.198.2.2
+++ conga/luci/cluster/form-macros	2007/05/30 05:54:01	1.198.2.3
@@ -3627,7 +3627,7 @@
 <div metal:define-macro="nodelogs-form">
 	<h2>Recent Log Activity for <span tal:replace="request/nodename"/></h2>
 	<hr/>
-	<span tal:replace="structure python: here.getLogsForNode(request)"/>
+	<span tal:replace="structure python: here.getSystemLogs(request)"/>
 </div>
 
 <div metal:define-macro="nodeadd-form">
@@ -4660,7 +4660,12 @@
 
 <div metal:define-macro="servicedelete-form">
 	<h2>Service Delete Form</h2>
-	<tal:block tal:define="dummy python: here.delService(request)" />
+
+	<tal:block tal:define="
+		global ricci_agent ri_agent | python: here.getRicciAgentForCluster(request)" />
+
+	<span tal:define="
+		result python: here.serviceDelete(ricci_agent, request)" />
 </div>
 
 <div metal:define-macro="resources-form">
--- conga/luci/cluster/resource-form-macros	2007/03/15 22:08:42	1.37
+++ conga/luci/cluster/resource-form-macros	2007/05/30 05:54:01	1.37.2.1
@@ -92,7 +92,7 @@
 	<h2>Resources Remove Form</h2>
 
 	<tal:block tal:define="
-		msg python: here.delResource(here.getRicciAgentForCluster(request), request)">
+		msg python: here.deleteResource(here.getRicciAgentForCluster(request), request)">
 		<span class="error" tal:condition="msg" tal:content="msg" />
 	</tal:block>
 </div>
--- conga/luci/logs/log_provider	2006/10/30 23:00:50	1.1
+++ conga/luci/logs/log_provider	2007/05/30 05:54:01	1.1.6.1
@@ -1 +1 @@
-<pre tal:content="structure python: here.getLogsForNode(request)"></pre>
+<pre tal:content="structure python: here.getSystemLogs(request)"></pre>
--- conga/luci/site/luci/Extensions/Attic/LuciClusterActions.py	2007/05/23 21:21:32	1.1.2.6
+++ conga/luci/site/luci/Extensions/Attic/LuciClusterActions.py	2007/05/30 05:54:01	1.1.2.7
@@ -8,16 +8,17 @@
 from LuciSyslog import get_logger
 import RicciQueries as rq
 
-from ricci_communicator import RicciCommunicator, RicciError
+from ricci_communicator import RicciCommunicator
 
-from LuciDB import set_node_flag, getRicciAgent, delCluster, \
+from LuciDB import set_node_flag, getRicciAgent, \
 	getClusterNode, getStorageNode, NodeBusy, \
-	setNodeStatus, resolve_nodename
+	setNodeStatus, resolve_nodename, \
+	delCluster, delClusterSystem, \
+	CLUSTER_NODE_NEED_AUTH
 
 from conga_constants import CLUSTER_CONFIG, LUCI_DEBUG_MODE, \
-	NODE_DELETE, CLUSTER_DELETE, CLUSTER_FOLDER_PATH, \
-	CLUSTERLIST, CLUSTER_NODE_NEED_AUTH, NODE_FENCE, \
-	NODE_JOIN_CLUSTER, NODE_LEAVE_CLUSTER, NODE_REBOOT, \
+	NODE_DELETE, CLUSTER_DELETE, CLUSTERLIST, \
+	NODE_FENCE, NODE_JOIN_CLUSTER, NODE_LEAVE_CLUSTER, NODE_REBOOT, \
 	RESOURCE_ADD, RESOURCE_CONFIG, RESOURCE_REMOVE, \
 	SERVICE_DELETE, SERVICE_RESTART, SERVICE_START, SERVICE_STOP
 
@@ -226,7 +227,7 @@
 # Cluster node membership-related tasks
 #
 
-def nodeJoin(self, rc, clustername, nodename_resolved):
+def NodeJoinCluster(self, rc, clustername, nodename_resolved):
 	batch_number, result = rq.nodeJoinCluster(rc)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
@@ -244,17 +245,31 @@
 		return None
 	return True
 
-def nodeLeave(self, rc, clustername, nodename_resolved):
+def NodeLeaveCluster(self, rc, clustername, nodename_resolved):
+	reported_cluname = None
+	try:
+		cluster_info = rc.cluster_info()
+		reported_cluname = cluster_info[0] or cluster_info[1]
+		if not reported_cluname:
+			raise Exception, 'not a cluster member'
+		if reported_cluname.lower() != clustername.lower():
+			raise Exception, 'cluster mismatch: expected %s, got %s' \
+								% (clustername, reported_cluname)
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('NCL0: no cluster name: %r %s' % (e, str(e)))
+		return None
+
 	if NodeBusy(self, clustername, nodename_resolved, rc) is not False:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug('NL0: flags still present for %s -- bailing out' \
+			luci_log.debug('NC1: %s is busy, can\'t leave cluster yet.' \
 				% nodename_resolved)
 		return None
 
 	batch_number, result = rq.nodeLeaveCluster(rc)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('NL1: %s: batch_number or result is None' \
+			luci_log.debug_verbose('NLC2: %s: batch_number or result is None' \
 				% nodename_resolved)
 		return None
 
@@ -264,84 +279,37 @@
 			'Node "%s" leaving cluster "%s"' % (nodename_resolved, clustername))
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('NL4: failed to set flags: %s: %r %s' \
+			luci_log.debug_verbose('NLC3: failed to set flags: %s: %r %s' \
 				% (nodename_resolved, e, str(e)))
 	return True
 
-def nodeDelete(self, rc, model, clustername, nodename, nodename_resolved, delete_cluster=False):
+def NodeDeleteFromCluster(	self,
+							rc,
+							model,
+							clustername,
+							nodename,
+							nodename_resolved,
+							delete_cluster=False):
+
 	# We need to get a node name other than the node
 	# to be deleted, then delete the node from the cluster.conf
 	# and propogate it. We will need two ricci agents for this task,
 	# unless we are deleting the cluster itself.
 
-	if not delete_cluster:
+	if delete_cluster is False:
 		# Make sure we can find a second node before we hose anything.
-		found_one = False
-
-		path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
-
-		try:
-			clusterfolder = self.restrictedTraverse(path)
-			if not clusterfolder:
-				raise Exception, 'no cluster folder at %s' % path
-		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ND0: node delete error for cluster %s: %r %s' % (clustername, e, str(e)))
-			return None
-
-		try:
-			nodes = clusterfolder.objectItems('Folder')
-			if not nodes or len(nodes) < 1:
-				raise Exception, 'no cluster nodes in DB'
-		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ND1: node delete error for cluster %s: %r %s' % (clustername, e, str(e)))
-
-		for node in nodes:
-			if node[1].getId().find(nodename) != (-1):
-				continue
-			# here we make certain the node is up...
-			# XXX- we should also make certain this host is still
-			# in the cluster we believe it is.
-
-			try:
-				rc2 = RicciCommunicator(node[1].getId())
-				if not rc2:
-					raise Exception, 'ND1a: rc2 is None'
-			except Exception, e:
-				if LUCI_DEBUG_MODE is True:
-					luci_log.info('ND2: ricci %s error: %r %s' \
-						% (node[0], e, str(e)))
-				continue
-
-			if not rc2.authed():
-				try:
-					setNodeStatus(node[1], CLUSTER_NODE_NEED_AUTH)
-				except:
-					pass
-
-				try:
-					snode = getStorageNode(self, node[0])
-					setNodeStatus(snode, CLUSTER_NODE_NEED_AUTH)
-				except:
-					pass
+		rc2 = getRicciAgent(self, clustername,
+				exclude_names=[ nodename_resolved ], exclude_busy=True)
 
-				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('ND3: %s is not authed' % node[0])
-				rc2 = None
-				continue
-			else:
-				found_one = True
-				break
-
-		if not found_one:
+		if rc2 is None:
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ND4: unable to find ricci agent to delete %s from %s' % (nodename, clustername))
+				luci_log.debug_verbose('ND0: unable to find ricci agent to delete %s from %s' % (nodename_resolved, clustername))
 			return None
 
 	# First, delete cluster.conf from node to be deleted.
 	# next, have node leave cluster.
-	batch_number, result = rq.nodeLeaveCluster(rc, purge=True)
+
+	batch_number, result = rq.nodeLeaveCluster(rc, purge=False)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('ND5: batch_number and/or result is None')
@@ -352,7 +320,7 @@
 	# anyway. Now, we need to delete node from model and send out
 	# new cluster.conf
 
-	if delete_cluster:
+	if delete_cluster is True:
 		try:
 			set_node_flag(self, clustername, rc.hostname(),
 				str(batch_number), CLUSTER_DELETE,
@@ -363,32 +331,17 @@
 				luci_log.debug_verbose('ND5a: failed to set flags: %r %s' \
 					% (e, str(e)))
 	else:
-		delete_target = None
-		nodelist = model.getNodes()
-		find_node = nodename.lower()
-		for n in nodelist:
-			try:
-				if n.getName().lower() == find_node:
-					delete_target = n
-					break
-			except:
-				continue
-
-		if delete_target is None:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ND6: no delete target for %s in cluster %s' % (nodename, clustername))
-			return None
-
 		try:
-			model.deleteNode(delete_target)
+			model.deleteNodeByName(nodename.lower())
 		except Exception, e:
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ND6a: deleteNode %s failed: %r %s' \
-					% (delete_target.getName(), e, str(e)))
+				luci_log.debug_verbose('ND6: deleteNode %s: %r %s' \
+					% (nodename, e, str(e)))
+			return None
 
 		try:
 			model.setModified(True)
-			str_buf = model.exportModelAsString()
+			str_buf = str(model.exportModelAsString())
 			if not str_buf:
 				raise Exception, 'model string is blank'
 		except Exception, e:
@@ -398,21 +351,20 @@
 				return None
 
 		# propagate the new cluster.conf via the second node
-		batch_number, result = rq.setClusterConf(rc2, str(str_buf))
+		batch_number, result = rq.setClusterConf(rc2, str_buf)
 		if batch_number is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('ND8: batch number is None after del node in NTP')
 			return None
 
-	# Now we need to delete the node from the DB
-	path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
 	try:
-		clusterfolder = self.restrictedTraverse(path)
-		clusterfolder.manage_delObjects([nodename_resolved])
+		ret = delClusterSystem(self, clustername, nodename_resolved)
+		if ret is not None:
+			raise Exception, ret
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('ND9: error deleting %s@%s: %r %s' \
-				% (nodename_resolved, path, e, str(e)))
+			luci_log.debug_verbose('ND9: error deleting %s: %r %s' \
+				% (nodename_resolved, e, str(e)))
 
 	if delete_cluster:
 		return True
@@ -420,7 +372,7 @@
 	try:
 		set_node_flag(self, clustername, rc2.hostname(),
 			str(batch_number), NODE_DELETE,
-			'Deleting node "%s"' % nodename_resolved)
+			'Deleting node "%s"' % nodename)
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('ND10: failed to set flags: %r %s' \
@@ -431,7 +383,7 @@
 # Cluster management-related tasks.
 #
 
-def clusterStart(self, model):
+def ClusterStart(self, model):
 	if model is None:
 		return None
 
@@ -454,7 +406,8 @@
 					% (nodename_resolved, e, str(e)))
 			errors += 1
 			continue
-		if nodeJoin(self, rc, clustername, nodename_resolved) is None:
+
+		if NodeJoinCluster(self, rc, clustername, nodename_resolved) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('CStart1: nodeJoin %s' \
 					% nodename_resolved)
@@ -462,7 +415,7 @@
 
 	return errors
 
-def clusterStop(self, model, delete=False):
+def ClusterStop(self, model, delete=False):
 	if model is None:
 		return None
 
@@ -487,74 +440,73 @@
 			continue
 
 		if delete is True:
-			ret = nodeDelete(self, rc, model, clustername, nodename,
-					nodename_resolved, delete_cluster=True)
+			ret = NodeDeleteFromCluster(self, rc, model, clustername,
+					nodename, nodename_resolved, delete_cluster=True)
 			if ret is None:
 				if LUCI_DEBUG_MODE is True:
 					luci_log.debug_verbose('CStop1: [1] nodeDelete failed')
 				errors += 1
 		else:
-			if nodeLeave(self, rc, clustername, nodename_resolved) is None:
+			ret = NodeLeaveCluster(self, rc, clustername, nodename_resolved)
+			if ret is None:
 				if LUCI_DEBUG_MODE is True:
 					luci_log.debug_verbose('CStop2: [0] nodeLeave %s' \
 						% (nodename_resolved))
 				errors += 1
 	return errors
 
-def clusterRestart(self, model):
-	snum_err = clusterStop(self, model)
+def ClusterRestart(self, model):
+	snum_err = ClusterStop(self, model)
 	if snum_err:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('cluRestart0: clusterStop: %d errs' \
+			luci_log.debug_verbose('cluRestart0: ClusterStop: %d errs' \
 				% snum_err)
-	jnum_err = clusterStart(self, model)
+
+	jnum_err = ClusterStart(self, model)
 	if jnum_err:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('cluRestart1: clusterStart: %d errs' \
+			luci_log.debug_verbose('cluRestart1: ClusterStart: %d errs' \
 				% jnum_err)
 	return snum_err + jnum_err
 
-def clusterDelete(self, model):
+def ClusterDelete(self, model):
+	try:
+		clustername = model.getClusterName()
+		if not clustername:
+			raise Exception, 'no cluster name found'
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('ClusterDelete0: %r %s' % (e, str(e)))
+		return None
+
 	# Try to stop all the cluster nodes before deleting any.
-	num_errors = clusterStop(self, model, delete=False)
+	num_errors = ClusterStop(self, model, delete=False)
 	if num_errors > 0:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('cluDelete: %d errors' % num_errors)
+			luci_log.debug_verbose('ClusterDelete1: %s: %d errors' \
+				% (clustername, num_errors))
 		return None
 
 	# If the cluster is stopped, delete all of the nodes.
-	num_errors = clusterStop(self, model, delete=True)
-	try:
-		clustername = model.getClusterName()
-	except Exception, e:
+	num_errors = ClusterStop(self, model, delete=True)
+	if num_errors > 0:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('clusterDelete0: unable to get cluster name')
+			luci_log.debug_verbose('ClusterDelete2: %s: %d errors' \
+				% (clustername, num_errors))
 		return None
 
-	if num_errors < 1:
-		try:
-			delCluster(self, clustername)
-		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('clusterDelete1: %s: %r %s' \
-					% (clustername, e, str(e)))
-
-		try:
-			clusterfolder = self.restrictedTraverse('%s%s' % (CLUSTER_FOLDER_PATH, clustername))
-			if len(clusterfolder.objectItems()) < 1:
-				clusters = self.restrictedTraverse(str(CLUSTER_FOLDER_PATH))
-				clusters.manage_delObjects([clustername])
-		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('clusterDelete2: %s %r %s' \
-					% (clustername, e, str(e)))
-		return CLUSTERLIST
-	else:
+	try:
+		ret = delCluster(self, clustername)
+		if ret is not None:
+			raise Exception, ret
+	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('clusterDelete2: %s: %d errors' \
-				% (clustername, num_errors))
+			luci_log.debug_verbose('ClusterDelete3: %s: %r %s' \
+				% (clustername, e, str(e)))
+		return None
+	return CLUSTERLIST
 
-def forceNodeReboot(self, rc, clustername, nodename_resolved):
+def NodeReboot(self, rc, clustername, nodename_resolved):
 	batch_number, result = rq.nodeReboot(rc)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
@@ -571,150 +523,35 @@
 				% (e, str(e)))
 	return True
 
-def forceNodeFence(self, clustername, nodename, nodename_resolved):
-	path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
-
-	try:
-		clusterfolder = self.restrictedTraverse(path)
-		if not clusterfolder:
-			raise Exception, 'no cluster folder@%s' % path
-	except Exception, e:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug('FNF0: The cluster obj %s not found: %r %s' \
-				% (clustername, e, str(e)))
-		return None
-
-	try:
-		nodes = clusterfolder.objectItems('Folder')
-		if not nodes or len(nodes) < 1:
-			raise Exception, 'no cluster nodes'
-	except Exception, e:
+def NodeFence(self, clustername, nodename, nodename_resolved):
+	rc = getRicciAgent(self, clustername,
+			exclude_names=[ nodename_resolved, nodename ], exclude_busy=True)
+	if rc is None:
+		rc = getRicciAgent(self, clustername,
+				exclude_names=[ nodename_resolved, nodename ])
+	if rc is None:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug('FNF1: No cluster nodes for %s were found: %r %s' \
-				% (clustername, e, str(e)))
+			luci_log.debug_verbose('FNF0: no ricci to fence %s for cluster %s' \
+				% (nodename_resolved, clustername))
 		return None
-
-	found_one = False
-	for node in nodes:
-		if node[1].getId().find(nodename) != (-1):
-			continue
-
-		try:
-			rc = RicciCommunicator(node[1].getId())
-			if not rc:
-				raise Exception, 'rc is None'
-		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug('FNF2: ricci error for host %s: %r %s' \
-					% (node[0], e, str(e)))
-			continue
-
-		if not rc.authed():
-			rc = None
-			try:
-				snode = getStorageNode(self, node[1].getId())
-				setNodeStatus(snode, CLUSTER_NODE_NEED_AUTH)
-			except:
-				pass
-
-			try:
-				setNodeStatus(node[1], CLUSTER_NODE_NEED_AUTH)
-			except:
-				pass
-
-			continue
-		found_one = True
-		break
-
-	if not found_one:
-		return None
-
-	batch_number, result = rq.nodeFence(rc, nodename)
+			
+	batch_number, result = rq.nodeFence(rc, nodename_resolved)
 	if batch_number is None or result is None:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('FNF3: batch_number and/or result is None')
+			luci_log.debug_verbose('FNF1: batch_number and/or result is None')
 		return None
 
 	try:
 		set_node_flag(self, clustername, rc.hostname(),
 			str(batch_number), NODE_FENCE,
-			'Node "%s" is being fenced' % nodename_resolved)
+			'Node "%s" is being fenced by node "%s"' \
+				% (nodename_resolved, rc.hostname()))
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('FNF4: failed to set flags: %r %s' \
+			luci_log.debug_verbose('FNF2: failed to set flags: %r %s' \
 				% (e, str(e)))
 	return True
 
-#
-# Cluster-independent tasks.
-#
-
-def getLogsForNode(self, request):
-	try:
-		nodename = request['nodename']
-	except KeyError, e:
-		try:
-			nodename = request.form['nodename']
-		except:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('GNL0: no node name')
-			return 'Unable to get node name to retrieve logging information'
-
-	clustername = None
-	try:
-		clustername = request['clustername']
-	except KeyError, e:
-		try:
-			clustername = request.form['clustername']
-			if not clustername:
-				raise
-		except:
-			clustername = None
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('GNL1: no cluster for %s' % nodename)
-	except:
-		pass
-
-	if clustername is None:
-		nodename_resolved = nodename
-	else:
-		nodename_resolved = resolve_nodename(self, clustername, nodename)
-
-	try:
-		rc = RicciCommunicator(nodename_resolved)
-	except RicciError, e:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GNL2: ricci error %s: %r %s' \
-				% (nodename_resolved, e, str(e)))
-		return 'Ricci error while getting logs for %s' % nodename_resolved
-	except Exception, e:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('GNL3: unexpected exception for %s: %r %s' \
-				% (nodename_resolved, e, str(e)))
-		return 'Ricci error while getting logs for %s' % nodename_resolved
-
-	if not rc.authed():
-		try:
-			snode = getStorageNode(self, nodename)
-			setNodeStatus(snode, CLUSTER_NODE_NEED_AUTH)
-		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('GNL4: %s: %r %s' \
-					% (nodename_resolved, e, str(e)))
-
-		if clustername:
-			try:
-				cnode = getClusterNode(self, nodename, clustername)
-				setNodeStatus(cnode, CLUSTER_NODE_NEED_AUTH)
-			except Exception, e:
-				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('GNL5: %s: %r %s' \
-						% (nodename_resolved, e, str(e)))
-		return 'Luci is not authenticated to node %s. Reauthenticate first.' \
-			% nodename
-
-	return rq.getNodeLogs(rc)
-
 def propagateClusterConfAsync(	self,
 								model,
 								rc=None,
@@ -734,10 +571,12 @@
 		errors.append('Unable to determine cluster name')
 		return (False, { 'errors': errors, 'messages': messages })
 
-	if not rc:
+	if rc is None:
+		rc = getRicciAgent(self, clustername, exclude_busy=True)
+	if rc is None:
 		rc = getRicciAgent(self, clustername)
 
-	if not rc:
+	if rc is None:
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('PCC1: no ricci agent for the %s cluster' \
 				% clustername)
@@ -776,3 +615,48 @@
 				% (e, str(e)))
 
 	return (True, { 'errors': errors, 'messages': messages, 'batchid': batch_id })
+
+def GetSystemLogs(self, fvars):
+	nodename = fvars['nodename']
+	if nodename is None:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GSL0: no node name')
+		return 'No system name was given'
+
+	clustername = fvars['clustername']
+	if clustername is None:
+		nodename_resolved = nodename
+	else:
+		nodename_resolved = resolve_nodename(self, clustername, nodename)
+
+	try:
+		rc = RicciCommunicator(nodename_resolved)
+		if not rc:
+			raise Exception, 'no rc'
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GSL1: unexpected exception for %s: %r %s' \
+				% (nodename_resolved, e, str(e)))
+		return 'Ricci error while getting logs for %s' % nodename_resolved
+
+	if not rc.authed():
+		try:
+			snode = getStorageNode(self, nodename_resolved)
+			setNodeStatus(snode, CLUSTER_NODE_NEED_AUTH)
+		except Exception, e:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GSL2: %s: %r %s' \
+					% (nodename_resolved, e, str(e)))
+
+		if clustername is not None:
+			try:
+				cnode = getClusterNode(self, nodename_resolved, clustername)
+				setNodeStatus(cnode, CLUSTER_NODE_NEED_AUTH)
+			except Exception, e:
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('GNL5: %s: %r %s' \
+						% (nodename_resolved, e, str(e)))
+		return 'Luci is not authenticated to %s. Reauthenticate first.' \
+			% nodename
+
+	return rq.getNodeLogs(rc)
--- conga/luci/site/luci/Extensions/Attic/LuciDB.py	2007/05/23 21:21:32	1.1.2.12
+++ conga/luci/site/luci/Extensions/Attic/LuciDB.py	2007/05/30 05:54:02	1.1.2.13
@@ -12,9 +12,13 @@
 from LuciSyslog import get_logger
 
 from conga_constants import CLUSTER_FOLDER_PATH, BATCH_ID, TASKTYPE, \
-	FLAG_DESC, CLUSTER_ADD, CLUSTER_NODE_ADDED, CLUSTER_NODE_NEED_AUTH, \
-	LAST_STATUS, PLONE_ROOT, STORAGE_FOLDER_PATH, CLUSTER_NODE_NOT_MEMBER, \
-	LUCI_DEBUG_MODE
+	FLAG_DESC, CLUSTER_ADD, LAST_STATUS, PLONE_ROOT, \
+	STORAGE_FOLDER_PATH, LUCI_DEBUG_MODE
+
+# Cluster node exception attribute flags
+CLUSTER_NODE_NEED_AUTH	= 0x01
+CLUSTER_NODE_NOT_MEMBER	= 0x02
+CLUSTER_NODE_ADDED		= 0x04
 
 luci_log = get_logger()
 
@@ -730,7 +734,7 @@
 	allowed = dict(map(lambda x: [ x[0], None ], allowed_systems_list))
 	return allowed.has_key(hostname)
 
-def getRicciAgent(self, clustername):
+def getRicciAgent(self, clustername, exclude_names=None, exclude_busy=False):
 	try:
 		perm = cluster_permission_check(clustername)
 		if not perm:
@@ -770,25 +774,24 @@
 
 	cluname = clustername.lower()
 	for node in nodes:
-		try:
-			hostname = node[1].getId()
-		except:
-			try:
-				hostname = node[0]
-			except:
-				continue
+		hostname = node[0]
+
+		if exclude_names is not None and hostname in exclude_names:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GRA5: %s is in the excluded names list, excluding it' % hostname)
+			continue
 
 		try:
 			rc = RicciCommunicator(hostname)
 			if not rc:
 				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('GRA5: rc is None')
+					luci_log.debug_verbose('GRA6: rc is None')
 				continue
 
 			ricci_hostname = rc.hostname()
 			if not ricci_hostname:
 				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('GRA6: ricci_hostname is blank')
+					luci_log.debug_verbose('GRA7: ricci_hostname is blank')
 				continue
 
 			clu_info = rc.cluster_info()
@@ -797,35 +800,59 @@
 			if not cur_name:
 				cur_name = None
 				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('GRA7: cluster name is none for %s' \
+					luci_log.debug_verbose('GRA8: cluster name is none for %s' \
 						% ricci_hostname)
 
 			cur_alias = str(clu_info[1]).strip().lower()
 			if not cur_alias:
 				cur_alias = None
 				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('GRA8: no cluster alias for %s' \
+					luci_log.debug_verbose('GRA9: no cluster alias for %s' \
 						% ricci_hostname)
 
 			if (cur_name is not None and cluname != cur_name) and (cur_alias is not None and cluname != cur_alias):
 				if LUCI_DEBUG_MODE is True:
-					luci_log.debug('GRA9: node %s reports it\'s in cluster [%s:%s] we expect %s' % (hostname, clu_info[0], clu_info[1], cluname))
+					luci_log.debug('GRA10: node %s reports it\'s in cluster [%s:%s] we expect %s' % (ricci_hostname, clu_info[0], clu_info[1], cluname))
 				setNodeStatus(self, node, CLUSTER_NODE_NOT_MEMBER)
 				continue
 
-			if rc.authed():
-				return rc
-
-			setNodeStatus(node[1], CLUSTER_NODE_NEED_AUTH)
+			if not rc.authed():
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('GRA11: %s is not authenticated' \
+						% ricci_hostname)
+				setNodeStatus(node[1], CLUSTER_NODE_NEED_AUTH)
+				continue
 		except Exception, eout:
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('GRA10: %r %s' % (eout, str(eout)))
+				luci_log.debug_verbose('GRA12: %r %s' % (eout, str(eout)))
+			continue
+
+		if exclude_busy is True:
+			if NodeBusy(self, cluname, ricci_hostname, rc) is not False:
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('GRA13: %s is busy, excluding' \
+						% ricci_hostname)
+				continue
+		return rc
 
 	if LUCI_DEBUG_MODE is True:
-		luci_log.debug('GRA11: no ricci agent could be found for cluster %s' \
+		luci_log.debug('GRA14: no ricci agent could be found for cluster %s' \
 			% cluname)
 	return None
 
+def getClusterDBObj(self, clustername):
+	try:
+		cluster_path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
+		nodelist = self.restrictedTraverse(cluster_path)
+		if not nodelist:
+			raise Exception, 'no nodelist'
+		return nodelist
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCDB0: %s -> %s: %r %s' \
+				% (clustername, cluster_path, e, str(e)))
+	return None
+
 def getClusterDBNodes(self, clustername):
 	try:
 		cluster_path = '%s%s' % (CLUSTER_FOLDER_PATH, clustername)
@@ -837,6 +864,18 @@
 		return []
 	return nodelist
 
+def getClusterFlags(self, cluname):
+	try:
+		path = '%s%s' % (CLUSTER_FOLDER_PATH, cluname)
+		clusterfolder = self.restrictedTraverse(path)
+		if not clusterfolder:
+			raise Exception, 'clusterfolder is None'
+		return clusterfolder.objectItems('ManagedSystem')
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('GCF0: cluster %s [%s] folder missing: %r %s -- returning empty map' % (cluname, path, e, str(e)))
+	return None
+
 def getClusterStatusDB(self, clustername):
 	results = list()
 	vals = {}
--- conga/luci/site/luci/Extensions/Attic/LuciZopeExternal.py	2007/05/18 03:30:44	1.1.2.2
+++ conga/luci/site/luci/Extensions/Attic/LuciZopeExternal.py	2007/05/30 05:54:02	1.1.2.3
@@ -5,12 +5,18 @@
 # GNU General Public License as published by the
 # Free Software Foundation.
 
+#
+# The only purpose of this file is to aggregate all the functions
+# called by Zope External Methods.
+#
+
 from homebase_adapters import getUserPerms, homebaseControl, \
 	getDefaultUser
 
-from cluster_adapters import addResource, clusterTaskProcess, \
-	createCluChooser, createCluConfigTree, delResource, delService, \
-	getClusterOS, getClusterURL, getLogsForNode, getRicciAgentForCluster, \
+from cluster_adapters import clusterTaskProcess, resourceAdd, \
+	resourceDelete, \
+	createCluChooser, createCluConfigTree, serviceDelete, \
+	getClusterOS, getClusterURL, getSystemLogs, getRicciAgentForCluster, \
 	isClusterBusy, nodeTaskProcess, process_cluster_conf_editor, \
 	serviceMigrate, serviceRestart, serviceStart, serviceStop
 
--- conga/luci/site/luci/Extensions/Attic/RicciQueries.py	2007/05/18 05:23:55	1.1.2.5
+++ conga/luci/site/luci/Extensions/Attic/RicciQueries.py	2007/05/30 05:54:02	1.1.2.6
@@ -399,6 +399,13 @@
 
 	time_now = time()
 	entry_list = list()
+
+	try:
+		# Show older entries first.
+		log_entries.sort(lambda x, y: int(y.getAttribute('age')) - int(x.getAttribute('age')))
+	except:
+		pass
+
 	for i in log_entries:
 		try:
 			log_msg = i.getAttribute('msg')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/05/23 21:21:32	1.255.2.10
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/05/30 05:54:02	1.255.2.11
@@ -29,7 +29,20 @@
 from homebase_adapters import parseHostForm
 from LuciClusterInfo import getClusterInfo, getModelBuilder, getModelForCluster
 
-from conga_constants import *
+from conga_constants import BATCH_ID, CLUNAME, CLUNODE_CREATE_ERRORS, \
+	CLUSTER, CLUSTER_ADD, CLUSTER_CONFIG, CLUSTER_DAEMON, CLUSTER_DELETE, \
+	CLUSTER_FOLDER_PATH, CLUSTERLIST, CLUSTER_RESTART, CLUSTERS, \
+	CLUSTER_START, CLUSTER_STOP, DISABLE_SVC_TASK, ENABLE_SVC_TASK, \
+	FDOM, FDOM_ADD, FDOM_CONFIG, FDOMS, FENCEDEV, FENCEDEV_ADD, \
+	FENCEDEV_CONFIG, FENCEDEV_NODE_CONFIG, FENCEDEVS, FLAG_DESC, \
+	INSTALL_TASK, LAST_STATUS, LUCI_DEBUG_MODE, NODE, NODE_ADD, \
+	NODE_CONFIG, NODE_DELETE, NODE_FENCE, NODE_GRID, NODE_JOIN_CLUSTER, \
+	NODE_LEAVE_CLUSTER, NODE_LIST, NODE_REBOOT, NODES, PAGETYPE, \
+	POSSIBLE_REBOOT_MESSAGE, PRE_CFG, PRE_INSTALL, PRE_JOIN, \
+	REBOOT_TASK, REDIRECT_MSG, RESOURCE, RESOURCE_ADD, RESOURCE_CONFIG, \
+	RESOURCES, RICCI_CONNECT_FAILURE, RICCI_CONNECT_FAILURE_MSG, \
+	SEND_CONF, SERVICE, SERVICE_ADD, SERVICE_CONFIG, SERVICE_LIST, \
+	SERVICES, START_NODE, TASKTYPE, VM_ADD, VM_CONFIG
 
 from FenceHandler import validateNewFenceDevice, \
 	validateFenceDevice, validate_fenceinstance, \
@@ -39,9 +52,10 @@
 	batch_status, extract_module_status
 
 from LuciDB import manageCluster, createClusterSystems, \
-	setNodeStatus, getStorageNode, \
-	getClusterNode, delCluster, buildClusterCreateFlags, \
-	resolve_nodename, set_node_flag, getRicciAgent
+	setNodeStatus, getStorageNode, getClusterFlags, \
+	getClusterNode, buildClusterCreateFlags, getClusterDBObj, \
+	resolve_nodename, set_node_flag, getRicciAgent, \
+	CLUSTER_NODE_NEED_AUTH
 
 from LuciZopePerm import havePermCreateCluster
 
@@ -319,6 +333,7 @@
 
 def validateAddClusterNode(self, request):
 	import time
+
 	try:
 		request.SESSION.delete('add_node')
 	except:
@@ -3174,13 +3189,17 @@
 
 	redirect_page = NODES
 	if task == CLUSTER_STOP:
-		clusterStop(self, model)
+		from LuciClusterActions import ClusterStop
+		ClusterStop(self, model)
 	elif task == CLUSTER_START:
-		clusterStart(self, model)
+		from LuciClusterActions import ClusterStart
+		ClusterStart(self, model)
 	elif task == CLUSTER_RESTART:
-		clusterRestart(self, model)
+		from LuciClusterActions import ClusterRestart
+		ClusterRestart(self, model)
 	elif task == CLUSTER_DELETE:
-		ret = clusterDelete(self, model)
+		from LuciClusterActions import ClusterDelete
+		ret = ClusterDelete(self, model)
 		if ret is not None:
 			redirect_page = ret
 	else:
@@ -3191,7 +3210,7 @@
 		% (request['URL'], redirect_page, model.getClusterName()))
 
 def nodeTaskProcess(self, model, request):
-	fvar = GetReqVars(request, [ 'task', 'clustername', 'nodename' ])
+	fvar = GetReqVars(request, [ 'task', 'clustername', 'nodename', 'URL' ])
 
 	task = fvar['task']
 	clustername = fvar['clustername']
@@ -3270,7 +3289,8 @@
 			return (False, { 'errors': [ 'Node "%s" is not authenticated' % nodename_resolved ]})
 
 	if task == NODE_LEAVE_CLUSTER:
-		if nodeLeave(self, rc, clustername, nodename_resolved) is None:
+		from LuciClusterActions import NodeLeaveCluster
+		if NodeLeaveCluster(self, rc, clustername, nodename_resolved) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('NTP8: nodeLeave failed')
 			return (False, {'errors': [ 'Node "%s" failed to leave cluster "%s"' % (nodename_resolved, clustername) ]})
@@ -3278,7 +3298,8 @@
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
 			% (request['URL'], NODES, clustername))
 	elif task == NODE_JOIN_CLUSTER:
-		if nodeJoin(self, rc, clustername, nodename_resolved) is None:
+		from LuciClusterActions import NodeJoinCluster
+		if NodeJoinCluster(self, rc, clustername, nodename_resolved) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('NTP9: nodeJoin failed')
 			return (False, {'errors': [ 'Node "%s" failed to join cluster "%s"' % (nodename_resolved, clustername) ]})
@@ -3286,7 +3307,8 @@
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
 			% (request['URL'], NODES, clustername))
 	elif task == NODE_REBOOT:
-		if forceNodeReboot(self, rc, clustername, nodename_resolved) is None:
+		from LuciClusterActions import NodeReboot
+		if NodeReboot(self, rc, clustername, nodename_resolved) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('NTP10: nodeReboot failed')
 			return (False, {'errors': [ 'Node "%s" failed to reboot' \
@@ -3295,16 +3317,17 @@
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
 			% (request['URL'], NODES, clustername))
 	elif task == NODE_FENCE:
-		if forceNodeFence(self, clustername, nodename, nodename_resolved) is None:
+		from LuciClusterActions import NodeFence
+		if NodeFence(self, clustername, nodename, nodename_resolved) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('NTP11: nodeFencefailed')
 			return (False, {'errors': [ 'Fencing of node "%s" failed' \
 				% nodename_resolved]})
-
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
 			% (request['URL'], NODES, clustername))
 	elif task == NODE_DELETE:
-		if nodeDelete(self, rc, model, clustername, nodename, nodename_resolved) is None:
+		from LuciClusterActions import NodeDeleteFromCluster
+		if NodeDeleteFromCluster(self, rc, model, clustername, nodename, nodename_resolved) is None:
 			if LUCI_DEBUG_MODE is True:
 				luci_log.debug_verbose('NTP12: nodeDelete failed')
 			return (False, {'errors': [ 'Deletion of node "%s" from cluster "%s" failed' % (nodename_resolved, clustername) ]})
@@ -3318,51 +3341,26 @@
 	isBusy = False
 	redirect_message = False
 	nodereports = list()
-	busy_map['nodereports'] = nodereports
-
-	try:
-		cluname = req['clustername']
-	except KeyError, e:
-		try:
-			cluname = req.form['clustername']
-		except:
-			try:
-				cluname = req.form['clustername']
-			except:
-				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('ICB0: No cluster name -- returning empty map')
-				return busy_map
 
-	path = '%s%s' % (CLUSTER_FOLDER_PATH, cluname)
+	fvar = GetReqVars(req, [ 'clustername', 'URL' ])
+	busy_map['nodereports'] = nodereports
 
-	try:
-		clusterfolder = self.restrictedTraverse(path)
-		if not clusterfolder:
-			raise Exception, 'clusterfolder is None'
-	except Exception, e:
+	cluname = fvar['clustername']
+	if cluname is None:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('ICB1: cluster %s [%s] folder missing: %r %s -- returning empty map' % (cluname, path, e, str(e)))
+			luci_log.debug_verbose('ICB0: No cluster name, returning empty map')
 		return busy_map
-	except:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('ICB2: cluster %s [%s] folder missing: returning empty map' % (cluname, path))
 
-	try:
-		items = clusterfolder.objectItems('ManagedSystem')
-		if not items or len(items) < 1:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ICB3: NOT BUSY: no flags at %s for cluster %s' % (cluname, path))
-			# This returns an empty map, and indicates not busy
-			return busy_map
-	except Exception, e:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug('ICB4: An error occurred while looking for cluster %s flags at path %s: %r %s' % (cluname, path, e, str(e)))
-		return busy_map
-	except:
+	items = getClusterFlags(self, cluname)
+	if not items or len(items) < 1:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug('ICB5: An error occurred while looking for cluster %s flags@path %s' % (cluname, path))
+			luci_log.debug_verbose('ICB3: NOT BUSY: no flags for cluster %s' \
+				% cluname)
+		# This returns an empty map, and indicates not busy
 		return busy_map
 
+	clusterfolder = getClusterDBObj(cluname)
+	
 	if LUCI_DEBUG_MODE is True:
 		luci_log.debug_verbose('ICB6: %s is busy: %d flags' \
 			% (cluname, len(items)))
@@ -3401,7 +3399,7 @@
 			ricci = item[0].split('____')
 
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('ICB6A: using host %s for rc for item %s' \
+				luci_log.debug_verbose('ICB6A: using rc host %s for item %s' \
 					% (ricci[0], item[0]))
 
 			try:
@@ -3576,6 +3574,7 @@
 					nodereports.append(node_report)
 					propslist = list()
 					propslist.append(LAST_STATUS)
+
 					try:
 						item[1].manage_delProperties(propslist)
 						item[1].manage_addProperty(LAST_STATUS, creation_status, 'int')
@@ -3595,6 +3594,7 @@
 				rc = None
 				finished = -1
 				err_msg = ''
+
 				if LUCI_DEBUG_MODE is True:
 					luci_log.debug_verbose('ICB15: ricci error: %s: %r %s' \
 						% (ricci[0], e, str(e)))
@@ -3745,9 +3745,8 @@
 			luci_log.debug_verbose('GRI1: missing res name')
 		return {}
 
-	cluname = fvars['clustername']
-	baseurl = fvars['URL']
-
+	#cluname = fvars['clustername']
+	#baseurl = fvars['URL']
 	#CALL
 	return {}
 
@@ -3772,43 +3771,47 @@
 def serviceRestart(self, rc, req):
 	from LuciClusterActions import RestartCluSvc
 
-	fvars = GetReqVars(request, [ 'clustername', 'servicename', 'nodename' ])
+	fvars = GetReqVars(req,
+				[ 'clustername', 'servicename', 'nodename', 'URL' ])
 	ret = RestartCluSvc(self, rc, fvars)
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], SERVICE_LIST, cluname))
+			% (fvars['URL'], SERVICE_LIST, fvars['clustername']))
 	else:
 		return ret
 
 def serviceStop(self, rc, req):
 	from LuciClusterActions import StopCluSvc
 
-	fvars = GetReqVars(request, [ 'clustername', 'servicename', 'nodename' ])
+	fvars = GetReqVars(req,
+				[ 'clustername', 'servicename', 'nodename', 'URL' ])
 	ret = StopCluSvc(self, rc, fvars)
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], SERVICE_LIST, cluname))
+			% (fvars['URL'], SERVICE_LIST, fvars['clustername']))
 	else:
 		return ret
 
 def serviceStart(self, rc, req):
 	from LuciClusterActions import StartCluSvc
 
-	fvars = GetReqVars(request, [ 'clustername', 'servicename', 'nodename' ])
+	fvars = GetReqVars(req,
+				[ 'clustername', 'servicename', 'nodename', 'URL' ])
 	ret = StartCluSvc(self, rc, fvars)
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], SERVICE_LIST, cluname))
+			% (fvars['URL'], SERVICE_LIST, fvars['clustername']))
 	else:
 		return ret
 
 def serviceDelete(self, rc, req):
 	from LuciClusterActions import DeleteCluSvc
 
-	fvars = GetReqVars(request, [ 'clustername', 'servicename', 'nodename' ])
+	fvars = GetReqVars(req,
+				[ 'clustername', 'servicename', 'nodename', 'URL' ])
 	try:
 		model = LuciExtractCluModel(self, req,
 					cluster_name=fvars['clustername'])
@@ -3821,26 +3824,28 @@
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], SERVICES, clustername))
+			% (fvars['URL'], SERVICES, fvars['clustername']))
 	else:
 		return ret
 
 def serviceMigrate(self, rc, req):
 	from LuciClusterActions import MigrateCluSvc
 
-	fvars = GetReqVars(request, [ 'clustername', 'servicename', 'nodename' ])
+	fvars = GetReqVars(req,
+				[ 'clustername', 'servicename', 'nodename', 'URL' ])
 	ret = MigrateCluSvc(self, rc, fvars)
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], SERVICE_LIST, cluname))
+			% (fvars['URL'], SERVICE_LIST, fvars['clustername']))
 	else:
 		return ret
 
 def resourceDelete(self, rc, req):
 	from LuciClusterActions import DeleteResource
 
-	fvars = GetReqVars(request, [ 'clustername', 'resourcename', 'nodename' ])
+	fvars = GetReqVars(req,
+		[ 'clustername', 'resourcename', 'nodename', 'URL' ])
 	try:
 		model = LuciExtractCluModel(self, req,
 					cluster_name=fvars['clustername'])
@@ -3855,7 +3860,7 @@
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], RESOURCES, fvars['clustername']))
+			% (fvars['URL'], RESOURCES, fvars['clustername']))
 	else:
 		return ret
 
@@ -3865,7 +3870,7 @@
 	try:
 		cluname = model.getClusterName()
 		rc = getRicciAgent(self, cluname)
-		if not rc:
+		if rc is None:
 			raise Exception, 'no rc'
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
@@ -3881,23 +3886,12 @@
 	if ret is None:
 		response = req.RESPONSE
 		response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-			% (req['URL'], RESOURCES, clustername))
+			% (req['URL'], RESOURCES, cluname))
 	else:
 		return ret
 
-def nodeJoin(self, rc, cluname, nodename):
-	return None
-def nodeLeave(self, rc, cluname, nodename):
-	return None
-def nodeDelete(self, rc, cluname, nodename):
-	return None
-
-
-def clusterStart(self, model):
-	return None
-def clusterStop(self, model):
-	return None
-def clusterRestart(self, model):
-	return None
-def clusterDelete(self, model):
-	return None
+def getSystemLogs(self, req):
+	from LuciClusterActions import GetSystemLogs
+
+	fvars = GetReqVars(req, [ 'clustername', 'nodename' ])
+	return GetSystemLogs(self, fvars)
--- conga/luci/site/luci/Extensions/conga_constants.py	2007/05/15 21:42:21	1.39.2.4
+++ conga/luci/site/luci/Extensions/conga_constants.py	2007/05/30 05:54:02	1.39.2.5
@@ -142,11 +142,6 @@
 
 REDIRECT_MSG = ' -- You will be redirected in 5 seconds.'
 
-# Cluster node exception attribute flags
-CLUSTER_NODE_NEED_AUTH	= 0x01
-CLUSTER_NODE_NOT_MEMBER	= 0x02
-CLUSTER_NODE_ADDED		= 0x04
-
 # Debugging parameters. Set LUCI_DEBUG_MODE to True and LUCI_DEBUG_VERBOSITY
 # to >= 2 to get full debugging output in syslog (LOG_DAEMON/LOG_DEBUG).
 
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2007/05/22 02:45:54	1.50.2.7
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2007/05/30 05:54:02	1.50.2.8
@@ -5,7 +5,7 @@
 # GNU General Public License as published by the
 # Free Software Foundation.
 
-from conga_constants import PLONE_ROOT, CLUSTER_NODE_NEED_AUTH, \
+from conga_constants import PLONE_ROOT, \
 	STORAGE_FOLDER_PATH, CLUSTER_FOLDER_PATH, LUCI_DEBUG_MODE
 
 from RicciQueries import getClusterConf
@@ -14,7 +14,8 @@
 
 from LuciDB import delCluster, clearNodeStatus, delSystem, \
 	getClusterNode, getClusters, getStorage, getStorageNode, \
-	manageCluster
+	manageCluster, \
+	CLUSTER_NODE_NEED_AUTH
 
 from LuciZopePerm import havePermAddCluster, havePermRemCluster, \
 	havePermAddUser, havePermDelUser, havePermEditPerms, \
--- conga/luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py	2007/05/22 21:52:05	1.1.2.5
+++ conga/luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py	2007/05/30 05:54:02	1.1.2.6
@@ -544,12 +544,12 @@
     self.isModified = True
 
   def retrieveNodeByName(self, name):
-    nodes = self.getNodes()
-    for node in nodes:
-      if node.getName() == name:
-        return node
+    ret = filter(lambda x: x.getName() == name, self.getNodes())
+    if len(ret) != 1:
+      raise KeyError, name
 
-    raise GeneralError('FATAL', "Couldn't find node name in current node list")
+  def deleteNodeByName(self, name):
+    return self.deleteNode(self.retrieveNodeByName(name))
 
   def retrieveServiceByName(self, name):
     svcs = self.getServices()



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-02-16  2:12 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-02-16  2:12 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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
 }
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-02-16  2:06 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-02-16  2:06 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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
 }
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-02-08 15:59 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-02-08 15:59 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe at sourceware.org	2007-02-08 15:59:20

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : luci_homebase.css 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	Support fdoms, recovery, and running exclusive for services.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.5&r2=1.176.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.31&r2=1.31.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.29&r2=1.29.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.37.2.1&r2=1.37.2.2
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.4&r2=1.227.2.5

--- conga/luci/cluster/form-macros	2007/02/08 03:46:51	1.176.2.5
+++ conga/luci/cluster/form-macros	2007/02/08 15:59:20	1.176.2.6
@@ -3820,6 +3820,41 @@
 				<p class="reshdr">Create a Virtual Machine Service</p>
 			</td></tr>
 		<tfoot class="systemsTable">
+			<tr class="systemsTable">
+				<td>Automatically start this service</td>
+				<td>
+					<input type="checkbox" name="autostart" checked="checked">
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Run exclusive</td>
+				<td>
+					<input type="checkbox" name="exclusive">
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Failover Domain</td>
+				<td>
+					<select name="domain">
+						<option value="" selected="selected">None</option>
+						<tal:block tal:repeat="f python:here.get_fdom_names(modelb)">
+							<option tal:content="f"
+								tal:attributes="value f" />
+						</tal:block>
+					</select>
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Recovery policy</td>
+				<td>
+					<select name="recovery">
+						<option value="">Select a recovery policy</option>
+						<option name="relocate" value="relocate">Relocate</option>
+						<option name="restart" value="restart">Restart</option>
+						<option name="disable" value="disable">Disable</option>
+					</select>
+				</td>
+			</tr>
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input type="submit" value="Create Virtual Machine Service" />
@@ -3861,6 +3896,52 @@
 				<p class="reshdr">Properties for <tal:block tal:replace="vminfo/name | string:virtual machine service"/></p>
 			</td></tr>
 		<tfoot class="systemsTable">
+			<tr class="systemsTable">
+				<td>Automatically start this service</td>
+				<td>
+					<input type="checkbox" name="autostart"
+						tal:attributes="checked python: ('autostart' in vminfo and vminfo['autostart'] != '0') and 'checked' or ''" />
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Run exclusive</td>
+				<td>
+					<input type="checkbox" name="exclusive"
+						tal:attributes="checked python: ('exclusive' in vminfo and vminfo['exclusive'] != '0') and 'checked' or ''" />
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Failover Domain</td>
+				<td>
+					<select name="domain">
+						<option value="" tal:content="string:None"
+							tal:attributes="selected python: (not 'domain' in vminfo or not vminfo['domain']) and 'selected' or ''" />
+						<tal:block tal:repeat="f python:here.get_fdom_names(modelb)">
+							<option tal:content="f"
+								tal:attributes="
+									value f;
+									selected python: ('domain' in vminfo and vminfo['domain'] == f) and 'selected' or ''" />
+						</tal:block>
+					</select>
+				</td>
+			</tr>
+			<tr class="systemsTable">
+				<td>Recovery policy</td>
+				<td>
+					<select name="recovery">
+						<option value="">Select a recovery policy</option>
+						<option name="relocate" value="relocate"
+							tal:content="string:Relocate"
+							tal:attributes="selected python: ('recovery' in vminfo and vminfo['recovery'] == 'relocate') and 'selected' or ''" />
+						<option name="restart" value="restart"
+							tal:content="string:Restart"
+							tal:attributes="selected python: ('recovery' in vminfo and vminfo['recovery'] == 'restart') and 'selected' or ''" />
+						<option name="disable" value="disable"
+							tal:content="string:Disable"
+							tal:attributes="selected python: ('recovery' in vminfo and vminfo['recovery'] == 'disable') and 'selected' or ''" />
+					</select>
+				</td>
+			</tr>
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input name="submit" type="submit" value="Update Virtual Machine Service" />
@@ -3920,6 +4001,35 @@
 						<input type="checkbox" name="autostart" checked="checked" />
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">Run exclusive</td>
+					<td class="systemsTable">
+						<input type="checkbox" name="exclusive">
+					</td>
+				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">Failover Domain</td>
+					<td class="systemsTable">
+						<select name="domain">
+							<option value="" selected="selected">None</option>
+							<tal:block tal:repeat="f sinfo/fdoms">
+								<option tal:content="f"
+									tal:attributes="value f" />
+							</tal:block>
+						</select>
+					</td>
+				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">Recovery policy</td>
+					<td class="systemsTable">
+						<select name="recovery">
+							<option value="">Select a recovery policy</option>
+							<option name="relocate" value="relocate">Relocate</option>
+							<option name="restart" value="restart">Restart</option>
+							<option name="disable" value="disable">Disable</option>
+						</select>
+					</td>
+				</tr>
 			</table>
 		</form>
 	</div>
@@ -3944,6 +4054,9 @@
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="autostart" value="-1" />
+		<input type="hidden" name="exclusive" value="-1" />
+		<input type="hidden" name="recovery" />
+		<input type="hidden" name="domain" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="add" />
 		</form>
@@ -4167,11 +4280,50 @@
 	<div class="service_comp_list">
 		<form name="service_name_form">
 			<table class="rescfg">
-				<tr><td>
-				Automatically start this service
-				</td>
-				<td><input type="checkbox" name="autostart"
-						tal:attributes="checked python: ('autostart' in sinfo and sinfo['autostart'].lower() != 'false') and 'checked'" /></td></tr>
+				<tr>
+					<td>Automatically start this service</td>
+					<td><input type="checkbox" name="autostart"
+							tal:attributes="checked python: ('autostart' in sinfo and sinfo['autostart'].lower() != 'false') and 'checked'" />
+					</td>
+				</tr>
+				<tr>
+					<td>Run exclusive</td>
+					<td><input type="checkbox" name="exclusive"
+							tal:attributes="checked python: ('exclusive' in sinfo and sinfo['exclusive'].lower() != 'false') and 'checked'" />
+					</td>
+				</tr>
+				<tr>
+					<td>Failover Domain</td>
+					<td>
+						<select name="domain">
+							<option value=""
+								tal:attributes="selected python: (not 'domain' in sinfo or not sinfo['domain']) and 'selected' or ''">None</option>
+							<tal:block tal:repeat="f sinfo/fdoms">
+								<option tal:content="f"
+									tal:attributes="
+										value f;
+										selected python: ('domain' in sinfo and sinfo['domain'] == f) and 'selected' or ''" />
+							</tal:block>
+						</select>
+					</td>
+				</tr>
+				<tr class="systemsTable">
+					<td>Recovery policy</td>
+					<td>
+						<select name="recovery">
+							<option value="">Select a recovery policy</option>
+							<option name="relocate" value="relocate"
+								tal:content="string:Relocate"
+								tal:attributes="selected python: ('recovery' in sinfo and sinfo['recovery'] == 'relocate') and 'selected' or ''" />
+							<option name="restart" value="restart"
+								tal:content="string:Restart"
+								tal:attributes="selected python: ('recovery' in sinfo and sinfo['recovery'] == 'restart') and 'selected' or ''" />
+							<option name="disable" value="disable"
+								tal:content="string:Disable"
+								tal:attributes="selected python: ('recovery' in sinfo and sinfo['recovery'] == 'disable') and 'selected' or ''" />
+						</select>
+					</td>
+				</tr>
 			</table>
 			<input type="hidden" name="service_name"
 				tal:attributes="value sinfo/name | string:1" />
@@ -4194,6 +4346,9 @@
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="autostart" value="-1" />
+		<input type="hidden" name="exclusive" value="-1" />
+		<input type="hidden" name="recovery" />
+		<input type="hidden" name="domain" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="edit" />
 		</form>
--- conga/luci/cluster/resource-form-macros	2007/01/29 16:56:50	1.31
+++ conga/luci/cluster/resource-form-macros	2007/02/08 15:59:20	1.31.2.1
@@ -129,11 +129,6 @@
 				</option>
 				<option name="TOMCAT-5" value="TOMCAT-5">Tomcat 5</option>
 			</tal:block>
-
-			<tal:block
-				tal:condition="python: os_version and os_version == 'rhel5'">
-				<option name="VM" value="VM">Virtual Machine</option>
-			</tal:block>
 		</select>
 		</form>
 	</p>
@@ -174,6 +169,17 @@
 			<option name="NFSX" value="NFSX">NFS export</option>
 			<option name="SCR" value="SCR">Script</option>
 			<option name="SMB" value="SMB">Samba</option>
+
+			<tal:block
+				tal:condition="python: os_version and os_version == 'rhel4'">
+				<option name="APACHE" value="APACHE">Apache</option>
+				<option name="MYSQL" value="MYSQL">MySQL</option>
+				<option name="OPENLDAP" value="OPENLDAP">Open LDAP</option>
+				<option name="POSTGRES-8" value="POSTGRES-8">
+					PostgreSQL 8
+				</option>
+				<option name="TOMCAT-5" value="TOMCAT-5">Tomcat 5</option>
+			</tal:block>
 		</select>
 		</form>
 	</p>
@@ -419,10 +425,10 @@
 
 					<option name="ext3" value="ext3"
 						tal:content="string: ext3"
-						tal:attributes="checked python: fstype == 'ext3' and 'checked'" />
+						tal:attributes="selected python: fstype == 'ext3' and 'selected'" />
 					<option name="ext2" value="ext2"
 						tal:content="string: ext2"
-						tal:attributes="checked python: fstype == 'ext2' and 'checked'" />
+						tal:attributes="selected python: fstype == 'ext2' and 'selected'" />
 				</select>
 			</td>
 		</tr>
--- conga/luci/cluster/resource_form_handlers.js	2007/01/26 17:56:14	1.29
+++ conga/luci/cluster/resource_form_handlers.js	2007/02/08 15:59:20	1.29.2.1
@@ -423,6 +423,9 @@
 	var form_xml = '';
 	var svc_name = null;
 	var autostart = 1;
+	var domain = null;
+	var exclusive = 0;
+	var recovery = null;
 
 	var form = document.getElementsByTagName('form');
 	for (var i = 0 ; i < form.length ; i++) {
@@ -435,8 +438,26 @@
 				clr_form_err(form[i].service_name);
 				svc_name = form[i].service_name.value;
 			}
+
 			if (!form[i].autostart.checked)
 				autostart = 0;
+
+			if (!form[i].exclusive.checked)
+				exclusive = 0;
+			else
+				exclusive = 1;
+
+			if (form[i].recovery) {
+				recovery = form[i].recovery.options[form[i].recovery.options.selectedIndex].value;
+				if (str_is_blank(recovery))
+					recovery = null;
+			}
+
+			if (form[i].domain) {
+				domain = form[i].domain.options[form[i].domain.options.selectedIndex].value;
+				if (str_is_blank(domain))
+					domain = null;
+			}
 			continue;
 		}
 
@@ -480,13 +501,22 @@
 	if (!form_xml)
 		errors.push('No resource information was submitted.');
 
+	if (recovery && recovery != 'relocate' && recovery != 'restart' && recovery != 'disable') {
+		errors.push('You entered an invalid recovery option. Valid options are "relocate" "restart" and "disable"');
+	}
+
 	if (error_dialog(errors))
 		return (-1);
 
 	/* sort this out in the backend */
 	master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
 	master_form.svc_name.value = svc_name;
+	if (domain)
+		master_form.domain.value = domain;
+	if (recovery)
+		master_form.recovery.value = recovery;
 	master_form.autostart.value = autostart;
+	master_form.exclusive.value = exclusive;
 
 	var confirm_msg = null;
 	if (master_form.action.value == 'add')
--- conga/luci/homebase/luci_homebase.css	2007/02/07 17:16:55	1.37.2.1
+++ conga/luci/homebase/luci_homebase.css	2007/02/08 15:59:20	1.37.2.2
@@ -336,7 +336,6 @@
 strong.cluster {
 	text-align: top;
 	font-size: 9pt;
-	letter-spacing: +.5px;
 }
 
 *.reshdr {
@@ -350,7 +349,6 @@
 strong.node_name,
 strong.cluster_name {
 	font-size: 10pt;
-	letter-spacing: +.5px;
 }
 
 td.service_name,
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/08 03:46:51	1.227.2.4
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/08 15:59:20	1.227.2.5
@@ -775,6 +775,25 @@
 	if len(errors) > 0:
 		return (False, {'errors': errors})
 
+	fdom = None
+	try:
+		fdom = request.form['domain'].strip()
+		if not fdom:
+			raise Exception, 'blank'
+	except:
+		fdom = None
+
+	recovery = None
+	try:
+		recovery = request.form['recovery'].strip()
+		if not recovery:
+			recovery = None
+		else:
+			if recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
+				errors.append('You entered an invalid recovery option: \"%s\" Valid options are \"restart\" \"relocate\" and \"disable\"')
+	except:
+		recovery = None
+
 	try:
 		service_name = request.form['svc_name'].strip()
 	except Exception, e:
@@ -789,6 +808,15 @@
 		autostart = None
 		luci_log.debug_verbose('vSA5a: error getting autostart: %s' % str(e))
 
+	exclusive = "0"
+	try:
+		if not request.form.has_key('exclusive') or request.form['exclusive'] != "1":
+			exclusive = "0"
+		else:
+			exclusive = "1"
+	except Exception, e:
+		exclusive = "0"
+
 	try:
 		cur_service = model.retrieveServiceByName(service_name)
 	except GeneralError, e:
@@ -827,6 +855,11 @@
 
 	new_service = Service()
 	new_service.addAttribute('name', service_name)
+	if fdom:
+		new_service.addAttribute('domain', fdom)
+	if recovery:
+		new_service.addAttribute('recovery', recovery)
+	new_service.addAttribute('exclusive', str(exclusive))
 	if autostart is not None:
 		new_service.attr_hash['autostart'] = autostart
 
@@ -2169,6 +2202,43 @@
 		luci_log.debug_verbose('validateVM1: no vm path: %s' % str(e))
 		errors.append('No path to the virtual machine configuration file was given.')
 
+	autostart = 1
+	try:
+		if request.form.has_key('autostart'):
+			autostart = 1
+		else:
+			autostart = 0
+	except:
+		autostart = 1
+
+	exclusive = 0
+	try:
+		if request.form.has_key('exclusive'):
+			exclusive = 1
+		else:
+			exclusive = 0
+	except:
+		exclusive = 0
+
+	recovery = None
+	try:
+		recovery = request.form['recovery'].strip()
+		if not recovery:
+			recovery = None
+		else:
+			if recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
+				errors.append('You entered an invalid recovery option: \"%s\" Valid options are \"restart\" \"relocate\" and \"disable\"')
+	except:
+		recovery = None
+
+	fdom = None
+	try:
+		fdom = request.form['domain'].strip()
+		if not fdom:
+			raise Exception, 'blank'
+	except:
+		fdom = None
+
 	if len(errors) > 0:
 		return (False, {'errors': errors })
 
@@ -2208,6 +2278,24 @@
 			xvm.addAttribute('name', vm_name)
 			xvm.addAttribute('path', vm_path)
 
+	xvm.addAttribute('autostart', str(autostart))
+	xvm.addAttribute('exclusive', str(exclusive))
+	if fdom:
+		xvm.addAttribute('domain', fdom)
+	else:
+		try:
+			xvm.removeAttribute('domain')
+		except:
+			pass
+
+	if recovery:
+		xvm.addAttribute('recovery', recovery)
+	else:
+		try:
+			xvm.removeAttribute('recovery')
+		except:
+			pass
+
 	try:
 		model.setModified(True)
 		stringbuf = str(model.exportModelAsString())
@@ -3230,9 +3318,15 @@
 		if item['type'] == "service":
 			itemmap = {}
 			itemmap['name'] = item['name']
+
 			if item['running'] == "true":
 				itemmap['running'] = "true"
 				itemmap['nodename'] = item['nodename']
+				itemmap['disableurl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + item['name'] + "&pagetype=" + SERVICE_STOP
+				itemmap['restarturl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + item['name'] + "&pagetype=" + SERVICE_RESTART
+			else:
+				itemmap['enableurl'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + item['name'] + "&pagetype=" + SERVICE_START
+
 			itemmap['autostart'] = item['autostart']
 
 			try:
@@ -3257,6 +3351,9 @@
 	map['services'] = maplist
 	return map
 
+def get_fdom_names(model):
+	return map(lambda x: x.getName(), model.getFailoverDomains())
+
 def getServiceInfo(self, status, model, req):
 	#set up struct for service config page
 	hmap = {}
@@ -3270,6 +3367,11 @@
 		baseurl = '/luci/cluster/index_html'
 
 	try:
+		hmap['fdoms'] = get_fdom_names(model)
+	except:
+		hmap['fdoms'] = list()
+
+	try:
 		cluname = req['clustername']
 		if not cluname:
 			raise KeyError, 'is blank'
@@ -3334,6 +3436,24 @@
 	#Now build hashes for resources under service.
 	#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:
+		if int(svc.getAttribute('exclusive')):
+			hmap['exclusive'] = 'true' 
+		else:
+			hmap['exclusive'] = 'false'
+	except:
+		hmap['exclusive'] = 'false'
+
 	resource_list = list()
 	if svc is not None:
 		indent_ctr = 0
@@ -3357,9 +3477,11 @@
 	#Note: Final version needs all resource attrs
 	if child.isRefObject() == True:
 		rc_map['ref_object'] = True
+		rc_map['tag_name'] = child.getObj().TAG_NAME
 		rc_map['type'] = child.getObj().getResourceType()
 		rc_map['attrs'] = child.getObj().getAttributes()
 	else:
+		rc_map['tag_name'] = child.TAG_NAME
 		rc_map['type'] = child.getResourceType()
 		rc_map['attrs'] = child.getAttributes()
 
@@ -5085,7 +5207,7 @@
       % vmname)
     return map
 
-  attrs= vm.getAttributes()
+  attrs = vm.getAttributes()
   keys = attrs.keys()
   for key in keys:
     map[key] = attrs[key]



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-02-08  5:05 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-02-08  5:05 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-02-08 05:05:22

Modified files:
	luci/cluster   : form-macros resource_form_handlers.js 
	luci/homebase  : luci_homebase.css 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	Allow a failover domain to be selected for services

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.182&r2=1.183
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.234&r2=1.235

--- conga/luci/cluster/form-macros	2007/02/08 03:42:58	1.182
+++ conga/luci/cluster/form-macros	2007/02/08 05:05:21	1.183
@@ -3920,6 +3920,18 @@
 						<input type="checkbox" name="autostart" checked="checked" />
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">Failover Domain</td>
+					<td class="systemsTable">
+						<select name="domain">
+							<option value="" selected="selected">None</option>
+							<tal:block tal:repeat="f sinfo/fdoms">
+								<option tal:content="f"
+									tal:attributes="value f" />
+							</tal:block>
+						</select>
+					</td>
+				</tr>
 			</table>
 		</form>
 	</div>
@@ -3945,6 +3957,7 @@
 		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="autostart" value="-1" />
 		<input type="hidden" name="form_xml" />
+		<input type="hidden" name="domain" />
 		<input type="hidden" name="action" value="add" />
 		</form>
 	</div>
@@ -4167,11 +4180,27 @@
 	<div class="service_comp_list">
 		<form name="service_name_form">
 			<table class="rescfg">
-				<tr><td>
-				Automatically start this service
-				</td>
-				<td><input type="checkbox" name="autostart"
-						tal:attributes="checked python: ('autostart' in sinfo and sinfo['autostart'].lower() != 'false') and 'checked'" /></td></tr>
+				<tr>
+					<td>Automatically start this service</td>
+					<td><input type="checkbox" name="autostart"
+							tal:attributes="checked python: ('autostart' in sinfo and sinfo['autostart'].lower() != 'false') and 'checked'" />
+					</td>
+				</tr>
+				<tr>
+					<td>Failover Domain</td>
+					<td>
+						<select name="domain">
+							<option value=""
+								tal:attributes="selected python: (not 'domain' in sinfo or not sinfo['domain']) and 'selected' or ''">None</option>
+							<tal:block tal:repeat="f sinfo/fdoms">
+								<option tal:content="f"
+									tal:attributes="
+										value f;
+										selected python: ('domain' in sinfo and sinfo['domain'] == f) and 'selected' or ''" />
+							</tal:block>
+						</select>
+					</td>
+				</tr>
 			</table>
 			<input type="hidden" name="service_name"
 				tal:attributes="value sinfo/name | string:1" />
@@ -4195,6 +4224,7 @@
 		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="autostart" value="-1" />
 		<input type="hidden" name="form_xml" />
+		<input type="hidden" name="domain" />
 		<input type="hidden" name="action" value="edit" />
 		</form>
 	</div>
--- conga/luci/cluster/resource_form_handlers.js	2007/01/26 17:56:14	1.29
+++ conga/luci/cluster/resource_form_handlers.js	2007/02/08 05:05:21	1.30
@@ -423,6 +423,7 @@
 	var form_xml = '';
 	var svc_name = null;
 	var autostart = 1;
+	var domain = null;
 
 	var form = document.getElementsByTagName('form');
 	for (var i = 0 ; i < form.length ; i++) {
@@ -437,6 +438,12 @@
 			}
 			if (!form[i].autostart.checked)
 				autostart = 0;
+
+			if (form[i].domain) {
+				domain = form[i].domain.options[form[i].domain.options.selectedIndex].value;
+				if (str_is_blank(domain))
+					domain = null;
+			}
 			continue;
 		}
 
@@ -486,6 +493,8 @@
 	/* sort this out in the backend */
 	master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
 	master_form.svc_name.value = svc_name;
+	if (domain)
+		master_form.domain.value = domain;
 	master_form.autostart.value = autostart;
 
 	var confirm_msg = null;
--- conga/luci/homebase/luci_homebase.css	2007/02/07 17:18:43	1.38
+++ conga/luci/homebase/luci_homebase.css	2007/02/08 05:05:22	1.39
@@ -336,7 +336,6 @@
 strong.cluster {
 	text-align: top;
 	font-size: 9pt;
-	letter-spacing: +.5px;
 }
 
 *.reshdr {
@@ -350,7 +349,6 @@
 strong.node_name,
 strong.cluster_name {
 	font-size: 10pt;
-	letter-spacing: +.5px;
 }
 
 td.service_name,
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/08 03:42:58	1.234
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/08 05:05:22	1.235
@@ -775,6 +775,14 @@
 	if len(errors) > 0:
 		return (False, {'errors': errors})
 
+	fdom = None
+	try:
+		fdom = request.form['domain'].strip()
+		if not fdom:
+			raise Exception, 'blank'
+	except:
+		fdom = None
+
 	try:
 		service_name = request.form['svc_name'].strip()
 	except Exception, e:
@@ -827,6 +835,8 @@
 
 	new_service = Service()
 	new_service.addAttribute('name', service_name)
+	if fdom:
+		new_service.addAttribute('domain', fdom)
 	if autostart is not None:
 		new_service.attr_hash['autostart'] = autostart
 
@@ -3270,6 +3280,11 @@
 		baseurl = '/luci/cluster/index_html'
 
 	try:
+		hmap['fdoms'] = map(lambda x: x.getName(), model.getFailoverDomains())
+	except:
+		hmap['fdoms'] = list()
+
+	try:
 		cluname = req['clustername']
 		if not cluname:
 			raise KeyError, 'is blank'
@@ -3334,6 +3349,11 @@
 	#Now build hashes for resources under service.
 	#first get service by name from model
 	svc = model.getService(servicename)
+	try:
+		hmap['domain'] = svc.getAttribute('domain')
+	except:
+		hmap['domain'] = None
+
 	resource_list = list()
 	if svc is not None:
 		indent_ctr = 0
@@ -3357,9 +3377,11 @@
 	#Note: Final version needs all resource attrs
 	if child.isRefObject() == True:
 		rc_map['ref_object'] = True
+		rc_map['tag_name'] = child.getObj().TAG_NAME
 		rc_map['type'] = child.getObj().getResourceType()
 		rc_map['attrs'] = child.getObj().getAttributes()
 	else:
+		rc_map['tag_name'] = child.TAG_NAME
 		rc_map['type'] = child.getResourceType()
 		rc_map['attrs'] = child.getAttributes()
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-01-26 17:56 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-01-26 17:56 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-26 17:56:15

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

Log message:
	fix for adding global resources to services and other cleanup/polish

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.162&r2=1.163
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.211&r2=1.212

--- conga/luci/cluster/form-macros	2007/01/26 16:53:53	1.162
+++ conga/luci/cluster/form-macros	2007/01/26 17:56:14	1.163
@@ -223,14 +223,14 @@
 
 		<table id="systemsTable" class="systemsTable" cellspacing="0">
 			<thead class="systemsTable">
-                <tr class="systemsTable"><td class="systemsTable" colspan="2">
-                    <div class="systemsTableTop">
-                        <strong>Cluster Name</strong>
-                        <input class="hbInputSys" type="text"
+				<tr class="systemsTable"><td class="systemsTable" colspan="2">
+					<div class="systemsTableTop">
+						<strong>Cluster Name</strong>
+						<input class="hbInputSys" type="text"
 							id="clusterName" name="clusterName"
 							tal:attributes="value add_cluster/name | nothing" />
-                    </div>
-                </td></tr>
+					</div>
+				</td></tr>
 				<tr class="systemsTable">
 					<th class="systemsTable">Node Hostname</th>
 					<th class="systemsTable">Root Password</th>
@@ -2700,62 +2700,62 @@
 <div metal:define-macro="fencedev-instance-cond-ladder"
 	tal:condition="exists: cur_fence_type">
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_apc'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_apc'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-apc" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_mcdata'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_mcdata'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-mcdata" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_wti'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_wti'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-wti" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_brocade'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_brocade'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_sanbox2'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_sanbox2'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-sanbox2" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_vixel'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_vixel'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-vixel" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_gnbd'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_gnbd'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-gnbd" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_egenera'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_egenera'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-egenera" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_scsi'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_scsi'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-scsi" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_xvm'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_xvm'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-bladecenter" />
 	</tal:block>
@@ -3738,8 +3738,10 @@
 		<tal:block tal:repeat="gr global_resources">
 			<tal:block tal:define="
 				global res gr;
-				global type res/type;
+				global type python: 'tag_name' in res and res['tag_name'] or '';
 				global resourceIsRef python: True" />
+				<span tal:content="type" />
+				<span tal:content="res" />
 
 			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 		</tal:block>
@@ -3790,45 +3792,55 @@
 </div>
 
 <div metal:define-macro="serviceconfig-type-macro" tal:omit-tag="">
-	<tal:block tal:condition="python: type == 'ip' or type == 'IP Address: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/ip_macro" />
+	<tal:block tal:condition="python: type == 'ip'">
+		<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'fs' or type == 'File System: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+	<tal:block tal:condition="python: type == 'fs'">
+		<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'gfs' or type == 'GFS: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+	<tal:block tal:condition="python: type == 'gfs' or type == 'clusterfs'">
+		<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'nfsm' or type == 'NFS Mount: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+	<tal:block tal:condition="python: type == 'nfsm'">
+		<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'nfsx' or type == 'NFS Export: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+	<tal:block tal:condition="python: type == 'nfsx'">
+		<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'nfsc' or type == 'NFS Client: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
+	<tal:block tal:condition="python: type == 'nfsc'">
+		<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
 	</tal:block>
 
-	<tal:block
-		tal:condition="python: type == 'smb' or type == 'Samba Service: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+	<tal:block tal:condition="python: type == 'smb'">
+		<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'script' or type == 'Script: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	<tal:block tal:condition="python: type == 'script'">
+		<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'apache'">
+		<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'openldap'">
+		<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'mysql'">
+		<div metal:use-macro="here/resource-form-macros/macros/mysql_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>
+	<tal:block tal:condition="python: type == 'tomcat-5'">
+		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
 	</tal:block>
 </div>
 
@@ -3930,7 +3942,7 @@
 			tal:replace="structure python: '<div class=nothing>'" />
 
 		<tal:block tal:define="
-			global type res/type;
+			global type python: 'tag_name' in res and res['tag_name'] or '';
 			global resourceIsRef res/ref_object | nothing" />
 
 		<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
@@ -3979,9 +3991,11 @@
 		<tal:block tal:repeat="gr global_resources">
 			<tal:block tal:define="
 				global res gr;
-				global type res/type;
+				global type python: 'tag_name' in res and res['tag_name'] or '';
 				global resourceIsRef python: True" />
 
+				<span tal:content="type" />
+				<span tal:content="res" />
 			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 		</tal:block>
 	</div>
@@ -4238,12 +4252,12 @@
 
 	<tal:block tal:condition="exists: fencedevs/fencedevs">
 		<table class="systemsTable">
-	        <thead class="systemsTable">
+			<thead class="systemsTable">
 				<tr class="systemsTable">
 					<th class="systemsTable" width="100">Name</th>
 					<th class="systemsTable" width="100">Type</th>
 					<th class="systemsTable" width="75">Configure</th>
-            	</tr>
+				</tr>
 			</thead>
 			<tr class="systemsTable" tal:repeat="f fencedevs/fencedevs">
 				<td class="systemsTable" tal:content="f/name | string:[unknown]"/>
@@ -4334,7 +4348,7 @@
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-manual" />
 	</tal:block>
 
-    <tal:block tal:condition="exists:cur_fencedev/unknown">
+	<tal:block tal:condition="exists:cur_fencedev/unknown">
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-unknown" />
 	</tal:block>
 </div>
@@ -4376,7 +4390,7 @@
 				tal:attributes="value request/clustername" />
 			<input type="hidden" name="orig_name"
 				tal:attributes="value request/fencename"/>
-  			<input type="hidden" name="fencename"
+			<input type="hidden" name="fencename"
 				tal:attributes="value request/fencename" />
 
 			<div class="hbSubmit">
@@ -4408,22 +4422,28 @@
 <div metal:define-macro="conf_editor-form">
 	<h2>Edit cluster.conf</h2>
 	<form method="post"
-	      tal:attributes="action python: './?' + request['QUERY_STRING']"
-	      tal:define="ret python: here.process_cluster_conf_editor(request)">
-	  <span tal:content="structure python: ret['msg'].replace('\n', '<br/>')"/>
-	  <textarea name="new_cluster_conf"
-		    tal:attributes="rows python: len(ret['cluster_conf'].splitlines()) + 8"
-		    tal:content="structure ret/cluster_conf"></textarea>
-	  <input tal:attributes="type  string:hidden;
-	                         name  string:pagetype;
-	                         value python:request['pagetype']"/>
-	  <input tal:attributes="type  string:hidden;
-	                         name  string:clustername;
-	                         value python:request['clustername']"/>
-	  <input type="button" 
-	         value="Reset"
-	         tal:attributes="onclick python:'window.location.assign(\'./?pagetype=' + request['pagetype'] + '&clustername=' + request['clustername'] + '\')'"/>
-	  <input type="submit" value="Propagate"/>
+		tal:attributes="action python: './?' + request['QUERY_STRING']"
+		tal:define="ret python: here.process_cluster_conf_editor(request)">
+
+	<span tal:content="structure python: ret['msg'].replace('\n', '<br/>')" />
+
+	<textarea name="new_cluster_conf"
+		tal:attributes="rows python: len(ret['cluster_conf'].splitlines()) + 8"
+		tal:content="structure ret/cluster_conf">
+	</textarea>
+
+	<input type="hidden" name="pagetype"
+		 tal:attributes="
+			value request/pagetype | nothing" />
+
+	<input type="hidden" name="clustername"
+		tal:attributes="
+			value request/clustername | nothing" />
+
+	<input type="button" value="Reset"
+		tal:attributes="onclick python:'window.location.assign(\'./?pagetype=' + request['pagetype'] + '&clustername=' + request['clustername'] + '\')'" />
+
+	<input type="submit" value="Propagate" />
 	</form>
 </div>
 
--- conga/luci/cluster/resource-form-macros	2007/01/22 17:05:59	1.29
+++ conga/luci/cluster/resource-form-macros	2007/01/26 17:56:14	1.30
@@ -281,66 +281,17 @@
 	</script>
 
 	<tal:block tal:define="global resourcename request/resourcename | request/form/resourceName | nothing" />
+
 	<tal:block tal:condition="resourcename"
 		tal:define="
 			global res python: here.getResourceInfo(modelb, request);
 			global type python: 'tag_name' in res and res['tag_name'] or ''">
 
 	<h2>Configure <span tal:replace="res/name | string: resource" /></h2>
+	<br/>
 
-	<div class="reschoose">
-		<tal:block tal:condition="python: type == 'ip'">
-			<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'fs'">
-			<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'gfs' or type == 'clusterfs'">
-			<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'nfsm'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'nfsx'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'nfsc'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'smb'">
-			<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'script'">
-			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'apache'">
-			<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'openldap'">
-			<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'mysql'">
-			<div metal:use-macro="here/resource-form-macros/macros/mysql_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>
-
-		<tal:block tal:condition="python: type == 'tomcat-5'">
-			<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
-		</tal:block>
-	</div>
+	<div class="reschoose"
+		metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 	</tal:block>
 </div>
 
--- conga/luci/cluster/resource_form_handlers.js	2007/01/22 17:06:00	1.28
+++ conga/luci/cluster/resource_form_handlers.js	2007/01/26 17:56:14	1.29
@@ -279,7 +279,10 @@
 	var errors = check_form(form);
 	if (error_dialog(errors))
 		return (-1);
-	form.submit();
+
+	var confirm_str = form.edit ? 'Update this resource?' : 'Add this resource?';
+	if (confirm(confirm_str))
+		form.submit();
 }
 
 function delete_resource(form) {
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/24 19:45:44	1.211
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/26 17:56:14	1.212
@@ -5050,6 +5050,7 @@
 		itemmap['name'] = item.getName()
 		itemmap['attrs'] = item.attr_hash
 		itemmap['type'] = item.resource_type
+		itemmap['tag_name'] = item.TAG_NAME
 		itemmap['cfgurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_CONFIG
 		itemmap['url'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE
 		itemmap['delurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_REMOVE
@@ -5264,7 +5265,7 @@
 		return errstr
 
 	try:
-		set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_REMOVE, "Removing Resource \'%s\'" % request['resourcename'])
+		set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_REMOVE, "Removing resource \'%s\'" % request['resourcename'])
 	except Exception, e:
 		luci_log.debug_verbose('delResource7: failed to set flags: %s' % str(e))
 
@@ -6593,7 +6594,17 @@
 		res_name = res.attr_hash['address']
 
 	try:
-		set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_ADD, "Creating New Resource \'%s\'" % res_name)
+		try:
+			if request.form.has_key('edit'):
+				action_type = RESOURCE_CONFIG
+				action_str = 'Configuring resource \"%s\"' % res_name
+			else:
+				raise Exception, 'new'
+		except Exception, e:
+			action_type = RESOURCE_ADD
+			action_str = 'Creating new resource \"%s\"' % res_name
+
+		set_node_flag(self, clustername, ragent, str(batch_number), action_type, action_str)
 	except Exception, e:
 		luci_log.debug_verbose('addResource7: failed to set flags: %s' % str(e))
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2007-01-20  4:50 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2007-01-20  4:50 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-01-20 04:50:20

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : luci_homebase.css 
	luci/site/luci/Extensions: Apache.py Clusterfs.py 
	                           FenceHandler.py Fs.py MySQL.py 
	                           NFSExport.py Netfs.py OpenLDAP.py 
	                           Postgres8.py Samba.py Script.py 
	                           Tomcat5.py Vm.py cluster_adapters.py 

Log message:
	fence and resource fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.155&r2=1.156
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Apache.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Clusterfs.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Fs.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/MySQL.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/NFSExport.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Netfs.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/OpenLDAP.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Postgres8.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Samba.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Script.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Tomcat5.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Vm.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.207&r2=1.208

--- conga/luci/cluster/form-macros	2007/01/16 17:37:26	1.155
+++ conga/luci/cluster/form-macros	2007/01/20 04:50:19	1.156
@@ -1223,7 +1223,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 	</div>
@@ -1278,7 +1278,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1336,7 +1336,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1385,7 +1385,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1435,7 +1435,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1483,7 +1483,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1532,7 +1532,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1589,7 +1589,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1647,7 +1647,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1696,7 +1696,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1736,7 +1736,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1785,7 +1785,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1835,7 +1835,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1893,7 +1893,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1936,7 +1936,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1966,7 +1966,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -1997,7 +1997,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -2067,7 +2067,7 @@
 
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 
@@ -2094,7 +2094,7 @@
 		</table>
 		<tal:block tal:condition="exists: cur_fencedev">
 			<input type="hidden" name="existing_device" value="1" />
-			<input type="hidden" name="old_name"
+			<input type="hidden" name="orig_name"
 				tal:attributes="value cur_fencedev/name | nothing" />
 		</tal:block>
 		<input type="hidden" name="fence_type" value="fence_manual" />
--- conga/luci/cluster/resource-form-macros	2007/01/18 02:49:29	1.27
+++ conga/luci/cluster/resource-form-macros	2007/01/20 04:50:19	1.28
@@ -256,7 +256,7 @@
 		</thead>
 		<tr class="systemsTable">
 			<td class="systemsTable" tal:content="res/name" />
-			<td class="systemsTable" tal:content="res/tag_name" />
+			<td class="systemsTable" tal:content="res/type" />
 			<td>
 				<a class="cluster resource"
 					tal:content="string: configure"
@@ -266,7 +266,6 @@
 	</table>
 </div>
 
-
 <div metal:define-macro="resourceprocess-form">
 	<h2>Resource <span tal:replace="python: ('edit' in request and request['edit']) and 'Edited' or 'Added'" /></h2>
 
@@ -325,6 +324,30 @@
 		<tal:block tal:condition="python: type == 'script'">
 			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</tal:block>
+
+		<tal:block tal:condition="python: type == 'vm'">
+			<div metal:use-macro="here/resource-form-macros/macros/vm_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'apache'">
+			<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'openldap'">
+			<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
+		</tal:block>
+
+		<tal:block tal:condition="python: type == 'mysql'">
+			<div metal:use-macro="here/resource-form-macros/macros/mysql_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>
+
+		<tal:block tal:condition="python: type == 'tomcat-5'">
+			<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
+		</tal:block>
 	</div>
 	</tal:block>
 </div>
@@ -1280,20 +1303,21 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Recovery Options</td>
 			<td class="systemsTable">
-				<select name="recovery">
+				<select name="recovery"
 					tal:attributes="disabled python: editDisabled"
 					tal:define="recovery_opt res/recovery | string:relocate">
-					<option name="relocate"
+
+					<option name="relocate" value="relocate"
+						tal:content="string:Relocate"
 						tal:attributes="
-							content string:Relocate
 							selected python: recovery_opt == 'relocate' and 'selected' or ''" />
-					<option name="restart"
+					<option name="restart" value="restart"
+						tal:content="string:Restart"
 						tal:attributes="
-							content string:Restart
 							selected python: recovery_opt == 'restart' and 'selected' or ''" />
-					<option name="disable"
+					<option name="disable" value="disable"
+						tal:content="string:Disable"
 						tal:attributes="
-							content string:Disable
 							selected python: recovery_opt == 'disable' and 'selected' or ''" />
 				</select>
 			</td>
--- conga/luci/cluster/resource_form_handlers.js	2007/01/17 20:50:38	1.26
+++ conga/luci/cluster/resource_form_handlers.js	2007/01/20 04:50:19	1.27
@@ -99,23 +99,39 @@
 }
 
 function validate_apache(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_tomcat5(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_postgres8(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_mysql(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_openldap(form) {
+	var errors = new Array();
+	return (errors);
 }
 
 function validate_vm(form) {
+	var errors = new Array();
+	return (errors);
 }
 
+function validate_nfs_export(form) {
+	var errors = new Array();
+	return (errors);
+}
 
 function validate_nfs_mount(form) {
 	var errors = new Array();
@@ -140,11 +156,6 @@
 	return (errors);
 }
 
-function validate_nfs_export(form) {
-	var errors = new Array();
-	return (errors);
-}
-
 function validate_nfs_client(form) {
 	var errors = new Array();
 
@@ -231,12 +242,12 @@
 }
 
 var required_children = new Array();
-var required_children['nfsx'] = [ 'nfsc' ];
+required_children['nfsx'] = [ 'nfsc' ];
 
 var forbidden_children = new Array();
-var forbidden_children['ip'] = [ 'nfsc', 'nfsx' ];
-var forbidden_children['netfs'] = [ 'nfsc', 'nfsx' ];
-var forbidden_children['nfsx'] = [ 'nfsx' ];
+forbidden_children['ip'] = [ 'nfsc', 'nfsx' ];
+forbidden_children['netfs'] = [ 'nfsc', 'nfsx' ];
+forbidden_children['nfsx'] = [ 'nfsx' ];
 
 var form_validators = new Array();
 form_validators['ip'] = validate_ip;
@@ -249,8 +260,8 @@
 form_validators['smb'] = validate_samba;
 form_validators['vm'] = validate_vm;
 form_validators['apache'] = validate_apache;
-form_validators['tomcat-5'] validate_tomcat5;
-form_validators['postgres-8'] validate_postgres8;
+form_validators['tomcat-5'] = validate_tomcat5;
+form_validators['postgres-8'] = validate_postgres8;
 form_validators['openldap'] = validate_openldap;
 form_validators['mysql'] = validate_mysql;
 
--- conga/luci/homebase/luci_homebase.css	2007/01/10 16:00:41	1.33
+++ conga/luci/homebase/luci_homebase.css	2007/01/20 04:50:19	1.34
@@ -333,8 +333,7 @@
 
 *.reshdr {
 	text-align: top;
-	font-size: 9pt;
-	letter-spacing: +.5px;
+	font-size: 10pt;
 	font-weight: 600;
 	padding-bottom: +1em;
 }
--- conga/luci/site/luci/Extensions/Apache.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/Apache.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "apache"
-RESOURCE_TYPE = _("Apache Server: ")
+RESOURCE_TYPE = _("Apache Server")
 
 class Apache(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Clusterfs.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Clusterfs.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "clusterfs"
-RESOURCE_TYPE = _("GFS: ")
+RESOURCE_TYPE = _("GFS")
 
 class Clusterfs(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/19 21:48:23	1.15
+++ conga/luci/site/luci/Extensions/FenceHandler.py	2007/01/20 04:50:20	1.16
@@ -1,6 +1,5 @@
 import re
 from Device import Device
-from FenceDevice import FenceDevice
 from conga_constants import FD_VAL_SUCCESS, FD_VAL_FAIL
 
 FD_NEW_SUCCESS = 'New %s successfully added to cluster'
@@ -103,48 +102,6 @@
 	'cserver':				'CServer'
 }
 
-FI_VALIDATE = {
-	'fence_apc':			val_apc_fi,
-	'fence_wti':			val_wti_fi,
-	'fence_brocade':		val_brocade_fi,
-	'fence_vixel':			val_vixel_fi,
-	'fence_gnbd':			val_gnbd_fi,
-	'fence_sanbox2':		val_sanbox2_fi,
-	'fence_bladecenter':	val_bladecenter_fi,
-	'fence_mcdata':			val_mcdata_fi,
-	'fence_egenera':		val_egenera_fi,
-	'fence_bullpap':		val_bullpap_fi,
-	'fence_xvm':			val_xvm_fi,
-	'fence_scsi':			val_scsi_fi,
-	'fence_ilo':			val_noop_fi,
-	'fence_ipmilan':		val_noop_fi,
-	'fence_drac':			val_noop_fi,
-	'fence_rsa':			val_noop_fi,
-	'fence_rps10':			val_noop_fi,
-	'fence_manual':			val_noop_fi
-}
-
-FD_VALIDATE = {
-	'fence_apc':			val_apc_fd,
-	'fence_wti':			val_wti_fd,
-	'fence_brocade':		val_brocade_fd,
-	'fence_vixel':			val_vixel_fd,
-	'fence_gnbd':			val_gnbd_fd,
-	'fence_sanbox2':		val_sanbox2_fd,
-	'fence_bladecenter':	val_bladecenter_fd,
-	'fence_mcdata':			val_mcdata_fd,
-	'fence_egenera':		val_egenera_fd,
-	'fence_bullpap':		val_bullpap_fd,
-	'fence_xvm':			val_noop_fd,
-	'fence_scsi':			val_noop_fd,
-	'fence_ilo':			val_ilo_fd,
-	'fence_ipmilan':		val_ipmilan_fd,
-	'fence_drac':			val_drac_fd,
-	'fence_rsa':			val_rsa_fd,
-	'fence_rps10':			val_rps10_fd,
-	'fence_manual':			val_noop_fd
-}
-
 FENCE_FI_ATTRS = {
 	'fence_apc':			['port', 'switch'],
 	'fence_wti':			['port'],
@@ -191,7 +148,7 @@
 
 def makeNCName(name):
 	### name must conform to relaxNG ID type ##
-	return re.sub('_', name)
+	return ILLEGAL_CHARS.sub('_', name)
 
 def check_unique_fd_name(model, name):
 	fds = model.getFenceDevices()
@@ -201,6 +158,7 @@
 	return True
 
 def validateNewFenceDevice(form, model):
+	from FenceDevice import FenceDevice
 	fencedev = FenceDevice()
 
 	try:
@@ -216,6 +174,7 @@
 	return (FD_VAL_FAIL, ret)
 
 def validateFenceDevice(form, model):
+	from FenceDevice import FenceDevice
 	try:
 		old_fence_name = form['orig_name'].strip()
 		if not old_fence_name:
@@ -245,52 +204,6 @@
 
 	return (FD_VAL_FAIL, ret)
 
-def validate_fencedevice(form, model, fencedev, fence_edit=False):
-	try:
-		fence_name = form['name'].strip()
-		if not fence_name:
-			raise Exception, 'blank'
-		fence_name = makeNCName(fence_name)
-	except Exception, e:
-		return [ FD_PROVIDE_NAME ]
-
-	name_change = False
-	if fence_edit is True:
-		try:
-			old_fence_name = form['orig_name'].strip()
-			if not old_fence_name:
-				raise Exception, 'blank'
-		except Exception, e:
-			return [ FD_PROVIDE_NAME ]
-		if old_fence_name != fence_name:
-			if check_unique_fd_name(model, fence_name) is False:
-				return [ FD_PROVIDE_NAME ]
-			name_change = True
-	else:
-		if check_unique_fd_name(model, fence_name) is False:
-			return [ FD_PROVIDE_NAME ]
-
-	try:
-		fence_agent = form['agent'].strip()
-		if not fence_agent:
-			raise Exception, 'blank agent'
-	except Exception, e:
-		return [ FD_PROVIDE_AGENT ]
-
-	fencedev.addAttribute('name', fence_name)
-	fencedev.addAttribute('agent', fence_agent)
-
-	try:
-		ret = FD_VALIDATE[fence_agent](form, fencedev)
-		if len(ret) < 1 and name_change is True:
-			try:
-				model.rectifyNewFencedevicenameWithFences(old_fence_name, fence_name)
-			except:
-				return [ FD_NEW_FAIL % fence_agent ]
-		return ret
-	except:
-		return [ FD_NEW_FAIL % fence_agent ]
-
 def val_apc_fd(form, fencedev):
 	errors = list()
 
@@ -533,7 +446,7 @@
 	fencedev.addAttribute('passwd', pwd)
 	return errors
 
-def val_noop_fd(dummy, dummy):
+def val_noop_fd(dummy, _dummy):
 	return []
 
 # non-shared devices
@@ -695,33 +608,74 @@
 	fencedev.addAttribute('passwd', pwd)
 	return errors
 
-# Validation Methods for Fence Instances
+FD_VALIDATE = {
+	'fence_apc':			val_apc_fd,
+	'fence_wti':			val_wti_fd,
+	'fence_brocade':		val_brocade_fd,
+	'fence_vixel':			val_vixel_fd,
+	'fence_gnbd':			val_gnbd_fd,
+	'fence_sanbox2':		val_sanbox2_fd,
+	'fence_bladecenter':	val_bladecenter_fd,
+	'fence_mcdata':			val_mcdata_fd,
+	'fence_egenera':		val_egenera_fd,
+	'fence_bullpap':		val_bullpap_fd,
+	'fence_xvm':			val_noop_fd,
+	'fence_scsi':			val_noop_fd,
+	'fence_ilo':			val_ilo_fd,
+	'fence_ipmilan':		val_ipmilan_fd,
+	'fence_drac':			val_drac_fd,
+	'fence_rsa':			val_rsa_fd,
+	'fence_rps10':			val_rps10_fd,
+	'fence_manual':			val_noop_fd
+}
 
-def validate_fenceinstance(form, parent_name):
+def validate_fencedevice(form, model, fencedev, fence_edit=False):
 	try:
-		fence_agent = form['fence_type'].strip()
-		if not fence_agent:
+		fence_name = form['name'].strip()
+		if not fence_name:
 			raise Exception, 'blank'
-	except:
-		return [ FD_PROVIDE_AGENT ]
+		fence_name = makeNCName(fence_name)
+	except Exception, e:
+		return [ FD_PROVIDE_NAME ]
+
+	name_change = False
+	if fence_edit is True:
+		try:
+			old_fence_name = form['orig_name'].strip()
+			if not old_fence_name:
+				raise Exception, 'blank'
+		except Exception, e:
+			return [ FD_PROVIDE_NAME ]
+		if old_fence_name != fence_name:
+			if check_unique_fd_name(model, fence_name) is False:
+				return [ FD_PROVIDE_NAME ]
+			name_change = True
+	else:
+		if check_unique_fd_name(model, fence_name) is False:
+			return [ FD_PROVIDE_NAME ]
 
 	try:
-		if not parent_name.strip():
-			return [ FI_PROVIDE_PARENT ]
-	except:
-		return [ FI_PROVIDE_PARENT ]
+		fence_agent = form['fence_type'].strip()
+		if not fence_agent:
+			raise Exception, 'blank agent'
+	except Exception, e:
+		return [ FD_PROVIDE_AGENT ]
 
-	fenceinst = Device()
-	fenceinst.addAttribute('name', parent_name)
+	fencedev.addAttribute('name', fence_name)
+	fencedev.addAttribute('agent', fence_agent)
 
 	try:
-		ret = FI_VALIDATE[fence_agent](form, fenceinst)
-		if len(ret) > 0:
-			return (FD_VAL_FAIL, ret)
-	except Exception, e:
-		return (FD_VAL_FAIL, [ FI_NEW_FAIL % fence_agent ])
+		ret = FD_VALIDATE[fence_agent](form, fencedev)
+		if len(ret) < 1 and name_change is True:
+			try:
+				model.rectifyNewFencedevicenameWithFences(old_fence_name, fence_name)
+			except:
+				return [ FD_NEW_FAIL % fence_agent ]
+		return ret
+	except:
+		return [ FD_NEW_FAIL % fence_agent ]
 
-	return (FD_VAL_SUCCESS, fenceinst)
+# Validation Methods for Fence Instances
 
 def val_apc_fi(form, fenceinst):
 	errors = list()
@@ -898,5 +852,45 @@
 	fenceinst.addAttribute('nodename', nodename)
 	return errors
 
-def val_noop_fi(dummy, dummy):
+def val_noop_fi(dummy, _dummy):
 	return []
+
+FI_VALIDATE = {
+	'fence_apc':			val_apc_fi,
+	'fence_wti':			val_wti_fi,
+	'fence_brocade':		val_brocade_fi,
+	'fence_vixel':			val_vixel_fi,
+	'fence_gnbd':			val_gnbd_fi,
+	'fence_sanbox2':		val_sanbox2_fi,
+	'fence_bladecenter':	val_bladecenter_fi,
+	'fence_mcdata':			val_mcdata_fi,
+	'fence_egenera':		val_egenera_fi,
+	'fence_bullpap':		val_bullpap_fi,
+	'fence_xvm':			val_xvm_fi,
+	'fence_scsi':			val_scsi_fi,
+	'fence_ilo':			val_noop_fi,
+	'fence_ipmilan':		val_noop_fi,
+	'fence_drac':			val_noop_fi,
+	'fence_rsa':			val_noop_fi,
+	'fence_rps10':			val_noop_fi,
+	'fence_manual':			val_noop_fi
+}
+
+def validate_fenceinstance(form, parent_name, fence_agent):
+	try:
+		if not parent_name.strip():
+			return (FD_VAL_FAIL, [ FI_PROVIDE_PARENT ])
+	except:
+		return (FD_VAL_FAIL, [ FI_PROVIDE_PARENT ])
+
+	fenceinst = Device()
+	fenceinst.addAttribute('name', parent_name)
+
+	try:
+		ret = FI_VALIDATE[fence_agent](form, fenceinst)
+		if len(ret) > 0:
+			return (FD_VAL_FAIL, ret)
+	except Exception, e:
+		return (FD_VAL_FAIL, [ FI_NEW_FAIL % fence_agent ])
+
+	return (FD_VAL_SUCCESS, fenceinst)
--- conga/luci/site/luci/Extensions/Fs.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Fs.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "fs"
-RESOURCE_TYPE = _("File System: ")
+RESOURCE_TYPE = _("File System")
 
 class Fs(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/MySQL.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/MySQL.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "mysql"
-RESOURCE_TYPE = _("MySQL Server: ")
+RESOURCE_TYPE = _("MySQL Server")
 
 class MySQL(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/NFSExport.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/NFSExport.py	2007/01/20 04:50:20	1.2
@@ -5,7 +5,7 @@
 import gettext
 _ = gettext.gettext
 
-RESOURCE_TYPE = _("NFS Export: ")
+RESOURCE_TYPE = _("NFS Export")
 TAG_NAME = "nfsexport"
 
 class NFSExport(BaseResource):
--- conga/luci/site/luci/Extensions/Netfs.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Netfs.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "netfs"
-RESOURCE_TYPE = _("NFS Mount: ")
+RESOURCE_TYPE = _("NFS Mount")
 
 class Netfs(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/OpenLDAP.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/OpenLDAP.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "openldap"
-RESOURCE_TYPE = _("Open LDAP Server: ")
+RESOURCE_TYPE = _("Open LDAP Server")
 
 class OpenLDAP(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Postgres8.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/Postgres8.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "postgres-8"
-RESOURCE_TYPE = _("PostgreSQL 8 Server: ")
+RESOURCE_TYPE = _("PostgreSQL 8 Server")
 
 class Postgres8(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Samba.py	2006/07/20 21:30:33	1.1
+++ conga/luci/site/luci/Extensions/Samba.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "smb"
-RESOURCE_TYPE = _("Samba Service: ")
+RESOURCE_TYPE = _("Samba Service")
 
 class Samba(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Script.py	2006/05/30 20:17:21	1.1
+++ conga/luci/site/luci/Extensions/Script.py	2007/01/20 04:50:20	1.2
@@ -5,7 +5,7 @@
 import gettext
 _ = gettext.gettext
 
-RESOURCE_TYPE = _("Script: ")
+RESOURCE_TYPE = _("Script")
 TAG_NAME = "script"
 
 class Script(BaseResource):
--- conga/luci/site/luci/Extensions/Tomcat5.py	2007/01/17 20:46:31	1.1
+++ conga/luci/site/luci/Extensions/Tomcat5.py	2007/01/20 04:50:20	1.2
@@ -6,7 +6,7 @@
 _ = gettext.gettext
 
 TAG_NAME = "tomcat-5"
-RESOURCE_TYPE = _("Tomcat 5 Server: ")
+RESOURCE_TYPE = _("Tomcat 5 Server")
 
 class Tomcat5(BaseResource):
   def __init__(self):
--- conga/luci/site/luci/Extensions/Vm.py	2006/10/24 15:04:13	1.2
+++ conga/luci/site/luci/Extensions/Vm.py	2007/01/20 04:50:20	1.3
@@ -1,15 +1,16 @@
 import string
 from TagObject import TagObject
+from BaseResource import BaseResource
+
+import gettext
+_ = gettext.gettext
 
 TAG_NAME = "vm"
+RESOURCE_TYPE = _("Virtual Machine")
 
-class Vm(TagObject):
+class Vm(BaseResource):
   def __init__(self):
-    TagObject.__init__(self)
+    BaseResource.__init__(self)
     self.TAG_NAME = TAG_NAME
-    #Have autostart set by default
-    self.addAttribute("autostart","1")
-
-  def getProperties(self):
-    stringbuf = ""
-    return stringbuf
+    self.resource_type = RESOURCE_TYPE
+    self.addAttribute('autostart', '1')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/19 21:48:23	1.207
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/20 04:50:20	1.208
@@ -30,7 +30,6 @@
 from clusterOS import resolveOSType
 from Fence import Fence
 from Method import Method
-from FenceDevice import FenceDevice
 from Device import Device
 from FenceHandler import validateNewFenceDevice, FENCE_OPTS, validateFenceDevice, validate_fenceinstance
 from GeneralError import GeneralError
@@ -1295,7 +1294,6 @@
     luci_log.debug_verbose('VFE: no form was submitted')
     return (False, {'errors': ['No form was submitted']})
 
-  #fencehandler = FenceHandler()
   error_code, retobj = validateNewFenceDevice(form, model)
   if error_code == FD_VAL_SUCCESS:
     try:
@@ -1304,7 +1302,7 @@
         raise Exception, 'conf_str is none'
     except Exception, e:
       luci_log.debug_verbose('VFE: export model as string failed: %s' \
-      % str(e))
+        % str(e))
       errors.append('Unable to store the new cluster configuration')
 
     try:
@@ -1643,7 +1641,7 @@
 			pass
 
 		for inst in instance_list:
-			retcode, retobj = validate_fenceinstance(inst, fencedev_name)
+			retcode, retobj = validate_fenceinstance(inst, fencedev_name, fence_type)
 			if retcode != FD_VAL_SUCCESS:
 				errors.extend(retobj)
 				continue



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-12-06 22:44 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-12-06 22:44 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-12-06 22:44:18

Modified files:
	luci/cluster   : form-macros resource_form_handlers.js 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	more svc autostart fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.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.175&r2=1.176

--- conga/luci/cluster/form-macros	2006/12/06 22:11:20	1.124
+++ conga/luci/cluster/form-macros	2006/12/06 22:44:18	1.125
@@ -2918,7 +2918,7 @@
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
-		<input type="hidden" name="autostart" value="" />
+		<input type="hidden" name="autostart" value="-1" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="add" />
 		</form>
@@ -3135,7 +3135,8 @@
 				<tr><td>
 				Automatically start this service
 				</td>
-				<td><input type="checkbox" name="autostart" tal:attributes="checked sinfo/autostart | nothing" /></td></tr>
+				<td><input type="checkbox" name="autostart"
+						tal:attributes="checked python: ('autostart' in sinfo and sinfo['autostart'].lower() != 'false') and 'checked'" /></td></tr>
 			</table>
 			<input type="hidden" name="service_name"
 				tal:attributes="value sinfo/name | string:1" />
@@ -3157,7 +3158,7 @@
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
-		<input type="hidden" name="autostart" value="" />
+		<input type="hidden" name="autostart" value="-1" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="edit" />
 		</form>
--- conga/luci/cluster/resource_form_handlers.js	2006/12/05 23:32:34	1.24
+++ conga/luci/cluster/resource_form_handlers.js	2006/12/06 22:44:18	1.25
@@ -444,7 +444,7 @@
 	/* sort this out in the backend */
 	master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
 	master_form.svc_name.value = svc_name;
-	master_form.autostart = autostart;
+	master_form.autostart.value = autostart;
 
 	var confirm_msg = null;
 	if (master_form.action.value == 'add')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/06 22:11:20	1.175
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/06 22:44:18	1.176
@@ -500,18 +500,19 @@
 
 	autostart = "1"
 	try:
-		if request.form['autostart'] == "0":
+		if not request.form.has_key('autostart') or request.form['autostart'] == "0":
 			autostart = "0"
-	except:
-		pass
+	except Exception, e:
+		autostart = None
+		luci_log.debug_verbose('vSA5a: error getting autostart: %s' % str(e))
 
 	try:
 		cur_service = model.retrieveServiceByName(service_name)
 	except GeneralError, e:
-		luci_log.debug_verbose('vSA5a: no service named %s found' % service_name)
+		luci_log.debug_verbose('vSA5b: no service named %s found' % service_name)
 		cur_service = None
 	except Exception, e:
-		luci_log.debug_verbose('vSA5a: no service named %s found: %s' % (service_name, str(e)))
+		luci_log.debug_verbose('vSA5c: no service named %s found: %s' % (service_name, str(e)))
 		cur_service = None
 
 	try:
@@ -543,7 +544,8 @@
 
 	new_service = Service()
 	new_service.addAttribute('name', service_name)
-	new_service.attr_hash['autostart'] = autostart
+	if autostart is not None:
+		new_service.attr_hash['autostart'] = autostart
 
 	buildSvcTree(new_service, form_hash['toplevel']['kids'])
 	model.resourcemanager_ptr.addChild(new_service)



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-12-05 23:32 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-12-05 23:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-12-05 23:32:35

Modified files:
	luci/cluster   : form-macros resource_form_handlers.js 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	service add and edit fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.171&r2=1.172

--- conga/luci/cluster/form-macros	2006/12/05 06:44:09	1.120
+++ conga/luci/cluster/form-macros	2006/12/05 23:32:34	1.121
@@ -2857,6 +2857,14 @@
 						<input type="text" length="20" name="service_name" value="" />
 					</td>
 				</tr>
+				<tr class="systemsTable">
+					<td class="systemsTable">
+						Automatically start this service
+					</td>
+					<td class="systemsTable">
+						<input type="checkbox" name="autostart" checked="checked" />
+					</td>
+				</tr>
 			</table>
 		</form>
 	</div>
@@ -2880,6 +2888,7 @@
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
+		<input type="hidden" name="autostart" value="" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="add" />
 		</form>
@@ -3022,7 +3031,8 @@
 					tal:content="sinfo/name | nothing"
 					tal:attributes="class python: running and 'running' or 'stopped'" />
 			</td>
-			<td class="cluster service service_action">
+			<td class="cluster service service_action"
+				tal:condition="python: sinfo and 'innermap' in sinfo">
 				<form method="post" onSubmit="return dropdown(this.gourl)">
 					<input type="hidden" name="pagetype" tal:attributes="
 						value request/pagetype | request/form/pagetype | nothing" />
@@ -3090,9 +3100,16 @@
 	</div>
 	<div class="service_comp_list">
 		<form name="service_name_form">
+			<table class="rescfg">
+				<tr><td>
+				Automatically start this service
+				</td>
+				<td><input type="checkbox" name="autostart" tal:attributes="checked sinfo/autostart | nothing" /></td></tr>
+			</table>
 			<input type="hidden" name="service_name"
-				tal:attributes="value sinfo/name | nothing" />
+				tal:attributes="value sinfo/name | string:1" />
 		</form>
+
 		<form name="master" method="post">
 		<tal:block
 			tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
@@ -3109,6 +3126,7 @@
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
+		<input type="hidden" name="autostart" value="" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="edit" />
 		</form>
--- conga/luci/cluster/resource_form_handlers.js	2006/12/05 06:44:09	1.23
+++ conga/luci/cluster/resource_form_handlers.js	2006/12/05 23:32:34	1.24
@@ -381,6 +381,7 @@
 	var errors = new Array();
 	var form_xml = '';
 	var svc_name = null;
+	var autostart = 1;
 
 	var form = document.getElementsByTagName('form');
 	for (var i = 0 ; i < form.length ; i++) {
@@ -393,17 +394,40 @@
 				clr_form_err(form[i].service_name);
 				svc_name = form[i].service_name.value;
 			}
+			if (!form[i].autostart.checked)
+				autostart = 0;
 			continue;
 		}
 
 		if (form[i].name == 'master' || !form[i].uuid || !form[i].uuid.value)
 			continue;
+
 		var err = check_form(form[i]);
 		if (err)
 			errors = errors.concat(err);
-		var temp = form[i].innerHTML.match(/<input [^>]+>/ig).toString().replace(/>(,|$)/g, '/>');
-		if (!temp)
-			continue;
+		var temp = '';
+
+		var input_elem = form[i].getElementsByTagName('input');
+		for (var j = 0 ; j < input_elem.length ; j++) {
+			var res_type = input_elem[j].type;
+			if (res_type == 'hidden' || res_type == 'text' ||
+				res_type == 'password')
+			{
+				temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" value="' + input_elem[j].value + '" />';
+			} else if (res_type == 'checkbox' || res_type == 'radio') {
+				if (input_elem[j].checked)
+					temp += '<input type="' + res_type + '" name="' + input_elem[j].name + '" checked="checked"';
+				if (res_type == 'radio')
+					temp += ' value="' + input_elem[j].value + '"';
+				temp += ' />';
+			}
+		}
+
+		var select_elem = form[i].getElementsByTagName('select');
+		for (var j = 0 ; j < select_elem.length ; j++) {
+			temp += '<input type="text" name="' + select_elem[j].name + '" value="' + select_elem[j].options[select_elem[j].options.selectedIndex].value + '" />';
+		}
+
 		form_xml += '<form id="' + form[i].uuid.value + '" parent="' +
 					form[i].parent_uuid.value + '">' + temp + '</form>';
 	}
@@ -420,6 +444,7 @@
 	/* sort this out in the backend */
 	master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
 	master_form.svc_name.value = svc_name;
+	master_form.autostart = autostart;
 
 	var confirm_msg = null;
 	if (master_form.action.value == 'add')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/05 06:44:10	1.171
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/05 23:32:35	1.172
@@ -12,8 +12,10 @@
 from Ip import Ip
 from Clusterfs import Clusterfs
 from Fs import Fs
+from RefObject import RefObject
 from NFSClient import NFSClient
 from NFSExport import NFSExport
+from Service import Service
 from Netfs import Netfs
 from Vm import Vm
 from Script import Script
@@ -396,15 +398,26 @@
 	response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clusterName + '&busyfirst=true')
 
 def validateServiceAdd(self, request):
+	errors = list()
+
 	try:
 		form_xml = request['form_xml']
 		if not form_xml:
 			raise KeyError, 'form_xml must not be blank'
+		luci_log.debug_verbose('VSAXML DUMP: %s' % form_xml)
 	except Exception, e:
 		luci_log.debug_verbose('vSA0: no form_xml: %s' % str(e))
 		return (False, {'errors': ['No resource data was supplied for this service.']})
 
 	try:
+		model = request.SESSION.get('model')
+		if not model:
+			raise Exception, 'model is None'
+	except Exception, e:
+		luci_log.debug_verbose('vSA0a: %s' % str(e))
+		return (False, {'errors': [ 'The cluster model is missing from the session object.' ]})
+
+	try:
 		doc = minidom.parseString(form_xml)
 		forms = doc.getElementsByTagName('form')
 		if len(forms) < 1:
@@ -447,20 +460,21 @@
 
 		try:
 			res_type = dummy_form['type'].strip()
-			if not res_type or not res_type in resourceAddHandler:
+			if not res_type:
+				raise Exception, 'no resource type was given'
+			if not res_type in resourceAddHandler:
 				raise Exception, 'invalid resource type: %s' % res_type
 		except Exception, e:
 			luci_log.debug_verbose('vSA3: %s' % str(e))
-			return (False, {'errors': ['An invalid resource type was specified: ' + res_type]})
+			return (False, {'errors': [ 'An invalid resource type was specified' ]})
 
 		try:
 			if dummy_form.has_key('immutable'):
-				model = request.SESSION.get('model')
-				if not model:
-					raise Exception, 'model is None'
-				resObj = getResource(model, dummy_form['resourceName'])
+				newRes = getResource(model, dummy_form['resourceName'])
+				resObj = RefObject(newRes)
+				resObj.setRef(newRes.getName())
 			else:
-				resObj = resourceAddHandler[res_type](request, dummy_form)
+				resObj = resourceAddHandler[res_type](request, dummy_form)[0]
 		except Exception, e:
 			resObj = None
 			luci_log.debug_verbose('vSA4: type %s: %s' % (res_type, str(e)))
@@ -468,8 +482,109 @@
 		if resObj is None:
 			return (False, {'errors': [ 'An error occurred while adding %s' % res_type ]})
 		form_hash[form_id]['obj'] = resObj
-			
-	return (True, {'messages': ['This service has been updated.']})
+
+	if len(errors) > 0:
+		return (False, {'errors': errors})
+
+	try:
+		service_name = request.form['svc_name'].strip()
+	except Exception, e:
+		luci_log.debug_verbose('vSA5: no service name: %s' % str(e))
+		return (False, {'errors': [ 'No service name was given.' ]})
+
+	autostart = "1"
+	try:
+		if not request.form.has_key('autostart'):
+			autostart = "0"
+	except:
+		pass
+
+	try:
+		cur_service = model.retrieveServiceByName(service_name)
+	except GeneralError, e:
+		luci_log.debug_verbose('vSA5a: no service named %s found' % service_name)
+		cur_service = None
+	except Exception, e:
+		luci_log.debug_verbose('vSA5a: no service named %s found: %s' % (service_name, str(e)))
+		cur_service = None
+
+	try:
+		if request.form['action'] == 'edit':
+			if cur_service is None:
+				return (False, {'errors': [ 'The service %s could not be found for editing.' % service_name ]})
+			model.deleteService(service_name)
+		elif request.form['action'] == 'add':
+			if cur_service is not None:
+				return (False, {'errors': [ 'A service with the name %s already exists.' % service_name ]})
+		else:
+			luci_log.debug_verbose('vSA4a: unknown action %s' % request.form['action'])
+			return (False, {'errors': [ 'An unknown action was specified.' ]})
+	except Exception, e:
+		luci_log.debug_verbose('vSA5: no action type: %s' % str(e))
+
+	def buildSvcTree(parent, child_id_list):
+		for i in child_id_list:
+			try:
+				child = form_hash[i]['obj']
+				if not child:
+					raise Exception, 'No object for %s' % i
+			except Exception, e:
+				luci_log.debug_verbose('bST0: %s' % str(e))
+				continue
+			parent.addChild(child)
+			if 'kids' in form_hash[i]:
+				buildSvcTree(child, form_hash[i]['kids'])
+
+	new_service = Service()
+	new_service.addAttribute('name', service_name)
+	new_service.attr_hash['autostart'] = autostart
+
+	buildSvcTree(new_service, form_hash['toplevel']['kids'])
+	model.resourcemanager_ptr.addChild(new_service)
+
+	clustername = model.getClusterName()
+	if not clustername:
+		luci_log.debug_verbose('vAS6: no cluname from mb')
+		return (False, {'errors': [ 'Unable to determine cluster name' ]})
+
+	try:
+		conf = model.exportModelAsString()
+		if not conf:
+			raise Exception, 'model string for %s is blank' % clustername
+	except Exception, e:
+		luci_log.debug_verbose('vAS6a: exportModelAsString : %s' \
+			% str(e))
+		return (False, {'errors': [ 'An error occurred while adding this service.' ]})
+
+	rc = getRicciAgent(self, clustername)
+	if not rc:
+		luci_log.debug_verbose('vAS6b: unable to find a ricci agent for cluster %s' % clustername)
+		return 'Unable to find a ricci agent for the %s cluster' % clustername
+
+	try:
+		ragent = rc.hostname()
+		if not ragent:
+			luci_log.debug_verbose('vAS7: missing ricci hostname')
+			raise Exception, 'unknown ricci agent hostname'
+
+		batch_number, result = setClusterConf(rc, str(conf))
+		if batch_number is None or result is None:
+			luci_log.debug_verbose('vAS8: missing batch_number or result')
+			raise Exception, 'unable to save the new cluster configuration.'
+	except Exception, e:
+		luci_log.debug_verbose('vAS9: %s' % str(e))
+		return 'An error occurred while propagating the new cluster.conf: %s' % str(e)
+
+	try:
+		if request.form['action'] == 'edit':
+			set_node_flag(self, clustername, ragent, str(batch_number), SERVICE_CONFIG, "Configuring service \'%s\'" % service_name)
+		else:
+			set_node_flag(self, clustername, ragent, str(batch_number), SERVICE_ADD, "Adding new service \'%s\'" % service_name)
+	except Exception, e:
+		luci_log.debug_verbose('vAS10: failed to set flags: %s' % str(e))
+
+	response = request.RESPONSE
+	response.redirect(request['URL'] + "?pagetype=" + SERVICES + "&clustername=" + clustername + '&busyfirst=true')
 
 def validateResourceAdd(self, request):
 	try:
@@ -1856,6 +1971,7 @@
 			if item['name'] == servicename:
 				hmap['name'] = servicename
 				starturls = list()
+				hmap['autostart'] = item['autostart']
 				if item['running'] == "true":
 					hmap['running'] = "true"
 					#In this case, determine where it can run...
@@ -3952,6 +4068,9 @@
 	if form is None:
 		form = request.form
 
+	if form is not None:
+		luci_log.debug_verbose('addIp DUMP: %s' % str(form.items()))
+
 	if not form:
 		luci_log.debug_verbose('addIp error: form is missing')
 		return None
@@ -4526,7 +4645,7 @@
 	'gfs': addGfs,
 	'nfsm': addNfsm,
 	'nfsx': addNfsx,
-	'nfsc': addNfsx,
+	'nfsc': addNfsc,
 	'scr': addScr,
 	'smb': addSmb
 }



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-12-05  6:44 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-12-05  6:44 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-12-05 06:44:10

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

Log message:
	fixes for adding and editing services

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.119&r2=1.120
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.170&r2=1.171

--- conga/luci/cluster/form-macros	2006/12/04 22:59:56	1.119
+++ conga/luci/cluster/form-macros	2006/12/05 06:44:09	1.120
@@ -2879,7 +2879,9 @@
 		<input type="hidden" name="uuid" value="toplevel" />
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
+		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="form_xml" />
+		<input type="hidden" name="action" value="add" />
 		</form>
 	</div>
 
@@ -2939,30 +2941,46 @@
 </div>
 
 <div metal:define-macro="serviceconfig-type-macro" tal:omit-tag="">
-	<span tal:omit-tag="" tal:condition="python: type == 'ip'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-	</span>
-	<span tal:omit-tag="" tal:condition="python: type == 'script'">
-		<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-	</span>
+	<tal:block tal:condition="python: type == 'ip' or type == 'IP Address: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/ip_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'fs' or type == 'File System: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'gfs' or type == 'GFS: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'nfsm' or type == 'NFS Mount: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'nfsx' or type == 'NFS Export: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'nfsc' or type == 'NFS Client: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
+	</tal:block>
+
+	<tal:block
+		tal:condition="python: type == 'smb' or type == 'Samba Service: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'script' or type == 'Script: '">
+		<tal:block
+			metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	</tal:block>
 </div>
 
 <div metal:define-macro="service-config-head-macro" tal:omit-tag="">
@@ -3071,6 +3089,10 @@
 		</div>
 	</div>
 	<div class="service_comp_list">
+		<form name="service_name_form">
+			<input type="hidden" name="service_name"
+				tal:attributes="value sinfo/name | nothing" />
+		</form>
 		<form name="master" method="post">
 		<tal:block
 			tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
@@ -3086,7 +3108,9 @@
 		<input type="hidden" name="uuid" value="toplevel" />
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
+		<input type="hidden" name="svc_name" value="" />
 		<input type="hidden" name="form_xml" />
+		<input type="hidden" name="action" value="edit" />
 		</form>
 	</div>
 
--- conga/luci/cluster/resource-form-macros	2006/11/10 19:44:57	1.24
+++ conga/luci/cluster/resource-form-macros	2006/12/05 06:44:09	1.25
@@ -271,7 +271,7 @@
 			<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
 		</tal:block>
 
-		<tal:block tal:condition="python: type == 'gfs'">
+		<tal:block tal:condition="python: type == 'gfs' or type == 'clusterfs'">
 			<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
 		</tal:block>
 
@@ -307,7 +307,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -368,7 +371,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -507,7 +513,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -609,7 +618,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -727,7 +739,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -799,7 +814,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -851,7 +869,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
@@ -913,7 +934,10 @@
 		tal:attributes="name res/parent_uuid | nothing"
 		tal:define="editDisabled resourceIsRef | nothing">
 
-	<input name="edit" type="hidden"
+	<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"
--- conga/luci/cluster/resource_form_handlers.js	2006/11/10 19:44:57	1.22
+++ conga/luci/cluster/resource_form_handlers.js	2006/12/05 06:44:09	1.23
@@ -380,14 +380,27 @@
 function forms_to_xml(master_form) {
 	var errors = new Array();
 	var form_xml = '';
+	var svc_name = null;
 
 	var form = document.getElementsByTagName('form');
 	for (var i = 0 ; i < form.length ; i++) {
+		if (form[i].name == 'service_name_form') {
+			if (!form[i].service_name ||
+				str_is_blank(form[i].service_name.value))
+			{
+				set_form_err(form[i].service_name);
+			} else {
+				clr_form_err(form[i].service_name);
+				svc_name = form[i].service_name.value;
+			}
+			continue;
+		}
+
 		if (form[i].name == 'master' || !form[i].uuid || !form[i].uuid.value)
 			continue;
 		var err = check_form(form[i]);
 		if (err)
-			errors.concat(err);
+			errors = errors.concat(err);
 		var temp = form[i].innerHTML.match(/<input [^>]+>/ig).toString().replace(/>(,|$)/g, '/>');
 		if (!temp)
 			continue;
@@ -395,6 +408,9 @@
 					form[i].parent_uuid.value + '">' + temp + '</form>';
 	}
 
+	if (!svc_name)
+		errors.push('No name was given for this service.');
+
 	if (!form_xml)
 		errors.push('No resource information was submitted.');
 
@@ -403,7 +419,14 @@
 
 	/* sort this out in the backend */
 	master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
-	if (confirm('Save changes to this service?'))
+	master_form.svc_name.value = svc_name;
+
+	var confirm_msg = null;
+	if (master_form.action.value == 'add')
+		confirm_msg = 'Create this service?';
+	else
+		confirm_msg = 'Save changes to this service?';
+	if (confirm(confirm_msg))
 		master_form.submit();
 	return (0);
 }
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/29 18:15:20	1.170
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/05 06:44:10	1.171
@@ -399,8 +399,9 @@
 	try:
 		form_xml = request['form_xml']
 		if not form_xml:
-			raise KeyError('form_xml must not be blank')
-	except KeyError, e:
+			raise KeyError, 'form_xml must not be blank'
+	except Exception, e:
+		luci_log.debug_verbose('vSA0: no form_xml: %s' % str(e))
 		return (False, {'errors': ['No resource data was supplied for this service.']})
 
 	try:
@@ -408,7 +409,8 @@
 		forms = doc.getElementsByTagName('form')
 		if len(forms) < 1:
 			raise
-	except:
+	except Exception, e:
+		luci_log.debug_verbose('vSA1: error: %s' % str(e))
 		return (False, {'errors': ['The resource data submitted for this service is not properly formed.']})
 
 	form_hash = {}
@@ -440,24 +442,31 @@
 			try:
 				dummy_form[str(i.getAttribute('name'))] = str(i.getAttribute('value'))
 			except Exception, e:
-				luci_log.debug_verbose('Error parsing service XML: %s' % str(e))
+				luci_log.debug_verbose('vSA2: parsing XML: %s' % str(e))
 				pass
 
 		try:
 			res_type = dummy_form['type'].strip()
 			if not res_type or not res_type in resourceAddHandler:
-				raise
-		except:
+				raise Exception, 'invalid resource type: %s' % res_type
+		except Exception, e:
+			luci_log.debug_verbose('vSA3: %s' % str(e))
 			return (False, {'errors': ['An invalid resource type was specified: ' + res_type]})
 
 		try:
-			resObj = resourceAddHandler[res_type](request, dummy_form)
-		except:
-			luci_log('res type %d is invalid' % res_type)
+			if dummy_form.has_key('immutable'):
+				model = request.SESSION.get('model')
+				if not model:
+					raise Exception, 'model is None'
+				resObj = getResource(model, dummy_form['resourceName'])
+			else:
+				resObj = resourceAddHandler[res_type](request, dummy_form)
+		except Exception, e:
 			resObj = None
+			luci_log.debug_verbose('vSA4: type %s: %s' % (res_type, str(e)))
 
 		if resObj is None:
-			return (False, {'errors': ['An error occurred while adding ' + res_type]})
+			return (False, {'errors': [ 'An error occurred while adding %s' % res_type ]})
 		form_hash[form_id]['obj'] = resObj
 			
 	return (True, {'messages': ['This service has been updated.']})
@@ -3798,6 +3807,7 @@
 	for item in modelb.getResources():
 		itemmap = {}
 		itemmap['name'] = item.getName()
+		itemmap['attrs'] = item.attr_hash
 		itemmap['type'] = item.resource_type
 		itemmap['cfgurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_CONFIG
 		itemmap['url'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE
@@ -4651,6 +4661,17 @@
 	response = request.RESPONSE
 	response.redirect(request['URL'] + "?pagetype=" + RESOURCES + "&clustername=" + clustername + '&busyfirst=true')
 
+def getResource(modelb, name):
+	resPtr = modelb.getResourcesPtr()
+	resources = resPtr.getChildren()
+
+	for res in resources:
+		if res.getName() == name:
+			return res
+
+	luci_log.debug_verbose('getResource: unable to find resource \"%s\"' % name)
+	raise KeyError, name
+
 def getResourceForEdit(modelb, name):
 	resPtr = modelb.getResourcesPtr()
 	resources = resPtr.getChildren()
@@ -4660,7 +4681,7 @@
 			resPtr.removeChild(res)
 			return res
 
-	luci_log.debug_verbose('unable to find resource \"%s\"' % name)
+	luci_log.debug_verbose('GRFE0: unable to find resource \"%s\"' % name)
 	raise KeyError, name
 
 def appendModel(request, model):



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-09-23  4:04 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-09-23  4:04 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-09-23 04:04:08

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : form-macros luci_homebase.css 
	luci/site/luci/Extensions: cluster_adapters.py ricci_bridge.py 

Log message:
	more cleanups, add the service add form to the service add page.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.17&r2=1.18

--- conga/luci/cluster/form-macros	2006/09/22 21:59:03	1.65
+++ conga/luci/cluster/form-macros	2006/09/23 04:04:08	1.66
@@ -165,7 +165,7 @@
 
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
+						<input type="button" value="Add Another Row" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -238,7 +238,7 @@
 				</td></tr>
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
+						<input type="button" value="Add Another Row" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -281,7 +281,7 @@
 		</tal:block>
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -670,7 +670,7 @@
 
 		<div class="spacing configTabContent"></div>
 		<div class="hbSubmit spacing configTabContent">
-			<input class="hbSubmit" type="button" value="Apply"
+			<input type="button" value="Apply"
 				onClick="validate_form(this.form);"
 			>
 		</div>
@@ -769,7 +769,7 @@
 		<tfoot class="systemsTable">
 			<tr class="systemsTable"><td class="systemsTable" colspan="3">
 				<div class="systemsTableEnd">
-					<input class="hbSubmit" type="button" value="Update node daemon properties" />
+					<input type="button" value="Update node daemon properties" />
 				</div>
 			</td></tr>
 		</tfoot>
@@ -991,7 +991,7 @@
 
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add Another Row" onClick="addSystem(adminform);" />
+						<input type="button" value="Add Another Row" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -1013,7 +1013,7 @@
 		</table>
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -1090,7 +1090,54 @@
 </div>
 
 <div metal:define-macro="serviceadd-form">
-	<h2>Service Add Form</h2>
+	<tal:block metal:use-macro="here/form-macros/macros/service-config-head-macro" />
+
+	<h2>Add a Service</h2>
+
+	<div id="resskel" class="invisible">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" /> 
+	</div>
+
+	<div class="service_comp_list">
+		<form name="service_name_form">
+			<table class="systemsTable">
+				<tr class="systemsTable">
+					<td class="systemsTable">
+						<strong class="reshdr">Service name</strong>
+					</td>
+					<td class="systemsTable">
+						<input type="text" length="20" name="service_name" value="" />
+					</td>
+				</tr>
+			</table>
+		</form>
+	</div>
+	<div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
+	</div>
+
+	<div class="service_comp_list">
+		<form name="master">
+		<input type="button" value="Add a resource to this service"
+			onclick="add_child_resource(this.form);" />
+		<input type="button" value="Submit"
+			onClick="forms_to_xml()" />
+		<input type="hidden" name="uuid" value="toplevel" />
+		<input type="hidden" name="parent_uuid" value="_toplevel" />
+		<input type="hidden" name="tree_level" value="-1" />
+		<input type="hidden" name="form_xml" />
+		</form>
+	</div>
+
+	<div class="invisible" id="global_resources_block">
+		<tal:block tal:repeat="gr global_resources">
+			<tal:block tal:define="
+				global res gr;
+				global type res/type;
+				global resourceIsRef python: True" />
+
+			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
+		</tal:block>
+	</div>
 </div>
 
 <div metal:define-macro="servicestart">
@@ -1112,7 +1159,34 @@
 	<!-- <span metal:use-macro="here/form-macros/macros/serviceconfig-form"/> -->
 </div>
 
-<div metal:define-macro="serviceconfig-form">
+<div metal:define-macro="serviceconfig-type-macro" tal:omit-tag="">
+	<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'fs'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'smb'">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+	</span>
+	<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	</span>
+</div>
+
+<div metal:define-macro="service-config-head-macro" tal:omit-tag="">
 	<script type="text/javascript"
 		src="/luci/homebase/homebase_common.js">
 	</script>
@@ -1132,7 +1206,10 @@
 		var active_resources = <tal:block tal:replace="python: map(lambda x: str(x['name']), sinfo['resource_list']) or 'null'" />;
 		var resource_names = <tal:block tal:replace="python: (map(lambda x: str(x['name']), global_resources) + map(lambda x: str(x['name']), sinfo['resource_list'])) or 'null'" />;
 	<tal:block tal:replace="structure string: </script>" />
+</div>
 
+<div metal:define-macro="serviceconfig-form">
+	<tal:block metal:use-macro="here/form-macros/macros/service-config-head-macro" />
 	<table class="cluster service" width="100%">
 		<tr class="cluster service info_top">
 			<td class="cluster service service_name">
@@ -1178,14 +1255,13 @@
 	</table>
 	<br/>
 
+	<h2>Service Composition</h2>
+
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" /> 
 	</div>
 
-	<h2>Service Composition</h2>
-
 	<div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
-
 	<div tal:repeat="res sinfo/resource_list"
 		tal:attributes="
 			class python: 'service_comp rc_indent' + str(res['indent_ctr']);
@@ -1199,48 +1275,24 @@
 			global type res/type;
 			global resourceIsRef res/ref_object | nothing" />
 
-		<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</span>
+		<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 
 		<tal:block
 			tal:condition="python: 'indent_ctr' in res and 'max_depth' in res"
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
+		</div>
 	</div>
-	<form name="master">
-		<input type="button" class="hbSubmit"
-			value="Save changes"
+	<div class="service_comp_list">
+		<form name="master">
+		<input type="button" value="Add a resource to this service"
+			onclick="add_child_resource(this.form);" />
+		<input type="button" value="Save changes"
 			onClick="forms_to_xml()" />
+		<input type="hidden" name="uuid" value="toplevel" />
+		<input type="hidden" name="parent_uuid" value="_toplevel" />
+		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="form_xml" />
-	</form>
+		</form>
 	</div>
 
 	<div class="invisible" id="global_resources_block">
@@ -1250,37 +1302,7 @@
 				global type res/type;
 				global resourceIsRef python: True" />
 
-		<span tal:omit-tag="" tal:condition="python: type == 'IP Address: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'Script: '">
-			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</span>
+			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 		</tal:block>
 	</div>
 </div>
--- conga/luci/cluster/resource-form-macros	2006/09/22 21:59:03	1.15
+++ conga/luci/cluster/resource-form-macros	2006/09/23 04:04:08	1.16
@@ -6,15 +6,15 @@
 
 <div metal:define-macro="res_form_footer" tal:omit-tag="">
 	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
+		<input type="button"
 			onClick="validate_form(this.form);"
 			value="Submit"
 			tal:condition="not: sinfo" />
 
 		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
+			<input type="button" value="Add a child"
 				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
+			<input type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
 	</p>
--- conga/luci/cluster/resource_form_handlers.js	2006/09/22 21:59:03	1.11
+++ conga/luci/cluster/resource_form_handlers.js	2006/09/23 04:04:08	1.12
@@ -271,16 +271,15 @@
 
 function add_child_resource(form) {
 	if (!form || !form.tree_level || !form.parent_uuid || !form.uuid ||
-		!is_valid_int(form.tree_level.value, 0, null))
+		!is_valid_int(form.tree_level.value, -1, null))
 	{
 		return (-1);
 	}
 
 	var ilevel = Number(form.tree_level.value) + 1;
 	var sdiv = document.getElementById('resskel');
-	if (!sdiv) {
+	if (!sdiv)
 		return (-1);
-	}
 
 	var pdiv = document.getElementById(form.uuid.value);
 	if (!pdiv) {
--- conga/luci/homebase/form-macros	2006/09/22 18:22:39	1.36
+++ conga/luci/homebase/form-macros	2006/09/23 04:04:08	1.37
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.36 2006/09/22 18:22:39 rmccabe Exp $
+	$Id: form-macros,v 1.37 2006/09/23 04:04:08 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -72,7 +72,7 @@
 			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
 
 		<div class="hbSubmit" tal:condition="python:userList" id="hbSubmit">
-			<input class="hbSubmit" name="Submit" type="button" value="Delete This User" onClick="validateForm(document.adminform);" />
+			<input name="Submit" type="button" value="Delete This User" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 
@@ -138,7 +138,7 @@
 			tal:attributes="value python:data['children'][data['curIndex']]['absolute_url']" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input class="hbSubmit" name="Submit" type="button" value="Submit" onClick="validateForm(document.adminform);" />
+			<input name="Submit" type="button" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -245,7 +245,7 @@
 			tal:attributes="value python: num_clusters + 1" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Update Permissions" value="Update Permissions" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Update Permissions" value="Update Permissions" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 
@@ -351,7 +351,7 @@
 			tal:attributes="value python: num_clusters + 1" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Remove Selected Systems" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Remove Selected Systems" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 
@@ -413,7 +413,7 @@
 
 				<tr class="systemsTable"><td class="systemsTable" colspan="2">
 					<div class="systemsTableEnd">
-						<input type="button" class="hbSubmit" value="Add another entry" onClick="addSystem(adminform);" />
+						<input type="button" value="Add another entry" onClick="addSystem(adminform);" />
 					</div>
 				</td></tr>
 			</tfoot>
@@ -435,7 +435,7 @@
 		</table>
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -540,7 +540,7 @@
 			tal:attributes="value python: sysNum" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Add This Cluster" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Add This Cluster" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
@@ -609,7 +609,7 @@
 		<input type="hidden" name="numStorage" value="1" />
 
 		<div class="hbSubmit" id="hbSubmit">
-			<input type="button" class="hbSubmit" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
+			<input type="button" name="Submit" value="Submit" onClick="validateForm(document.adminform);" />
 		</div>
 	</form>
 </div>
--- conga/luci/homebase/luci_homebase.css	2006/09/13 17:50:22	1.22
+++ conga/luci/homebase/luci_homebase.css	2006/09/23 04:04:08	1.23
@@ -1,5 +1,11 @@
 input[type=text], input[type=password] {
 	padding: .2em ! important;
+	font-family: "Bitstream Vera Sans Mono", "DejaVu Sans Mono", monospace;
+	font-size: 11px;
+}
+
+input[type=button] {
+	font-size: 11px;
 }
 
 input[type=checkbox], input[type=radio] {
@@ -19,7 +25,6 @@
 
 input.qdisk {
 	padding: .2em;
-	font-size: 10px;
 }
 
 input.qdname {
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/22 18:24:45	1.66
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/23 04:04:08	1.67
@@ -843,9 +843,9 @@
       rb = ricci_bridge(node[1].getId())
       if rb.getRicciResponse() == True:
         return node[1].getId()
-    return None
+    return ""
   else:
-    return None
+    return ""
   
 
 def getClusterStatus(self, ricci_name):
@@ -921,7 +921,17 @@
   baseurl = req['URL']
   cluname = req['clustername']
   hmap = {}
-  servicename = req['servicename']
+  root_uuid = 'toplevel'
+
+  hmap['root_uuid'] = root_uuid
+  hmap['uuid_list'] = map(lambda x: make_uuid('resource'), xrange(30))
+
+  try:
+      servicename = req['servicename']
+  except KeyError, e:
+      hmap['resource_list'] = {}
+      return hmap
+
   for item in status:
     if item['type'] == "service":
       if item['name'] == servicename:
@@ -966,13 +976,10 @@
   if svc != None:
     indent_ctr = 0
     children = svc.getChildren()
-    root_uuid = 'toplevel';
     for child in children:
       recurse_resources(root_uuid, child, resource_list, indent_ctr)
       
   hmap['resource_list'] = resource_list
-  hmap['root_uuid'] = root_uuid
-  hmap['uuid_list'] = map(lambda x: make_uuid('resource'), xrange(30))
   return hmap
 
 def recurse_resources(parent_uuid, child, resource_list, indent_ctr, parent=None):
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/08/14 16:01:59	1.17
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/09/23 04:04:08	1.18
@@ -127,9 +127,12 @@
     if hello != None:
         pass
         #print hello.toxml()
-    self.__sendall(CLUSTER_STR, ss)
-    
-    
+    try:
+        self.__sendall(CLUSTER_STR, ss)
+    except sslerror, e:
+        sock.close()
+        return ''
+
     # receive response
     doc = self.__receive(ss)
     if doc == None:



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-09-14 21:24 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-09-14 21:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-09-14 21:24:25

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : homebase_common.js 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	the end of the service/resource frontend nastiness. i hope.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.64&r2=1.65

--- conga/luci/cluster/form-macros	2006/09/13 17:50:22	1.59
+++ conga/luci/cluster/form-macros	2006/09/14 21:24:24	1.60
@@ -1148,15 +1148,9 @@
 
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
-		<p class="invisible expander">
-			<img class="service_tree" name="arrow_down" alt="[-]"
-				src="/luci/cluster/arrow_down.png"
-				onClick="collapse_div(this)">
-			<span class="service_tree expander">Hide Children</span>
-		</p>
 	</div>
 
-	<h2>Service Composition</h2>
+	<h2 onclick="forms_to_xml()">Service Composition</h2>
 
 	<div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
 
@@ -1205,19 +1199,13 @@
 			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</span>
 
-		<p
-			tal:attributes="
-				class python: (res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))) + ' expander'">
-			<img class="service_tree" name="arrow_down" alt="[-]"
-				src="/luci/cluster/arrow_down.png"
-				onClick="collapse_div(this)">
-			<span class="service_tree expander">Hide Children</span>
-		</p>
-
 		<tal:block
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
 	</div>
 	</div>
+	<form name="master">
+		<input type="hidden" name="form_xml" />
+	</form>
 </div>
 
 <div metal:define-macro="service-form">
--- conga/luci/cluster/resource-form-macros	2006/09/13 17:50:22	1.10
+++ conga/luci/cluster/resource-form-macros	2006/09/14 21:24:24	1.11
@@ -4,6 +4,35 @@
 </head>
 <body>
 
+<div metal:define-macro="res_form_footer" tal:omit-tag="">
+	<p class="hbSubmit">
+		<input class="hbSubmit" type="button"
+			onClick="validate_form(this.form);"
+			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
+
+		<tal:block tal:condition="sinfo">
+			<input class="hbSubmit" type="button" value="Add a child"
+				onClick="add_child_resource(this.form)" />
+			<input class="hbSubmit" type="button" value="Delete this resource"
+				onClick="delete_resource(this.form)" />
+		</tal:block>
+	</p>
+
+	<tal:block tal:condition="not:exists:res"
+		tal:define="global expclass string: invisible expander" />
+
+	<tal:block tal:condition="exists:res">
+		<tal:block tal:define="
+			global expclass python: ((res['max_depth'] == 0 and 'invisible ') + 'expander')" />
+	</tal:block>
+
+	<p tal:attributes="class expclass">
+		<img class="service_tree" name="arrow_down" alt="[-]"
+			src="/luci/cluster/arrow_down.png"
+			onClick="collapse_div(this)">
+		<span class="service_tree expander">Hide Children</span>
+	</p>
+</div>
 
 <div metal:define-macro="resources-form">
 	<h2>Resources for <span tal:replace="request/clustername" /></h2>
@@ -64,30 +93,27 @@
 </div>
 
 <div metal:define-macro="resource-swap-form">
-<form>
 	<p class="reshdr">
 		<strong class="reshdr">Select a Resource Type</strong>
 	</p>
 
 	<p class="reshdr">
-	<select onChange="swap_div_elem(this.form.parentNode.parentNode,
-		'invisible', 'container',
-		this.options[this.selectedIndex].value);">
-		<option name="blank" value="blank" checked>Select a Resource</option>
-		<option name="IP" value="IP">IP address</option>
-		<option name="FS" value="FS">File system</option>
-		<option name="GFS" value="GFS">GFS file system</option>
-		<option name="NFSM" value="NFSM">NFS mount</option>
-		<option name="NFSC" value="NFSC">NFS client</option>
-		<option name="NFSX" value="NFSX">NFS export</option>
-		<option name="SCR" value="SCR">Script</option>
-		<option name="SMB" value="SMB">Samba</option>
-	</select>
+		<form>
+		<select onChange="swap_div_elem(this.form.parentNode,
+									this.options[this.selectedIndex].value);">
+			<option name="blank" value="blank" checked>Select a Resource</option>
+			<option name="IP" value="IP">IP address</option>
+			<option name="FS" value="FS">File system</option>
+			<option name="GFS" value="GFS">GFS file system</option>
+			<option name="NFSM" value="NFSM">NFS mount</option>
+			<option name="NFSC" value="NFSC">NFS client</option>
+			<option name="NFSX" value="NFSX">NFS export</option>
+			<option name="SCR" value="SCR">Script</option>
+			<option name="SMB" value="SMB">Samba</option>
+		</select>
+		</form>
 	</p>
 
-	<div name="container" class="systemsTable">
-	</div>
-
 	<div name="invisible" class="invisible">
 		<div name="blank">&nbsp;</div>
 		<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
@@ -99,7 +125,6 @@
 		<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 	</div>
-</form>
 </div>
 
 <div metal:define-macro="resourceadd-form">
@@ -231,9 +256,12 @@
 
 	<p class="reshdr">IP Address Resource Configuration</p>
 
-	<form name="ip_form" method="get"
-		tal:attributes="action processURL">
-	<input name="pagetype" type="hidden" value="35"/>
+	<form method="get"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
+	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
 		tal:attributes="value res/parent_uuid | nothing" />
@@ -274,19 +302,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -320,7 +336,11 @@
 
 	<p class="reshdr">File System Resource Configuration</p>
 
-	<form name="fs_form" method="get" tal:attributes="action processURL">
+	<form method="get"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+		
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -427,18 +447,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -467,7 +476,11 @@
 
 	<p class="reshdr">GFS Resource Configuration</p>
 
-	<form name="gfs_form" method="get" tal:attributes="action processURL">
+	<form method="get"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -543,19 +556,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -584,7 +585,11 @@
 
 	<p class="reshdr">NFS Mount Resource Configuration</p>
 
-	<form name="nfsm_form" method="get" tal:attributes="action processURL">
+	<form method="get"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -673,19 +678,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -710,7 +703,11 @@
 
 	<p class="reshdr">NFS Client Resource Configuration</p>
 
-	<form name="nfsc_form" method="post" tal:attributes="action processURL">
+	<form method="post"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -761,19 +758,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -794,7 +779,11 @@
 
 	<p class="reshdr">NFS Export Resource Configuration</p>
 
-	<form name="nfsx_form" method="post" tal:attributes="action processURL">
+	<form method="post"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -829,19 +818,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -863,7 +840,11 @@
 
 	<p class="reshdr">Script Resource Configuration</p>
 
-	<form name="scr_form" method="post" tal:attributes="action processURL">
+	<form method="post"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -906,19 +887,7 @@
 		</tr>
 	</table>
 
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
@@ -944,7 +913,11 @@
 		Samba Server Configuration
 	</p>
 
-	<form name="smb_form" method="post" tal:attributes="action processURL">
+	<form method="post"
+		tal:attributes="
+			action processURL | nothing;
+			name res/parent_uuid | nothing">
+
 	<input name="pagetype" type="hidden" value="35" />
 
 	<input name="parent_uuid" type="hidden"
@@ -986,20 +959,7 @@
 			</td>
 		</tr>
 	</table>
-
-	<p class="hbSubmit">
-		<input class="hbSubmit" type="button"
-			onClick="validate_form(this.form);"
-			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
-
-		<tal:block tal:condition="sinfo">
-			<input class="hbSubmit" type="button" value="Add a child"
-				onClick="add_child_resource(this.form)" />
-			<input class="hbSubmit" type="button" value="Delete this resource"
-				onClick="delete_resource(this.form)" />
-		</tal:block>
-	</p>
-
+	<div metal:use-macro="here/resource-form-macros/macros/res_form_footer" />
 	</form>
 </div>
 
--- conga/luci/cluster/resource_form_handlers.js	2006/09/13 17:50:22	1.7
+++ conga/luci/cluster/resource_form_handlers.js	2006/09/14 21:24:24	1.8
@@ -1,30 +1,64 @@
-function swap_div_elem(container, swap_out_cname, swap_in_cname, swap_in_name) {
-	var divs = container.getElementsByTagName('div');
-	if (!divs)
+function collapse_div(image) {
+	var span = null;
+	var pdiv = image.parentNode;
+	var spanc = pdiv.getElementsByTagName('span');
+	for (var i = 0 ; i < spanc.length ; i++) {
+		if (spanc[i].className.match(/expander/)) {
+			span = spanc[i];
+			break;
+		}
+	}
+	if (!span)
 		return (-1);
 
-	var swap_out_cont = null;
-	var swap_in_cont = null;
+	var div = pdiv.parentNode.parentNode;
+	while (div) {
+		if (div.tagName && div.tagName.match(/^DIV$/i) &&
+			div.className.match(/service_comp/))
+		{
+			break;
+		}
+		if (!div.nextSibling)
+			div = div.parentNode;
+		else
+			div = div.nextSibling;
+	}
+	if (!div)
+		return (-1);
+
+	var dclass = 'invisible expander service_comp';
+	if (div.className.match(/invisible/))
+		dclass = 'expander service_comp';
+	while (div) {
+		div.className = dclass;
+		div = div.nextSibling;
+	}
+
+	if (image.name == 'arrow_down') {
+		image.src = 'arrow_right.png';
+		image.name = 'arrow_right';
+		image.alt = '[-]';
+		span.innerHTML = 'Show Children';
+	} else {
+		image.src = 'arrow_down.png';
+		image.name = 'arrow_down';
+		image.alt = '[+]';
+		span.innerHTML = 'Hide Children';
+	}
+}
+
+function swap_div_elem(container, swap_in_name) {
 	var swap_in_elem = null;
-	var i = 0;
-	while ((!swap_out_cont || !swap_in_cont || !swap_in_elem) && i < divs.length)
-	{
-		if (!swap_in_cont && divs[i].getAttribute('name') == swap_in_cname)
-			swap_in_cont = divs[i];
-		else if (!swap_out_cont && divs[i].getAttribute('name') == swap_out_cname)
-			swap_out_cont = divs[i];
-		else if (!swap_in_elem && divs[i].getAttribute('name') == swap_in_name)
+	var divs = container.getElementsByTagName('div');
+
+	for (var i = 0 ; i < divs.length ; i++) {
+		if (!swap_in_elem && divs[i].getAttribute('name') == swap_in_name)
 			swap_in_elem = divs[i];
-		i++;
 	}
-
-	if (!swap_out_cont || !swap_in_cont || !swap_in_elem)
+	if (!swap_in_elem)
 		return (-1);
 
-	if (swap_in_cont.id)
-		swap_in_elem.id = swap_in_cont.id;
-	var temp = swap_in_cont.parentNode.replaceChild(swap_in_elem, swap_in_cont);
-	swap_out_cont.appendChild(temp);
+	container.parentNode.replaceChild(swap_in_elem, container);
 }
 
 function validate_ip(form) {
@@ -143,7 +177,16 @@
 function delete_resource(form) {
 	if (!confirm('Are you sure you want to delete this resource?'))
 		return (-1);
-	form.submit();
+	var div = document.getElementById(form.uuid.value);
+	if (!div)
+		return (-1);
+	var pdiv = document.getElementById(form.parent_uuid.value);
+	div.parentNode.removeChild(div);
+	var pelem = pdiv.getElementsByTagName('p');
+	for (var i = 0 ; i < pelem.length ; i++) {
+		if (pelem[i].className.match(/expander/))
+			pelem[i].className += ' invisible';
+	}
 }
 
 function add_child_resource(form) {
@@ -155,12 +198,12 @@
 
 	var ilevel = Number(form.tree_level.value) + 1;
 	var sdiv = document.getElementById('resskel');
-	if (!sdiv)
+	if (!sdiv) {
 		return (-1);
+	}
 
 	var pdiv = document.getElementById(form.uuid.value);
 	if (!pdiv) {
-		alert('failed to find ' + form.uuid.value);
 		return (-1);
 	}
 
@@ -179,8 +222,13 @@
 	node.id = null;
 	node.className = null;
 	ielem = node.getElementsByTagName('input');
-	if (!ielem)
+	if (!ielem) {
 		return (-1);
+	}
+
+	forms = node.getElementsByTagName('form');
+	for (var i = 0 ; i < forms.length ; i++)
+		forms.name = form.uuid.value;
 
 	var new_uuid = uuid_list.pop();
 	for (var i = 0 ; i < ielem.length ; i++) {
@@ -198,7 +246,11 @@
 	}
 
 	if (!child_div) {
-		/* enable parent collapse */
+		var pelem = pdiv.getElementsByTagName('p');
+		for (var i = 0 ; i < pelem.length ; i++) {
+			if (pelem[i].className.match(/expander/))
+				pelem[i].className = pelem[i].className.replace(/invisible/,'');
+		}
 		child_div = document.createElement('div');
 	} else {
 		wrap_div = document.createElement('div');
@@ -211,3 +263,29 @@
 	child_div.appendChild(node);
 	pdiv.appendChild(child_div);
 }
+
+function forms_to_xml() {
+	var form = document.getElementsByTagName('form');
+	var master_form = null;
+	var form_xml = '';
+
+	for (var i = 0 ; i < form.length ; i++) {
+		if (form[i].name == 'master') {
+			master_form = form[i];
+			continue;
+		} else if (!form[i].uuid || !form[i].uuid.value)
+			continue;
+		var temp = form[i].innerHTML.match(/<input [^>]+>/ig).toString().replace(/>(,|$)/g, '/>');
+		if (!temp)
+			continue;
+		form_xml += '<form id="' + form[i].uuid.value + '" parent="' +
+					form[i].parent_uuid.value + '">' + temp + '</form>';
+	}
+
+	if (!master_form || !form_xml)
+		return (-1);
+
+	/* sort this out in the backend */
+	master_form.form_xml.value = form_xml;
+	master_form.submit();
+}
--- conga/luci/homebase/homebase_common.js	2006/09/13 17:50:22	1.9
+++ conga/luci/homebase/homebase_common.js	2006/09/14 21:24:25	1.10
@@ -1,45 +1,3 @@
-function collapse_div(image) {
-	if (!image)
-		return (-1);
-
-	var span = null;
-	var pdiv = image.parentNode;
-	var spanc = pdiv.getElementsByTagName('span');
-	if (!spanc)
-		return (-1);
-	for (var i = 0 ; i < spanc.length ; i++) {
-		if (spanc[i].className.match(/expander/)) {
-			span = spanc[i];
-			break;
-		}
-	}
-	if (!span)
-		return (-1);
-
-	var div = image.parentNode.parentNode.nextSibling;
-	while (div) {
-		if (div.tagName && div.tagName.match(/^DIV$/i) && div.className.match(/expander/))
-			break;
-		div = div.nextSibling;
-	}
-	if (!div)
-		return (-1);
-
-	if (image.name == 'arrow_down') {
-		image.src = 'arrow_right.png';
-		image.name = 'arrow_right';
-		image.alt = '[-]';
-		span.innerHTML = 'Show Children';
-		div.className = 'invisible expander service_comp';
-	} else {
-		image.src = 'arrow_down.png';
-		image.name = 'arrow_down';
-		image.alt = '[+]';
-		span.innerHTML = 'Hide Children';
-		div.className = 'expander service_comp';
-	}
-}
-
 function is_valid_int(str, min, max) {
 	if (str.match(/[^0-9 -]/))
 		return (0);
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/13 17:50:22	1.64
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/14 21:24:25	1.65
@@ -966,7 +966,7 @@
   if svc != None:
     indent_ctr = 0
     children = svc.getChildren()
-    root_uuid = make_uuid('resource') 
+    root_uuid = 'toplevel';
     for child in children:
       recurse_resources(root_uuid, child, resource_list, indent_ctr)
       



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-09-13 17:50 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-09-13 17:50 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-09-13 17:50:22

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : homebase_common.js luci_homebase.css 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	service stuff..

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.63&r2=1.64

--- conga/luci/cluster/form-macros	2006/09/11 22:22:00	1.58
+++ conga/luci/cluster/form-macros	2006/09/13 17:50:22	1.59
@@ -1097,6 +1097,10 @@
 		global sinfo python: here.getServiceInfo(sstat, modelb,request);
 		global running sinfo/running | nothing;" />
 
+	<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>'" />
+		var uuid_list = <tal:block tal:replace="sinfo/uuid_list" />;
+	<tal:block tal:replace="structure string: </script>" />
+
 	<table class="cluster service" width="100%">
 		<tr class="cluster service info_top">
 			<td class="cluster service service_name">
@@ -1144,25 +1148,26 @@
 
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
-		<div name="expander" class="invisible">
+		<p class="invisible expander">
 			<img class="service_tree" name="arrow_down" alt="[-]"
 				src="/luci/cluster/arrow_down.png"
 				onClick="collapse_div(this)">
-			<span class="service_tree">Hide Children</span>
-		</div>
+			<span class="service_tree expander">Hide Children</span>
+		</p>
 	</div>
 
 	<h2>Service Composition</h2>
 
-	<div id="service_comp_list">
-	<div tal:repeat="res sinfo/resource_list"
-		tal:attributes="class python: 'service_comp rc_indent' + str(res['indent_ctr'])">
+	<div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
 
+	<div tal:repeat="res sinfo/resource_list"
+		tal:attributes="
+			class python: 'service_comp rc_indent' + str(res['indent_ctr']);
+			id python: res['uuid']">
 
 		<tal:block
 			tal:condition="python: res['max_depth'] > 0"
-			tal:replace="structure python: '<div>'" />
-
+			tal:replace="structure python: '<div class=nothing>'" />
 
 		<tal:block tal:define="
 			global type res/type;
@@ -1200,14 +1205,14 @@
 			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</span>
 
-		<div name="expander"
+		<p
 			tal:attributes="
-				class python: res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))">
+				class python: (res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))) + ' expander'">
 			<img class="service_tree" name="arrow_down" alt="[-]"
 				src="/luci/cluster/arrow_down.png"
 				onClick="collapse_div(this)">
-			<span class="service_tree">Hide Children</span>
-		</div>
+			<span class="service_tree expander">Hide Children</span>
+		</p>
 
 		<tal:block
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
--- conga/luci/cluster/resource-form-macros	2006/09/11 22:22:00	1.9
+++ conga/luci/cluster/resource-form-macros	2006/09/13 17:50:22	1.10
@@ -65,10 +65,11 @@
 
 <div metal:define-macro="resource-swap-form">
 <form>
-	<div class="reshdr">
+	<p class="reshdr">
 		<strong class="reshdr">Select a Resource Type</strong>
-	</div>
-	<div class="reshdr">
+	</p>
+
+	<p class="reshdr">
 	<select onChange="swap_div_elem(this.form.parentNode.parentNode,
 		'invisible', 'container',
 		this.options[this.selectedIndex].value);">
@@ -82,10 +83,9 @@
 		<option name="SCR" value="SCR">Script</option>
 		<option name="SMB" value="SMB">Samba</option>
 	</select>
-	</div>
+	</p>
 
 	<div name="container" class="systemsTable">
-		<div>&nbsp;</div>
 	</div>
 
 	<div name="invisible" class="invisible">
@@ -174,37 +174,37 @@
 		<h2>Configure <span tal:replace="python: res['name']" /></h2>
 
 		<div class="reschoose">
-			<span tal:omit-tag="" tal:condition="python: type == 'ip'">
-				<div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-				<div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-				<div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-				<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-				<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-				<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-				<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-			</span>
-
-			<span tal:omit-tag="" tal:condition="python: type == 'script'">
-				<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-			</span>
+		<span tal:omit-tag="" tal:condition="python: type == 'ip'">
+			<div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
+			<div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+			<div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+			<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+			<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+			<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
+			<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+		</span>
+
+		<span tal:omit-tag="" tal:condition="python: type == 'script'">
+			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+		</span>
 		</div>
 	</tal:block>
 </div>
@@ -229,12 +229,18 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">IP Address Resource Configuration</div>
+	<p class="reshdr">IP Address Resource Configuration</p>
 
 	<form name="ip_form" method="get"
 		tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35"/>
 
+	<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" />
 
@@ -268,7 +274,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -279,7 +285,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
@@ -312,11 +318,17 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">File System Resource Configuration</div>
+	<p class="reshdr">File System Resource Configuration</p>
 
 	<form name="fs_form" method="get" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -415,7 +427,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -426,7 +438,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 	</form>
 </div>
 
@@ -453,11 +465,17 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">GFS Resource Configuration</div>
+	<p class="reshdr">GFS Resource Configuration</p>
 
 	<form name="gfs_form" method="get" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -525,7 +543,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -536,7 +554,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
@@ -564,11 +582,17 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">NFS Mount Resource Configuration</div>
+	<p class="reshdr">NFS Mount Resource Configuration</p>
 
 	<form name="nfsm_form" method="get" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -649,7 +673,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -660,7 +684,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
@@ -684,11 +708,17 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">NFS Client Resource Configuration</div>
+	<p class="reshdr">NFS Client Resource Configuration</p>
 
 	<form name="nfsc_form" method="post" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -731,7 +761,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -742,7 +772,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
@@ -762,11 +792,17 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">NFS Export Resource Configuration</div>
+	<p class="reshdr">NFS Export Resource Configuration</p>
 
 	<form name="nfsx_form" method="post" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -793,7 +829,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -804,7 +840,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
@@ -825,11 +861,17 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr">Script Resource Configuration</div>
+	<p class="reshdr">Script Resource Configuration</p>
 
 	<form name="scr_form" method="post" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -864,7 +906,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -875,7 +917,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
@@ -897,14 +939,20 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<div class="reshdr"
+	<p class="reshdr"
 		tal:condition="python: edit != 'true'">
 		Samba Server Configuration
-	</div>
+	</p>
 
 	<form name="smb_form" method="post" tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35" />
 
+	<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" />
 
@@ -939,7 +987,7 @@
 		</tr>
 	</table>
 
-	<div class="hbSubmit">
+	<p class="hbSubmit">
 		<input class="hbSubmit" type="button"
 			onClick="validate_form(this.form);"
 			tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -950,7 +998,7 @@
 			<input class="hbSubmit" type="button" value="Delete this resource"
 				onClick="delete_resource(this.form)" />
 		</tal:block>
-	</div>
+	</p>
 
 	</form>
 </div>
--- conga/luci/cluster/resource_form_handlers.js	2006/09/11 22:22:00	1.6
+++ conga/luci/cluster/resource_form_handlers.js	2006/09/13 17:50:22	1.7
@@ -21,7 +21,9 @@
 	if (!swap_out_cont || !swap_in_cont || !swap_in_elem)
 		return (-1);
 
-	var temp = swap_in_cont.replaceChild(swap_in_elem, swap_in_cont.firstChild);
+	if (swap_in_cont.id)
+		swap_in_elem.id = swap_in_cont.id;
+	var temp = swap_in_cont.parentNode.replaceChild(swap_in_elem, swap_in_cont);
 	swap_out_cont.appendChild(temp);
 }
 
@@ -145,54 +147,67 @@
 }
 
 function add_child_resource(form) {
-	if (!form || !form.tree_level ||
+	if (!form || !form.tree_level || !form.parent_uuid || !form.uuid ||
 		!is_valid_int(form.tree_level.value, 0, null))
 	{
 		return (-1);
 	}
-	var ilevel = Number(form.tree_level.value);
+
+	var ilevel = Number(form.tree_level.value) + 1;
 	var sdiv = document.getElementById('resskel');
 	if (!sdiv)
 		return (-1);
 
-	var pdiv = form.parentNode;
-	var regex = eval('/rc_indent' + ilevel + '$/');
-	while (pdiv && !pdiv.className.match(regex)) {
-		if (pdiv.className == 'service_comp_list')
-			break;
-		pdiv = pdiv.parentNode;
-	}
-	if (!pdiv)
+	var pdiv = document.getElementById(form.uuid.value);
+	if (!pdiv) {
+		alert('failed to find ' + form.uuid.value);
 		return (-1);
+	}
 
-	var divs = pdiv.getElementsByTagName('div');
-	var target = null;
-
-	++ilevel;
-	regex = eval('/rc_indent' + ilevel + '$/');
-	for (var i = 0 ; i < divs.length ; i++) {
-		if (divs[i].className.match(regex)) {
-			target = divs[i]
+	var forms = pdiv.getElementsByTagName('form');
+	var child_div = null;
+	for (var i = 0 ; i < forms.length ; i++) {
+		if (forms[i].parent_uuid &&
+			forms[i].parent_uuid.value == form.uuid.value)
+		{
+			child_div = document.getElementById(forms[i].uuid.value);
 			break;
 		}
 	}
 
-	if (!target) {
-		alert('need to append');
-		target = document.createElement('div');
-		target.className = 'service_comp rc_indent' + ilevel;
-		pdiv.appendChild(target);
-	}
-
 	var node = sdiv.cloneNode(1);
 	node.id = null;
 	node.className = null;
 	ielem = node.getElementsByTagName('input');
 	if (!ielem)
 		return (-1);
+
+	var new_uuid = uuid_list.pop();
 	for (var i = 0 ; i < ielem.length ; i++) {
 		if (ielem[i].getAttribute('name') == 'tree_level')
 			ielem[i].value = ilevel;
+		else if (ielem[i].getAttribute('name') == 'parent_uuid')
+			ielem[i].value = form.uuid.value;
+		else if (ielem[i].getAttribute('name') == 'uuid') {
+			if (!new_uuid) {
+				alert('You have too many pending children. Update first.');
+				return (-1);
+			}
+			ielem[i].value = new_uuid;
+		}
 	}
-	target.appendChild(node);
+
+	if (!child_div) {
+		/* enable parent collapse */
+		child_div = document.createElement('div');
+	} else {
+		wrap_div = document.createElement('div');
+		child_div.appendChild(wrap_div);
+		child_div = wrap_div;
+	}
+	child_div.id = new_uuid;
+	child_div.className = 'service_comp rc_indent' + ilevel;
+
+	child_div.appendChild(node);
+	pdiv.appendChild(child_div);
 }
--- conga/luci/homebase/homebase_common.js	2006/09/08 22:54:32	1.8
+++ conga/luci/homebase/homebase_common.js	2006/09/13 17:50:22	1.9
@@ -2,21 +2,26 @@
 	if (!image)
 		return (-1);
 
-	var span = image.parentNode.getElementsByTagName('span');
-	if (span && span.length > 0)
-		span = span[0];
-	else
-		span = null;
-
-	var div = null;
-	divc = image.parentNode.parentNode.parentNode.getElementsByTagName('div');
-	for (var i = 0 ; i < divc.length ; i++) {
-		if (divc[i].className.match(/service_comp/)) {
-			div = divc[i];
+	var span = null;
+	var pdiv = image.parentNode;
+	var spanc = pdiv.getElementsByTagName('span');
+	if (!spanc)
+		return (-1);
+	for (var i = 0 ; i < spanc.length ; i++) {
+		if (spanc[i].className.match(/expander/)) {
+			span = spanc[i];
 			break;
 		}
 	}
+	if (!span)
+		return (-1);
 
+	var div = image.parentNode.parentNode.nextSibling;
+	while (div) {
+		if (div.tagName && div.tagName.match(/^DIV$/i) && div.className.match(/expander/))
+			break;
+		div = div.nextSibling;
+	}
 	if (!div)
 		return (-1);
 
@@ -24,18 +29,14 @@
 		image.src = 'arrow_right.png';
 		image.name = 'arrow_right';
 		image.alt = '[-]';
-		if (span)
-			span.innerHTML = 'Show Children';
-		div.style.visibility = 'hidden';
-		div.style.display = 'none';
+		span.innerHTML = 'Show Children';
+		div.className = 'invisible expander service_comp';
 	} else {
 		image.src = 'arrow_down.png';
 		image.name = 'arrow_down';
 		image.alt = '[+]';
-		if (span)
-			span.innerHTML = 'Hide Children';
-		div.style.visibility = 'inherit';
-		div.style.display = 'block';
+		span.innerHTML = 'Hide Children';
+		div.className = 'expander service_comp';
 	}
 }
 
--- conga/luci/homebase/luci_homebase.css	2006/09/11 22:22:01	1.21
+++ conga/luci/homebase/luci_homebase.css	2006/09/13 17:50:22	1.22
@@ -146,7 +146,7 @@
 	margin-bottom: .25em;
 }
 
-div.hbSubmit {
+div.hbSubmit,p.hbSubmit {
 	margin-top: .5em;
 	margin-bottom: .5em;
 	margin-right: .5em;
@@ -381,10 +381,11 @@
 	margin-bottom: .25em ! important;
 }
 
-#service_comp_list {
+div.service_comp_list {
 	background: #dee7ec;
 	max-width: 700px;
 	padding: 1em;
+	margin-top: 0;
 }
 
 div.reschoose {
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/08 22:54:32	1.63
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/09/13 17:50:22	1.64
@@ -6,6 +6,7 @@
 from ricci_communicator import *
 import time
 import Products.ManagedSystem
+from Products.Archetypes.utils import make_uuid
 from Ip import Ip
 from Clusterfs import Clusterfs
 from Fs import Fs
@@ -919,15 +920,15 @@
   #set up struct for service config page
   baseurl = req['URL']
   cluname = req['clustername']
-  map = {}
+  hmap = {}
   servicename = req['servicename']
   for item in status:
     if item['type'] == "service":
       if item['name'] == servicename:
-        map['name'] = servicename
+        hmap['name'] = servicename
         starturls = list()
         if item['running'] == "true":
-          map['running'] = "true"
+          hmap['running'] = "true"
           #In this case, determine where it can run...
           innermap = {}
           nodename = item['nodename']
@@ -956,7 +957,7 @@
             starturl['url'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + servicename + "&pagetype=" + SERVICE_START + "&nodename=" + node.getName()
             starturls.append(starturl)
           innermap['links'] = starturls
-        map['innermap'] = innermap
+        hmap['innermap'] = innermap
 
   #Now build hashes for resources under service.
   #first get service by name from model
@@ -965,15 +966,16 @@
   if svc != None:
     indent_ctr = 0
     children = svc.getChildren()
-    
+    root_uuid = make_uuid('resource') 
     for child in children:
-      recurse_resources(child, resource_list, indent_ctr)
+      recurse_resources(root_uuid, child, resource_list, indent_ctr)
       
-  map['resource_list'] = resource_list 
-
-  return map
+  hmap['resource_list'] = resource_list
+  hmap['root_uuid'] = root_uuid
+  hmap['uuid_list'] = map(lambda x: make_uuid('resource'), range(30))
+  return hmap
 
-def recurse_resources(child, resource_list, indent_ctr, parent=None):
+def recurse_resources(parent_uuid, child, resource_list, indent_ctr, parent=None):
   #First, add the incoming child as a resource
   #Next, check for children of it
   #Call yourself on every children
@@ -992,6 +994,8 @@
     
   #Note: Final version needs all resource attrs
   rc_map['attrs'] = child.getAttributes()
+  rc_map['uuid'] = make_uuid('resource')
+  rc_map['parent_uuid'] = parent_uuid
 
   new_indent_ctr = indent_ctr + 1
 
@@ -999,7 +1003,7 @@
   kids = child.getChildren()
   child_depth = 0
   for kid in kids:
-    child_depth = recurse_resources(kid, resource_list, new_indent_ctr, child)
+    child_depth = recurse_resources(rc_map['uuid'], kid, resource_list, new_indent_ctr, child)
 
   rc_map['max_depth'] = child_depth
   return child_depth + 1



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-09-11 22:22 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-09-11 22:22 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-09-11 22:22:01

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/homebase  : luci_homebase.css x.png 

Log message:
	resource / service frontend bits

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.57&r2=1.58
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/x.png.diff?cvsroot=cluster&r1=1.1&r2=1.2

--- conga/luci/cluster/form-macros	2006/09/08 22:54:32	1.57
+++ conga/luci/cluster/form-macros	2006/09/11 22:22:00	1.58
@@ -1085,7 +1085,11 @@
 </div>
 
 <div metal:define-macro="serviceconfig-form">
-	<script type="text/javascript" src="/luci/homebase/homebase_common.js">
+	<script type="text/javascript"
+		src="/luci/homebase/homebase_common.js">
+	</script>
+	<script type="text/javascript"
+		src="/luci/cluster/resource_form_handlers.js">
 	</script>
 	<tal:block tal:define="
 		global ricci_agent python: here.getRicciAgentForCluster(request);
@@ -1137,6 +1141,17 @@
 		</tr>
 	</table>
 	<br/>
+
+	<div id="resskel" class="invisible">
+		<tal:block metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
+		<div name="expander" class="invisible">
+			<img class="service_tree" name="arrow_down" alt="[-]"
+				src="/luci/cluster/arrow_down.png"
+				onClick="collapse_div(this)">
+			<span class="service_tree">Hide Children</span>
+		</div>
+	</div>
+
 	<h2>Service Composition</h2>
 
 	<div id="service_comp_list">
@@ -1185,10 +1200,9 @@
 			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</span>
 
-		<div
-			tal:condition="python: res['max_depth'] != 0"
+		<div name="expander"
 			tal:attributes="
-				class python: 'rc_indent' + str(res['indent_ctr'] - 1)">
+				class python: res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))">
 			<img class="service_tree" name="arrow_down" alt="[-]"
 				src="/luci/cluster/arrow_down.png"
 				onClick="collapse_div(this)">
--- conga/luci/cluster/resource-form-macros	2006/09/08 22:54:32	1.8
+++ conga/luci/cluster/resource-form-macros	2006/09/11 22:22:00	1.9
@@ -13,7 +13,7 @@
 			global rescInf python: here.getResourcesInfo(modelb, request);
 			global msg python: here.appendModel(request, modelb)" />
 
-	<table id="systemsTable" class="systemsTable" border="0" cellspacing="0">
+	<table class="systemsTable" border="0" cellspacing="0">
 		<thead class="systemsTable">
 			<tr class="systemsTable">
 				<th class="systemsTable" width="100">Resource Name</th>
@@ -46,12 +46,10 @@
 	</table>
 </div>
 
-
 <div metal:define-macro="resourceslist-form">
 	<h2>Resources List Form</h2>
 </div>
 
-
 <div metal:define-macro="resourceremove-form">
 	<h2>Resources Remove Form</h2>
 
@@ -65,22 +63,16 @@
 	<div tal:condition="msg" tal:content="msg" />
 </div>
 
-<div metal:define-macro="resourceadd-form">
-	<script type="text/javascript"
-		src="/luci/cluster/resource_form_handlers.js">
-	</script>
-
-	<tal:block
-		tal:define="
-			global res python: here.getResourceInfo(modelb, request);" />
-
-	<h2>Add a Resource</h2>
-	<strong>Select a Resource Type</strong>
-	<br/>
-
-	<form>
-	<select name="select_div"
-		onChange="swap_div('container', this.form.select_div.options[this.form.select_div.selectedIndex].value);">
+<div metal:define-macro="resource-swap-form">
+<form>
+	<div class="reshdr">
+		<strong class="reshdr">Select a Resource Type</strong>
+	</div>
+	<div class="reshdr">
+	<select onChange="swap_div_elem(this.form.parentNode.parentNode,
+		'invisible', 'container',
+		this.options[this.selectedIndex].value);">
+		<option name="blank" value="blank" checked>Select a Resource</option>
 		<option name="IP" value="IP">IP address</option>
 		<option name="FS" value="FS">File system</option>
 		<option name="GFS" value="GFS">GFS file system</option>
@@ -90,17 +82,14 @@
 		<option name="SCR" value="SCR">Script</option>
 		<option name="SMB" value="SMB">Samba</option>
 	</select>
-	</form>
+	</div>
 
-	<table class="systemsTable">
-		<tr class="systemsTable">
-			<td class="systemsTable" id="container" width="400">
-				&nbsp
-			</td></tr>
-	</table>
+	<div name="container" class="systemsTable">
+		<div>&nbsp;</div>
+	</div>
 
-	<div id="invisible">
-		<div id="blank">&nbsp</div>
+	<div name="invisible" class="invisible">
+		<div name="blank">&nbsp;</div>
 		<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
@@ -110,6 +99,23 @@
 		<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 	</div>
+</form>
+</div>
+
+<div metal:define-macro="resourceadd-form">
+	<script type="text/javascript"
+		src="/luci/cluster/resource_form_handlers.js">
+	</script>
+
+	<tal:block
+		tal:define="
+			global res python: here.getResourceInfo(modelb, request);" />
+
+	<h2>Add a Resource</h2>
+
+	<div class="reschoose">
+		<div metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
+	</div>
 </div>
 
 <div metal:define-macro="resource-form">
@@ -167,41 +173,43 @@
 
 		<h2>Configure <span tal:replace="python: res['name']" /></h2>
 
-		<span tal:omit-tag="" tal:condition="python: type == 'ip'">
-			<div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'fs'">
-			<div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
-			<div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'smb'">
-			<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</span>
-
-		<span tal:omit-tag="" tal:condition="python: type == 'script'">
-			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</span>
+		<div class="reschoose">
+			<span tal:omit-tag="" tal:condition="python: type == 'ip'">
+				<div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'fs'">
+				<div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+				<div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+				<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+				<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+				<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'smb'">
+				<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+			</span>
+
+			<span tal:omit-tag="" tal:condition="python: type == 'script'">
+				<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+			</span>
+		</div>
 	</tal:block>
 </div>
 
-<div class="rescfg" id="IP" metal:define-macro="ip_macro">
+<div class="rescfg" name="IP" metal:define-macro="ip_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype == '24'"
 	tal:define="
 		global edit python: True;
@@ -223,7 +231,7 @@
 
 	<div class="reshdr">IP Address Resource Configuration</div>
 
-	<form name="ip_form" id="ip_form" method="get"
+	<form name="ip_form" method="get"
 		tal:attributes="action processURL">
 	<input name="pagetype" type="hidden" value="35"/>
 
@@ -242,7 +250,7 @@
 
 	<input name="type" type="hidden" value="ip"/>
 
-	<table id="ipResourceTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">IP address</td>
 			<td class="systemsTable">
@@ -276,7 +284,7 @@
 	</form>
 </div>
 
-<div class="rescfg" id="FS" metal:define-macro="fs_macro">
+<div class="rescfg" name="FS" metal:define-macro="fs_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype == '24'"
 	tal:define="
 		global edit python: True;
@@ -324,12 +332,12 @@
 
 	<input name="type" type="hidden" value="fs" />
 
-	<table id="fileSystemTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing"/>
 			</td>
 		</tr>
@@ -337,7 +345,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">File system type</td>
 			<td class="systemsTable">
-				<select id="fstype" name="fstype">
+				<select name="fstype">
 					<option name="ext3" value="ext3"
 						tal:content="string: ext3"
 						tal:attributes="checked python: (edit == nothing or fstype == 'ext3') and 'checked'" />
@@ -351,7 +359,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Mount point</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="mountpoint" name="mountpoint"
+				<input type="text" size="20" name="mountpoint"
 					tal:attributes="value mountPoint | nothing" />
 			</td>
 		</tr>
@@ -359,7 +367,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Device</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="device" name="device"
+				<input type="text" size="20" name="device"
 					tal:attributes="value device | nothing" />
 			</td>
 		</tr>
@@ -367,7 +375,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Options</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="options" name="options"
+				<input type="text" size="20" name="options"
 					tal:attributes="value opt | nothing" />
 			</td>
 		</tr>
@@ -375,7 +383,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">File system ID</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="fsid" name="fsid"
+				<input type="text" size="20" name="fsid"
 					tal:attributes="value fsid | nothing" />
 			</td>
 		</tr>
@@ -383,7 +391,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Force unmount</td>
 			<td class="systemsTable">
-				<input type="checkbox" id="forceunmount" name="forceunmount"
+				<input type="checkbox" name="forceunmount"
 					tal:attributes="checked python: force_unmount == '1' and 'checked'" />
 			</td>
 		</tr>
@@ -391,7 +399,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Reboot host node if unmount fails</td>
 			<td class="systemsTable">
-				<input type="checkbox" id="selffence" name="selffence"
+				<input type="checkbox" name="selffence"
 					tal:attributes="
 						checked python: reboot_fail == '1' and 'checked'" />
 			</td>
@@ -400,7 +408,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Check file system before mounting</td>
 			<td class="systemsTable">
-				<input type="checkbox" id="checkfs" name="checkfs"
+				<input type="checkbox" name="checkfs"
 					tal:attributes="
 						checked python: fscheck == '1' and 'checked'" />
 			</td>
@@ -419,11 +427,10 @@
 				onClick="delete_resource(this.form)" />
 		</tal:block>
 	</div>
-
 	</form>
 </div>
 
-<div class="rescfg" id="GFS" metal:define-macro="gfs_macro">
+<div class="rescfg" name="GFS" metal:define-macro="gfs_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype =='24'"
 	tal:define="
 		global edit python: True;
@@ -466,12 +473,12 @@
 
 	<input name="type" type="hidden" value="gfs" />
 
-	<table id="gfsTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing" />
 			</td>
 		</tr>
@@ -479,7 +486,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Mount point</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="mountPoint" name="mountpoint"
+				<input type="text" size="20" name="mountpoint"
 					tal:attributes="value mountpoint | nothing" />
 			</td>
 		</tr>
@@ -487,7 +494,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Device</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="device" name="device"
+				<input type="text" size="20" name="device"
 					tal:attributes="value device | nothing"/>
 			</td>
 		</tr>
@@ -495,7 +502,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Options</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="options" name="options"
+				<input type="text" size="20" name="options"
 					tal:attributes="value opt | nothing" />
 			</td>
 		</tr>
@@ -503,7 +510,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">File system ID</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="fsid" name="fsid"
+				<input type="text" size="20" name="fsid"
 					tal:attributes="value fsid | nothing" />
 			</td>
 		</tr>
@@ -511,7 +518,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Force unmount</td>
 			<td class="systemsTable">
-				<input type="checkbox" id="forceunmount" name="forceunmount"
+				<input type="checkbox" name="forceunmount"
 					tal:attributes="
 						checked python: force_unmount == '1' and 'checked'" />
 			</td>
@@ -534,7 +541,7 @@
 	</form>
 </div>
 
-<div class="rescfg" id="NFSM" metal:define-macro="nfsm_macro">
+<div class="rescfg" name="NFSM" metal:define-macro="nfsm_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype =='24'"
 	tal:define="
 		global edit python: True;
@@ -577,12 +584,12 @@
 
 	<input name="type" type="hidden" value="nfsm" />
 
-	<table id="nfsMountTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing" />
 			</td>
 		</tr>
@@ -590,7 +597,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Mount point</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="mountpoint" name="mountpoint"
+				<input type="text" size="20" name="mountpoint"
 					tal:attributes="value mountpoint | nothing" />
 			</td>
 		</tr>
@@ -598,7 +605,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Host</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="host" name="host"
+				<input type="text" size="20" name="host"
 					tal:attributes="value hostname | nothing" />
 			</td>
 		</tr>
@@ -606,7 +613,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Export path</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="exportpath" name="exportpath"
+				<input type="text" size="20" name="exportpath"
 					tal:attributes="value expath | nothing" />
 			</td>
 		</tr>
@@ -627,7 +634,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Options</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="options" name="options"
+				<input type="text" size="20" name="options"
 					tal:attributes="value opt | nothing" />
 			</td>
 		</tr>
@@ -635,7 +642,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Force unmount</td>
 			<td class="systemsTable">
-				<input type="checkbox" id="forceunmount" name="forceunmount"
+				<input type="checkbox" name="forceunmount"
 					tal:attributes="
 						checked python: force_unmount == '1' and 'checked'" />
 			</td>
@@ -658,7 +665,7 @@
 	</form>
 </div>
 
-<div class="rescfg" id="NFSC" metal:define-macro="nfsc_macro">
+<div class="rescfg" name="NFSC" metal:define-macro="nfsc_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype == '24'"
 	tal:define="
 		global edit python: True;
@@ -697,12 +704,12 @@
 
 	<input name="type" type="hidden" value="nfsc"/>
 
-	<table id="nfsClientTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing" />
 			</td>
 		</tr>
@@ -710,7 +717,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Target</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="target" name="target"
+				<input type="text" size="20" name="target"
 					tal:attributes="value target | nothing"/>
 			</td>
 		</tr>
@@ -718,7 +725,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Options</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="options" name="options"
+				<input type="text" size="20" name="options"
 					tal:attributes="value opt | nothing"/>
 			</td>
 		</tr>
@@ -740,7 +747,7 @@
 	</form>
 </div>
 
-<div class="rescfg" id="NFSX" metal:define-macro="nfsx_macro">
+<div class="rescfg" name="NFSX" metal:define-macro="nfsx_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype == '24'"
 	tal:define="
 		global edit python: True;
@@ -775,12 +782,12 @@
 
 	<input name="type" type="hidden" value="nfsx" />
 
-	<table id="nfsExportTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing" />
 			</td>
 		</tr>
@@ -802,7 +809,7 @@
 	</form>
 </div>
 
-<div class="rescfg" id="SCR" metal:define-macro="scr_macro">
+<div class="rescfg" name="SCR" metal:define-macro="scr_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype == '24'"
 	tal:define="
 		global edit string:true;
@@ -838,12 +845,12 @@
 
 	<input name="type" type="hidden" value="scr" />
 
-	<table id="scriptTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing" />
 			</td>
 		</tr>
@@ -851,7 +858,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Full path to script file</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="file" name="file"
+				<input type="text" size="20" name="file"
 					tal:attributes="value filename | nothing" />
 			</td>
 		</tr>
@@ -873,7 +880,7 @@
 	</form>
 </div>
 
-<div class="rescfg" id="SMB" metal:define-macro="smb_macro">
+<div class="rescfg" name="SMB" metal:define-macro="smb_macro">
 <tal:block tal:condition="python: ptype == '33' or ptype == '24'"
 	tal:define="
 		global edit python: True;
@@ -913,12 +920,12 @@
 
 	<input name="type" type="hidden" value="smb" />
 
-	<table id="sambaTable" class="systemsTable">
+	<table class="systemsTable">
 		<tr class="systemsTable">
 			<td class="systemsTable">Name</td>
 			<td class="systemsTable">
 				<input type="text" size="20"
-					id="resourceName" name="resourceName"
+					name="resourceName"
 					tal:attributes="value resName | nothing" />
 			</td>
 		</tr>
@@ -926,7 +933,7 @@
 		<tr class="systemsTable">
 			<td class="systemsTable">Workgroup</td>
 			<td class="systemsTable">
-				<input type="text" size="20" id="workgroup" name="workgroup"
+				<input type="text" size="20" name="workgroup"
 					tal:attributes="value workgroup | nothing"/>
 			</td>
 		</tr>
--- conga/luci/cluster/resource_form_handlers.js	2006/09/08 22:54:32	1.5
+++ conga/luci/cluster/resource_form_handlers.js	2006/09/11 22:22:00	1.6
@@ -1,19 +1,28 @@
-function swap_div(container_id, element_id) {
-	var container_element = document.getElementById(container_id);
-	if (!container_element)
+function swap_div_elem(container, swap_out_cname, swap_in_cname, swap_in_name) {
+	var divs = container.getElementsByTagName('div');
+	if (!divs)
 		return (-1);
 
-	var child_element = document.getElementById(element_id);
-	if (!child_element)
-		return (-1);
+	var swap_out_cont = null;
+	var swap_in_cont = null;
+	var swap_in_elem = null;
+	var i = 0;
+	while ((!swap_out_cont || !swap_in_cont || !swap_in_elem) && i < divs.length)
+	{
+		if (!swap_in_cont && divs[i].getAttribute('name') == swap_in_cname)
+			swap_in_cont = divs[i];
+		else if (!swap_out_cont && divs[i].getAttribute('name') == swap_out_cname)
+			swap_out_cont = divs[i];
+		else if (!swap_in_elem && divs[i].getAttribute('name') == swap_in_name)
+			swap_in_elem = divs[i];
+		i++;
+	}
 
-	var invisible_div = document.getElementById('invisible');
-	if (!invisible_div)
+	if (!swap_out_cont || !swap_in_cont || !swap_in_elem)
 		return (-1);
 
-	var temp = container_element.firstChild;
-	container_element.replaceChild(child_element, container_element.firstChild);
-	invisible_div.appendChild(temp);
+	var temp = swap_in_cont.replaceChild(swap_in_elem, swap_in_cont.firstChild);
+	swap_out_cont.appendChild(temp);
 }
 
 function validate_ip(form) {
@@ -141,5 +150,49 @@
 	{
 		return (-1);
 	}
-	var level = Number(form.tree_level.value);
+	var ilevel = Number(form.tree_level.value);
+	var sdiv = document.getElementById('resskel');
+	if (!sdiv)
+		return (-1);
+
+	var pdiv = form.parentNode;
+	var regex = eval('/rc_indent' + ilevel + '$/');
+	while (pdiv && !pdiv.className.match(regex)) {
+		if (pdiv.className == 'service_comp_list')
+			break;
+		pdiv = pdiv.parentNode;
+	}
+	if (!pdiv)
+		return (-1);
+
+	var divs = pdiv.getElementsByTagName('div');
+	var target = null;
+
+	++ilevel;
+	regex = eval('/rc_indent' + ilevel + '$/');
+	for (var i = 0 ; i < divs.length ; i++) {
+		if (divs[i].className.match(regex)) {
+			target = divs[i]
+			break;
+		}
+	}
+
+	if (!target) {
+		alert('need to append');
+		target = document.createElement('div');
+		target.className = 'service_comp rc_indent' + ilevel;
+		pdiv.appendChild(target);
+	}
+
+	var node = sdiv.cloneNode(1);
+	node.id = null;
+	node.className = null;
+	ielem = node.getElementsByTagName('input');
+	if (!ielem)
+		return (-1);
+	for (var i = 0 ; i < ielem.length ; i++) {
+		if (ielem[i].getAttribute('name') == 'tree_level')
+			ielem[i].value = ilevel;
+	}
+	target.appendChild(node);
 }
--- conga/luci/homebase/luci_homebase.css	2006/09/08 22:54:32	1.20
+++ conga/luci/homebase/luci_homebase.css	2006/09/11 22:22:01	1.21
@@ -2,6 +2,12 @@
 	padding: .2em ! important;
 }
 
+input[type=checkbox], input[type=radio] {
+	float: left ! important;
+	vertical-align: middle;
+	background: #dee7ec;
+}
+
 ul.configTab {
 	color: #436976 !important;
 	margin: 20px 0px 0px 0px !important;
@@ -201,13 +207,13 @@
 }
 
 img.qdel_img {
-	height: 9px;
+	height: 7px;
 	width: 7px;
 	background: #dee7ec;
 	border: none;
 }
 
-#invisible, #allSameDiv {
+*.invisible,#invisible, #allSameDiv {
 	visibility: hidden;
 	display: none;
 }
@@ -259,23 +265,22 @@
 strong.cluster {
 	text-align: top;
 	font-size: 9pt;
-	letter-spacing: +1px;
+	letter-spacing: +.5px;
 }
 
 *.reshdr {
 	text-align: top;
 	font-size: 9pt;
-	letter-spacing: +1px;
+	letter-spacing: +.5px;
 	font-weight: 600;
 	padding-bottom: +1em;
 }
 
-
 strong.service_name,
 strong.node_name,
 strong.cluster_name {
 	font-size: 10pt;
-	letter-spacing: +1px;
+	letter-spacing: +.5px;
 }
 
 td.service_name,
@@ -382,6 +387,12 @@
 	padding: 1em;
 }
 
+div.reschoose {
+	background: #dee7ec;
+	padding: .5em;
+	max-width: 700px;
+}
+
 div.rescfg {
 	background: #dee7ec;
 }
Binary files /cvs/cluster/conga/luci/homebase/x.png	2006/06/20 21:21:47	1.1 and /cvs/cluster/conga/luci/homebase/x.png	2006/09/11 22:22:01	1.2 differ
rcsdiff: /cvs/cluster/conga/luci/homebase/x.png: diff failed



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
@ 2006-09-05 21:25 rmccabe
  0 siblings, 0 replies; 16+ messages in thread
From: rmccabe @ 2006-09-05 21:25 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-09-05 21:25:45

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	luci/homebase  : form-macros homebase_common.js 
	                 luci_homebase.css 
Added files:
	luci/cluster   : arrow_down.png arrow_right.png 

Log message:
	more ui work

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/arrow_down.png.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/arrow_right.png.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.54&r2=1.55
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.17&r2=1.18

/cvs/cluster/conga/luci/cluster/arrow_down.png,v  -->  standard output
revision 1.1
Binary files /cvs/cluster/conga/luci/cluster/arrow_down.png and - differ
/cvs/cluster/conga/luci/cluster/arrow_right.png,v  -->  standard output
revision 1.1
Binary files /cvs/cluster/conga/luci/cluster/arrow_right.png and - differ
--- conga/luci/cluster/form-macros	2006/08/30 23:40:13	1.54
+++ conga/luci/cluster/form-macros	2006/09/05 21:25:44	1.55
@@ -114,7 +114,7 @@
 </div>
 
 
-<div metal:define-macro="clusteradd-form" style="margin-left: 1em">
+<div metal:define-macro="clusteradd-form">
 	<script type="text/javascript" src="/luci/homebase/homebase_common.js">
 	</script>
 	<script type="text/javascript" src="/luci/homebase/validate_cluster_add.js">
@@ -1124,10 +1124,12 @@
 	<div tal:repeat="res sinfo/resource_list"
 		tal:attributes="class python: 'service_comp rc_indent' + str(res['indent_ctr'])">
 
+
 		<tal:block
 			tal:condition="python: res['max_depth'] > 0"
 			tal:replace="structure string:<div>" />
 
+
 		<tal:block tal:define="
 			global type res/type;
 			global ref res/ref_object | nothing" />
@@ -1164,6 +1166,16 @@
 			<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
 		</span>
 
+		<div
+			tal:condition="python: res['max_depth'] != 0"
+			tal:attributes="
+				class python: 'service_tree rc_indent' + str(res['indent_ctr'] - 1)">
+			<img class="service_tree" name="arrow_down"
+				src="/luci/cluster/arrow_down.png"
+				onClick="collapse_div(this)">
+			<span class="service_tree">Hide Children</span>
+		</div>
+
 		<tal:block
 			tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
 	</div>
--- conga/luci/cluster/resource-form-macros	2006/08/29 23:22:59	1.5
+++ conga/luci/cluster/resource-form-macros	2006/09/05 21:25:44	1.6
@@ -71,12 +71,12 @@
 	</script>
 
 	<h2>Add a Resource</h2>
-	<strong>Select Resource Type</strong><br/>
+	<strong>Select Resource Type</strong>
+	<br/>
 
-	<form name="filler">
+	<form>
 	<select name="select_div"
-		onChange="swap_div('container', filler.select_div.options[filler.select_div.selectedIndex].value);">
-
+		onChange="swap_div('container', this.form.select_div.options[this.form.select_div.selectedIndex].value);">
 		<option name="blank" value="blank">Select a resource type</option>
 		<option name="IP" value="IP">IP Resource</option>
 		<option name="FS" value="FS">FS Resource</option>
@@ -96,16 +96,16 @@
 			</td></tr>
 	</table>
 
-	<div id="invisible" style="display: none">
+	<div id="invisible">
 		<div id="blank">&nbsp</div>
-		<div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
-		<div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
-		<div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
-		<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
-		<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
-		<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/ip_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+		<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>
 </div>
 
@@ -223,7 +223,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong>IP Address Resource Configuration</strong>
+	<strong class="reshdr">IP Address Resource Configuration</strong>
 
 	<form name="ip_form" id="ip_form" method="get"
 		tal:attributes="action processURL">
@@ -252,7 +252,8 @@
 				<input size="3" name="ip3" type="text" maxlength="3" tal:attributes="value ip3 | nothing"/>.
 				<input size="3" name="ip4" type="text" maxlength="3" tal:attributes="value ip4 | nothing"/>
 			</td>
-
+		</tr>
+		<tr class="systemsTable">
 			<td class="systemsTable">
 				<strong>Monitor Link</strong>
 			</td>
@@ -297,7 +298,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong>File System Resource Configuration</strong>
+	<strong class="reshdr">File System Resource Configuration</strong>
 
 	<form name="fs_form" method="get" tal:attributes="action processURL">
 
@@ -444,7 +445,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong>GFS Resource Configuration</strong>
+	<strong class="reshdr">GFS Resource Configuration</strong>
 	<form name="gfs_form" method="get" tal:attributes="action processURL">
 
 	<input name="pagetype" type="hidden" value="35" />
@@ -556,7 +557,7 @@
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 	<form name="nfsm_form" method="get" tal:attributes="action processURL">
 
-	<strong>NFS Mount Resource Configuration</strong>
+	<strong class="reshdr">NFS Mount Resource Configuration</strong>
 
 	<input name="pagetype" type="hidden" value="35" />
 
@@ -675,7 +676,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong>NFS Client Resource Configuration</strong>
+	<strong class="reshdr">NFS Client Resource Configuration</strong>
 
 	<form name="nfsc_form" method="post" tal:attributes="action processURL">
 
@@ -746,7 +747,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong>NFS Export Resource Configuration</strong>
+	<strong class="reshdr">NFS Export Resource Configuration</strong>
 	<form name="nfsx_form" method="post" tal:attributes="action processURL">
 
 	<input name="pagetype" type="hidden" value="35" />
@@ -797,7 +798,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong>Script Resource Configuration</strong>
+	<strong class="reshdr">Script Resource Configuration</strong>
 	<form name="scr_form" method="post" tal:attributes="action processURL">
 
 	<input name="pagetype" type="hidden" value="35" />
@@ -859,7 +860,7 @@
 		tmp_URL context/cluster/index_html/absolute_url;
 		global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
 
-	<strong tal:condition="python: edit != 'true'">Samba Server Configuration</strong>
+	<strong class="reshdr" tal:condition="python: edit != 'true'">Samba Server Configuration</strong>
 
 	<form name="smb_form" method="post" tal:attributes="action processURL">
 
--- conga/luci/homebase/form-macros	2006/08/02 16:25:11	1.34
+++ conga/luci/homebase/form-macros	2006/09/05 21:25:45	1.35
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.34 2006/08/02 16:25:11 rmccabe Exp $
+	$Id: form-macros,v 1.35 2006/09/05 21:25:45 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -403,7 +403,7 @@
 			<tfoot class="systemsTable">
 				<tr class="systemsTable"><td colspan="2" class="systemsTable">
 					<div id="allSameDiv">
-						<input type="checkbox" class="allSameCheckBox" name="allSameCheckBox" id="allSameCheckBox" onClick="allPasswdsSame(adminform);"/> Check if storage system passwords are identical.
+						<input type="checkbox" class="allSameCheckBox" name="allSameCheckBox" id="allSameCheckBox" onClick="allPasswdsSame(adminform);"/><span>Check if storage system passwords are identical.</span>
 					</div>
 				</td></tr>
 
--- conga/luci/homebase/homebase_common.js	2006/08/30 22:57:58	1.6
+++ conga/luci/homebase/homebase_common.js	2006/09/05 21:25:45	1.7
@@ -1,11 +1,33 @@
-function list_toggle_collapse(li) {
-	var elem = li.parent;
-	if (!elem)
-		return;
-	if (elem.className == 'tree expanded')
-		elem.className = 'tree collapsed';
+function collapse_div(image) {
+	if (!image)
+		return (-1);
+
+	var span = image.parentNode.getElementsByTagName('span');
+	if (span && span.length > 0)
+		span = span[0];
 	else
-		elem.className = 'tree expanded';
+		span = null;
+
+	div = image.parentNode.parentNode.parentNode.getElementsByTagName('div');
+	if (!div || div.length < 1)
+		return (-1);
+	div = div[3];
+
+	if (image.name == 'arrow_down') {
+		image.src = 'arrow_right.png';
+		image.name = 'arrow_right';
+		if (span)
+			span.innerHTML = 'Show Children';
+		div.style.visibility = 'hidden';
+		div.style.display = 'none';
+	} else {
+		image.src = 'arrow_down.png';
+		image.name = 'arrow_down';
+		if (span)
+			span.innerHTML = 'Hide Children';
+		div.style.visibility = 'inherit';
+		div.style.display = 'block';
+	}
 }
 
 function is_valid_int(str, min, max) {
@@ -64,8 +86,10 @@
 
 function hide_element(id) {
 	var elem = document.getElementById(id);
-	if (elem)
-		elem.style['visibility'] = 'hidden';
+	if (elem) {
+		elem.style.visibility = 'hidden';
+		elem.style.display = 'none';
+	}
 }
 
 function isValidHost(str) {
@@ -173,8 +197,7 @@
 	if (num_systems == 2) {
 		var temp = document.getElementById('allSameDiv');
 		temp.style.visibility = 'visible';
-		temp = document.getElementById('allSameCheckBox');
-		temp.style.visibility = 'visible';
+		temp.style.display = 'block';
 	}
 }
 
--- conga/luci/homebase/luci_homebase.css	2006/08/30 22:57:58	1.17
+++ conga/luci/homebase/luci_homebase.css	2006/09/05 21:25:45	1.18
@@ -1,3 +1,7 @@
+input[type=text], input[type=password] {
+	padding: .2em ! important;
+}
+
 ul.configTab {
 	color: #436976 !important;
 	margin: 20px 0px 0px 0px !important;
@@ -8,22 +12,27 @@
 }
 
 input.qdisk {
+	padding: .2em;
 	font-size: 10px;
 }
 
 input.qdname {
+	padding: .2em;
 	width: 15em;
 }
 
 input.qdint {
+	padding: .2em;
 	width: 5em;
 }
 
 input.qdpath {
+	padding: .2em;
 	width: 20em;
 }
 
 input.qdscore {
+	padding: .2em;
 	width: 5em;
 }
 
@@ -79,9 +88,6 @@
 	color: red !important;
 }
 
-div.luciContent {
-}
-
 p.luciInst {
 	color: black;
 }
@@ -125,13 +131,13 @@
 }
 
 div.hbCSystems {
-	margin-left:1em !important;
-	padding-top:.5em !important;
+	margin-left:1em;
+	padding-top:.5em;
 }
 
 div.hbSSysList {
-	margin-top: .25em !important;
-	margin-bottom: .25em !important;
+	margin-top: .25em;
+	margin-bottom: .25em;
 }
 
 div.hbSubmit {
@@ -194,13 +200,13 @@
 	margin-left: +1.5em;
 }
 
-#allSameDiv, input.allSameCheckBox {
+#invisible, #allSameDiv {
 	visibility: hidden;
+	display: none;
 }
 
 input.hbInputSys {
-	padding: .20em !important;
-	padding-top: .5em !important;
+	padding: .2em ! important;
 	width: 200px;
 }
 
@@ -209,18 +215,18 @@
 	padding-left: +.5em;
 }
 
-
-ul.tree {
-	background: #dee7ec;
-	padding-top: .25em;
-	padding-bottom: .25em;
-	padding-left: .5em;
-	list-style: none;
-	max-width: 600px;
-	margin-left: 0;
+img.service_tree {
+	border: none;
+	margin-right: 1em;
 }
 
+div.service_tree {
+	margin-top: 1em;
+}
 
+span.tree {
+	font-size: 10px;
+}
 
 li.node_fdom {
 	list-style-image: url(/luci/cluster/small_fdom.png);
@@ -341,7 +347,7 @@
 }
 
 input.hbInputPass {
-	padding: .20em !important;
+	padding: .2em ! important;
 	width: 160px;
 }
 
@@ -361,7 +367,7 @@
 }
 
 div.rc_indent0 {
-	margin-left: 0px 
+	margin-left: 0px;
 	max-width: 700px;
 }
 



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-05-30  5:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08 16:00 [Cluster-devel] conga/luci cluster/form-macros cluster/resourc rmccabe
  -- strict thread matches above, loose matches on Subject: below --
2007-05-30  5:54 rmccabe
2007-02-16  2:12 rmccabe
2007-02-16  2:06 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

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.