Author: arkurth
Date: Tue Apr 12 20:27:02 2016
New Revision: 1738862

URL: http://svn.apache.org/viewvc?rev=1738862&view=rev
Log:
VCL-941
In State.pm::reservation_failed and utils.pm::switch_state, added checks for 
request state including 'reboot' and 'server' in order to prevent an inuse 
requests from being set to failed.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/State.pm
    vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/State.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/State.pm?rev=1738862&r1=1738861&r2=1738862&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/State.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/State.pm Tue Apr 12 20:27:02 2016
@@ -415,7 +415,7 @@ sub reservation_failed {
        my $new_computer_state_name;
        my $request_log_ending;
        
-       if ($request_state_name eq 'inuse') {
+       if ($request_state_name =~ /(inuse|reboot|server)/) {
                # Check if the request end time has not been reached
                my $request_end_time_epoch = 
convert_to_epoch_seconds($self->data->get_request_end_time());
                my $current_time_epoch = time;
@@ -926,7 +926,7 @@ sub state_exit {
                                $request_state_name_new = 'maintenance';
                                $computer_state_name_new = 'maintenance';
                        }
-                       elsif ($request_state_name_old eq 'inuse' && 
$request_state_name_new !~ /(inuse|timeout|maintenance)/) {
+                       elsif ($request_state_name_old =~ 
/(inuse|reboot|server)/ && $request_state_name_new !~ 
/(inuse|timeout|maintenance)/) {
                                notify($ERRORS{'CRITICAL'}, 0, "previous 
request state is $request_state_name_old, not setting request state to 
$request_state_name_new, setting request and computer state to inuse");
                                $request_state_name_new = 'inuse';
                                $computer_state_name_new = 'inuse';
@@ -936,7 +936,7 @@ sub state_exit {
                        # Do this to ensure that reservations are not processed 
again quickly after this process exits
                        # For cluster requests, the parent may have had to wait 
a while for child processes to exit
                        # Resetting reservation.lastcheck causes reservations 
to wait the full interval between inuse checks
-                       if ($request_state_name_new =~ /(reserved|inuse)/) {
+                       if ($request_state_name_new =~ 
/(reserved|inuse|reboot|server)/) {
                                update_reservation_lastcheck(@reservation_ids);
                        }
                        

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1738862&r1=1738861&r2=1738862&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Tue Apr 12 20:27:02 2016
@@ -6354,8 +6354,8 @@ sub switch_state {
                        $request_state_name_new = 'maintenance';
                        $computer_state_name_new = 'maintenance';
                }
-               elsif ($request_state_name_old eq 'inuse') {
-                       notify($ERRORS{'DEBUG'}, 0, "previous request state is 
$request_state_name_old, not setting request state to $request_state_name_new, 
setting request state back to $request_state_name_old");
+               elsif ($request_state_name_old =~ /(inuse|reboot|server)/) {
+                       notify($ERRORS{'DEBUG'}, 0, "previous request state is 
$request_state_name_old, not setting request state to $request_state_name_new, 
setting request state back to inuse");
                        $request_state_name_new = 'inuse';
                        $computer_state_name_new = 'inuse';
                }
@@ -6364,7 +6364,7 @@ sub switch_state {
        # Don't set log.ending to failed for inuse - this throws off the counts 
on the dashboard page
        # Don't set log.ending to failed for image or checkpoint
        if ($request_log_ending && $request_log_ending =~ /(failed)/) {
-               if ($request_state_name_old =~ /(image|checkpoint|inuse)/) {
+               if ($request_state_name_old =~ 
/(image|checkpoint|inuse|reboot|server)/) {
                        notify($ERRORS{'DEBUG'}, 0, "request state is 
$request_state_name_old, not setting log.ending to $request_log_ending");
                        $request_log_ending = 0;
                }


Reply via email to