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

jparsons at sourceware.org jparsons at sourceware.org
Wed Oct 11 20:58:13 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons at sourceware.org	2006-10-11 20:58:13

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

Log message:
	added laststatus field to props

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.93&r2=1.94
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.12&r2=1.13

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/11 17:43:30	1.93
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/11 20:58:13	1.94
@@ -232,6 +232,7 @@
     flag.manage_addProperty(BATCH_ID,batch_id, "string")
     flag.manage_addProperty(TASKTYPE,CLUSTER_ADD, "string")
     flag.manage_addProperty(FLAG_DESC,"Creating node " + key + " for cluster " + clusterName, "string")
+    flag.manage_addProperty(LAST_STATUS, 0, "int")
 
 
 def validateAddClusterNode(self, request):
@@ -2236,11 +2237,22 @@
       node_report['iserror'] = False  #Default value
       node_report['desc'] = item[1].getProperty(FLAG_DESC) 
       ricci = item[0].split("____") #This removes the 'flag' suffix
-      rc = RicciCommunicator(ricci[0])
-      batch_xml = rc.batch_report(item[1].getProperty(BATCH_ID))
-      (creation_status, total) = batch_status(batch_xml)
+      try:
+        rc = RicciCommunicator(ricci[0])
+        batch_xml = rc.batch_report(item[1].getProperty(BATCH_ID))
+        (creation_status, total) = batch_status(batch_xml)
+      except:
+        creation_status = RICCI_CONNECT_FAILURE  #No contact with ricci (-1000)
+
       if creation_status < 0:  #an error was encountered
-        if creation_status == -(INSTALL_TASK):
+        if creation_status == RICCI_CONNECT_FAILURE:
+          laststatus = item[1].getProperty(LAST_STATUS)
+          if laststatus == INSTALL_TASK: #This means maybe node is rebooting
+            nodereport['statusindex'] = INSTALL_TASK
+            nodereport['statusmessage'] = POSSIBLE_REBOOT_MESSAGE
+            nodereports.append(node_report)
+            continue
+        elif creation_status == -(INSTALL_TASK):
           node_report['iserror'] = True
           (err_code, err_msg) = extract_module_status(batch_xml, INSTALL_TASK)
           node_report['errormessage'] = CLUNODE_CREATE_ERRORS[INSTALL_TASK] + err_msg
@@ -2275,7 +2287,7 @@
           node_report['statusmessage'] = "Node still being created"
           node_report['statusindex'] = creation_status
           nodereports.append(node_report)
-          clusterfolder.manage_delObjects(item[0])
+          item[1].manage_addProperty(LAST_STATUS,creation_status, "int")
           continue
           
     else:
--- conga/luci/site/luci/Extensions/conga_constants.py	2006/10/10 21:26:01	1.12
+++ conga/luci/site/luci/Extensions/conga_constants.py	2006/10/11 20:58:13	1.13
@@ -58,6 +58,7 @@
 CLUNAME="clustername"
 BATCH_ID="batch_id"
 FLAG_DESC="flag_desc"
+LAST_STATUS="last_status"
 
 PATH_TO_PRIVKEY="/var/lib/luci/var/certs/privkey.pem"
 PATH_TO_CACERT="/var/lib/luci/var/certs/cacert.pem"
@@ -75,6 +76,9 @@
 REBOOT_TASK=2
 SEND_CONF=3
 START_NODE=4
+RICCI_CONNECT_FAILURE=(-1000)
 
 #cluster/node create error messages
 CLUNODE_CREATE_ERRORS = ["An unknown error occurred when creating this node: ", "A problem occurred when installing packages: ","A problem occurred when rebooting this node: ", "A problem occurred when propagating the configuration to this node: ", "A problem occurred when starting this node: "]
+
+POSSIBLE_REBOOT_MESSAGE="This node is not currently responding and is probably<br/>rebooting as planned. This state should persist for 5 minutes or so..."




More information about the Cluster-devel mailing list