Author: fapeeler
Date: Thu Feb 10 15:42:00 2011
New Revision: 1069431

URL: http://svn.apache.org/viewvc?rev=1069431&view=rev
Log:
VCL-432

storing duration in request hash

if duration is equal to or greater than 24hrs automatically disable user checks.
This does not update the database.


Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1069431&r1=1069430&r2=1069431&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Thu Feb 10 15:42:00 2011
@@ -4337,7 +4337,9 @@ sub get_request_info {
                                notify($ERRORS{'DEBUG'}, 0, "request checkuser 
flag is set to $reservation_row{request_checkuser}");
                                
$request_info{reservation}{$reservation_id}{image}{imagemeta}{checkuser} = 
$reservation_row{request_checkuser};
                        }
+
                }
+               
 
                # Check if the computer associated with this reservation has a 
vmhostid set
                if ($reservation_row{computer_vmhostid}) {
@@ -4477,6 +4479,14 @@ sub get_request_info {
        $request_info{NOTICEINTERVAL}   = '';
        $request_info{RESERVATIONCOUNT} = scalar keys 
%{$request_info{reservation}};
        $request_info{UPDATED}          = '0';
+       $request_info{DURATION}         = '';
+
+       
+       # Store duration in epoch seconds format
+       my $startepoch                  = 
convert_to_epoch_seconds($request_info{start});
+       my $endepoch                    = 
convert_to_epoch_seconds($request_info{end});
+       $request_info{DURATION}         = ($endepoch - $startepoch);
+ 
 
        # Each selected row represents a reservation associated with this 
request
 
@@ -4553,6 +4563,12 @@ sub get_request_info {
                if 
(!defined($request_info{reservation}{$reservation_id}{remoteIP})) {
                        $request_info{reservation}{$reservation_id}{remoteIP} = 
0;
                }
+               
+               # If duration is greater >= 24 hrs disable user checks
+               if($request_info{DURATION} >= (1 * 60 * 60 * 24) ){
+                       notify($ERRORS{'DEBUG'}, 0, "DURATION greater than 24 
hrs disabling checkuser flag by setting to 0");
+                       
$request_info{reservation}{$reservation_id}{image}{imagemeta}{checkuser} = 0;
+               }
 
                # Set the short name of the computer based on the hostname
                my $computer_hostname = 
$request_info{reservation}{$reservation_id}{computer}{hostname};


Reply via email to