Author: fapeeler
Date: Thu Apr 24 19:26:05 2014
New Revision: 1589841

URL: http://svn.apache.org/r1589841
Log:
VCL-280

- extended reservation_failed routine to accept optional computer state
- updated the code location for when image is not found it will not fail the 
computer


Modified:
    vcl/trunk/managementnode/lib/VCL/Module/State.pm
    vcl/trunk/managementnode/lib/VCL/new.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=1589841&r1=1589840&r2=1589841&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/State.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/State.pm Thu Apr 24 19:26:05 2014
@@ -243,6 +243,12 @@ sub reservation_failed {
                $message = 'reservation failed';
        }
 
+       # Check if computer needs to be marked as failed
+       my $computer_input_state = shift;
+   if (!$computer_input_state) {
+      $computer_input_state = 0;
+   }
+
        # Get the required data
        my $request_id                  = $self->data->get_request_id();
        my $request_logid               = $self->data->get_request_log_id();
@@ -288,6 +294,10 @@ sub reservation_failed {
                $new_request_state_name = 'maintenance';
                $new_computer_state_name = 'maintenance';
        }
+       elsif ($computer_input_state) {
+          $new_request_state_name = 'failed';
+          $new_computer_state_name = $computer_input_state;
+       }
        else {
                $new_request_state_name = 'failed';
                $new_computer_state_name = 'failed';

Modified: vcl/trunk/managementnode/lib/VCL/new.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/new.pm?rev=1589841&r1=1589840&r2=1589841&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/new.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/new.pm Thu Apr 24 19:26:05 2014
@@ -623,13 +623,13 @@ sub reload_image {
                                        else {
                                                notify($ERRORS{'CRITICAL'}, 0, 
"$image_name does not exist on management node and could not be retrieved");
                                                insertloadlog($reservation_id, 
$computer_id, "failed", "requested image does not exist on management node and 
could not be retrieved");
-                                               return;
+                                               
$self->reservation_failed("$image_name does not exist unable to retrieve image 
from another management node", "available");
                                        }
                                } ## end if 
($self->provisioner->can("retrieve_image"...
                                else {
                                        notify($ERRORS{'CRITICAL'}, 0, "unable 
to retrieve image from another management node, retrieve_image() is not 
implemented by " . ref($self->provisioner));
                                        insertloadlog($reservation_id, 
$computer_id, "failed", "failed requested image does not exist on management 
node, retrieve_image() is not implemented");
-                                       return;
+                                       $self->reservation_failed("$image_name 
does not exist", "available");
                                }
                        } ## end else [ if 
($self->provisioner->does_image_exist($image_name...
                } ## end if ($self->provisioner->can("does_image_exist"...
@@ -965,7 +965,7 @@ sub reserve_computer {
                                        notify($ERRORS{'DEBUG'}, 0, "updated 
password in the reservation table");
                                }
                                else {
-                                       $self->reservation_failed("failed to 
update password in the reservation table");
+                                       $self->reservation_failed("failed to 
update password in the reservation table", "available");
                                }
                                
                                # Set the password in the DataStructure object


Reply via email to