[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons sourceware org	2006-10-04 16:05:43

Modified files:
	luci/site/luci/Extensions: cluster_adapters.py ricci_bridge.py 

Log message:
	os version schtuff

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.20&r2=1.21

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/04 15:11:10	1.81
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/04 16:05:43	1.82
@@ -139,8 +139,12 @@
 
 	if cluster_properties['isComplete'] == True:
 		from ricci_communicator import RicciCommunicator
+    rc = RicciCommunicator(nodeList[0]['ricci_host'])
+    os_str = resolveOSType(rc.os())
+    if os_str == None:
+      os_str = "rhel5"  #Backup plan in case all is almost lost...
 
-		batchNode = createClusterBatch(clusterName, clusterName, map(lambda x: x['ricci_host'], nodeList), True, False, False)
+		batchNode = createClusterBatch(os_str, clusterName, clusterName, map(lambda x: x['ricci_host'], nodeList), True, False, False)
 		if not batchNode:
 			nodeUnauth(nodeList)
 			cluster_properties['isComplete'] = False
@@ -155,6 +159,7 @@
 			return (False, {'errors': errors, 'requestResults':cluster_properties })
 
 		batch_id_map = {}
+    rc = None
 		for i in nodeList:
 			try:
 				rc = RicciCommunicator(i['ricci_host'])
@@ -2164,10 +2169,17 @@
 	ricci_agent = resolve_nodename(self, clustername, ragent)
 	rc = RicciCommunicator(ricci_agent)
 	map = {}
-	map['os'] = rc.os()
+  os_str = resolveOSType(rc.os())
+	map['os'] = os_str
 	map['isVirtualized'] = rc.dom0()
 	return map
 
+def resolveOSType(os):
+  if os.find("Tikanga") != (-1) or os.find("FC6") != (-1):
+    return "rhel5"
+  else:
+    return "rhel4"
+
 def getResourcesInfo(modelb, request):
 	resList = list()
 	baseurl = request['URL']
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/09/29 21:41:43	1.20
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/04 16:05:43	1.21
@@ -686,7 +686,7 @@
 
 	return minidom.parseString(batch).firstChild
 
-def createClusterBatch(cluster_name, cluster_alias, nodeList, services, shared_storage, LVS):
+def createClusterBatch(os_str, cluster_name, cluster_alias, nodeList, services, shared_storage, LVS):
     batch = '<?xml version="1.0" ?>'
     batch += '<batch>'
     batch += '<module name="rpm">'
@@ -724,8 +724,14 @@
     batch += '<fence_daemon post_fail_delay="0" post_join_delay="3"/>'
 
     batch += '<clusternodes>'
+    x = 0
     for i in nodeList:
-        batch += '<clusternode name="' + i + '" votes="1" />'
+        if os_str == "rhel4":
+          batch += '<clusternode name="' + i + '" votes="1" />'
+        else:
+          batch += '<clusternode name="' + i + '" votes="1" nodeid="' + x + '" />'
+        x = x + 1
+
     batch += '</clusternodes>'
 
     if len(nodeList) == 2:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]