From mboxrd@z Thu Jan 1 00:00:00 1970 From: kupcevic@sourceware.org Date: 21 Dec 2006 21:26:21 -0000 Subject: [Cluster-devel] conga/luci cluster/form-chooser cluster/form-m ... Message-ID: <20061221212621.3296.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Changes by: kupcevic at sourceware.org 2006-12-21 21:26:20 Modified files: luci/cluster : form-chooser form-macros luci/site/luci/Extensions: cluster_adapters.py conga_constants.py Log message: luci: cluster.conf editor Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.14&r2=1.15 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.136&r2=1.137 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.191&r2=1.192 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.31&r2=1.32 --- conga/luci/cluster/form-chooser 2006/12/06 18:38:53 1.14 +++ conga/luci/cluster/form-chooser 2006/12/21 21:26:20 1.15 @@ -152,6 +152,11 @@
+ + +
+ + --- conga/luci/cluster/form-macros 2006/12/21 05:08:48 1.136 +++ conga/luci/cluster/form-macros 2006/12/21 21:26:20 1.137 @@ -825,7 +825,8 @@ - Post Fail Delay + Post Fail Delay + @@ -3871,6 +3872,28 @@

Fence Device Process Form

+
+

Edit cluster.conf

+
+ + + + + + + +
+ --- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/21 05:08:49 1.191 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/21 21:26:20 1.192 @@ -5799,3 +5799,68 @@ % (batch_id, task, desc, objpath, str(e)) luci_log.debug_verbose(errmsg) raise Exception, errmsg + + + + + + + + + + + +def process_cluster_conf_editor(self, req): + clustername = req['clustername'] + msg = '\n' + cc = '' + if 'new_cluster_conf' in req: + cc = req['new_cluster_conf'] + msg += 'Checking if valid XML - ' + cc_xml = None + try: + cc_xml = minidom.parseString(cc) + except: + pass + if cc_xml == None: + msg += 'FAILED\n' + msg += 'Fix the error and try again:\n' + else: + msg += 'PASSED\n' + + msg += 'Making sure no clustername change has accured - ' + new_name = cc_xml.firstChild.getAttribute('name') + if new_name != clustername: + msg += 'FAILED\n' + msg += 'Fix the error and try again:\n' + else: + msg += 'PASSED\n' + + msg += 'Increasing cluster version number - ' + version = cc_xml.firstChild.getAttribute('config_version') + version = int(version) + 1 + cc_xml.firstChild.setAttribute('config_version', str(version)) + msg += 'DONE\n' + + msg += 'Propagating new cluster.conf' + rc = getRicciAgent(self, clustername) + if not rc: + luci_log.debug_verbose('VFA: unable to find a ricci agent for the %s cluster' % clustername) + msg += '\nUnable to contact a ricci agent for cluster ' + clustername + '\n\n' + else: + batch_id, result = setClusterConf(rc, cc_xml.toxml()) + if batch_id is None or result is None: + luci_log.debug_verbose('VFA: setClusterConf: batchid or result is None') + msg += '\nUnable to propagate the new cluster configuration for ' + clustername + '\n\n' + else: + msg += ' - DONE\n' + cc = cc_xml.toxml() + msg += '\n\nALL DONE\n\n' + else: + if getClusterInfo(self, None, req) == {}: + msg = 'invalid cluster' + else: + model = req.SESSION.get('model') + cc = model.exportModelAsString() + return {'msg' : msg, + 'cluster_conf' : cc} --- conga/luci/site/luci/Extensions/conga_constants.py 2006/12/21 03:42:49 1.31 +++ conga/luci/site/luci/Extensions/conga_constants.py 2006/12/21 21:26:20 1.32 @@ -46,6 +46,8 @@ SERVICE_DELETE = '56' FENCEDEV_DELETE = "57" +CONF_EDITOR = '80' + #Cluster tasks CLUSTER_STOP = '1000' CLUSTER_START = '1001'