FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 08-06-2010, 11:54 PM
 
Default conga/luci cluster/validate_config_qdisk.js si ...

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe@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_t ag=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

--- conga/luci/cluster/validate_config_qdisk.js 2008/07/14 21:52:30 1.4.2.7
+++ conga/luci/cluster/validate_config_qdisk.js 2010/08/06 23:54:11 1.4.2.8
@@ -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);
}
--- conga/luci/site/luci/Extensions/LuciValidation.py 2010/08/06 21:57:43 1.6.2.15
+++ conga/luci/site/luci/Extensions/LuciValidation.py 2010/08/06 23:54:12 1.6.2.16
@@ -747,38 +747,46 @@
return (True, {})

try:
- interval = int(form['interval'])
- if interval < 0:
- raise ValueError, 'Interval must be 0 or greater'
+ interval = form['interval']
+ if interval:
+ interval = int(interval)
+ if interval < 0:
+ raise ValueError, 'Interval must be 0 or greater'
except KeyError, e:
errors.append('No Interval value was given')
except ValueError, e:
errors.append('An invalid Interval value was given: %s' % str(e))

try:
- votes = int(form['votes'])
- if votes < 1:
- raise ValueError, 'Votes must be greater than 0'
+ votes = form['votes']
+ if votes:
+ votes = int(votes)
+ if votes < 1:
+ raise ValueError, 'Votes must be greater than 0'
except KeyError, e:
- errors.append('No Votes value was given')
+ votes = None
except ValueError, e:
errors.append('An invalid Votes value was given: %s' % str(e))

try:
- tko = int(form['tko'])
- if tko < 0:
- raise ValueError, 'TKO must be 0 or greater'
+ tko = form['tko']
+ if tko:
+ tko = int(tko)
+ if tko < 0:
+ raise ValueError, 'TKO must be 0 or greater'
except KeyError, e:
- errors.append('No TKO value was given')
+ tko = None
except ValueError, e:
errors.append('An invalid TKO value was given: %s' % str(e))

try:
- min_score = int(form['min_score'])
- if min_score < 1:
- raise ValueError('Minimum Score must be greater than 0')
+ min_score = form['min_score']
+ if min_score:
+ min_score = int(min_score)
+ if min_score < 1:
+ raise ValueError('Minimum Score must be greater than 0')
except KeyError, e:
- errors.append('No Minimum Score value was given')
+ min_score = None
except ValueError, e:
errors.append('An invalid Minimum Score value was given: %s' % str(e))

@@ -826,21 +834,23 @@
except Exception, e:
errors.append('No program was given for heuristic %d' % (i + 1))
try:
- hint = int(h[1])
- if hint < 1:
- raise ValueError, 'Heuristic interval values must be greater than 0'
+ if hint:
+ hint = int(h[1])
+ if hint < 1:
+ raise ValueError, 'Heuristic interval values must be greater than 0'
except KeyError, e:
- errors.append('No interval was given for heuristic %d' % (i + 1))
+ hint = None
except ValueError, e:
errors.append('An invalid interval was given for heuristic %d: %s'
% ((i + 1), str(e)))

try:
- hscore = int(h[2])
- if hscore < 1:
- raise ValueError, 'Heuristic scores must be greater than 0'
+ if hscore:
+ hscore = int(h[2])
+ if hscore < 1:
+ raise ValueError, 'Heuristic scores must be greater than 0'
except KeyError, e:
- errors.append('No score was given for heuristic %d' % (i + 1))
+ hscore = None
except ValueError, e:
errors.append('An invalid score was given for heuristic %d: %s'
% ((i + 1), str(e)))
@@ -851,10 +861,14 @@
return (False, {'errors': errors })

qd = QuorumD()
- qd.addAttribute('interval', str(interval))
- qd.addAttribute('votes', str(votes))
- qd.addAttribute('tko', str(tko))
- qd.addAttribute('min_score', str(min_score))
+ if interval:
+ qd.addAttribute('interval', str(interval))
+ if votes:
+ qd.addAttribute('votes', str(votes))
+ if tko:
+ qd.addAttribute('tko', str(tko))
+ if min_score:
+ qd.addAttribute('min_score', str(min_score))

if device:
qd.addAttribute('device', str(device))
@@ -871,8 +885,10 @@
for h in heuristics:
new_h = Heuristic()
new_h.addAttribute('program', str(h[0]))
- new_h.addAttribute('interval', str(h[1]))
- new_h.addAttribute('score', str(h[2]))
+ if h[1]:
+ new_h.addAttribute('interval', str(h[1]))
+ if h[2]:
+ new_h.addAttribute('score', str(h[2]))
qd.addChild(new_h)

if len(errors) > 0:
--- conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2010/08/06 21:57:43 1.1.4.14
+++ conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py 2010/08/06 23:54:12 1.1.4.15
@@ -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)
 

Thread Tools




All times are GMT. The time now is 01:01 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org