[Cluster-devel] conga ./conga.spec.in.in make/version.in luci/ ...

rmccabe at sourceware.org rmccabe at sourceware.org
Wed Jul 23 19:55:45 UTC 2008


CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2008-07-23 19:55:42

Modified files:
	.              : conga.spec.in.in 
	make           : version.in 
	luci/cluster   : cluster_svc-macros 
	luci/site/luci/Extensions: HelperFunctions.py LuciValidation.py 
	                           LuciZopeClusterPortal.py 
	                           StorageReport.py 

Log message:
	Fix bz429350 (RFE: GUI support for failing over a service to another node after X number of restarts)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.45.2.97&r2=1.45.2.98
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/make/version.in.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.40&r2=1.21.2.41
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_svc-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.3.2.4&r2=1.3.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/HelperFunctions.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.7&r2=1.4.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.5&r2=1.6.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeClusterPortal.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.2&r2=1.1.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.9&r2=1.20.2.10

--- conga/conga.spec.in.in	2008/07/15 18:19:58	1.45.2.97
+++ conga/conga.spec.in.in	2008/07/23 19:55:40	1.45.2.98
@@ -306,6 +306,7 @@
 - Fix bz223785 (Storage 'Display Devices by' option does not work)
 - Fix bz250439 (conga is unable to delete snapshot volumes)
 - Fix bz414551 (Sector size list is improperly sorted)
+- Fix bz429350 (RFE: GUI support for failing over a service to another node after X number of restarts)
 
 * Fri Apr 18 2008 Ryan McCabe <rmccabe at redhat.com> 0.12.0-8
 - Fix bz441580 (conga should install 'sg3_utils' and start service 'scsi_reserve' when scsi fencing is used)
--- conga/make/version.in	2008/05/12 17:04:41	1.21.2.40
+++ conga/make/version.in	2008/07/23 19:55:40	1.21.2.41
@@ -1,2 +1,2 @@
-VERSION=0.12.0
-RELEASE=9
+VERSION=0.12.1
+RELEASE=0
--- conga/luci/cluster/cluster_svc-macros	2008/03/12 15:13:12	1.3.2.4
+++ conga/luci/cluster/cluster_svc-macros	2008/07/23 19:55:41	1.3.2.5
@@ -46,7 +46,7 @@
 						class python: 'cluster service ' + (running and 'running' or 'stopped')"
 						tal:content="svc/name" />
 					<tal:block tal:condition="exists:svc/is_vm">
-						(virtual service)
+						(virtual machine service)
 					</tal:block>
 				</td>
 
@@ -156,46 +156,8 @@
 				<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"
 				tal:condition="exists:clusterinfo/vm_migration_choice">
-
 				<td>Migration type</td>
 				<td>
 					<select name="migration_type">
@@ -205,6 +167,8 @@
 				</td>
 			</tr>
 						
+			<tal:block metal:use-macro="here/cluster_svc-macros/macros/failover-prefs-macro" />
+
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
 					<input type="submit" value="Create Virtual Machine Service" />
@@ -228,7 +192,7 @@
 
 <div metal:define-macro="vmconfig-form">
 <form method="post" action=""
-	tal:define="vminfo python:here.getVMInfo(modelb, request)">
+	tal:define="sinfo python:here.getVMInfo(modelb, request)">
 
 	<input type="hidden" name="clustername"
 		tal:attributes="value request/clustername | nothing" />
@@ -237,14 +201,14 @@
 		tal:attributes="value request/pagetype | nothing" />
 
 	<input type="hidden" name="oldname"
-		tal:attributes="value vminfo/name | nothing" />
+		tal:attributes="value sinfo/name | nothing" />
 
 	<div class="service_comp_list">
 	<table class="systemsTable">
 		<thead class="systemsTable">
 			<tr class="systemsTable">
 				<td class="systemsTable">
-					<p class="reshdr">Properties for <tal:block tal:replace="vminfo/name | string:virtual machine service"/></p>
+					<p class="reshdr">Properties for <tal:block tal:replace="sinfo/name | string:virtual machine service"/></p>
 				</td>
 			</tr>
 
@@ -313,66 +277,21 @@
 		</thead>
 
 		<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"
