conga/luci/site/luci/Extensions ricci_bridge.py
CVSROOT: /cvs/cluster
Module name: conga
Changes by: jparsons at sourceware.org 2006-08-12 18:59:40
Modified files:
luci/site/luci/Extensions: ricci_bridge.py
Log message:
new helper functions
luci/site/luci/Extensions/ricci_bridge.py +54 -0
@@ -526,6 +526,59 @@ batch_number, result = self.batchAttemptResult(payload) return (batch_number, result) + def nodeLeaveCluster(self, cluster_shutdown=False): + cshutdown = "false" + if cluster_shutdown == True: + cshutdown = "true" + QUERY_STR='<?xml version="1.0" ?><ricci async="true" function="process_batch" version="1.0"><batch><module name="cluster"><request sequence="111" API_version="1.0"><function_call name="stop_node"><var mutable="false" name="cluster_shutdown" type="boolean" value="' + cshutdown + '"/></function_call></request></module></batch></ricci>' + + try: + payload = self.makeConnection(QUERY_STR) + except RicciReceiveError, r: + return None + + batch_number, result = self.batchAttemptResult(payload) + + return (batch_number, result) + + def nodeJoinCluster(self, cluster_startup=False): + cstartup = "false" + if cluster_startup == True: + cstartup = "true" + QUERY_STR='<?xml version="1.0" ?><ricci async="true" function="process_batch" version="1.0"><batch><module name="cluster"><request sequence="111" API_version="1.0"><function_call name="start_node"><var mutable="false" name="cluster_startup" type="boolean" value="' + cstartup + '"/></function_call></request></module></batch></ricci>' + + try: + payload = self.makeConnection(QUERY_STR) + except RicciReceiveError, r: + return None + + batch_number, result = self.batchAttemptResult(payload) + + return (batch_number, result) + + def nodeReboot(self): + QUERY_STR='<?xml version="1.0" ?><ricci async="true" function="process_batch" version="1.0"><batch><module name="reboot"><request sequence="111" API_version="1.0"><function_call name="reboot_now"/></request></module></batch></ricci>' + + try: + payload = self.makeConnection(QUERY_STR) + except RicciReceiveError, r: + return None + + batch_number, result = self.batchAttemptResult(payload) + + return (batch_number, result) + + def nodeFence(self, nodename): + QUERY_STR='<?xml version="1.0" ?><ricci async="true" function="process_batch" version="1.0"><batch><module name="cluster"><request sequence="111" API_version="1.0"><function_call name="fence_node"><var mutable="false" name="nodename" type="string" value="' + nodename + '"/></function_call></request></module></batch></ricci>' + + try: + payload = self.makeConnection(QUERY_STR) + except RicciReceiveError, r: + return None + + batch_number, result = self.batchAttemptResult(payload) + + return (batch_number, result) def createClusterBatch(cluster_name, cluster_alias, nodeList, services, shared_storage, LVS): batch = '<?xml version="1.0" ?>'
@@ -592,3 +645,4 @@ batch += '</batch>' return minidom.parseString(batch).firstChild +