From mboxrd@z Thu Jan 1 00:00:00 1970 From: jparsons@sourceware.org Date: 4 Oct 2006 16:05:44 -0000 Subject: [Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ... Message-ID: <20061004160544.23723.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: jparsons at 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 = '' batch += '' batch += '' @@ -724,8 +724,14 @@ batch += '' batch += '' + x = 0 for i in nodeList: - batch += '' + if os_str == "rhel4": + batch += '' + else: + batch += '' + x = x + 1 + batch += '' if len(nodeList) == 2: