Index: luci/site/luci/Extensions/RicciQueries.py =================================================================== RCS file: /cvs/cluster/conga/luci/site/luci/Extensions/RicciQueries.py,v retrieving revision 1.1.4.11 diff -u -r1.1.4.11 RicciQueries.py --- a/luci/site/luci/Extensions/RicciQueries.py 17 Sep 2008 06:29:54 -0000 1.1.4.11 +++ b/luci/site/luci/Extensions/RicciQueries.py 6 Aug 2010 20:15:18 -0000 @@ -13,6 +13,7 @@ luci_log = get_logger() def addClusterNodeBatch(cluster_name, + conf_str, install_base, install_services, install_shared_storage, @@ -22,6 +23,11 @@ reboot_nodes=False): batch = list() + conf = str(conf_str).replace('<?xml version="1.0"?>', '') + conf = conf.replace('<?xml version="1.0" ?>', '') + conf = conf.replace('<? xml version="1.0"?>', '') + conf = conf.replace('<? xml version="1.0" ?>', '') + batch.append('<module name="rpm">') batch.append('<request API_version="1.0">') batch.append('<function_call name="install">') @@ -84,15 +90,7 @@ batch.append('<request API_version="1.0">') batch.append('<function_call name="set_cluster.conf">') batch.append('<var mutable="false" name="propagate" type="boolean" value="false"/>') - batch.append('<var mutable="false" name="cluster.conf" type="xml">') - batch.append('<cluster config_version="1" name="%s">' % cluster_name) - batch.append('<fence_daemon post_fail_delay="0" post_join_delay="3"/>') - batch.append('<clusternodes/>') - batch.append('<cman/>') - batch.append('<fencedevices/>') - batch.append('<rm/>') - batch.append('</cluster>') - batch.append('</var>') + batch.append('<var mutable="false" name="cluster.conf" type="xml">%s</var>' % conf) batch.append('</function_call>') batch.append('</request>') batch.append('</module>') Index: luci/site/luci/Extensions/cluster_adapters.py =================================================================== RCS file: /cvs/cluster/conga/luci/site/luci/Extensions/cluster_adapters.py,v retrieving revision 1.120.2.48 diff -u -r1.120.2.48 cluster_adapters.py --- a/luci/site/luci/Extensions/cluster_adapters.py 26 Jan 2009 17:01:22 -0000 1.120.2.48 +++ b/luci/site/luci/Extensions/cluster_adapters.py 6 Aug 2010 20:15:19 -0000 @@ -545,7 +545,26 @@ try: skeys = system_list.keys() skeys.sort() + + for x in skeys: + i = system_list[x] + 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: + next_node_id += 1 + new_node.attr_hash['nodeid'] = str(next_node_id) + nodesptr.addChild(new_node) + + model.setModified(True) + conf_str = str(model.exportModelAsString()) + if not conf_str: + raise Exception, 'Unable to save the new cluster model' + + # Propagate the new cluster.conf to the existing nodes batch_node = rq.addClusterNodeBatch(clustername, + conf_str, True, True, shared_storage, @@ -559,27 +578,12 @@ raise Exception, 'batch is blank' for x in skeys: - i = system_list[x] system_list[x]['batch'] = batch_node_xml - 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: - next_node_id += 1 - new_node.attr_hash['nodeid'] = str(next_node_id) - nodesptr.addChild(new_node) if incomplete or len(errors) > 0: request.SESSION.set('add_node', add_cluster) return (False, { 'errors': errors, 'messages': messages }) - model.setModified(True) - conf_str = str(model.exportModelAsString()) - if not conf_str: - raise Exception, 'Unable to save the new cluster model' - - # Propagate the new cluster.conf to the existing nodes # before having any of the new nodes join. If this fails, # abort the whole process. result = rq.setClusterConfSync(cluster_ricci, conf_str)