Skip to contentSkip to conversation

conga/luci cluster/form-macros cluster/resourc ...

Cluster-devel [email protected] 1 participant 1 message Feb 8, 2007

lore
Share & tools
lore
#0 lore raw

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

luci/cluster/form-macros +127 -2
@@ -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>
luci/cluster/resource-form-macros +13 -7
@@ -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>
luci/cluster/resource_form_handlers.js +21 -0
@@ -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')
luci/site/luci/Extensions/cluster_adapters.py +102 -2

167 lines not on this page · raw message