Skip to contentSkip to conversation

conga luci/cluster/cluster_config-macros luci/ ...

Cluster-devel [email protected] 1 participant 1 message Nov 10, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2008-11-10 21:02:48

Modified files:
luci/cluster : cluster_config-macros cluster_svc-macros
fence-macros form-macros index_html resource-form-macros resource_form_handlers.js validate_config_qdisk.js validate_create_gulm.js
luci/plone-custom: conga.js update_hostinfo.js luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
LuciValidation.py LuciZopeClusterPortal.py RicciQueries.py StorageReport.py cluster_adapters.py ricci_communicator.py
luci/site/luci/Extensions/ClusterModel: ModelBuilder.py luci/site/luci/etc: zope.conf.in
luci/storage : form-macros
ricci/common : File.cpp Variable.cpp utils.cpp
ricci/include : shred_allocator.h ricci/modules/cluster/clumon: REDHAT-CLUSTER-MIB REDHAT-MIB ricci/modules/cluster/clumon/src/common: Cluster.cpp ricci/modules/rpm: PackageHandler.cpp ricci/modules/service: ServiceManager.cpp ricci/modules/storage: ContentFS.cpp ExtendedFS.cpp LV.cpp
LVM.cpp Mapper.cpp MountHandler.cpp PTSource.cpp PV.cpp Partition.cpp PartitionTable.cpp parted_wrapper.cpp
ricci/ricci : SSLInstance.cpp

Log message:
Backport fixes from RHEL5

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_config-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.4.2.1&r2=1.4.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/cluster_svc-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.1&r2=1.7.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.5&r2=1.2.4.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.24&r2=1.176.2.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.30.2.6&r2=1.30.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.31.2.12&r2=1.31.2.13
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.7&r2=1.29.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.4&r2=1.5.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_create_gulm.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.2&r2=1.1.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.4.2.3&r2=1.4.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/update_hostinfo.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.4.1&r2=1.1.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.6&r2=1.10.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.2.3&r2=1.6.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciValidation.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.2&r2=1.9.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeClusterPortal.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.3&r2=1.7.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.22.2.5&r2=1.22.2.6
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.27&r2=1.227.2.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.24.2.3&r2=1.24.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.5&r2=1.5.2.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/etc/zope.conf.in.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.4.2&r2=1.1.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/storage/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.20.2.4&r2=1.20.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/File.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.1&r2=1.3.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/Variable.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.4.1&r2=1.8.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/utils.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/include/shred_allocator.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.1&r2=1.2.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/REDHAT-MIB.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.4.2&r2=1.6.4.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/rpm/PackageHandler.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.11.2.6&r2=1.11.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/service/ServiceManager.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.6&r2=1.7.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ContentFS.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.4.1&r2=1.5.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/ExtendedFS.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.3&r2=1.7.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.11.2.2&r2=1.11.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Mapper.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.4.1&r2=1.3.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/MountHandler.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PTSource.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.4.1&r2=1.2.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PV.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.2&r2=1.5.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/Partition.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.4.1&r2=1.3.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/PartitionTable.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.4.1&r2=1.5.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/parted_wrapper.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.4.4&r2=1.8.4.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/SSLInstance.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.2&r2=1.7.2.3

luci/cluster/cluster_config-macros +34 -15
@@ -715,21 +715,40 @@
 				</td>
 			</tr>
 
