From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions RicciQueries.p ...
Date: 22 Oct 2007 19:29:38 -0000 [thread overview]
Message-ID: <20071022192938.11659.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-10-22 19:29:38
Modified files:
luci/site/luci/Extensions: RicciQueries.py cluster_adapters.py
Log message:
Generate node IDs for RHEL5 cman-based clusters
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.4.6&r2=1.1.4.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.39&r2=1.120.2.40
--- conga/luci/site/luci/Extensions/RicciQueries.py 2007/08/08 21:14:38 1.1.4.6
+++ conga/luci/site/luci/Extensions/RicciQueries.py 2007/10/22 19:29:38 1.1.4.7
@@ -204,9 +204,10 @@
batch.append('<cluster config_version="1" name="%s" alias="%s">' % (cluster_name, cluster_alias))
batch.append('<fence_daemon post_fail_delay="0" post_join_delay="3"/>')
batch.append('<clusternodes>')
+
x = 1
for i in nodeList:
- if os_str == 'rhel4':
+ if gulm_lockservers:
batch.append('<clusternode name="%s" votes="1"/>' % i)
else:
batch.append('<clusternode name="%s" votes="1" nodeid="%d"/>' % (i, x))
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/08/27 18:36:45 1.120.2.39
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/10/22 19:29:38 1.120.2.40
@@ -34,7 +34,7 @@
CLUSTER_ADD, CLUSTER_CONFIG, CLUSTER_DAEMON, CLUSTER_DELETE, \
CLUSTER_FOLDER_PATH, CLUSTER_RESTART, CLUSTER_START, CLUSTER_STOP, \
DISABLE_SVC_TASK, ENABLE_SVC_TASK, FDOM, FDOM_ADD, FENCEDEV, \
- FENCEDEV_NODE_CONFIG, FENCEDEVS, FLAG_DESC, INSTALL_TASK, \
+ FENCEDEV_NODE_CONFIG, FENCEDEVS, FLAG_DESC, INSTALL_TASK, CLUSTER_PROCESS, \
LAST_STATUS, LUCI_DEBUG_MODE, NODE, NODE_ADD, NODE_DELETE, \
NODE_FENCE, NODE_FORCE_DELETE, NODE_JOIN_CLUSTER, NODE_LEAVE_CLUSTER, \
NODE_REBOOT, NODES, POSSIBLE_REBOOT_MESSAGE, PRE_CFG, PRE_INSTALL, \
@@ -544,21 +544,32 @@
request.SESSION.set('add_node', add_cluster)
return (False, { 'errors': errors, 'messages': messages })
+ gulm_ptr = None
+ next_node_id = 1
try:
model = getModelBuilder(None, cluster_ricci, cluster_ricci.dom0())
if not model:
errors.append('Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors' % clustername)
raise Exception, 'unable to get model for %s' % clustername
-
nodesptr = model.getClusterNodesPtr()
- used_ids = {}
+ gulm_ptr = model.getGULMPtr()
+ used_ids = []
+
for i in model.getNodes():
- used_ids[int(i.getAttribute('nodeid'))] = 1
+ if not gulm_ptr:
+ used_ids.append(int(i.getAttribute('nodeid')))
+
node_name = str(i.getAttribute('name'))
if node_name in system_list:
system_list[node_name]['errors'] = True
errors.append('%s is already a member of %s' \
% (node_name, clustername))
+
+ if not gulm_ptr:
+ used_ids.sort()
+ used_list_len = len(used_ids)
+ if used_list_len > 0:
+ next_node_id = used_ids[used_list_len - 1] + 1
except Exception, e:
incomplete = True
errors.append('Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors' % clustername)
@@ -569,8 +580,6 @@
request.SESSION.set('add_node', add_cluster)
return (False, { 'errors': errors, 'messages': messages })
- next_node_id = 1
-
try:
for x in system_list:
i = system_list[x]
@@ -606,13 +615,13 @@
% (cur_host, e, str(e)))
continue
- next_node_id += 1
new_node = ClusterNode()
new_node.attr_hash['name'] = str(i['host'])
new_node.attr_hash['votes'] = str(1)
- while next_node_id in used_ids:
+
+ if not gulm_ptr:
+ new_node.attr_hash['nodeid'] = str(next_node_id)
next_node_id += 1
- new_node.attr_hash['nodeid'] = str(next_node_id)
nodesptr.addChild(new_node)
if incomplete or len(errors) > 0:
@@ -2318,14 +2327,16 @@
luci_log.debug('CTP0: no cluster task')
return 'No cluster task was given'
+ cluname = fvar['clustername']
if not model:
- cluname = fvar['clustername']
model = LuciExtractCluModel(self, request, cluname)
if model is None:
if LUCI_DEBUG_MODE is True:
luci_log.debug_verbose('CTP2: No cluster model for %s' \
% cluname)
return 'Unable to retrieve the cluster configuration for %s. The configuration XML may contain errors.' % cluname
+ elif cluname is None:
+ cluname = model.getClusterName()
redirect_page = NODES
if task == CLUSTER_STOP:
@@ -2335,8 +2346,11 @@
from LuciClusterActions import ClusterStart
ClusterStart(self, model)
elif task == CLUSTER_RESTART:
- from LuciClusterActions import ClusterRestart
- ClusterRestart(self, model)
+ from LuciClusterActions import ClusterStop
+ ClusterStop(self, model)
+ request.RESPONSE.redirect('%s?pagetype=%s&clustername=%s&task=%s&busyfirst=true' \
+ % (baseurl, CLUSTER_PROCESS, cluname, CLUSTER_START))
+ return
elif task == CLUSTER_DELETE:
from LuciClusterActions import ClusterDelete
ret = ClusterDelete(self, model)
next reply other threads:[~2007-10-22 19:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-22 19:29 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-10-09 20:20 [Cluster-devel] conga/luci/site/luci/Extensions RicciQueries.p 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=20071022192938.11659.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.