From: Stephen Soltesz Date: Fri, 1 May 2009 18:02:40 +0000 (+0000) Subject: add a check for whether observed boot state is stale or not. X-Git-Tag: PLEWWW-4.3-11~3 X-Git-Url: http://git.onelab.eu/?p=plewww.git;a=commitdiff_plain;h=77ba41b85de6ad1875086446903212bcf3de656d add a check for whether observed boot state is stale or not. --- diff --git a/planetlab/includes/plc_objects.php b/planetlab/includes/plc_objects.php index a60a18a..65abc9a 100644 --- a/planetlab/includes/plc_objects.php +++ b/planetlab/includes/plc_objects.php @@ -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)); diff --git a/planetlab/nodes/node.php b/planetlab/nodes/node.php index e1ba953..ebade5e 100644 --- a/planetlab/nodes/node.php +++ b/planetlab/nodes/node.php @@ -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;