-			<tr class="systemsTable">
-				<td class="systemsTable">Device</td>
-				<td class="systemsTable">
-					<input type="text" name="device"
-						tal:attributes="value clusterinfo/device | nothing" />
-				</td>
-			</tr>
-
-			<tr class="systemsTable">
-				<td class="systemsTable">Label</td>
-				<td class="systemsTable">
-					<input type="text" name="label"
-						tal:attributes="value clusterinfo/label | nothing" />
-				</td>
-			</tr>
+			<tr class="systemsTable"><td colspan="2">
+				<table class="systemsTable">
+					<tr class="systemsTable">
+						<td class="systemsTable">
+							<input type="radio" name="qdisk_dev_label"
+								onclick="disable_text_field(this.form.label, this.form.device)"
+								tal:attributes="
+									checked python:(clusterinfo.get('label') or not clusterinfo.get('device')) and 'checked' or ''">Label
+						</td>
+						<td class="systemsTable">
+							<input type="text" name="label" id="qdisk_label"
+								onfocus="disable_text_field(this.form.label, this.form.device);this.form.qdisk_dev_label[0].checked='checked';"
+								tal:attributes="
+									disabled python:(not clusterinfo.get('label') and clusterinfo.get('device')) and 'disabled' or '';
+									value clusterinfo/label | nothing" />
+						</td>
+					</tr>
+					<tr class="systemsTable">
+						<td class="systemsTable">
+							<input type="radio" name="qdisk_dev_label"
+								onclick="disable_text_field(this.form.device, this.form.label)"
+									tal:attributes="
+										checked python:clusterinfo.get('device') and 'checked' or ''">Device (deprecated)
+						</td>
+						<td class="systemsTable">
+							<input type="text" name="device" id="qdisk_device"
+								onfocus="disable_text_field(this.form.device, this.form.label);this.form.qdisk_dev_label[1].checked='checked';"
+								tal:attributes="
+									disabled python:not clusterinfo.get('device') and 'disabled' or '';
+									value clusterinfo/device | nothing" />
+						</td>
+					</tr>
+				</table>
+			</td></tr>
 		</table>
 		</div>
 
luci/cluster/cluster_svc-macros +105 -178

404 lines not on this page · raw message

luci/cluster/fence-macros +9 -2
@@ -684,6 +684,13 @@
 				</td>
 			</tr>
 			<tr>
+				<td>Module Name</td>
+				<td>
+					<input name="modulename" type="text"
+						tal:attributes="value cur_fencedev/modulename | nothing" />
+				</td>
+			</tr>
+			<tr>
 				<td>
 					<span title="Full path to a script to generate fence password">Password Script (optional)</span>
 				</td>
@@ -1850,7 +1857,7 @@
 	</div>
 </div>
 
-<div metal:define-macro="fence-instance-form-gndb"
+<div metal:define-macro="fence-instance-form-gnbd"
 	tal:omit-tag="exists: cur_fence_dev_id">
 	<div id="fence_gnbd_instance" name="fence_gnbd" class="fencedev_instance"
 		tal:omit-tag="exists: cur_fence_dev_id">
@@ -2056,7 +2063,7 @@
 	<tal:block
 		metal:use-macro="here/fence-macros/macros/fence-instance-form-mcdata" />
 	<tal:block
-		metal:use-macro="here/fence-macros/macros/fence-instance-form-gndb" />
+		metal:use-macro="here/fence-macros/macros/fence-instance-form-gnbd" />
 	<tal:block
 		metal:use-macro="here/fence-macros/macros/fence-instance-form-bullpap" />
 	<tal:block
luci/cluster/form-macros +100 -87

226 lines not on this page · raw message

luci/cluster/index_html +11 -5
@@ -27,20 +27,26 @@
 	    <tal:block tal:define="
 			global sinfo nothing;
 			global hascluster request/clustername | nothing;
-			global isBusy python: False;
+			global isBusy python:False;
+			global isVirtualized python:False;
 			global firsttime nothing;
 			global ri_agent nothing;
+			global os_version nothing;
 			global busywaiting python:None" />
 
 		<tal:block tal:condition="hascluster">
 			<tal:block tal:define="
 				global ri_agent python:here.getRicciAgentForCluster(request);
-				resmap python:here.getClusterOS(ri_agent);
-				global isVirtualized resmap/isVirtualized | nothing;
-				global os_version resmap/os | nothing;
-				global isBusy python:here.isClusterBusy(request);
 				global firsttime request/busyfirst | nothing" />
 
