[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe 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]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]