From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/validat ...
Date: 16 Feb 2007 05:29:39 -0000 [thread overview]
Message-ID: <20070216052939.23837.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-02-16 05:29:38
Modified files:
luci/cluster : form-macros validate_config_qdisk.js
luci/site/luci/Extensions: cluster_adapters.py
Log message:
- Only set the totem params cman actually reads
- Fix a bunch of bugs relating to qdisk properties
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.176.2.11&r2=1.176.2.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5&r2=1.5.2.1
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.8&r2=1.227.2.9
--- conga/luci/cluster/form-macros 2007/02/16 02:12:46 1.176.2.11
+++ conga/luci/cluster/form-macros 2007/02/16 05:29:38 1.176.2.12
@@ -640,12 +640,56 @@
<table class="systemsTable">
<tr class="systemsTable">
<td class="systemsTable">
+ <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#token', 55, 65);">Token Timeout</a> (ms)
+ </td>
+ <td class="systemsTable">
+ <input type="text" size="10" name="token"
+ tal:attributes="value clusterinfo/totem/token | string:10000" />
+ </td>
+ </tr>
+
+ <tr class="systemsTable">
+ <td class="systemsTable">
+ <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#retransmits_before_loss', 55, 65);">Number of token retransmits before loss</a>
+ </td>
+ <td class="systemsTable">
+ <input type="text" size="10"
+ name="token_retransmits_before_loss_const"
+ tal:attributes="value clusterinfo/totem/token_retransmits_before_loss_const | string:20" />
+ </td>
+ </tr>
+
+ <tr class="systemsTable">
+ <td class="systemsTable">
+ <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#join', 55, 65);">Join Timeout</a> (ms)
+ </td>
+ <td class="systemsTable">
+ <input type="text" size="10" name="join"
+ tal:attributes="value clusterinfo/totem/join | string:60" />
+ </td>
+ </tr>
+
+ <tr class="systemsTable">
+ <td class="systemsTable">
+ <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#consensus', 55, 65);">Consensus Timeout</a> (ms)
+ </td>
+ <td class="systemsTable">
+ <input type="text" size="10"
+ name="consensus"
+ tal:attributes="value clusterinfo/totem/consensus | string:4800" />
+ </td>
+ </tr>
+
+<tal:comment tal:replace="nothing">
+ <tr class="systemsTable">
+ <td class="systemsTable">
<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#secauth', 55, 65);">Secure Authentication</a>
</td>
<td class="systemsTable">
<input type="checkbox" name="secauth" checked="checked" />
</tr>
+
<tr class="systemsTable">
<td class="systemsTable">
<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#rrp_mode', 55, 65);">Redundant Ring Protocol Mode</a>
@@ -703,16 +747,6 @@
<tr class="systemsTable">
<td class="systemsTable">
- <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#token', 55, 65);">Token Timeout</a> (ms)
- </td>
- <td class="systemsTable">
- <input type="text" size="10" name="token"
- tal:attributes="value string:5000" />
- </td>
- </tr>
-
- <tr class="systemsTable">
- <td class="systemsTable">
<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#token_retransmit', 55, 65);">Token Retransmit</a> (ms)
</td>
<td class="systemsTable">
@@ -734,27 +768,6 @@
<tr class="systemsTable">
<td class="systemsTable">
- <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#retransmits_before_loss', 55, 65);">Number of retransmits before loss</a>
- </td>
- <td class="systemsTable">
- <input type="text" size="10"
- name="retransmits_before_loss"
- tal:attributes="value string:4" />
- </td>
- </tr>
-
- <tr class="systemsTable">
- <td class="systemsTable">
- <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#join', 55, 65);">Join Timeout</a> (ms)
- </td>
- <td class="systemsTable">
- <input type="text" size="10" name="join"
- tal:attributes="value string:100" />
- </td>
- </tr>
-
- <tr class="systemsTable">
- <td class="systemsTable">
<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#send_join', 55, 65);">Maximum time to wait before sending a join message</a> (ms)
</td>
<td class="systemsTable">
@@ -765,17 +778,6 @@
<tr class="systemsTable">
<td class="systemsTable">
- <a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#consensus', 55, 65);">Consensus Timeout</a> (ms)
- </td>
- <td class="systemsTable">
- <input type="text" size="10"
- name="consensus"
- tal:attributes="value string:100" />
- </td>
- </tr>
-
- <tr class="systemsTable">
- <td class="systemsTable">
<a class="cluster_help" href="javascript:popup_window('/luci/doc/config_rhel5#merge', 55, 65);">Merge Detection Timeout</a> (ms)
</td>
<td class="systemsTable">
@@ -894,6 +896,7 @@
tal:attributes="value string:47" />
</td>
</tr>
+</tal:comment>
</table>
</td></tr>
</table>
@@ -1092,14 +1095,14 @@
<tr class="systemsTable" id="st_row"><td class="systemsTable" id="st_col">
<input type="radio" name="quorumd" value="False"
onClick="disableChildrenInput('quorumdisk');"
- tal:attributes="checked python: clusterinfo['is_quorumd'] != 'True'"/>
+ tal:attributes="checked python: (not clusterinfo['is_quorumd']) and 'checked' or ''" />
Do not use a Quorum Partition
</td></tr>
<tr class="systemsTable"><td class="systemsTable">
<input type="radio" name="quorumd" value="True"
onClick="enableChildrenInput('quorumdisk');"
- tal:attributes="checked python: clusterinfo['is_quorumd'] == 'True'"/>
+ tal:attributes="checked python: (clusterinfo['is_quorumd']) and 'checked' or ''" />
Use a Quorum Partition
</td></tr>
</tbody>
@@ -1114,48 +1117,48 @@
<tr class="systemsTable">
<td class="systemsTable">Interval</td>
<td class="systemsTable">
- <input type="text" name="interval" value=""
- tal:attributes="value clusterinfo/interval"/>
+ <input type="text" name="interval"
+ tal:attributes="value clusterinfo/interval | nothing" />
</td>
</tr>
<tr class="systemsTable">
<td class="systemsTable">Votes</td>
<td class="systemsTable">
- <input type="text" name="votes" value=""
- tal:attributes="value clusterinfo/votes"/>
+ <input type="text" name="votes"
+ tal:attributes="value clusterinfo/votes | nothing" />
</td>
</tr>
<tr class="systemsTable">
<td class="systemsTable">TKO</td>
<td class="systemsTable">
- <input type="text" name="tko" value=""
- tal:attributes="value clusterinfo/tko"/>
+ <input type="text" name="tko"
+ tal:attributes="value clusterinfo/tko | nothing" />
</td>
</tr>
<tr class="systemsTable">
<td class="systemsTable">Minimum Score</td>
<td class="systemsTable">
- <input type="text" name="min_score" value=""
- tal:attributes="value clusterinfo/min_score"/>
+ <input type="text" name="min_score"
+ tal:attributes="value clusterinfo/min_score | nothing" />
</td>
</tr>
<tr class="systemsTable">
<td class="systemsTable">Device</td>
<td class="systemsTable">
- <input type="text" name="device" value=""
- tal:attributes="value clusterinfo/device"/>
+ <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" value=""
- tal:attributes="value clusterinfo/label"/>
+ <input type="text" name="label"
+ tal:attributes="value clusterinfo/label | nothing" />
</td>
</tr>
</table>
@@ -1172,9 +1175,6 @@
<tr class="systemsTable">
<th class="systemsTable">
- <div class="systemsTableTop">Name</div>
- </th>
- <th class="systemsTable">
<div class="systemsTableTop">Path to Program</div>
</th>
<th class="systemsTable">
@@ -1190,22 +1190,22 @@
</thead>
<tbody class="systemsTable" id="heuristicList"
- tal:define="global heuristics clusterinfo/hlist">
+ tal:define="global heuristics clusterinfo/hlist | nothing">
- <tal:block tal:condition="python: not len(heuristics)">
+ <tal:block tal:condition="python: not heuristics or not len(heuristics)">
<input type="hidden" name="num_heuristics" id="num_heuristics" value="0">
<tr class="systemsTable" id="heuristic0">
<td class="systemsTable">
- <input class="qdname qdisk" type="text" name="heuristic0:hname" id="heuristic0:hname" value="">
- </td>
- <td class="systemsTable">
- <input class="qdpath qdisk" type="text" name="heuristic0:hprog" id="heuristic0:hprog" value="">
+ <input class="qdpath qdisk" type="text"
+ name="heuristic0:hprog" id="heuristic0:hprog" />
</td>
<td class="systemsTable">
- <input class="qdint qdisk" type="text" name="heuristic0:hinterval" id="heuristic0:hinterval" value="">
+ <input class="qdint qdisk" type="text"
+ name="heuristic0:hinterval" id="heuristic0:hinterval" />
</td>
<td class="systemsTable">
- <input class="qdscore qdisk" type="text" name="heuristic0:hscore" id="heuristic0:hscore" value="">
+ <input class="qdscore qdisk" type="text"
+ name="heuristic0:hscore" id="heuristic0:hscore" />
</td>
<td class="systemsTable">
<img class="qdisk deleteRow"
@@ -1230,32 +1230,27 @@
tal:define="global curHeur python: curHeur + 1">
<td class="systemsTable">
- <input class="qdname qdisk" type="text"
- tal:attributes="
- value heuristic/hname;
- id python: 'heuristic' + str(curHeur) + ':hname';
- name python: 'heuristic' + str(curHeur) + ':hname';"/>
- </td>
- <td class="systemsTable">
<input class="qdpath qdisk" type="text"
tal:attributes="
value heuristic/hprog;
id python: 'heuristic' + str(curHeur) + ':hprog';
- name python: 'heuristic' + str(curHeur) + ':hprog';"/>
+ name python: 'heuristic' + str(curHeur) + ':hprog'" />
</td>
+
<td class="systemsTable">
<input class="qdint qdisk" type="text"
tal:attributes="
value heuristic/hinterval;
id python: 'heuristic' + str(curHeur) + ':hinterval';
- name python: 'heuristic' + str(curHeur) + ':hinterval';"/>
+ name python: 'heuristic' + str(curHeur) + ':hinterval'" />
</td>
+
<td class="systemsTable">
<input class="qdscore qdisk" type="text"
tal:attributes="
value heuristic/hscore;
id python: 'heuristic' + str(curHeur) + ':hscore';
- name python: 'heuristic' + str(curHeur) + ':hscore';"/>
+ name python: 'heuristic' + str(curHeur) + ':hscore'" />
</td>
<td class="systemsTable">
<img class="qdisk deleteRow"
@@ -1264,14 +1259,15 @@
onClick="delete_qdisk_heur(this, document.quorum_partition);"
tal:attributes="
id python: 'heuristic' + str(curHeur) + ':hdel';
- name python: 'heuristic' + str(curHeur) + ':hdel';"/>
+ name python: 'heuristic' + str(curHeur) + ':hdel'" />
</td>
</tr>
</tal:block>
</tbody>
+
<tfoot>
<tr class="systemsTable"><td class="systemsTable">
- <input class="addrow" type="button" value="Add another heuristic" onClick="addHeuristic('heuristicList');">
+ <input class="addrow" type="button" value="Add another heuristic" onClick="addHeuristic('heuristicList')">
</td></tr>
</tfoot>
</table>
@@ -1281,10 +1277,9 @@
<div class="spacing configTabContent"></div>
<div class="hbSubmit spacing configTabContent">
<input type="button" value="Apply"
- onClick="validate_form(this.form);"
- >
+ onClick="validate_form(this.form)" />
</div>
- <script tal:condition="python: clusterinfo['is_quorumd'] != 'True'">
+ <script tal:condition="not: clusterinfo/is_quorumd">
disableChildrenInput('quorumdisk');
</script>
</form>
--- conga/luci/cluster/validate_config_qdisk.js 2006/12/21 05:08:48 1.5
+++ conga/luci/cluster/validate_config_qdisk.js 2007/02/16 05:29:38 1.5.2.1
@@ -1,4 +1,4 @@
-var heuristic_names = [ ':hname', ':hprog', ':hinterval', ':hscore', ':hdel' ];
+var heuristic_names = [ ':hprog', ':hinterval', ':hscore', ':hdel' ];
function clear_heuristic(form, heur_num) {
var str_prefix = 'heuristic' + heur_num;
@@ -82,26 +82,14 @@
var hstr = 'heuristic' + hnum;
- var hname = document.getElementById(hstr + ':hname');
- if (!hname || str_is_blank(hname.value)) {
- ++blank;
- errors.push('No name was given for heuristic ' + (hnum + 1));
- set_form_err(hname);
- } else {
- /* XXX sanity check the name */
- hname = hname.value;
- clr_form_err(hname);
- }
-
- var hpath = document.getElementById(hstr + ':hpath');
- if (!hpath || str_is_blank(hpath.value)) {
+ var hprog = document.getElementById(hstr + ':hprog');
+ if (!hprog || str_is_blank(hprog.value)) {
++blank;
errors.push('No path was given for heuristic ' + (hnum + 1));
- set_form_err(hpath);
+ set_form_err(hprog);
} else {
/* XXX sanity check the path */
- hpath = hpath.value;
- clr_form_err(hpath);
+ clr_form_err(hprog);
}
var hint = document.getElementById(hstr + ':hinterval');
@@ -110,8 +98,7 @@
errors.push('No interval was given for heuristic ' + (hnum + 1));
set_form_err(hint);
} else {
- hint = hint.value;
- if (!is_valid_int(hint, 1, null)) {
+ if (!is_valid_int(hint.value, 1, null)) {
errors.push('Heuristic interval values must be greater than 0.');
set_form_err(hint);
} else
@@ -124,18 +111,16 @@
errors.push('No score was given for heuristic ' + (hnum + 1));
set_form_err(hscore);
} else {
- hscore = hscore.value;
- if (!is_valid_int(hscore, 0, null)) {
+ if (!is_valid_int(hscore.value, 0, null)) {
errors.push('Heuristic score values must be 0 or greater.');
set_form_err(hscore);
} else
clr_form_err(hscore);
}
- if (blank == 4) {
+ if (blank == 3) {
/* The entry is blank -- ignore it. */
- clr_form_err(hname);
- clr_form_err(hpath);
+ clr_form_err(hprog);
clr_form_err(hint);
clr_form_err(hscore);
return (null);
@@ -219,30 +204,15 @@
clr_form_err(form.min_score);
}
- if (!form.device || str_is_blank(form.device.value)) {
- errors.push('No device setting was given.');
- set_form_err(form.device);
- } else {
- /* TODO: check this */
- var device = form.device.value;
- clr_form_err(form.device);
- }
-
- if (!form.label || str_is_blank(form.label.value)) {
- errors.push('No label setting was given.');
- set_form_err(form.label);
- } else {
- /* TODO: check this */
- var label = form.device.label;
- clr_form_err(form.label);
- }
+ 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)
+ errors.push('You must give either a label or a device.');
var hnum = document.getElementById('num_heuristics');
if (hnum) {
- hnum = Number(hnum.value);
- if (hnum === 0)
- hnum++;
- for (var i = 0 ; i < hnum ; i++) {
+ hnum = Number(hnum.value) + 1;
+ for (var i = 0 ; i <= hnum ; i++) {
var err = check_heuristic(i, form);
if (err)
errors = errors.concat(err);
@@ -252,6 +222,7 @@
if (error_dialog(errors))
return (-1);
+
if (confirm('Update quorum partition properties?'))
form.submit();
}
@@ -275,15 +246,6 @@
var hstr = 'heuristic' + cur_hnum;
- var name_td = document.createElement('td');
- name_td.className = 'systemsTable';
- var name_input = document.createElement('input');
- name_input.className = 'qdname qdisk';
- name_input.setAttribute('name', hstr + ':hname');
- name_input.setAttribute('id', hstr + ':hname');
- name_input.setAttribute('type', 'text');
- name_td.appendChild(name_input);
-
var path_td = document.createElement('td');
path_td.className = 'systemsTable';
var path_input = document.createElement('input');
@@ -325,7 +287,6 @@
var tr = document.createElement('tr');
tr.className = 'systemsTable';
tr.setAttribute('id', 'heuristic' + cur_hnum);
- tr.appendChild(name_td);
tr.appendChild(path_td);
tr.appendChild(interval_td);
tr.appendChild(score_td);
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/02/16 02:12:46 1.227.2.8
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/02/16 05:29:38 1.227.2.9
@@ -1013,8 +1013,16 @@
except KeyError, e:
return (False, {'errors': ['An invalid quorum partition selection was made']})
+ cp = model.getClusterPtr()
+ qdp = model.getQuorumdPtr()
+
if not qdisk_val:
- return (True, {'messages': ['Changes accepted. - FILL ME IN']})
+ if qdp:
+ try:
+ cp.removeChild(qdp)
+ except Exception, e:
+ return (False, {'errors': [ 'Error disabling quorum partition: %s' % str(e) ] })
+ return (True, {})
try:
interval = int(form['interval'])
@@ -1054,22 +1062,25 @@
#Either device or label must be present
device = None
- label = None
try:
device = form['device'].strip()
+ except:
+ device = None
+
+ label = None
+ try:
label = form['label'].strip()
- if not device and not label:
- raise KeyError, 'device and label are both none'
- except KeyError, e:
+ except:
+ label = None
+
+ if not device and not label:
errors.append('No Device or Label value was given')
num_heuristics = 0
try:
- num_heuristics = int(form['num_heuristics'])
- if num_heuristics < 0:
- raise ValueError, 'invalid number of heuristics: %s' % form['num_heuristics']
- if num_heuristics == 0:
- num_heuristics = 1
+ num_heuristics = int(form['num_heuristics']) + 1
+ if num_heuristics < 1:
+ raise ValueError, form['num_heuristics']
except KeyError, e:
errors.append('No number of heuristics was given.')
except ValueError, e:
@@ -1077,65 +1088,67 @@
heuristics = list()
for i in xrange(num_heuristics):
- prefix = 'heuristic' + str(i) + ':'
try:
- hname = form[prefix + 'hname'].strip()
- if not hname:
- raise KeyError(prefix + 'hname')
- except KeyError, e:
- if ((not prefix + 'hpath' in form or not form['hpath'].strip()) and
- (not prefix + 'hint' in form or not form['hint'].strip()) and
- (not prefix + 'hscore' in form or not form['hscore'].strip())):
- # The row is blank; ignore it.
+ h = form['heuristic%d' % i]
+ if not h or len(h) != 3:
continue
- errors.append('No heuristic name was given for heuristic #%d' % i + 1)
+ except:
+ continue
try:
- hpath = form[prefix + 'hpath']
- except KeyError, e:
- errors.append('No heuristic path was given for heuristic #%d' % i + 1)
-
+ hprog = h[0]
+ if not hprog:
+ raise Exception, 'no hprog'
+ except Exception, e:
+ errors.append('No program was given for heuristic %d' % i + 1)
try:
- hint = int(form[prefix + 'hint'])
+ hint = int(h[1])
if hint < 1:
raise ValueError, 'Heuristic interval values must be greater than 0'
except KeyError, e:
- errors.append('No heuristic interval was given for heuristic #%d' % i + 1)
+ errors.append('No interval was given for heuristic #%d' % i + 1)
except ValueError, e:
- errors.append('An invalid heuristic interval was given for heuristic #%d: %s' % (i + 1, str(e)))
+ errors.append('An invalid interval was given for heuristic %d: %s' \
+ % (i + 1, str(e)))
try:
- hscore = int(form[prefix + 'score'])
+ hscore = int(h[2])
if hscore < 1:
raise ValueError, 'Heuristic scores must be greater than 0'
except KeyError, e:
- errors.append('No heuristic score was given for heuristic #%d' % i + 1)
+ errors.append('No score was given for heuristic %d' % i + 1)
except ValueError, e:
- errors.append('An invalid heuristic score was given for heuristic #%d: %s' % (i + 1, str(e)))
- heuristics.append([ hname, hpath, hint, hscore ])
+ errors.append('An invalid score was given for heuristic %d: %s' \
+ % (i + 1, str(e)))
+
+ heuristics.append([ hprog, hint, hscore ])
if len(errors) > 0:
return (False, {'errors': errors })
qd = QuorumD()
- qd.addAttribute('interval', interval)
- qd.addAttribute('votes', votes)
- qd.addAttribute('tko', tko)
- qd.addAttribute('min_score', min_score)
+ qd.addAttribute('interval', str(interval))
+ qd.addAttribute('votes', str(votes))
+ qd.addAttribute('tko', str(tko))
+ qd.addAttribute('min_score', str(min_score))
if device:
- qd.addAttribute('device', device)
+ qd.addAttribute('device', str(device))
else:
- qd.addAttribute('label', label)
+ qd.addAttribute('label', str(label))
- cp = model.getClusterPtr()
+ if qdp:
+ try:
+ cp.removeChild(qdp)
+ except:
+ pass
cp.addChild(qd)
for h in heuristics:
new_h = Heuristic()
- new_h.addAttribute('program', h[1])
- new_h.addAttribute('interval', h[2])
- new_h.addAttribute('score', h[3])
+ new_h.addAttribute('program', str(h[0]))
+ new_h.addAttribute('interval', str(h[1]))
+ new_h.addAttribute('score', str(h[2]))
qd.addChild(new_h)
if len(errors) > 0:
@@ -1169,8 +1182,9 @@
version_num = int(form['cfgver'])
if version_num < old_ver:
raise ValueError, 'configuration version number must be %d or greater.' % old_ver
- # we'll increment the cluster version before propagating it.
- version_num -= 1
+ if version_num != old_ver:
+ # we'll increment the cluster version before propagating it.
+ version_num -= 1
except KeyError, e:
errors.append('No cluster configuration version was given.')
except ValueError, e:
@@ -1194,79 +1208,11 @@
return (False, {'errors': errors})
return (True, {})
-# totem = model.getTotemPtr()
-# if totem is None:
-# cp = model.getClusterPtr()
-# totem = Totem()
-# cp.addChild(totem)
- totem = Totem()
-
- if form.has_key('secauth'):
- totem.addAttribute('secauth', '1')
- else:
- totem.addAttribute('secauth', '0')
-
- try:
- rrp_mode = form['rrp_mode'].strip().lower()
- if not rrp_mode:
- raise KeyError, 'rrp_mode'
- if rrp_mode != 'none' and rrp_mode != 'active' and 'rrp_mode' != 'passive':
- raise Exception, '%s is an invalid value for redundant ring protocol mode' % rrp_mode
- totem.addAttribute('rrp_mode', str(rrp_mode))
- except KeyError, e:
- try:
- totem.removeAttribute('rrp_mode')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- net_mtu = form['net_mtu'].strip()
- if not net_mtu:
- raise KeyError, 'net_mtu'
- net_mtu = int(net_mtu)
- if net_mtu < 1:
- raise ValueError, '%d is an invalid value for network MTU' % net_mtu
- totem.addAttribute('net_mtu', str(net_mtu))
- except KeyError, e:
- try:
- totem.removeAttribute('net_mtu')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- threads = form['threads'].strip()
- if not threads:
- raise KeyError, 'threads'
- threads = int(threads)
- if threads < 0:
- raise ValueError, '%d is an invalid value for number of threads' % threads
- totem.addAttribute('threads', str(threads))
- except KeyError, e:
- try:
- totem.removeAttribute('threads')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- vsftype = form['vsftype'].strip().lower()
- if not vsftype:
- raise KeyError, 'vsftype'
- if vsftype != 'none' and vsftype != 'ykd':
- raise ValueError, '%s is an invalid value for virtual synchrony type' % vsftype
- totem.addAttribute('vsftype', str(vsftype))
- except KeyError, e:
- try:
- totem.removeAttribute('vsftype')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
+ totem = model.getTotemPtr()
+ if totem is None:
+ cp = model.getClusterPtr()
+ totem = Totem()
+ cp.addChild(totem)
try:
token = form['token'].strip()
@@ -1285,48 +1231,16 @@
errors.append(str(e))
try:
- token_retransmit = form['token_retransmit'].strip()
- if not token_retransmit:
- raise KeyError, 'token_retransmit'
- token_retransmit = int(token_retransmit)
- if token_retransmit < 1:
- raise ValueError, '%d is an invalid value for token retransmit' % token_retransmit
- totem.addAttribute('token_retransmit', str(token_retransmit))
+ token_retransmits_before_loss_const = form['token_retransmits_before_loss_const'].strip()
+ if not token_retransmits_before_loss_const:
+ raise KeyError, 'token_retransmits_before_loss_const'
+ token_retransmits_before_loss_const = int(token_retransmits_before_loss_const)
+ if token_retransmits_before_loss_const < 1:
+ raise ValueError, '%d is an invalid value for number of token retransmits before loss' % token_retransmits_before_loss_const
+ totem.addAttribute('token_retransmits_before_loss_const', str(token_retransmits_before_loss_const))
except KeyError, e:
try:
- totem.removeAttribute('token_retransmit')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- hold = form['hold'].strip()
- if not hold:
- raise KeyError, 'hold'
- hold = int(hold)
- if hold < 1:
- raise ValueError, '%d is not a valid value for hold token timeout' % hold
- totem.addAttribute('hold', str(hold))
- except KeyError, e:
- try:
- totem.removeAttribute('hold')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- retransmits_before_loss = form['retransmits_before_loss'].strip()
- if not retransmits_before_loss:
- raise KeyError, 'retransmits_before_loss'
- retransmits_before_loss = int(retransmits_before_loss)
- if retransmits_before_loss < 1:
- raise ValueError, '%d is an invalid value for number of retransmits before loss' % retransmits_before_loss
- totem.addAttribute('retransmits_before_loss', str(retransmits_before_loss))
- except KeyError, e:
- try:
- totem.removeAttribute('retransmits_before_loss')
+ totem.removeAttribute('token_retransmits_before_loss_const')
except:
pass
except Exception, e:
@@ -1349,22 +1263,6 @@
errors.append(str(e))
try:
- send_join = form['send_join'].strip()
- if not send_join:
- raise KeyError, 'send_join'
- send_join = int(send_join)
- if send_join < 0:
- raise ValueError, '%d is an invalid value for time to wait before sending a join message' % send_join
- totem.addAttribute('send_join', str(send_join))
- except KeyError, e:
- try:
- totem.removeAttribute('send_join')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
consensus = form['consensus'].strip()
if not consensus:
raise KeyError, 'consensus'
@@ -1380,182 +1278,6 @@
except Exception, e:
errors.append(str(e))
- try:
- merge = form['merge'].strip()
- if not merge:
- raise KeyError, 'merge'
- merge = int(merge)
- if merge < 1:
- raise ValueError, '%d is an invalid value for merge detection timeout' % merge
- totem.addAttribute('merge', str(merge))
- except KeyError, e:
- try:
- totem.removeAttribute('merge')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- downcheck = form['downcheck'].strip()
- if not downcheck:
- raise KeyError, 'downcheck'
- downcheck = int(downcheck)
- if downcheck < 1:
- raise ValueError, '%d is an invalid value for interface down check timeout' % downcheck
- totem.addAttribute('downcheck', str(downcheck))
- except KeyError, e:
- try:
- totem.removeAttribute('downcheck')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- fail_to_recv_const = form['fail_to_recv_const'].strip()
- if not fail_to_recv_const:
- raise KeyError, 'fail_to_recv_const'
- fail_to_recv_const = int(fail_to_recv_const)
- if fail_to_recv_const < 1:
- raise ValueError, '%d is an invalid value for fail to receive constant' % fail_to_recv_const
- totem.addAttribute('fail_to_recv_const', str(fail_to_recv_const))
- except KeyError, e:
- try:
- totem.removeAttribute('fail_to_recv_const')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- seqno_unchanged_const = form['seqno_unchanged_const'].strip()
- if not seqno_unchanged_const:
- raise KeyError, 'seqno_unchanged_const'
- seqno_unchanged_const = int(seqno_unchanged_const)
- if seqno_unchanged_const < 1:
- raise ValueError, '%d is an invalid value for rotations with no multicast traffic before merge detection timeout started' % seqno_unchanged_const
- totem.addAttribute('seqno_unchanged_const', str(seqno_unchanged_const))
- except KeyError, e:
- try:
- totem.removeAttribute('seqno_unchanged_const')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- heartbeat_failures_allowed = form['heartbeat_failures_allowed'].strip()
- if not heartbeat_failures_allowed:
- raise KeyError, 'heartbeat_failures_allowed'
- heartbeat_failures_allowed = int(heartbeat_failures_allowed)
- if heartbeat_failures_allowed < 0:
- raise ValueError, '%d is an invalid value for number of heartbeat failures allowed' % heartbeat_failures_allowed
- totem.addAttribute('heartbeat_failures_allowed', str(heartbeat_failures_allowed))
- except KeyError, e:
- try:
- totem.removeAttribute('heartbeat_failures_allowed')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- max_network_delay = form['max_network_delay'].strip()
- if not max_network_delay:
- raise KeyError, 'max_network_delay'
- max_network_delay = int(max_network_delay)
- if max_network_delay < 1:
- raise ValueError, '%d is an invalid value for maximum network delay' % max_network_delay
- totem.addAttribute('max_network_delay', str(max_network_delay))
- except KeyError, e:
- try:
- totem.removeAttribute('max_network_delay')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- window_size = form['window_size'].strip()
- if not window_size:
- raise KeyError, 'window_size'
- window_size = int(window_size)
- if window_size < 1:
- raise ValueError, '%d is an invalid value for window size' % window_size
- totem.addAttribute('window_size', str(window_size))
- except KeyError, e:
- try:
- totem.removeAttribute('window_size')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- max_messages = form['max_messages'].strip()
- if not max_messages:
- raise KeyError, 'max_messages'
- max_messages = int(max_messages)
- if max_messages < 1:
- raise ValueError, '%d is an invalid value for maximum messages' % max_messages
- totem.addAttribute('max_messages', str(max_messages))
- except KeyError, e:
- try:
- totem.removeAttribute('max_messages')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- rrp_problem_count_timeout = form['rrp_problem_count_timeout'].strip()
- if not rrp_problem_count_timeout:
- raise KeyError, 'rrp_problem_count_timeout'
- rrp_problem_count_timeout = int(rrp_problem_count_timeout)
- if rrp_problem_count_timeout < 1:
- raise ValueError, '%d is an invalid value for RRP problem count timeout' % rrp_problem_count_timeout
- totem.addAttribute('rrp_problem_count_timeout', str(rrp_problem_count_timeout))
- except KeyError, e:
- try:
- totem.removeAttribute('rrp_problem_count_timeout')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- rrp_problem_count_threshold = form['rrp_problem_count_threshold'].strip()
- if not rrp_problem_count_threshold:
- raise KeyError, 'rrp_problem_count_threshold'
- rrp_problem_count_threshold = int(rrp_problem_count_threshold)
- if rrp_problem_count_threshold < 1:
- raise ValueError, '%d is an invalid value for RRP problem count threshold' % rrp_problem_count_threshold
- totem.addAttribute('rrp_problem_count_threshold', str(rrp_problem_count_threshold))
- except KeyError, e:
- try:
- totem.removeAttribute('rrp_problem_count_threshold')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
- try:
- rrp_token_expired_timeout = form['rrp_token_expired_timeout'].strip()
- if not rrp_token_expired_timeout:
- raise KeyError, 'rrp_token_expired_timeout'
- rrp_token_expired_timeout = int(rrp_token_expired_timeout)
- if rrp_token_expired_timeout < 1:
- raise ValueError, '%d is an invalid value for RRP token expired timeout' % rrp_token_expired_timeout
- totem.addAttribute('rrp_token_expired_timeout', str(rrp_token_expired_timeout))
- except KeyError, e:
- try:
- totem.removeAttribute('rrp_token_expired_timeout')
- except:
- pass
- except Exception, e:
- errors.append(str(e))
-
if len(errors) > 0:
return (False, {'errors': errors})
return (True, {})
@@ -4173,6 +3895,7 @@
luci_log.debug_verbose('GCI0: unable to determine cluster name')
return {}
+ clumap = {}
if model is None:
try:
model = getModelForCluster(self, cluname)
@@ -4182,9 +3905,12 @@
except Exception, e:
luci_log.debug_verbose('GCI1: unable to get model for cluster %s: %s' % (cluname, str(e)))
return {}
+ else:
+ totem = model.getTotemPtr()
+ if totem:
+ clumap['totem'] = totem.getAttributes()
prop_baseurl = req['URL'] + '?' + PAGETYPE + '=' + CLUSTER_CONFIG + '&' + CLUNAME + '=' + cluname + '&'
- clumap = {}
basecluster_url = prop_baseurl + PROPERTIES_TAB + "=" + PROP_GENERAL_TAB
#needed:
clumap['basecluster_url'] = basecluster_url
@@ -4286,27 +4012,21 @@
clumap['label'] = label
heuristic_kids = qdp.getChildren()
- h_ctr = 0
+
for kid in heuristic_kids:
hmap = {}
- hname = kid.getAttribute('name')
- if hname is None:
- hname = h_ctr
- h_ctr = h_ctr + 1
hprog = kid.getAttribute('program')
- hscore = kid.getAttribute('score')
- hinterval = kid.getAttribute('interval')
if hprog is None:
continue
- if hname is not None:
- hmap['hname'] = hname
- else:
- hmap['hname'] = ""
+
+ hscore = kid.getAttribute('score')
hmap['hprog'] = hprog
if hscore is not None:
hmap['hscore'] = hscore
else:
hmap['hscore'] = ""
+
+ hinterval = kid.getAttribute('interval')
if hinterval is not None:
hmap['hinterval'] = hinterval
else:
next reply other threads:[~2007-02-16 5:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-16 5:29 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-08-24 22:01 [Cluster-devel] conga/luci cluster/form-macros cluster/validat rmccabe
2007-08-24 21:55 rmccabe
2007-08-24 18:42 rmccabe
2007-08-24 18:40 rmccabe
2007-08-09 4:37 rmccabe
2007-08-09 4:34 rmccabe
2007-02-24 7:02 rmccabe
2007-02-16 5:26 rmccabe
2007-02-12 23:28 rmccabe
2007-02-12 23:26 rmccabe
2007-02-09 18:32 rmccabe
2007-02-09 18:30 rmccabe
2007-02-08 3:43 rmccabe
2007-02-08 2:34 rmccabe
2007-02-01 23:48 rmccabe
2007-01-25 19:55 rmccabe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070216052939.23837.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.