+			<tal:block tal:condition="ri_agent"
+				tal:define="resmap python:here.getClusterOS(ri_agent)">
+				<tal:block tal:define="
+					global isVirtualized resmap/isVirtualized | nothing;
+					global os_version resmap/os | nothing;
+					global isBusy python:here.isClusterBusy(request)" />
+			</tal:block>
+
 			<tal:block tal:condition="firsttime">
 				<tal:block tal:define="global busywaiting python:True" />
 				<meta http-equiv="refresh"
luci/cluster/resource-form-macros +3 -3
@@ -1397,7 +1397,7 @@
 				<input type="text" size="20" name="user"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/user | nothing" />
+						value res/attrs/user | nothing" />
 			</td>
 		</tr>
 		<tr class="systemsTable">
@@ -1406,7 +1406,7 @@
 				<input type="text" size="20" name="home"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/home | nothing" />
+						value res/attrs/home | nothing" />
 			</td>
 		</tr>
 		<tr class="systemsTable">
@@ -1415,7 +1415,7 @@
 				<input type="text" size="20" name="vhost"
 					tal:attributes="
 						disabled python: editDisabled;
-						value res/vhost | nothing" />
+						value res/attrs/vhost | nothing" />
 			</td>
 		</tr>
 	</table>
luci/cluster/resource_form_handlers.js +18 -0
@@ -479,6 +479,8 @@
 	var domain = null;
 	var exclusive = 0;
 	var recovery = null;
+	var max_restarts = null;
+	var restart_expire_time = null;
 
 	submit_btn = submit_button;
 	submit_button.disabled = true;
@@ -509,6 +511,18 @@
 					recovery = null;
 			}
 
