Skip to contentSkip to conversation

conga/luci cluster/form-macros cluster/index_h ...

Cluster-devel [email protected] 1 participant 1 message Oct 16, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-10-16 04:26:19

Modified files:
luci/cluster : form-macros index_html resource-form-macros
luci/site/luci/Extensions: ricci_communicator.py
homebase_adapters.py conga_constants.py ricci_bridge.py cluster_adapters.py Variable.py PropsObject.py

Log message:
all sorts of fixes and cleanups..

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.84&r2=1.85
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.110&r2=1.111
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Variable.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/PropsObject.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

luci/cluster/form-macros +41 -29
@@ -58,21 +58,24 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? cluster list');
 	</script>
+
 <div id="cluster_list">
 <div class="cluster" tal:repeat="clu clusystems">
-	<tal:block tal:define="global ragent python: here.getRicciAgent(clu)" />
 
- <span tal:condition="python: ragent == ''">
-    <strong class="errmsgs">An error occurred when trying to contact any of the nodes in the <span tal:replace="python: clu[0]"/> cluster.</strong>
-  <hr/>
-  </span>
+	<tal:block tal:define="
+		global ragent python: here.getRicciAgent(clu[0])" />
 
-  <span tal:condition="python: ragent != ''">
-	<tal:block
-			tal:define="global stat python: here.getClusterStatus(ragent);
-			global cstatus python: here.getClustersInfo(stat,request);
+	<div tal:condition="python: not ragent">
+		<strong class="errmsgs">An error occurred when trying to contact any of the nodes in the <span tal:replace="python: clu[0]"/> cluster.</strong>
+		<hr/>
+	</div>
+
+	<tal:block tal:condition="python: ragent">
+		<tal:block tal:define="
+			global stat python: here.getClusterStatus(ragent);
+			global cstatus python: here.getClustersInfo(stat, request);
 			global cluster_status python: 'cluster ' + (('running' in cstatus and cstatus['running'] == 'true') and 'running' or 'stopped');"
- 	/>
+	 	/>
 
 	<table class="cluster" width="100%">
 	<tr class="cluster info_top">
@@ -151,7 +154,7 @@
 	</tr>
 	</table>
 	<hr>
- </span>
+ </tal:block>
 </div>
 </div>
 </div>
@@ -348,10 +351,8 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? Configure cluster properties');
 	</script>
-	<tal:comment tal:replace="nothing">
-		<span tal:define="global ricci_agent python: here.getRicciAgentForCluster(request)"/>
-	</tal:comment>
 
+	<span tal:define="global ricci_agent python: here.getRicciAgentForCluster(request)" />
 	<tal:block
 		tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
 
@@ -1129,9 +1130,9 @@
 		global ricci_agent python: here.getRicciAgentForCluster(request);
 		global nodestatus python: here.getClusterStatus(ricci_agent);
 		global nodeinfo python: here.getNodeInfo(modelb, nodestatus, request);
-		global fenceinfo python: here.getFenceInfo(modelb, request);
 		global status_class python: 'node_' + (nodeinfo['nodestate'] == '0' and 'active' or (nodeinfo['nodestate'] == '1' and 'inactive' or 'unknown'));
-		global cluster_node_status_str python: (nodeinfo['nodestate'] == '0' and 'Cluster member' or (nodeinfo['nodestate'] == '1' and 'Currently not a cluster participant' or 'This node is not responding'));"
+		global cluster_node_status_str python: (nodeinfo['nodestate'] == '0' and 'Cluster member' or (nodeinfo['nodestate'] == '1' and 'Currently not a cluster participant' or 'This node is not responding'));
+		global fenceinfo python: here.getFenceInfo(modelb, request)"
 	/>
 
 	 <table class="cluster node" width="100%">
@@ -1317,10 +1318,11 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? nodes');
 	</script>
+
 <div id="node_list" tal:define="
 	global ricci_agent python: here.getRicciAgentForCluster(request);
 	global status python: here.getClusterStatus(ricci_agent);
-	global nds python: here.getNodesInfo(modelb,status,request)">
+	global nds python: here.getNodesInfo(modelb, status, request)">
 
 	<div tal:repeat="nd nds">
 		<tal:block
@@ -1532,6 +1534,7 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? services');
 	</script>
+
 	<tal:block tal:omit-tag=""
 		tal:define="
 			global ricci_agent python: here.getRicciAgentForCluster(request);
