CVSROOT:        /cvs/cluster
Module name:    conga
Branch:         RHEL5
Changes by:     [email protected]  2010-08-06 20:17:22

Modified files:
        luci/site/luci/Extensions: FenceHandler.py RicciQueries.py 
                                   cluster_adapters.py 

Log message:
        Fix rhbz#612300 - conga will fail to start a new node that is added via 
luci

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.20&r2=1.4.2.21
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.11&r2=1.1.4.12
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.48&r2=1.120.2.49

--- conga/luci/site/luci/Extensions/FenceHandler.py     2010/08/05 19:06:35     
1.4.2.20
+++ conga/luci/site/luci/Extensions/FenceHandler.py     2010/08/06 20:17:20     
1.4.2.21
@@ -650,45 +650,34 @@
                fencedev.removeAttribute('secure')
 
        try:
-               vmlogin = form['vmlogin'].strip()
-               if not vmlogin:
+               vmware_type = form['vmware_type'].strip()
+               if not vmware_type in ('esx', 'server1', 'server2'):
+                       vmware_type = None
                        raise Exception, 'blank'
-               fencedev.addAttribute('vmlogin', vmlogin)
-       except Exception, e:
-               errors.append(FD_PROVIDE_VMLOGIN)
-
-       has_vmpasswd = False
-       try:
-               vmpwd = form['vmpasswd'].strip()
-               if not vmpwd:
-                       # Allow passwords that consist of only spaces.
-                       if not form.has_key('vmpasswd') or form['vmpasswd'] == 
'':
-                               raise Exception, 'blank'
-                       else:
-                               vmpwd = form['vmpasswd']
-               fencedev.addAttribute('vmpasswd', vmpwd)
-               has_vmpasswd = True
+               fencedev.addAttribute('vmware_type', vmware_type)
        except Exception, e:
                try:
-                       fencedev.removeAttribute('vmpasswd')
+                       fencedev.removeAttribute('vmware_type')
                except:
                        pass
 
-       try:
-               vmpwd_script = form['vmpasswd_script'].strip()
-               if not vmpwd_script:
-                       raise Exception, 'blank'
-               fencedev.addAttribute('vmpasswd_script', vmpwd_script)
-               has_vmpasswd = True
-       except Exception, e:
+       if not vmware_type in ('server1', 'server2'):
                try:
-                       fencedev.removeAttribute('vmpasswd_script')
+                       vmware_dc = form['vmware_datacenter'].strip()
+                       if not vmware_dc:
+                               raise Exception, 'blank'
+                       fencedev.addAttribute('vmware_datacenter', vmware_dc)
+               except Exception, e:
+                       try:
+                               fencedev.removeAttribute('vmware_datacenter')
+                       except:
+                               pass
+       else:
+               try:
+                       fencedev.removeAttribute('vmware_datacenter')
                except:
                        pass
 
-       if not has_vmpasswd:
-               errors.append(FD_PROVIDE_VMPASSWD)
-
        return errors
 
 def val_noop_fd(dummy, _dummy):
--- conga/luci/site/luci/Extensions/RicciQueries.py     2008/09/17 06:29:54     
1.1.4.11
+++ conga/luci/site/luci/Extensions/RicciQueries.py     2010/08/06 20:17:20     
1.1.4.12
@@ -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>')
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2009/01/26 17:01:22     
1.120.2.48
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2010/08/06 20:17:21     
1.120.2.49
@@ -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)

Reply via email to