+			if (form[i].max_restarts) {
+				max_restarts = form[i].max_restarts.value;
+				if (str_is_blank(max_restarts))
+					max_restarts = null;
+			}
+
+			if (form[i].restart_expire_time) {
+				restart_expire_time = form[i].restart_expire_time.value;
+				if (str_is_blank(restart_expire_time))
+					restart_expire_time = null;
+			}
+
 			if (form[i].domain) {
 				domain = form[i].domain.options[form[i].domain.options.selectedIndex].value;
 				if (str_is_blank(domain))
@@ -581,6 +595,10 @@
 		master_form.domain.value = domain;
 	if (recovery)
 		master_form.recovery.value = recovery;
+	if (max_restarts)
+		master_form.max_restarts.value = max_restarts;
+	if (restart_expire_time)
+		master_form.restart_expire_time.value = restart_expire_time;
 	master_form.autostart.value = autostart;
 	master_form.exclusive.value = exclusive;
 
luci/cluster/validate_config_qdisk.js +3 -0
@@ -206,6 +206,9 @@
 		var no_label = !form.label || str_is_blank(form.label.value);
 		if (no_dev && no_label)
 			errors.push('You must give either a label or a device.');
+		if (!no_dev && !no_label) {
+			errors.push('You may not specify both a device and a label.');
+		}
 
 		var hnum = document.getElementById('num_heuristics');
 		if (hnum) {
luci/cluster/validate_create_gulm.js +14 -5
@@ -65,10 +65,19 @@
 }
 
 function validate_cluster_create(form) {
-	if (form.lockmanager && !form.lockmanager[0].checked) {
-		var errors = check_gulm_lkserv();
-		if (error_dialog(errors))
-			return (-1);
+	try {
+		if (!form.cluster_os.value) {
+			get_system_info(null, null, 1);
+		}
+	} catch (e) {
+	}
+
+	if (form.cluster_os.value) {
+		if (form.lockmanager && !form.lockmanager[0].checked) {
+			var errors = check_gulm_lkserv();
+			if (error_dialog(errors))
+				return (-1);
+		}
+		return validateForm(form);
 	}
-	return validateForm(form);
 }
luci/plone-custom/conga.js +6 -0
@@ -248,6 +248,12 @@
 	elem.parentNode.removeChild(elem);
 }
 
+function disable_text_field(enable_obj, disable_obj) {
+	disable_obj.value = "";
+	disable_obj.disabled = "disabled";
+	enable_obj.disabled = "";
+}
+
 function swap_tabs(new_label, cur_tab, new_tab) {
 	if (cur_tab == new_tab) {
 		return (cur_tab);
luci/plone-custom/update_hostinfo.js +31 -1
@@ -97,6 +97,7 @@
 	var errors = [];
 	var msgs = [];
 	var systems_list = get_systems_list_offsets(errors);
+	var cluster_os = null;
 
 	for (var i = 0 ; i < systems_list.length ; i++) {
 		var cur_node_props = node_props[systems_list[i][0]];
@@ -106,6 +107,10 @@
 			var addr_elem = document.getElementById('__SYSTEM' + offset + ':Addr');
 			var pwd_elem = document.getElementById('__SYSTEM' + offset + ':Passwd');
 			var fp_elem = document.getElementById('__SYSTEM' + offset + 'Fingerprint');
+			try {
+				cluster_os = cur_node_props['OS'];
+			} catch (e) {
+			}
 
 			if (cur_node_props['available'] != 'True') {
 				errors.push(cur_node_props['err_msg']);
@@ -130,7 +135,32 @@
 				}
 			}
 		} catch (e) {
-			alert(e);
+			//alert(e);
+		}
+	}
+
+	if (cluster_os !== null) {
+		var os_str = null;
+
+		if (cluster_os.match(/Nahant/)) {
+			var lsdiv = document.getElementById('lockserver_div');
+			if (lsdiv !== null) {
+				var ls_cell = document.getElementById('lockserver_dialog');
+				if (ls_cell !== null) {
+					lsdiv.id = null;
+					ls_cell.appendChild(lsdiv);
+				}
+			}
+			os_str = 'rhel4';
+		} else {
+			os_str = 'rhel5';
+		}
+
+		if (os_str !== null) {
+			var os_in = document.getElementById('cluster_os');
+			if (os_in !== null) {
+				os_in.value = os_str;
+			}
 		}
 	}
 
luci/site/luci/Extensions/LuciClusterInfo.py +24 -0
@@ -82,6 +82,9 @@
 		vals['votes'] = '[unknown]'
 		vals['quorate'] = '[unknown]'
 		vals['minQuorum'] = '[unknown]'
+		if model.has_erors():
+			vals['errors'] = True
+			vals['errmsgs'] = model.get_errmsgs()
 		results.append(vals)
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
@@ -420,6 +423,20 @@
 		hmap['recovery'] = None
 
 	try:
+		hmap['max_restarts'] = svc.getAttribute('max_restarts')
+		if not hmap['max_restarts']:
+			hmap['max_restarts'] = 0
+	except:
+		hmap['max_restarts'] = 0
+
+	try:
+		hmap['restart_expire_time'] = svc.getAttribute('restart_expire_time')
+		if not hmap['restart_expire_time']:
+			hmap['restart_expire_time'] = 0
+	except:
+		hmap['restart_expire_time'] = 0
+
+	try:
 		if int(svc.getAttribute('exclusive')):
 			hmap['exclusive'] = 'true'
 		else:
@@ -738,6 +755,9 @@
 			hlist.append(hmap)
 	clumap['hlist'] = hlist
 
+	if model.has_errors():
+		clumap['has_errors'] = True
+		clumap['errmsgs'] = model.get_errmsgs()
 	return clumap
 
 def getClustersInfo(self, status, req):
@@ -1081,6 +1101,10 @@
 			fdom_dict_list.append(fdom_dict)
 
 		nl_map['fdoms'] = fdom_dict_list
+
+		if model and model.has_errors():
+			nl_map['has_errors'] = True
+			nl_map['errmsgs'] = model.get_errmsgs()
 		resultlist.append(nl_map)
 
 	return resultlist
luci/site/luci/Extensions/LuciDB.py +3 -0
@@ -836,6 +836,9 @@
 	for node in nodes:
 		hostname = node[0]
 
+		if hostname[-6:] == '__flag':
+			continue
+
 		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)
luci/site/luci/Extensions/LuciValidation.py +65 -3

