Skip to contentSkip to conversation

conga/luci cluster/validate_config_qdisk.js si ...

Cluster-devel [email protected] 1 participant 1 message Aug 6, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2010-08-06 23:54:12

Modified files:
luci/cluster : validate_config_qdisk.js
luci/site/luci/Extensions: LuciValidation.py luci/site/luci/Extensions/ClusterModel: ModelBuilder.py

Log message:
fix rhbz#606509 - luci requires wrongly requires users to fill interval / minimum score / votes fields for qdisk configuration

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.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.15&r2=1.6.2.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.14&r2=1.1.4.15

luci/cluster/validate_config_qdisk.js +16 -28
@@ -104,8 +104,6 @@
 	var hint = document.getElementById(hstr + ':hinterval');
 	if (!hint || str_is_blank(hint.value)) {
 		++blank;
-		errors.push('No interval was given for heuristic ' + (hnum + 1));
-		set_form_err(hint);
 	} else {
 		if (!is_valid_int(hint.value, 1, null)) {
 			errors.push('Heuristic interval values must be greater than 0.');
@@ -117,8 +115,6 @@
 	var hscore = document.getElementById(hstr + ':hscore');
 	if (!hscore || str_is_blank(hscore.value)) {
 		++blank;
-		errors.push('No score was given for heuristic ' + (hnum + 1));
-		set_form_err(hscore);
 	} else {
 		if (!is_valid_int(hscore.value, 0, null)) {
 			errors.push('Heuristic score values must be 0 or greater.');
@@ -169,9 +165,8 @@
 	}
 
 	if (qpart) {
-		if (!form.interval || str_is_blank(form.interval.value)) {
-			errors.push('No interval setting was given.');
-			set_form_err(form.interval);
+		if (form.interval && str_is_blank(form.interval.value)) {
+			clr_form_err(form.interval);
 		} else {
 			if (!is_valid_int(form.interval.value, 1, null)) {
 				errors.push('Interval values must be integers greater than 0.');
@@ -180,9 +175,8 @@
 				clr_form_err(form.interval);
 		}
 
-		if (!form.tko || str_is_blank(form.tko.value)) {
-			errors.push('No TKO setting was given.');
-			set_form_err(form.tko);
+		if (form.tko && str_is_blank(form.tko.value)) {
+			clr_form_err(form.tko);
 		} else {
 			if (!is_valid_int(form.tko.value, 1, null)) {
 				errors.push('TKO values must be greater than 0.');
@@ -191,9 +185,8 @@
 				clr_form_err(form.tko);
 		}
 
-		if (!form.votes || str_is_blank(form.votes.value)) {
-			errors.push('No votes setting was given.');
-			set_form_err(form.votes);
+		if (form.votes && str_is_blank(form.votes.value)) {
+			clr_form_err(form.votes);
 		} else {
 			if (!is_valid_int(form.votes.value, 1, null)) {
 				errors.push('Votes values must be greater than 0.');
@@ -202,6 +195,16 @@
 				clr_form_err(form.votes);
 		}
 
+		if (form.min_score && str_is_blank(form.min_score.value)) {
+			clr_form_err(form.min_score);
+		} else {
+			if (!is_valid_int(form.min_score.value, 1, null)) {
+				errors.push('Minimum score values must be greater than 0.');
+				set_form_err(form.min_score);
+			} else
+				clr_form_err(form.min_score);
+		}
+
 		var no_dev = !form.device || str_is_blank(form.device.value);
 		var no_label = !form.label || str_is_blank(form.label.value);
 		if (no_dev && no_label)
@@ -218,21 +221,6 @@
 				if (err)
 					errors = errors.concat(err);
 			}
-
-			if (hnum > 1) {
-				if (!form.min_score || str_is_blank(form.min_score.value)) {
-					errors.push('No minimum score setting was given.');
-					set_form_err(form.min_score);
-				} else {
-					if (!is_valid_int(form.min_score.value, 1, null)) {
-						errors.push('Minimum score values must be greater than 0.');
-						set_form_err(form.min_score);
-					} else
-						clr_form_err(form.min_score);
-				}
-			} else {
-				clr_form_err(form.min_score);
-			}
 		} else {
 			clr_form_err(form.min_score);
 		}
luci/site/luci/Extensions/LuciValidation.py +45 -29

122 lines not on this page · raw message

luci/site/luci/Extensions/ClusterModel/ModelBuilder.py +4 -1
@@ -1120,7 +1120,10 @@
         cur_votes = 1
       node_votes += cur_votes
 
-    return node_votes + qdisk_votes
+    if qdisk_votes != 0:
+        return node_votes + qdisk_votes
+    else:
+        return 2 * node_votes - 1
 
   def updateReferences(self):
     self.__updateReferences(self.cluster_ptr)