-				tal:condition="exists:vminfo/vm_migration_choice">
+				tal:condition="exists:sinfo/vm_migration_choice">
 
 				<td>Migration type</td>
 				<td>
 					<select name="migration_type">
 						<option value="live" tal:content="string:Live"
-							tal:attributes="selected python:('migrate' not in vminfo or vminfo['migrate'] != 'pause') and 'selected' or ''" />
+							tal:attributes="selected python:(sinfo.get('migrate') != 'pause') and 'selected' or ''" />
 						<option value="pause" tal:content="string:Pause"
-							tal:attributes="selected python:('migrate' in vminfo and vminfo['migrate'] == 'pause') and 'selected' or ''" />
+							tal:attributes="selected python:(sinfo.get('migrate') == 'pause') and 'selected' or ''" />
 					</select>
 				</td>
 			</tr>
+
+			<tal:block metal:use-macro="here/cluster_svc-macros/macros/failover-prefs-macro" />
 						
 			<tr class="systemsTable"><td colspan="2">
 				<div class="hbSubmit">
@@ -386,14 +305,14 @@
 				<td><span class="cluster_help" title="e.g., guest1 if the VM config file is at /etc/xen/guest1">Virtual machine name</span></td>
 				<td>
 					<input type="text" name="vmname"
-						tal:attributes="value vminfo/name | nothing" />
+						tal:attributes="value sinfo/name | nothing" />
 				</td>
 			</tr>
 			<tr class="systemsTable">
 				<td><span class="cluster_help" title="e.g., /etc/xen/">Path to VM configuration files</span></td>
 				<td>
 					<input type="text" name="vmpath"
-						tal:attributes="value vminfo/path | nothing" />
+						tal:attributes="value sinfo/path | nothing" />
 				</td>
 			</tr>
 		</tbody>
@@ -427,43 +346,7 @@
 						<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>
-				<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>
+				<tal:block metal:use-macro="here/cluster_svc-macros/macros/failover-prefs-macro" />
 			</table>
 		</form>
 	</div>
@@ -522,7 +405,7 @@
 
 <div metal:define-macro="servicemigrate">
 	<script type="text/javascript">
-		set_page_title('Luci — cluster — services — Migrate a virtual service');
+		set_page_title('Luci — cluster — services — Migrate a virtual machine service');
 	</script>
 
 	<tal:block tal:define="
@@ -625,6 +508,76 @@
 	</tal:block>
 </div>
 
+<div metal:define-macro="failover-prefs-macro" tal:omit-tag="">
+	<tr>
+		<td>Automatically start this service</td>
+		<td>
+			<input type="checkbox" name="autostart"
+				tal:attributes="checked python:(sinfo and sinfo.get('autostart') and sinfo['autostart'].lower() != 'false') and 'checked'" />
+		</td>
+	</tr>
+
+	<tr>
+		<td>Run exclusive</td>
+		<td>
+			<input type="checkbox" name="exclusive"
+				tal:attributes="checked python:(sinfo and sinfo.get('exclusive')and sinfo.get('exclusive').lower() != 'false') and 'checked'" />
+		</td>
+	</tr>
+
+	<tr>
+		<td>Failover Domain</td>
+		<td>
+			<select name="domain">
+				<option value=""
+					tal:attributes="selected python:(not sinfo or not sinfo.get('domain')) and 'selected' or ''">None</option>
+				<tal:block tal:condition="exists:sinfo/fdoms">
+				<tal:block tal:repeat="f sinfo/fdoms">
+					<option tal:content="f" tal:attributes="
+						value f;
+						selected python:(sinfo and sinfo.get('domain') == f) and 'selected' or ''" />
+				</tal:block>
+				</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:(sinfo and sinfo.get('recovery') == 'relocate') and 'selected' or ''" />
+				<option name="restart" value="restart"
+					tal:content="string:Restart"
+					tal:attributes="selected python:(sinfo and sinfo.get('recovery') == 'restart') and 'selected' or ''" />
+				<option name="disable" value="disable"
+					tal:content="string:Disable"
+					tal:attributes="selected python:(sinfo and sinfo.get('recovery') == 'disable') and 'selected' or ''" />
+			</select>
+		</td>
+	</tr>
+
+	<tr class="systemsTable">
+		<td class="systemsTable">
+			Maximum number of restart failures before relocating
+		</td>
+		<td class="systemsTable">
+			<input type="text" size="3" name="max_restarts"
+				tal:attributes="value sinfo/max_restarts|string:0" />
+		</td>
+	</tr>
+	<tr class="systemsTable">
+		<td class="systemsTable">Length of time in seconds after which to forget a restart</td>
+		<td class="systemsTable">
+			<input type="text" size="3" name="restart_expire_time"
+				tal:attributes="value sinfo/restart_expire_time|string:0" />
+		</td>
+	</tr>
+</div>
+
 <div metal:define-macro="service-config-head-macro" tal:omit-tag="">
 	<script type="text/javascript"
 		src="/luci/homebase/homebase_common.js">