126 lines not on this page · raw message

luci/site/luci/Extensions/LuciZopeClusterPortal.py +3 -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']
luci/site/luci/Extensions/RicciQueries.py +26 -4
@@ -6,12 +6,10 @@
 # Free Software Foundation.
 
 from xml.dom import minidom
-from ricci_communicator import RicciCommunicator
+from ricci_communicator import RicciCommunicator, batch_status
 from LuciSyslog import get_logger
 from conga_constants import LUCI_DEBUG_MODE
 
-
-
 luci_log = get_logger()
 
 def addClusterNodeBatch(cluster_name,
@@ -115,7 +113,7 @@
 	batch.append('<module name="cluster">')
 	batch.append('<request API_version="1.0">')
 	batch.append('<function_call name="start_node">')
-	batch.append('<var mutable="false" name="enable_services" type="boolean" value="true"/>"')
+	batch.append('<var mutable="false" name="enable_services" type="boolean" value="true"/>')
 	batch.append('</function_call>')
 	batch.append('</request>')
 	batch.append('</module>')
@@ -342,6 +340,30 @@
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)
 
+def setClusterConfSync(rc, clusterconf, propagate=True):
+	if propagate is True:
+		propg = 'true'
+	else:
+		propg = 'false'
+
+	conf = str(clusterconf).replace('<?xml version="1.0"?>', '')
+	conf = conf.replace('<?xml version="1.0" ?>', '')
+	conf = conf.replace('<? xml version="1.0"?>', '')
+	conf = conf.replace('<? xml version="1.0" ?>', '')
+
+	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="set_cluster.conf"><var type="boolean" name="propagate" mutable="false" value="%s"/><var type="xml" mutable="false" name="cluster.conf">%s</var></function_call></request></module>' % (propg, conf)
+
+	ricci_xml = rc.batch_run(batch_str, async=False)
+	if not ricci_xml:
+		return False
+	batch_xml = ricci_xml.getElementsByTagName('batch')
+	if not batch_xml:
+		return None
+	(num, total) = batch_status(batch_xml[0])
+	if num == total:
+		return True
+	return False
+
 def getNodeLogs(rc):
 	from time import time, ctime
 
luci/site/luci/Extensions/StorageReport.py +4 -2
@@ -1621,9 +1621,10 @@
 		mutable = var.getAttribute('mutable') == 'true'
 		var_type = var.getAttribute('type')
 		value = var.getAttribute('value')
+		def_value = value
 
 		d_units = ''
-		if name in ('size', 'extent_size', 'block_size', 'size_free', 'partition_begin' ):
+		if name in ('size', 'extent_size', 'block_size', 'journal_size', 'size_free', 'partition_begin' ):
 			d_units = 'bytes'
 		if 'percent' in name:
 			d_units = '%'
@@ -1685,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':
@@ -1697,6 +1698,7 @@
 				'name': name,
 				'pretty_name': get_pretty_prop_name(name),
 				'type': d_type,
+				'default_val': def_value,
 				'value': d_value,
 				'units': d_units,
 				'validation': validation_data,
luci/site/luci/Extensions/cluster_adapters.py +27 -61

119 lines not on this page · raw message

luci/site/luci/Extensions/ricci_communicator.py +3 -3
@@ -169,7 +169,7 @@
 				luci_log.debug_net('RC:UNAUTH0: unauthenticate %s for %s:%d' \
 					% (ret, self.__hostname, self.__port))
 			if ret != '0':
-				raise Exception, 'Invalid response'
+				raise Exception, 'Invalid response: %s' % ret
 
 			try:
 				self.ss.untrust()
@@ -494,7 +494,7 @@
 					% batch_xml.toxml())
 			except:
 				pass
-		raise RicciError, 'Not an XML batch node'
+		raise RicciError, 'Not an XML batch node: %s' % batch_xml.nodeName
 
 	total = 0
 	last = 0
@@ -544,7 +544,7 @@
 		if LUCI_DEBUG_NET is True:
 			luci_log.debug_net_priv('RC:EMS0: Expecting "batch" got "%s"' \
 				% batch_xml.toxml())
