add a check for whether observed boot state is stale or not.
authorStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 1 May 2009 18:02:40 +0000 (18:02 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Fri, 1 May 2009 18:02:40 +0000 (18:02 +0000)
planetlab/includes/plc_objects.php
planetlab/nodes/node.php

index a60a18a..65abc9a 100644 (file)
@@ -271,6 +271,15 @@ class Node extends PlcObject {
   function lastContact() {
     return $this->timeaway($this->last_contact);
   }
+  function stale() {
+    $now = time();
+       $STALE_LENGTH = 60*60;  /* TODO: set by some policy */
+    if ( $this->last_contact + $STALE_LENGTH > $now ) {
+           return False;
+       } else {
+           return True;
+       }
+  }
   function timeaway($val) {
     if ( $val != NULL ) {
       $ret = timeDiff(intval($val));
index e1ba953..ebade5e 100644 (file)
@@ -167,7 +167,7 @@ $details->th_td("Last update",$Node->lastUpdated());
 
 // boot area
 $details->space ();
-$details->th_td ("Observed Boot state",$run_level);
+$details->th_td ("Observed Boot state",$run_level . ( $Node->stale() ? " -- stale value" : "" ));
 if ( ! ($local_peer && $privileges)) {
   // just display it
   $boot_value=$boot_state;