[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:	kupcevic sourceware org	2006-10-10 21:33:29

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

Log message:
	luci: backend support for selection of what to install during deployment

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.87&r2=1.88
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.22&r2=1.23

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/09 20:21:58	1.87
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/10 21:33:29	1.88
@@ -158,7 +158,14 @@
 		return (False, {'errors': errors, 'requestResults':cluster_properties })
 
 	if cluster_properties['isComplete'] == True:
-		batchNode = createClusterBatch(cluster_os, clusterName, clusterName, map(lambda x: x['ricci_host'], nodeList), True, False, False)
+		batchNode = createClusterBatch(cluster_os,
+					       clusterName,
+					       clusterName,
+					       map(lambda x: x['ricci_host'], nodeList),
+					       True,
+					       True,
+					       False,
+					       False)
 		if not batchNode:
 			nodeUnauth(nodeList)
 			cluster_properties['isComplete'] = False
@@ -250,7 +257,11 @@
 	while i < len(nodeList):
 		clunode = nodeList[i]
 		try:
-			batchNode = addClusterNodeBatch(clusterName, True, False, False)
+			batchNode = addClusterNodeBatch(clusterName,
+							True,
+							True,
+							False,
+							False)
 			if not batchNode:
 				raise
 			del nodeList[i]
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/09 20:17:29	1.22
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2006/10/10 21:33:29	1.23
@@ -635,31 +635,49 @@
     #parse out log entry  
     return payload
 
-def addClusterNodeBatch(cluster_name, services, shared_storage, LVS):
+def addClusterNodeBatch(cluster_name,
+                        install_base,
+                        install_services,
+                        install_shared_storage,
+                        install_LVS):
 	batch = '<?xml version="1.0" ?>'
 	batch += '<batch>'
+        
+        
 	batch += '<module name="rpm">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="install">'
 	batch += '<var name="sets" type="list_xml">'
-	batch += '<set name="Cluster Base"/>'
-	if services:
-		batch += '<set name="Cluster Service Manager"/>'
-	if shared_storage:
-		batch += '<set name="Clustered Storage"/>'
-	if LVS:
-		batch += '<set name="Linux Virtual Server"/>'
+	if install_base:
+          batch += '<set name="Cluster Base"/>'
+        if install_services:
+          batch += '<set name="Cluster Service Manager"/>'
+	if install_shared_storage:
+          batch += '<set name="Clustered Storage"/>'
+	if install_LVS:
+          batch += '<set name="Linux Virtual Server"/>'
 	batch += '</var>'
 	batch += '</function_call>'
 	batch += '</request>'
 	batch += '</module>'
-
-	batch += '<module name="reboot">'
-	batch += '<request API_version="1.0">'
-	batch += '<function_call name="reboot_now"/>'
-	batch += '</request>'
-	batch += '</module>'
-
+        
+        
+	need_reboot = install_base or install_services or install_shared_storage or install_LVS
+        if need_reboot:
+          batch += '<module name="reboot">'
+          batch += '<request API_version="1.0">'
+          batch += '<function_call name="reboot_now"/>'
+          batch += '</request>'
+          batch += '</module>'
+        else:
+          # need placeholder instead of reboot
+          batch += '<module name="rpm">'
+          batch += '<request API_version="1.0">'
+          batch += '<function_call name="install"/>'
+          batch += '</request>'
+          batch += '</module>'
+        
+        
 	batch += '<module name="cluster">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="set_cluster.conf">'
@@ -676,45 +694,65 @@
 	batch += '</function_call>'
 	batch += '</request>'
 	batch += '</module>'
-
+        
+        
 	batch += '<module name="cluster">'
 	batch += '<request API_version="1.0">'
 	batch += '<function_call name="start_node"/>'
 	batch += '</request>'
 	batch += '</module>'
+        
+        
 	batch += '</batch>'
 
 	return minidom.parseString(batch).firstChild
 
-def createClusterBatch(os_str, cluster_name, cluster_alias, nodeList, services, shared_storage, LVS):
+def createClusterBatch(os_str,
+                       cluster_name,
+                       cluster_alias,
+                       nodeList,
+                       install_base,
+                       install_services,
+                       install_shared_storage,
+                       install_LVS):
     batch = '<?xml version="1.0" ?>'
     batch += '<batch>'
+    
+    
     batch += '<module name="rpm">'
     batch += '<request API_version="1.0">'
     batch += '<function_call name="install">'
     batch += '<var name="sets" type="list_xml">'
-    batch += '<set name="Cluster Base"/>'
-
-    if services:
-        batch += '<set name="Cluster Service Manager"/>'
-
-    if shared_storage:
-        batch += '<set name="Clustered Storage"/>'
-
-    if LVS:
-        batch += '<set name="Linux Virtual Server"/>'
-
+    if install_base:
+      batch += '<set name="Cluster Base"/>'
+    if install_services:
+      batch += '<set name="Cluster Service Manager"/>'
+    if install_shared_storage:
+      batch += '<set name="Clustered Storage"/>'
+    if install_LVS:
+      batch += '<set name="Linux Virtual Server"/>'
     batch += '</var>'
     batch += '</function_call>'
     batch += '</request>'
     batch += '</module>'
     
-    batch += '<module name="reboot">'
-    batch += '<request API_version="1.0">'
-    batch += '<function_call name="reboot_now"/>'
-    batch += '</request>'
-    batch += '</module>'
     
+    need_reboot = install_base or install_services or install_shared_storage or install_LVS
+    if need_reboot:
+      batch += '<module name="reboot">'
+      batch += '<request API_version="1.0">'
+      batch += '<function_call name="reboot_now"/>'
+      batch += '</request>'
+      batch += '</module>'
+    else:
+      # need placeholder instead of reboot
+      batch += '<module name="rpm">'
+      batch += '<request API_version="1.0">'
+      batch += '<function_call name="install"/>'
+      batch += '</request>'
+      batch += '</module>'
+    
+      
     batch += '<module name="cluster">'
     batch += '<request API_version="1.0">'
     batch += '<function_call name="set_cluster.conf">'
@@ -747,6 +785,7 @@
     batch += '</request>'
     batch += '</module>'
     
+    
     batch += '<module name="cluster">'
     batch += '<request API_version="1.0">'
     batch += '<function_call name="start_node">'
@@ -754,7 +793,9 @@
     batch += '</function_call>'
     batch += '</request>'
     batch += '</module>'
+    
+    
     batch += '</batch>'
-
+    
     return minidom.parseString(batch).firstChild
 


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