-		raise RicciError, 'Invalid XML node; expecting a batch node'
+		raise RicciError, 'Invalid XML node; expecting a batch node: %s' % batch_xml.nodeName
 
 	c = 0
 	for node in batch_xml.childNodes:
luci/site/luci/Extensions/ClusterModel/ModelBuilder.py +22 -2
@@ -127,6 +127,8 @@
     if domm is None:
       raise Exception, 'No cluster configuration'
 
+    self.errors = False
+    self.errmsg = None
     self.lock_type = DLM_TYPE
     self.mcast_address = mcast_addr
     self.mcast_interface = None
@@ -164,6 +166,12 @@
     self.check_for_multicast()
     self.check_for_nodeids()
 
+  def has_errors(self):
+    return self.errors
+
+  def get_errmsgs(self):
+    return self.errmsg
+
   def getClusterOS(self):
     return self.cluster_os
 
@@ -339,12 +347,24 @@
     for fd in self.getFenceDevices():
       agent = fd.getAgentType()
       if agent is not None:
-        agent_hash[fd.getName()] = agent
+        try:
+          agent_hash[fd.getName()] = agent
+        except KeyError, e:
+          self.errors = True
+          self.errmsg = 'Unknown fence device: %s' % fd.getName()
+        except Exception, e1:
+          self.errors = True
 
     for node in self.getNodes():
       for level in node.getFenceLevels():
         for child in level.getChildren():
-          child.setAgentType(agent_hash[child.getName()])
+          try:
+            child.setAgentType(agent_hash[child.getName()])
+          except KeyError, e:
+            self.errors = True
+            self.errmsg = 'Unknown fence device: %s' % child.getName()
+          except Exception, e1:
+            self.errors = True
     
   ##This method builds RefObject containers for appropriate
   ##entities after the object tree is built.
luci/site/luci/etc/zope.conf.in +2 -0
@@ -872,6 +872,8 @@
 #
 #    default_zpublisher_encoding utf-8
 
+default-zpublisher-encoding utf-8
+
 # Directives: servers
 #
 # Description:
luci/storage/form-macros +22 -13
@@ -87,6 +87,7 @@
 						</select>
 					</td>
 				</tr>
+				<tal:comment tal:replace="nothing">
 				<tr>
 					<td>
 						Display Devices by
@@ -99,6 +100,7 @@
 						</select>
 					</td>
 				</tr>
+				</tal:comment>
 			</table>
 		</form>
 	</fieldset>
@@ -865,21 +867,28 @@
 
 							<tal:block tal:condition="python:prop_type == 'select'">
 								<select tal:define="prop_options prop/value" tal:attributes="name p">
-									<tal:block
-										tal:condition="python: prop_units != 'bytes'"
-										tal:repeat="prop_opt prop_options">
-										<option tal:attributes="value prop_opt" />
-										<span tal:replace="prop_opt" />
+									<tal:block tal:condition="python: prop_units != 'bytes'">
+										<tal:block tal:repeat="prop_opt prop_options">
+											<option tal:attributes="value prop_opt" />
+											<span tal:replace="prop_opt" />
+										</tal:block>
 									</tal:block>
-									<tal:block
-										tal:condition="python: prop_units == 'bytes'"
-										tal:repeat="prop_opt prop_options">
-										<option tal:attributes="value prop_opt" />
-										<span
+
+									<tal:block tal:condition="python: prop_units == 'bytes'">
+										<tal:block
 											tal:define="
-												dummy python: here.bytes_to_value_units(prop_opt);
-												value python: str(dummy[0]) + ' ' + str(dummy[1])"
-											tal:replace="value" />
+													dummy2 python:map(lambda x: int(x), prop_options);
+													dummy3 python:dummy2.sort()"
+											tal:repeat="prop_opt dummy2">
+												<option tal:attributes="
+															value prop_opt;
+															selected python:prop.get('default_val') == str(prop_opt) and 'selected' or ''" />
+												<span
+													tal:define="
+														dummy python: here.bytes_to_value_units(prop_opt);
+														value python: str(dummy[0]) + ' ' + str(dummy[1])"
+													tal:replace="value" />
+										</tal:block>
 									</tal:block>
 								</select>
 							</tal:block>
