Author: arkurth
Date: Fri Oct 17 21:10:29 2014
New Revision: 1632667

URL: http://svn.apache.org/r1632667
Log:
VCL-685
Added variable to VIM_SSH.pm object to record if services.sh restart was run at 
any time during a process. This prevents a single process from running it more 
than once.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm?rev=1632667&r1=1632666&r2=1632667&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm 
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm Fri 
Oct 17 21:10:29 2014
@@ -178,7 +178,6 @@ sub _run_vim_cmd {
        my $wait_seconds = 2;
        
        my $connection_reset_errors = 0;
-       my $services_restart_detected = 0;
        ATTEMPT: while ($attempt++ < $attempt_limit) {
                if ($attempt > 1) {
                        # Wait before making next attempt
@@ -187,7 +186,7 @@ sub _run_vim_cmd {
                        
                        my $semaphore_id = 
"$vmhost_computer_name-vmware_services_restart";
                        if ($self->does_semaphore_exist($semaphore_id)) {
-                               $services_restart_detected = 1;
+                               $self->{services_restarted} = 1;
                                notify($ERRORS{'DEBUG'}, 0, "detected another 
process is restarting VMware services, sleeping for 10 seconds");
                                sleep_uninterrupted(10);
                                my $wait_message = "another process is 
restarting VMware services on $vmhost_computer_name";
@@ -224,12 +223,13 @@ sub _run_vim_cmd {
                        
                        # If 2 connection reset errors occured, attempt to run 
services.sh restart
                        if ($connection_reset_errors == 2) {
-                               if ($services_restart_detected) {
-                                       notify($ERRORS{'WARNING'}, 0, 
"encountered $connection_reset_errors connection reset errors on VM host 
$vmhost_computer_name, not calling 'services.sh restart', another process 
already attempted it");
+                               if ($self->{services_restarted}) {
+                                       notify($ERRORS{'WARNING'}, 0, 
"encountered $connection_reset_errors connection reset errors on VM host 
$vmhost_computer_name, not calling 'services.sh restart', it was already 
attempted");
                                }
                                else {
                                        notify($ERRORS{'OK'}, 0, "calling 
'services.sh restart', encountered $connection_reset_errors connection reset 
errors on VM host $vmhost_computer_name");
                                        $self->_services_restart();
+                                       $self->{services_restarted} = 1;
                                        next ATTEMPT;
                                }
                        }
@@ -367,15 +367,11 @@ sub _check_service_pid {
        }
        else {
                ($running_pid) = "@$ps_output" =~ /(\d+)/g;
-               if (!$running_pid) {
-                       notify($ERRORS{'DEBUG'}, 0, "parent $process_name PID 
is not running");
-               }
-               elsif ($running_pid > 1) {
+               if ($running_pid && $running_pid > 1) {
                        notify($ERRORS{'DEBUG'}, 0, "retrieved parent 
$process_name PID: $running_pid");
                }
                else {
-                       notify($ERRORS{'WARNING'}, 0, "parent $process_name PID 
not valid: $running_pid, command: '$ps_command', output:\n" . join("\n", 
@$ps_output));
-                       $running_pid = '';
+                       notify($ERRORS{'DEBUG'}, 0, "parent $process_name 
process is not running");
                }
        }
        


Reply via email to