@@ -778,51 +731,9 @@
 	<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>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>
+				<tal:block metal:use-macro="here/cluster_svc-macros/macros/failover-prefs-macro" />
 			</table>
+
 			<input type="hidden" name="service_name"
 				tal:attributes="value sinfo/name | string:1" />
 		</form>
--- conga/luci/site/luci/Extensions/HelperFunctions.py	2008/06/13 18:37:47	1.4.2.7
+++ conga/luci/site/luci/Extensions/HelperFunctions.py	2008/07/23 19:55:41	1.4.2.8
@@ -9,7 +9,7 @@
 import threading
 
 def resolveOSType(os_str):
-	if not os_str or os_str.find('Tikanga') != (-1) or os_str.find('Zod') != (-1) or os_str.find('Moonshine') != (-1) or os_str.find('Werewolf') != (-1) or os.str_find('Sulphur') != (-1):
+	if not os_str or os_str.find('Tikanga') != (-1) or os_str.find('Zod') != (-1) or os_str.find('Moonshine') != (-1) or os_str.find('Werewolf') != (-1) or os_str.find('Sulphur') != (-1):
 		return 'rhel5'
 	else:
 		return 'rhel4'
--- conga/luci/site/luci/Extensions/LuciValidation.py	2008/07/14 21:52:30	1.6.2.5
+++ conga/luci/site/luci/Extensions/LuciValidation.py	2008/07/23 19:55:41	1.6.2.6
@@ -268,7 +268,7 @@
 
 def validate_clusvc_add(model, request):
 	errors = list()
-	fvar = GetReqVars(request, [ 'form_xml', 'domain', 'recovery', 'svc_name', 'action' ])
+	fvar = GetReqVars(request, [ 'form_xml', 'domain', 'recovery', 'svc_name', 'action', 'max_restarts', 'restart_expire_time' ])
 
 	form_xml = fvar['form_xml']
 	if form_xml is None:
@@ -370,6 +370,26 @@
 	if recovery is not None and recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
 		errors.append('You entered an invalid recovery option: "%s" Valid options are "restart" "relocate" and "disable."')
 
+	if recovery == 'restart':
+		max_restarts = None
+		if fvar['max_restarts']:
+			try:
+				max_restarts = int(fvar['max_restarts'])
+				if max_restarts < 0:
+					raise ValueError, 'must be greater than 0'
+			except Exception, e:
+				errors.append('Maximum restarts must be a number greater than or equal to 0')
+				max_restarts = None
+		restart_expire_time = None
+		if fvar['restart_expire_time']:
+			try:
+				restart_expire_time = int(fvar['restart_expire_time'])
+				if restart_expire_time < 0:
+					raise ValueError, 'must be greater than 0'
+			except Exception, e:
+				errors.append('Restart expire time must be a number greater than or equal to 0')
+				restart_expire_time = None
+
 	service_name = fvar['svc_name']
 	if service_name is None:
 		if LUCI_DEBUG_MODE is True:
@@ -440,6 +460,11 @@
 		new_service.addAttribute('domain', fdom)
 	if recovery:
 		new_service.addAttribute('recovery', recovery)
