From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions FenceDaemon.py ...
Date: 6 Nov 2006 17:30:50 -0000 [thread overview]
Message-ID: <20061106173050.27275.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-11-06 17:30:50
Modified files:
luci/site/luci/Extensions: FenceDaemon.py cluster_adapters.py
Log message:
propagate multicast and fence daemon properties
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceDaemon.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.145&r2=1.146
--- conga/luci/site/luci/Extensions/FenceDaemon.py 2006/05/30 20:17:21 1.1
+++ conga/luci/site/luci/Extensions/FenceDaemon.py 2006/11/06 17:30:49 1.2
@@ -27,4 +27,10 @@
val = self.getAttribute("clean_start")
return val
+ def setPostJoinDelay(self, delay):
+ self.addAttribute("post_join_delay", delay)
+
+ def setPostFailDelay(self, delay):
+ self.addAttribute("post_fail_delay", delay)
+
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/05 00:59:09 1.145
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/11/06 17:30:49 1.146
@@ -480,33 +480,51 @@
## Cluster properties form validation routines
+# rhel5 cluster version
def validateMCastConfig(model, form):
+ errors = list()
try:
mcast_val = form['mcast'].strip().lower()
if mcast_val != 'true' and mcast_val != 'false':
raise KeyError, mcast_val
if mcast_val == 'true':
- mcast_val = 1
+ mcast_manual = True
else:
- mcast_val = 0
+ mcast_manual = False
except KeyError, e:
- return (False, {'errors': ['An invalid multicast selection was made']})
-
- if not mcast_val:
- return (True, {'messages': ['Changes accepted. - FILL ME IN']})
+ errors.append('An invalid multicast selection was made')
+ return (False, {'errors': errors})
- try:
- addr_str = form['mcast_addr'].strip()
- socket.inet_pton(socket.AF_INET, addr_str)
- except KeyError, e:
- return (False, {'errors': ['No multicast address was given']})
- except socket.error, e:
+ if mcast_manual == True:
try:
- socket.inet_pton(socket.AF_INET6, addr_str)
+ addr_str = form['mcast_addr'].strip()
+ socket.inet_pton(socket.AF_INET, addr_str)
+ except KeyError, e:
+ errors.append('No multicast address was given')
except socket.error, e:
- return (False, {'errors': ['An invalid multicast address was given: %s' % str(e)]})
+ try:
+ socket.inet_pton(socket.AF_INET6, addr_str)
+ except socket.error, e:
+ errors.append('An invalid multicast address was given: %s')
+ else:
+ addr_str = None
- return (True, {'messages': ['Changes accepted. - FILL ME IN']})
+ if (addr_str is None and mcast_manual != True) or (mcast_manual == True and addr_str == model.getMcastAddr()):
+ errors.append('No multicast configuration changes were made.')
+ return (False, {'errors': errors})
+
+ try:
+ model.usesMulticast = True
+ model.mcast_address = addr_str
+ model.setModified(True)
+ except Exception, e:
+ luci_log.debug('Error updating mcast properties: %s' % str(e))
+ errors.append('Unable to update cluster multicast properties')
+
+ if len(errors) > 0:
+ return (False, {'errors': errors})
+
+ return (True, {})
def validateQDiskConfig(model, form):
errors = list()
@@ -652,10 +670,9 @@
try:
version_num = int(form['cfgver'])
if version_num < old_ver:
- raise ValueError, 'configuration version number must be %d or greater.' \
- % old_ver
- if version_num == old_ver:
- version_num += 1
+ raise ValueError, 'configuration version number must be %d or greater.' % 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:
@@ -684,7 +701,7 @@
except KeyError, e:
errors.append('No post fail delay was given.')
except ValueError, e:
- errors.append('Invalid post fail delay: ' + e)
+ errors.append('Invalid post fail delay: %s' % str(e))
try:
post_join_delay = int(form['post_join_delay'])
@@ -693,12 +710,26 @@
except KeyError, e:
errors.append('No post join delay was given.')
except ValueError, e:
- errors.append('Invalid post join delay: ' + e)
+ errors.append('Invalid post join delay: %s' % str(e))
+
+ try:
+ fd = model.getFenceDaemonPtr()
+ old_pj_delay = fd.getPostJoinDelay()
+ old_pf_delay = fd.getPostFailDelay()
+
+ if post_join_delay == old_pj_delay and post_fail_delay == old_pf_delay:
+ errors.append('No fence daemon properties were changed.')
+ else:
+ fd.setPostJoinDelay(post_join_delay)
+ fd.setPostFailDelay(post_fail_delay)
+ except Exception, e:
+ luci_log.debug_verbose('Unable to update fence daemon properties: %s' % str(e))
+ errors.append('An error occurred while attempting to update fence daemon properties.')
if len(errors) > 0:
return (False, {'errors': errors })
- return (True, {'messages': ['Changes accepted. - FILL ME IN']})
+ return (True, {})
configFormValidators = {
'general': validateGeneralConfig,
@@ -712,7 +743,7 @@
messages = list()
try:
- model = request.SESSION.get('model')
+ model = request.SESSION.get('model')
if not model:
raise Exception, 'model is none'
except Exception, e:
@@ -731,6 +762,12 @@
luci_log.debug_verbose('VCC3: invalid config type: %s' % request.form['configtype'])
return (False, {'errors': ['An invalid configuration type was submitted.']})
+ try:
+ cp = model.getClusterPtr()
+ except:
+ luci_log.debug_verbose('VCC3a: getClusterPtr failed')
+ return (False, {'errors': ['No cluster model was found.']})
+
config_validator = configFormValidators[request.form['configtype']]
ret = config_validator(model, request.form)
@@ -743,6 +780,9 @@
if retcode == True:
try:
+ old_ver = cp.getConfigVersion()
+ # always increment the configuration version
+ model.setConfigVersion(old_ver + 1)
conf_str = str(model.exportModelAsString())
if not conf_str:
raise Exception, 'conf_str is none'
reply other threads:[~2006-11-06 17:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20061106173050.27275.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.