Author: arkurth
Date: Tue Mar  3 20:10:45 2015
New Revision: 1663775

URL: http://svn.apache.org/r1663775
Log:
VCL-564
Added call in reserved.pm to attempt to execute post_initial_connection scripts 
residing on the management node after an initial user connection is detected.

Added ability to execute scripts stored on management node during the 
'post_reservation' stage.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
    vcl/trunk/managementnode/lib/VCL/reserved.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1663775&r1=1663774&r2=1663775&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Tue Mar  3 20:10:45 2015
@@ -595,8 +595,9 @@ sub post_reserve {
 =head2 post_reservation
 
  Parameters  : none
- Returns     : boolean 1 or 0
- Description : Checks for and runs vcl_post_reservation script at the end of a 
reservation
+ Returns     : boolean
+ Description : Checks for and runs vcl_post_reservation script at the end of a
+               reservation.
 
 =cut
 
@@ -607,11 +608,10 @@ sub post_reservation {
                return 0;
        }
        
-       my $image_name          = $self->data->get_image_name();
-       my $computer_short_name = $self->data->get_computer_short_name();
-       my $script_path         = '/usr/local/vcl/vcl_post_reservation';
+       # Run custom post_reservation scripts residing on the management node
+       $self->run_management_node_tools_scripts('post_reservation');
        
-       notify($ERRORS{'OK'}, 0, "initiating Linux post_reservation: 
$image_name on $computer_short_name");
+       my $script_path = '/usr/local/vcl/vcl_post_reservation';
        
        # Check if script exists
        if (!$self->file_exists($script_path)) {
@@ -622,13 +622,10 @@ sub post_reservation {
        # Run the vcl_post_reserve script if it exists in the image
        my $result = $self->run_script($script_path, '1', '300', '1');
        if (!defined($result)) {
-               notify($ERRORS{'WARNING'}, 0, "error occurred running 
$script_path");
-       }
-       elsif ($result == 0) {
-               notify($ERRORS{'DEBUG'}, 0, "$script_path does not exist in 
image: $image_name");
+               notify($ERRORS{'WARNING'}, 0, "error occurred executing 
$script_path");
        }
        else {
-               notify($ERRORS{'DEBUG'}, 0, "ran $script_path");
+               notify($ERRORS{'DEBUG'}, 0, "executed $script_path");
        }
        
        return 1;

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1663775&r1=1663774&r2=1663775&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Tue Mar  3 20:10:45 
2015
@@ -1010,8 +1010,8 @@ sub post_reserve {
 
  Parameters  : none
  Returns     : boolean
- Description : Runs $SYSTEMROOT/vcl_post_reservation.cmd if it exists in the 
image.
-               Does not check if the actual script succeeded or not.
+ Description : Executes $SYSTEMROOT/vcl_post_reservation.cmd if it exists in 
the
+               image. Does not check if the actual script succeeded or not.
 
 =cut
 
@@ -1022,8 +1022,9 @@ sub post_reservation {
                return 0;
        }
        
-       my $image_name = $self->data->get_image_name();
-       my $computer_short_name = $self->data->get_computer_short_name();
+       # Run custom post_reservation scripts residing on the management node
+       $self->run_management_node_tools_scripts('post_reservation');
+       
        my $script_path = '$SYSTEMROOT/vcl_post_reservation.cmd';
        
        # Check if script exists
@@ -1034,14 +1035,11 @@ sub post_reservation {
        
        # Run the vcl_post_reserve.cmd script if it exists in the image
        my $result = $self->run_script($script_path);
-       if (!defined($result)) {
-               notify($ERRORS{'WARNING'}, 0, "failed to run post_reservation 
script: $script_path");
-       }
-       elsif ($result == 0) {
-               notify($ERRORS{'DEBUG'}, 0, "$script_path does not exist in 
image: $image_name");
+       if (!$result) {
+               notify($ERRORS{'WARNING'}, 0, "failed to execute 
post_reservation script: $script_path");
        }
        else {
-               notify($ERRORS{'DEBUG'}, 0, "ran $script_path");
+               notify($ERRORS{'DEBUG'}, 0, "executed $script_path");
        }
        
        return 1;

Modified: vcl/trunk/managementnode/lib/VCL/reserved.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/reserved.pm?rev=1663775&r1=1663774&r2=1663775&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/reserved.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/reserved.pm Tue Mar  3 20:10:45 2015
@@ -228,6 +228,9 @@ sub process {
                notify($ERRORS{'CRITICAL'}, 0, "failed to process connect 
methods after user connected to computer");
        }
        
+       # Run custom post_initial_connection scripts residing on the management 
node
+       $self->os->run_management_node_tools_scripts('post_initial_connection');
+       
        # For cluster reservations, the parent must wait until all child 
reserved processes have exited
        # Otherwise, the state will change to inuse while the child processes 
are still finishing up the reserved state
        # vcld will then fail to fork inuse processes for the child reservations


Reply via email to