+	if max_restarts is not None:
+		new_service.addAttribute('max_restarts', str(max_restarts))
+	if restart_expire_time is not None:
+		new_service.addAttribute('restart_expire_time', str(restart_expire_time))
+
 	new_service.addAttribute('exclusive', str(exclusive))
 	if autostart is not None:
 		new_service.attr_hash['autostart'] = autostart
@@ -1060,7 +1085,7 @@
 def validate_vmsvc_form(model, request):
 	errors = list()
 
-	fvar = GetReqVars(request, [ 'vmname', 'oldname', 'vmpath', 'recovery', 'domain', 'migration_type'])
+	fvar = GetReqVars(request, [ 'vmname', 'oldname', 'vmpath', 'recovery', 'domain', 'migration_type', 'max_restarts', 'restart_expire_time'])
 
 	vm_name = fvar['vmname']
 	if vm_name is None:
@@ -1089,6 +1114,32 @@
 	recovery = fvar['recovery']
 	if recovery is not None and recovery != 'restart' and recovery != 'relocate' and recovery != 'disable':
 		errors.append('You entered an invalid recovery option "%s" for VM service "%s". Valid options are "restart" "relocate" and "disable"' % (recovery, vm_name))
+	if recovery == 'restart':
+		max_restarts = None
+		if fvar['max_restarts']:
+			try:
+				max_restarts = int(fvar['max_restarts'])
+				if max_restarts < 0:
+					raise ValueError, 'must be greater than 0'
+			except Exception, e:
+				errors.append('Maximum restarts must be a number greater than or equal to 0')
+				max_restarts = None
+		restart_expire_time = None
+		if fvar['restart_expire_time']:
+			try:
+				restart_expire_time = int(fvar['restart_expire_time'])
+				if restart_expire_time < 0:
+					raise ValueError, 'must be greater than 0'
+			except Exception, e:
+				errors.append('Restart expire time must be a number greater than or equal to 0')
+				restart_expire_time = None
+
+	service_name = fvar['svc_name']
+	if service_name is None:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('vSA5: no service name')
+		errors.append('No service name was given')
+
 
 	migration_type = fvar['migration_type']
 	if migration_type is not None and migration_type != 'live' and migration_type != 'pause':
--- conga/luci/site/luci/Extensions/LuciZopeClusterPortal.py	2008/01/23 04:44:32	1.1.4.2
+++ conga/luci/site/luci/Extensions/LuciZopeClusterPortal.py	2008/07/23 19:55:42	1.1.4.3
@@ -251,10 +251,10 @@
 
 	if model.getIsVirtualized() is True:
 		vmadd = {}
-		vmadd['Title'] = 'Add a Virtual Service'
+		vmadd['Title'] = 'Add a Virtual Machine Service'
 		vmadd['cfg_type'] = 'vmadd'
 		vmadd['absolute_url'] = '%s?pagetype=%s&clustername=%s' % (url, VM_ADD, cluname)
-		vmadd['Description'] = 'Add a Virtual Service to this cluster'
+		vmadd['Description'] = 'Add a Virtual Machine Service to this cluster'
 		if pagetype == VM_ADD:
 			vmadd['currentItem'] = True
 		else:
@@ -305,7 +305,7 @@
 		svc['Title'] = name
 		svc['cfg_type'] = 'vm'
 		svc['absolute_url'] = '%s?pagetype=%s&servicename=%s&clustername=%s' % (url, VM_CONFIG, name, cluname)
-		svc['Description'] = 'Configure this Virtual Service'
+		svc['Description'] = 'Configure this Virtual Machine Service'
 		if pagetype == VM_CONFIG:
 			try:
 				xname = request['servicename']
--- conga/luci/site/luci/Extensions/StorageReport.py	2008/07/15 18:19:58	1.20.2.9
+++ conga/luci/site/luci/Extensions/StorageReport.py	2008/07/23 19:55:42	1.20.2.10
@@ -1686,7 +1686,7 @@
 			d_value = str(value)
 
 		hidden = False
-		if var_type == 'hidden' or name in ( 'partition_begin', 'snapshot' ):
+		if var_type == 'hidden' or name in ( 'partition_begin', 'snapshot' ) or name[0:11] == '__snap_size':
 			hidden = True
 
 		if name == 'removable':




More information about the Cluster-devel mailing list