ricci/common/File.cpp +5 -5
@@ -139,17 +139,17 @@
 	MutexLocker l(*_mutex);
 
 	long len = size();
-	const auto_ptr<char> buff(new char[len]);
+	char buff[len];
 	try {
 		((fstream *) _pimpl->fs)->seekg(0, ios::beg);
 		check_failed();
-		((fstream *) _pimpl->fs)->read(buff.get(), len);
+		((fstream *) _pimpl->fs)->read(buff, len);
 		check_failed();
-		String ret(buff.get(), len);
-		::shred(buff.get(), len);
+		String ret(buff, len);
+		::shred(buff, len);
 		return ret;
 	} catch ( ... ) {
-		::shred(buff.get(), len);
+		::shred(buff, len);
 		throw;
 	}
 }
ricci/common/Variable.cpp +2 -0
@@ -26,6 +26,8 @@
 
 #include <stdio.h>
 
+#include <vector>
+#include <algorithm>
 using namespace std;
 
 // ##### class Variable #####
ricci/common/utils.cpp +39 -8

87 lines not on this page · raw message

ricci/include/shred_allocator.h +6 -0
@@ -33,6 +33,12 @@
 #ifndef __CONGA_SHRED_ALLOCATOR_H
 #define __CONGA_SHRED_ALLOCATOR_H
 
+extern "C" {
+	#include <unistd.h>
+	#include <stdlib.h>
+	#include <string.h>
+}
+
 #include <new>
 
 template<typename _Tp>
ricci/modules/cluster/clumon/REDHAT-CLUSTER-MIB +2 -2
@@ -234,7 +234,7 @@
 	::= { rhcTables 1 }
 
 rhcNodeEntry OBJECT-TYPE
-	SYNTAX      RchNodeEntry
+	SYNTAX      RhcNodeEntry
 	MAX-ACCESS  not-accessible
 	STATUS      current
 	DESCRIPTION
@@ -311,7 +311,7 @@
 	::= { rhcTables 2 }
 
 rhcServiceEntry OBJECT-TYPE
-	SYNTAX      RchServiceEntry
+	SYNTAX      RhcServiceEntry
 	MAX-ACCESS  not-accessible
 	STATUS      current
 	DESCRIPTION
ricci/modules/cluster/clumon/REDHAT-MIB +1 -2
@@ -2,8 +2,7 @@
 
 
 IMPORTS
-	enterprises				FROM RFC1155-SMI
-	MODULE-IDENTITY				FROM SNMPv2-SMI;
+	enterprises, MODULE-IDENTITY				FROM RFC1155-SMI;
 
 
 RedHat MODULE-IDENTITY