@@ -1657,8 +1660,11 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? services ??? Start a service');
 	</script>
-	<span tal:define="global ricci_agent python: here.getRicciAgentForCluster(request)"/>
-	<span tal:define="result python: here.serviceStart(ricci_agent, request)"/>
+
+	<tal:block tal:define="
+		global ricci_agent python: here.getRicciAgentForCluster(request);
+		result python: here.serviceStart(ricci_agent, request)" />
+
 	<!-- <span metal:use-macro="here/form-macros/macros/serviceconfig-form"/> -->
 </div>
 
@@ -1667,8 +1673,11 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? services ??? Restart a service');
 	</script>
-	<span tal:define="global ricci_agent python: here.getRicciAgentForCluster(request)"/>
-	<span tal:define="result python: here.serviceRestart(ricci_agent, request)"/>
+
+	<tal:block tal:define="
+		global ricci_agent python: here.getRicciAgentForCluster(request);
+		result python: here.serviceRestart(ricci_agent, request)" />
+
 	<!-- <span metal:use-macro="here/form-macros/macros/serviceconfig-form"/> -->
 </div>
 
@@ -1676,8 +1685,11 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? services ??? Stop a service');
 	</script>
-	<span tal:define="global ricci_agent python: here.getRicciAgentForCluster(request)"/>
-	<span tal:define="result python: here.serviceStop(ricci_agent,request)"/>
+
+	<span tal:define="
+		global ricci_agent python: here.getRicciAgentForCluster(request);
+		result python: here.serviceStop(ricci_agent, request)" />
+
 	<!-- <span metal:use-macro="here/form-macros/macros/serviceconfig-form"/> -->
 </div>
 
@@ -1720,7 +1732,7 @@
 		global ricci_agent python: here.getRicciAgentForCluster(request);
 		global global_resources python: here.getResourcesInfo(modelb, request);
 		global sstat python: here.getClusterStatus(ricci_agent);
-		global sinfo python: here.getServiceInfo(sstat, modelb,request);
+		global sinfo python: here.getServiceInfo(sstat, modelb, request);
 		global running sinfo/running | nothing;" />
 
 	<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>'" />
@@ -1880,11 +1892,11 @@
 	<script type="text/javascript">
 		set_page_title('Luci ??? cluster ??? failover domains');
 	</script>
-	<tal:block
-		tal:define="
-			global ragent python: here.getRicciAgentForCluster(request);
-			global sta python: here.getClusterStatus(ragent);
-			global fdominfo python: here.getFdomsInfo(modelb, request, sta);" />
+
+	<tal:block tal:define="
+		global ragent python: here.getRicciAgentForCluster(request);
+		global sta python: here.getClusterStatus(ragent);
+		global fdominfo python: here.getFdomsInfo(modelb, request, sta);" />
 
 	<div class="cluster fdom" tal:repeat="fdom fdominfo">
 	<div class="cluster fdom fdomname">
luci/cluster/index_html +12 -5
@@ -34,9 +34,11 @@
     <span tal:condition="not: hascluster">
     <meta googaa="ooo"/>
     </span>
+
     <span tal:condition="hascluster">
       <span tal:define="ri_agent python:here.getRicciAgentForCluster(request)">
-        <span tal:define="resmap python:here.getClusterOS(ri_agent,request);
+
+        <span tal:define="resmap python:here.getClusterOS(ri_agent);
                           global isVirtualized resmap/isVirtualized;
                           global os_version resmap/os;"/>
       </span>
@@ -52,6 +54,7 @@
         <meta http-equiv="refresh" content="" tal:attributes="content isBusy/refreshurl"/> 
        </span>
     </span>
+
       <tal:comment replace="nothing"> A slot where you can insert elements in the header from a template </tal:comment>
     </metal:headslot>
 
@@ -156,10 +159,14 @@
       prefer layouts that don't use tables.
       </tal:comment>
     <!-- <div tal:define="global hascluster request/clustername |nothing"/>  -->
-    <span tal:condition="hascluster">
-    <span tal:define="global ricci_agent python:here.getRicciAgentForCluster(request)"/>
-    <div tal:omit-tag="" tal:define="global modelb python:here.getmodelbuilder(ricci_agent)" />
-    </span>
+
+    <tal:block tal:condition="hascluster">
+	    <tal:block tal:define="global ricci_agent python: here.getRicciAgentForCluster(request)" />
+		<tal:block tal:condition="ricci_agent"
+			tal:define="
+				global modelb python:here.getmodelbuilder(ricci_agent)" />
+    </tal:block>
+
       <table id="portal-columns">
         <tbody>
           <tr>
