From 77ba41b85de6ad1875086446903212bcf3de656d Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Fri, 1 May 2009 18:02:40 +0000 Subject: [PATCH] add a check for whether observed boot state is stale or not. --- planetlab/includes/plc_objects.php | 9 +++++++++ planetlab/nodes/node.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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; -- 2.43.0