ricci/modules/cluster/clumon/src/common/Cluster.cpp +3 -2
@@ -1,5 +1,5 @@
 /*
-** Copyright (C) Red Hat, Inc. 2005-2007
+** Copyright (C) Red Hat, Inc. 2005-2008
 **
 ** This program is free software; you can redistribute it and/or modify it
 ** under the terms of the GNU General Public License version 2 as
@@ -25,7 +25,8 @@
 #include <stdio.h>
 
 extern "C" {
-#	include <libcman.h>
+	#include <limits.h>
+	#include <libcman.h>
 }
 
 using namespace std;
ricci/modules/rpm/PackageHandler.cpp +3 -0
@@ -511,9 +511,12 @@
 			if (kernel.find("xen") == kernel.npos) {
 				set.packages.push_back("kmod-gfs");
 				set.packages.push_back("kmod-gfs2");
+				set.packages.push_back("cmirror");
+				set.packages.push_back("kmod-cmirror");
 			} else {
 				set.packages.push_back("kmod-gfs-xen");
 				set.packages.push_back("kmod-gfs2-xen");
+				set.packages.push_back("kmod-cmirror-xen");
 			}
 		}
 	}
ricci/modules/service/ServiceManager.cpp +2 -1
@@ -521,11 +521,12 @@
 		servs.push_back("gfs");
 		servs.push_back("scsi_reserve");
 	} else if (RHEL5 || FC6) {
-		descr = "Shared Storage: clvmd, gfs, gfs2";
+		descr = "Shared Storage: clvmd, cmirror, gfs, gfs2";
 		servs.push_back("clvmd");
 		servs.push_back("gfs");
 		servs.push_back("gfs2");
 		servs.push_back("scsi_reserve");
+		servs.push_back("cmirror");
 	}
 	s = ServiceSet(name, descr);
 	if (populate_set(s, servs))
ricci/modules/storage/ContentFS.cpp +1 -0
@@ -28,6 +28,7 @@
 #include "BDFactory.h"
 #include "defines.h"
 #include "utils.h"
+#include <algorithm>
 
 
 using namespace std;
ricci/modules/storage/ExtendedFS.cpp +2 -1
@@ -27,8 +27,9 @@
 #include "UMountError.h"
 #include "FileMagic.h"
 
-
+#include <algorithm>
 #include <iostream>
+
 using namespace std;
 
 
ricci/modules/storage/LV.cpp +1 -1
@@ -124,7 +124,7 @@
     long long min  = utils::to_long(xml.get_attr("min"));
     long long max  = utils::to_long(xml.get_attr("max"));
     long long step = utils::to_long(xml.get_attr("step"));
-    long long min_size = (long long ) (size * (usage / 100.0));
+    long long min_size = (long long) (size * usage) / 100;
     if (min_size > min)
       min = min_size;
     else if (min_size > max)
ricci/modules/storage/LVM.cpp +32 -12

56 lines not on this page · raw message

ricci/modules/storage/Mapper.cpp +1 -0
@@ -26,6 +26,7 @@
 #include "BDFactory.h"
 #include "MapperFactory.h"
 #include "MidAir.h"
+#include <algorithm>
 
 
 using namespace std;
ricci/modules/storage/MountHandler.cpp +2 -1
@@ -37,8 +37,9 @@
 #include <sys/file.h>
 #include <errno.h>
 
-
+#include <algorithm>
 #include <iostream>
+
 using namespace std;
 
 
ricci/modules/storage/PTSource.cpp +1 -0
@@ -25,6 +25,7 @@
 #include "PartitionTable.h"
 #include "parted_wrapper.h"
 
+#include <algorithm>
 
 using namespace std;
 
ricci/modules/storage/PV.cpp +1 -0
@@ -26,6 +26,7 @@
 #include "MapperFactory.h"
 #include "utils.h"
 #include "LVMClusterLockingError.h"
+#include <algorithm>
 
 
 using namespace std;
ricci/modules/storage/Partition.cpp +1 -0
@@ -30,6 +30,7 @@
 #include "ContentExtendedPartition.h"
 #include "PV.h"
 
+#include <algorithm>
 
 using namespace std;
 
ricci/modules/storage/PartitionTable.cpp +1 -1
@@ -28,7 +28,7 @@
 #include "MapperFactory.h"
 #include "utils.h"
 
-
+#include <algorithm>
 #include <iostream>
 
 
ricci/modules/storage/parted_wrapper.cpp +2 -1
@@ -24,8 +24,9 @@
 #include "parted_wrapper.h"
 #include "utils.h"
 
-
+#include <algorithm>
 #include <iostream>
+
 using namespace std;
 
 
ricci/ricci/SSLInstance.cpp +2 -0
@@ -498,6 +498,8 @@
 			e = "SSL_ERROR_WANT_X509_LOOKUP";
 			break;
 		case SSL_ERROR_SYSCALL:
+			if (err == EAGAIN || err == EINTR)
+				return;
 			e = "SSL_ERROR_SYSCALL";
 			break;
 		case SSL_ERROR_SSL: