- added a checked time value
authorStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 9 Apr 2008 17:13:58 +0000 (17:13 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Wed, 9 Apr 2008 17:13:58 +0000 (17:13 +0000)
- added new kernel version.  need a better way to do this.

findbad.py

index d1ee263..7c0a289 100755 (executable)
@@ -54,6 +54,9 @@ def collectPingAndSSH(nodename, cohash):
        else:
                values['ping'] = "PING"
 
+       #uptime = soltesz.SSH('root', nodename)
+       #(oval,eval) = uptime.run_noexcept("uptime | awk '{print $3,$4}' | tr , ' '")
+
        ### RUN SSH ######################
        b_getbootcd_id = True
        ssh = soltesz.SSH('root', nodename)
@@ -61,13 +64,12 @@ def collectPingAndSSH(nodename, cohash):
        eval = ""
        (oval, eval) = ssh.run_noexcept('echo `uname -a ; ls /tmp/bm.log`')
        val = oval
-       if "2.6.17" in oval or "2.6.20" in oval:
+       if "2.6.17" in oval or "2.6.2" in oval:
                values['ssh'] = 'SSH'
+               values['category'] = 'ALPHA'
                if "bm.log" in oval:
-                       values['category'] = 'ALPHA'
                        values['state'] = 'DEBUG'
                else:
-                       values['category'] = 'ALPHA'
                        values['state'] = 'BOOT'
        elif "2.6.12" in oval or "2.6.10" in oval:
                values['ssh'] = 'SSH'
@@ -104,7 +106,9 @@ def collectPingAndSSH(nodename, cohash):
                val = oval
                if "BootCD" in val:
                        values['bootcd'] = val
-                       if "v2" in val and nodename is not "planetlab1.cs.unc.edu":
+                       if "v2" in val and \
+                               ( nodename is not "planetlab1.cs.unc.edu" and \
+                                 nodename is not "planetlab2.cs.unc.edu" ):
                                values['category'] = 'OLDBOOTCD'
                else:
                        values['bootcd'] = ""
@@ -127,8 +131,10 @@ def collectPingAndSSH(nodename, cohash):
        plc_lock.acquire()
 
        try:
-               d_node = plc.getNodes({'hostname': nodename}, ['pcu_ids', 'site_id', 'last_contact', 'boot_state'])
+               d_node = plc.getNodes({'hostname': nodename}, ['pcu_ids', 'site_id', 'last_contact', 'boot_state', 'nodegroup_ids'])
        except:
+               b_except = True
+               import traceback
                b_except = True
                import traceback
                traceback.print_exc()
@@ -145,10 +151,12 @@ def collectPingAndSSH(nodename, cohash):
                        values['pcu'] = "NOPCU"
                site_id = d_node[0]['site_id']
                last_contact = d_node[0]['last_contact']
+               nodegroups = d_node[0]['nodegroup_ids']
                values['plcnode'] = {'status' : 'SUCCESS', 
                                                        'pcu_ids': pcu, 
                                                        'boot_state' : d_node[0]['boot_state'],
                                                        'site_id': site_id,
+                                                       'nodegroups' : nodegroups,
                                                        'last_contact': last_contact}
        else:
                values['pcu']     = "UNKNOWN"
@@ -183,6 +191,8 @@ def collectPingAndSSH(nodename, cohash):
        else:
                values['plcsite'] = {'status' : "GS_FAILED"}
 
+       values['checked'] = time.time()
+
        return (nodename, values)
 
 def recordPingAndSSH(request, result):
@@ -261,13 +271,11 @@ def main():
 
        # history information for all nodes
        cohash = cotop.coget(cotop_url)
-
-       if config.filename == "":
-               l_nodes = syncplcdb.create_plcdb()
-               l_nodes = [node['hostname'] for node in l_nodes]
+       l_nodes = syncplcdb.create_plcdb()
+       l_nodes = [node['hostname'] for node in l_nodes]
                #l_nodes = cohash.keys()
-       else:
-               l_nodes = config.getListFromFile(config.filename)
+#      else:
+#              l_nodes = config.getListFromFile(config.filename)
 
        checkAndRecordState(l_nodes, cohash)