luci/cluster/resource-form-macros +3 -4
@@ -93,9 +93,8 @@
 	<h2>Resources Remove Form</h2>
 
 	<tal:block tal:define="
-		ragent python: here.getRicciAgentForCluster(request);
-		msg python: here.delResource(request, ragent)">
-		<div tal:condition="msg" tal:content="msg" />
+		msg python: here.delResource(here.getRicciAgentForCluster(request), request)">
+		<span class="error" tal:condition="msg" tal:content="msg" />
 	</tal:block>
 </div>
 
@@ -243,7 +242,7 @@
 	<h2>Resource <span tal:replace="python: ('edit' in request and request['edit']) and 'Edited' or 'Added'" /></h2>
 
 	<div tal:content="
-		python: here.addResource(request, here.getRicciAgentForCluster(request))" />
+		python: here.addResource(here.getRicciAgentForCluster(request), request)" />
 </div>
 
 <div metal:define-macro="resourceconfig-form">
luci/site/luci/Extensions/ricci_communicator.py +17 -7
@@ -10,8 +10,7 @@
 from HelperFunctions import access_to_host_allowed
 
 
-CERTS_DIR_PATH='/var/lib/luci/var/certs/'
-
+CERTS_DIR_PATH = '/var/lib/luci/var/certs/'
 
 class RicciCommunicator:
     def __init__(self, hostname, port=11111):
@@ -38,14 +37,12 @@
         self.__reported_hostname = hello.firstChild.getAttribute('hostname')
         self.__os = hello.firstChild.getAttribute('os')
         self.__dom0 = hello.firstChild.getAttribute('xen_host') == 'true'
-        
+
         pass
     
     
     def hostname(self):
         return self.__hostname
-    
-    
     def authed(self):
         return self.__authed
     def system_name(self):
@@ -126,9 +123,22 @@
                     batch_node = node.cloneNode(True)
         if batch_node == None:
             raise 'missing <batch/> in ricci\'s response'
+
         return batch_node
     
-    
+    def batch_run(self, batch_str, async=True):
+        try:
+            batch_xml_str = '<?xml version="1.0" ?><batch>' + batch_str + '</batch>'
+            batch_xml = minidom.parseString(batch_xml_str).firstChild
+        except:
+            return None
+
+        try:
+            ricci_xml = self.process_batch(batch_xml, async)
+        except:
+            return None
+        return ricci_xml
+
     def batch_report(self, batch_id):
         if not self.authed():
             raise 'not authenticated'
@@ -339,5 +349,5 @@
                     elif status == '5':
                         return -103, 'module removed from schedule'
     
-    raise 'no ' + str(module_num) + 'th module in the batch, or malformed response'
+    raise Exception, str('no ' + str(module_num) + 'th module in the batch, or malformed response')
 
luci/site/luci/Extensions/homebase_adapters.py +33 -36

84 lines not on this page · raw message

luci/site/luci/Extensions/conga_constants.py +6 -0
@@ -94,6 +94,7 @@
 REDIRECT_MSG="  You will be redirected in 5 seconds. Please fasten your safety restraints."
 
 
+# Homebase-specific constants
 HOMEBASE_ADD_USER="1"
 HOMEBASE_ADD_SYSTEM="2"
 HOMEBASE_PERMS="3"
@@ -102,4 +103,9 @@
 HOMEBASE_ADD_CLUSTER="6"
 HOMEBASE_ADD_CLUSTER_INITIAL="7"
 
+# Cluster node exception attribute flags
+CLUSTER_NODE_NEED_AUTH = 0x01
+CLUSTER_NODE_NOT_MEMBER = 0x02
+CLUSTER_NODE_ADDED = 0x04
+
 PLONE_ROOT='luci'
luci/site/luci/Extensions/ricci_bridge.py +427 -772

1,237 lines not on this page · raw message

luci/site/luci/Extensions/cluster_adapters.py +749 -510

1,408 lines not on this page · raw message

luci/site/luci/Extensions/Variable.py +0 -1

Lines of this file are not shown. View the raw message.

luci/site/luci/Extensions/PropsObject.py +0 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.