You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2010/01/25 19:33:22 UTC

svn commit: r902913 - in /incubator/vcl/trunk/managementnode/lib/VCL: ./ Module/ Module/OS/ Module/OS/Windows/ Module/Provisioning/

Author: arkurth
Date: Mon Jan 25 18:33:21 2010
New Revision: 902913

URL: http://svn.apache.org/viewvc?rev=902913&view=rev
Log:
VCL-291
Removed section which calls the OS module's post_load() sub from new.pm. This is now handled by the provisioning modules.

Removed code which checks from SSH from vmware.pm, esx.pm, xCAT.pm, and xCAT21.pm. Added calls to post_load() to these modules.

Created Module.pm::code_loop_timeout(). It gets passed a code reference and timeout arguments. It attempts to run the code until it returns true or the timeout is reached.

Moved wait_for_ping(), wait_for_no_ping(), is_ssh_responding(), and wait_for_ssh() from Windows.pm to OS.pm so they can be used by other OSs. These were updated to use the new code_loop_timeout() sub. They were also changed so the arguments are in seconds rather than minutes for better control. Updated all calls to these subs in the Windows modules to use seconds.

Created OS.pm::wait_for_response(). It accepts timeout parameters and waits for the OS to respond to SSH. Added calls to wait_for_response() in Windows.pm::post_load() and Linux.pm::post_load(). Also created separate Version_6.pm::wait_for_response() sub which uses longer timeout values because Vista and 2008's Sysprep takes much longer.


VCL-185
Removed "$image_os_type =~ /linux/i" section from load() sub in xCAT.pm and xCAT21.pm which wasn't being called anymore since vmware.pm::post_load() has been implemented.


VCL-42
Moved set_device_path_key() and get_driver_inf_paths() subs from Version_5.pm to Windows.pm so they can be used by newer Windows OSs. Added call to set_device_path_key() in Version_6.pm::run_Sysprep().


VCL-297
Updated DataStructure.pm::get_computer_private_ip_address() to correctly get the private IP address out of /etc/hosts instead of using the database value.


VCL-298
Removed vmware.pm::vmrun_cmd() subroutine. It wasn't being called from anywhere and actually was calling 'vmware-cmd stop hard'.


Other
Updated utils.pm::_pingnode() to check for the hostname argument.

Updated utils.pm::run_ssh_command() to catch if vmware-cmd was run with a syntax error. It returns exit status 255 when this happens. run_ssh_command() was assuming this meant an SSH error occurred and retried the command 3 times needlessly.

Added optional argument to DataStructure.pm::automethod. If get_... is called with a true argument, warning output is suppressed if the value has not been initialized. This allows get_... to be called when the caller knows the data may not be defined without always generating a warning.

Added DataStructure.pm::get_reservation_info_string() subroutine. It assembles a string with reservation  data to be used in notify messages. Similar code used to be contained within xCAT.pm when a load failed. It was moved out so it can be used in other situations and so a consistent message is displayed.

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm
    incubator/vcl/trunk/managementnode/lib/VCL/new.pm
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Mon Jan 25 18:33:21 2010
@@ -566,7 +566,9 @@
  Description : This subroutine is automatically invoked when an class method is
                called on a DataStructure object but the method isn't explicitly
                defined. Function names are mapped to data stored in the request
-               data hash. This subroutine returns the requested data.
+               data hash. This subroutine returns the requested data. An
+               optional argument can be specified with a value of 1 to suppress
+               warnings if data is not initialized for the value requested.
 
 =cut
 
@@ -586,6 +588,9 @@
 	else {
 		return;
 	}
+	
+	# Determines whether or not warnings are shown if data is not initialized
+	my $show_warnings = 1;
 
 	# If set, make sure an argument was passed
 	my $set_data;
@@ -596,6 +601,9 @@
 		notify($ERRORS{'WARNING'}, 0, "data structure set function was called without an argument");
 		return;
 	}
+	elsif ($mode =~ /get/ && defined $args[0] && !$args[0]) {
+		$show_warnings = 0;
+	}
 
 	# Check if the sub name is defined in the subroutine mappings hash
 	# Return if it isn't
@@ -636,7 +644,7 @@
 			if ($self->get_log_data()) {
 				# Log data was retrieved, check if requested data is now populated
 				if (!eval "defined $hash_path") {
-					notify($ERRORS{'WARNING'}, 0, "log data was retrieved but corresponding data has not been initialized for $method_name: $hash_path", $self->request_data);
+					notify($ERRORS{'WARNING'}, 0, "log data was retrieved but corresponding data has not been initialized for $method_name: $hash_path", $self->request_data) if $show_warnings;
 					return sub { };
 				}
 			}
@@ -672,7 +680,7 @@
 			$return_value = eval $hash_path;
 		}
 		elsif (!$key_defined) {
-			notify($ERRORS{'WARNING'}, 0, "corresponding data has not been initialized for $method_name: $hash_path", $self->request_data);
+			notify($ERRORS{'WARNING'}, 0, "corresponding data has not been initialized for $method_name: $hash_path", $self->request_data) if $show_warnings;
 			return sub { };
 		}
 		else {
@@ -681,7 +689,7 @@
 		}
 
 		if (!defined $return_value) {
-			notify($ERRORS{'WARNING'}, 0, "corresponding data is undefined for $method_name: $hash_path", $self->request_data);
+			notify($ERRORS{'WARNING'}, 0, "corresponding data is undefined for $method_name: $hash_path", $self->request_data) if $show_warnings;
 			return sub { };
 		}
 
@@ -1413,7 +1421,9 @@
 		}
 		else {
 			# Argument was not specified, check if private IP address for this reservation's computer was already retrieved from /etc/hosts
-			if (my $existing_private_ip_address = $self->request_data->{reservation}{$self->reservation_id}{computer}{privateIPaddress}) {
+			if (defined $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS_ETC_HOSTS}) {
+				my $existing_private_ip_address = $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS_ETC_HOSTS};
+				
 				# This subroutine has already been run for the reservation computer, return IP address retrieved earlier
 				notify($ERRORS{'DEBUG'}, 0, "returning private IP address previously retrieved from /etc/hosts: $existing_private_ip_address");
 				return $existing_private_ip_address;
@@ -1491,7 +1501,7 @@
 	
 	# Update the request data if subroutine was called as an object method without an argument
 	if ($self && !$argument) {
-		$self->set_computer_private_ip_address($ip_address);
+		$self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS_ETC_HOSTS} = $ip_address;
 	}
 	
 	return $ip_address;
@@ -2173,6 +2183,63 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 get_reservation_info_string
+
+ Parameters  : None.
+ Returns     : String
+ Description : Assembles a string containing reservation information for
+               debugging purposes.
+
+=cut
+
+sub get_reservation_info_string {
+	my $self = shift;
+	
+	# Check if subroutine was called as an object method
+	unless (ref($self) && $self->isa('VCL::DataStructure')) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine can only be called as a VCL::DataStructure module object method");
+		return;
+	}
+
+	my $string;
+	$string .= "request: " . $self->get_request_id() . "\n";
+	$string .= "reservation: " . $self->get_reservation_id() . "\n";
+	$string .= "state/laststate: " . $self->get_request_state_name() . "/" . $self->get_request_laststate_name() . "\n";
+	$string .= "\n";
+	
+	$string .= "management node: " . $self->get_management_node_hostname() . "\n";
+	$string .= "PID: $PID\n";
+	$string .= "\n";
+	
+	$string .= "computer name: " . $self->get_computer_host_name() . " (id: " . $self->get_computer_id() . ")\n";
+	my $computer_type = $self->get_computer_type();
+	$string .= "computer type: $computer_type\n";
+	$string .= "\n";
+	
+	if ($computer_type eq 'virtualmachine') {
+		$string .= "vm host: " . $self->get_vmhost_hostname() . " (vmhost id: " . $self->get_vmhost_id() . ")\n";
+		$string .= "vm host profile: " . $self->get_vmhost_profile_name() . "\n";
+		$string .= "\n";
+	}
+	
+	$string .= "user name: " . $self->get_user_login_id() . " (id: " . $self->get_user_id() . ")\n";
+	$string .= "user affiliation: " . $self->get_user_affiliation_name() . "\n";
+	$string .= "\n";
+	
+	$string .= "image: " . $self->get_image_name() . " (id: " . $self->get_image_id() . ")\n";
+	$string .= "image prettyname: " . $self->get_image_prettyname() . "\n";
+	$string .= "image size: " . $self->get_image_size() . "\n";
+	$string .= "image affiliation: " . $self->get_image_affiliation_name() . "\n";
+	$string .= "image revision ID: " . $self->get_imagerevision_id() . "\n";
+	$string .= "image revision comments: " . ($self->get_imagerevision_comments(0) || 'none') . "\n";
+	$string .= "image revision created: " . $self->get_imagerevision_date_created() . "\n";
+	$string .= "image revision production: " . $self->get_imagerevision_production();
+	
+	return $string;
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
 1;
 __END__
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module.pm Mon Jan 25 18:33:21 2010
@@ -312,6 +312,116 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 code_loop_timeout
+
+ Parameters  : 1: code reference
+               2: array reference containing arguments to pass to code reference
+               3: message to display when attempting to execute code reference
+               4: timeout seconds, maximum number of seconds to attempt to execute code until it returns true
+               5: seconds to wait in between code execution attempts
+ Returns     : If code returns true: 1
+               If code never returns true: 0
+ Description : Executes the code contained in the code reference argument until
+               it returns true or until the timeout is reached.
+               
+               Example:
+               Call the _pingnode subroutine, pass it a single argument,
+               continue calling _pingnode until 20 seconds have passed, wait 4
+               seconds in between attempts:
+               $self->os->code_loop_timeout(\&_pingnode, ['vclh3-8'], 'checking ping', 20, 4);
+
+=cut
+
+sub code_loop_timeout {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	# Get the start time
+	my $start_time = time();
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	
+	# Check the argument count and get the arguments
+	if (scalar(@_) != 5) {
+		notify($ERRORS{'WARNING'}, 0, scalar(@_) . " arguments were passed, argument count must be 5");
+		return;
+	}
+	my ($code_ref, $args_array_ref, $message, $total_wait_seconds, $attempt_delay_seconds) = @_;
+	
+	# Make sure the code reference argument was passed correctly
+	if (!defined($code_ref)) {
+		notify($ERRORS{'WARNING'}, 0, "code reference argument is undefined");
+		return;
+	}
+	elsif (ref($code_ref) ne 'CODE') {
+		notify($ERRORS{'WARNING'}, 0, "1st argument must be a code reference, not " . ref($code_ref));
+		return;
+	}
+	
+	if (!defined($args_array_ref)) {
+		notify($ERRORS{'WARNING'}, 0, "2nd argument (arguments to pass to code reference) is undefined");
+		return;
+	}
+	elsif (!ref($args_array_ref) || ref($args_array_ref) ne 'ARRAY') {
+		notify($ERRORS{'WARNING'}, 0, "2nd argument (arguments to pass to code reference) is not an array reference");
+		return;
+	}
+	
+	if (!defined($message)) {
+		notify($ERRORS{'WARNING'}, 0, "3nd argument (message to display) is undefined");
+		return;
+	}
+	elsif (!$message) {
+		$message = 'executing code reference';
+	}
+	
+	if (!defined($total_wait_seconds) || $total_wait_seconds !~ /^\d+$/) {
+		notify($ERRORS{'WARNING'}, 0, "4th argument (total wait seconds) was not passed correctly");
+		return;
+	}
+	
+	if (!defined($attempt_delay_seconds) || $attempt_delay_seconds !~ /^\d+$/) {
+		notify($ERRORS{'WARNING'}, 0, "5th argument (attempt delay) was not passed correctly");
+		return;
+	}
+	
+	
+	# Calculate total seconds to wait and end time
+	my $end_time = $start_time + $total_wait_seconds;
+	notify($ERRORS{'OK'}, 0, "$message, maximum of $total_wait_seconds seconds");
+	
+	# Loop until code returns true
+	# Loop once if the wait time is 0
+	my $attempt_count = 0;
+	my $current_time;
+	while (($current_time = time()) < $end_time || ($total_wait_seconds == 0 && $attempt_count == 0)) {
+		$attempt_count++;
+		
+		if ($attempt_count > 1) {
+			my $seconds_elapsed = $current_time - $start_time;
+			my $seconds_remaining = $end_time - $current_time;
+			
+			notify($ERRORS{'OK'}, 0, "attempt " . ($attempt_count-1) . ": code returned false, seconds elapsed/remaining: $seconds_elapsed/$seconds_remaining, sleeping for $attempt_delay_seconds seconds");
+			sleep $attempt_delay_seconds;
+		}
+		
+		notify($ERRORS{'OK'}, 0, "attempt $attempt_count: $message");
+		
+		if (&$code_ref(@{$args_array_ref})) {
+			notify($ERRORS{'OK'}, 0, "$message, code returned true");
+			return 1;
+		}
+	}
+
+	notify($ERRORS{'OK'}, 0, "$message, code did not return true after waiting $total_wait_seconds seconds");
+	return 0;
+} ## end sub code_loop_timeout
+
+#/////////////////////////////////////////////////////////////////////////////
+
 1;
 __END__
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS.pm Mon Jan 25 18:33:21 2010
@@ -259,6 +259,238 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 wait_for_ping
+
+ Parameters  : Maximum number of seconds to wait (optional), delay between attempts (optional)
+ Returns     : If computer is pingable before the maximum amount of time has elapsed: 1
+               If computer never responds to ping before the maximum amount of time has elapsed: 0
+ Description : Attempts to ping the computer specified in the DataStructure
+               for the current reservation. It will wait up to a maximum number
+               of seconds. This can be specified by passing the subroutine an
+               integer value or the default value of 300 seconds will be used. The
+               delay between attempts can be specified as the 2nd argument in
+               seconds. The default value is 15 seconds.
+
+=cut
+
+sub wait_for_ping {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	# Attempt to get the total number of seconds to wait from the arguments
+	my $total_wait_seconds = shift;
+	if (!defined($total_wait_seconds) || $total_wait_seconds !~ /^\d+$/) {
+		$total_wait_seconds = 300;
+	}
+	
+	# Seconds to wait in between loop attempts
+	my $attempt_delay_seconds = shift;
+	if (!defined($attempt_delay_seconds) || $attempt_delay_seconds !~ /^\d+$/) {
+		$attempt_delay_seconds = 15;
+	}
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	
+	my $message = "waiting for $computer_node_name to respond to ping";
+	
+	# Call code_loop_timeout, specifify that it should call _pingnode with the computer name as the argument
+	return $self->code_loop_timeout(\&_pingnode, [$computer_node_name], $message, $total_wait_seconds, $attempt_delay_seconds);
+} ## end sub wait_for_ping
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 wait_for_no_ping
+
+ Parameters  : Maximum number of seconds to wait (optional), seconds to delay between attempts (optional)
+ Returns     : 1 if computer is not pingable, 0 otherwise
+ Description : Attempts to ping the computer specified in the DataStructure
+               for the current reservation. It will wait up to a maximum number
+               of seconds for ping to fail. The delay between attempts can be
+               specified as the 2nd argument in seconds. The default value is 15
+               seconds.
+
+=cut
+
+sub wait_for_no_ping {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	# Attempt to get the total number of seconds to wait from the arguments
+	my $total_wait_seconds = shift;
+	if (!defined($total_wait_seconds) || $total_wait_seconds !~ /^\d+$/) {
+		$total_wait_seconds = 300;
+	}
+	
+	# Seconds to wait in between loop attempts
+	my $attempt_delay_seconds = shift;
+	if (!defined($attempt_delay_seconds) || $attempt_delay_seconds !~ /^\d+$/) {
+		$attempt_delay_seconds = 15;
+	}
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	
+	my $message = "waiting for $computer_node_name to NOT respond to ping";
+	
+	# Call code_loop_timeout and invert the result, specifify that it should call _pingnode with the computer name as the argument
+	return $self->code_loop_timeout(sub{return !_pingnode(@_)}, [$computer_node_name], $message, $total_wait_seconds, $attempt_delay_seconds);
+} ## end sub wait_for_no_ping
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 wait_for_ssh
+
+ Parameters  : Seconds to wait (optional), seconds to delay between attempts (optional)
+ Returns     : 
+ Description : Attempts to communicate to the reservation computer via SSH.
+               SSH attempts are made until the maximum number of seconds has
+               elapsed. The maximum number of seconds can be specified as the
+               first argument. If an argument isn't supplied, a default value of
+               300 seconds will be used.
+               
+               A delay occurs between attempts. This can be specified by passing
+               a 2nd argument. If a 2nd argument isn't supplied, a default value
+               of 15 seconds will be used.
+
+=cut
+
+sub wait_for_ssh {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	# Attempt to get the total number of seconds to wait from the arguments
+	my $total_wait_seconds = shift;
+	if (!defined($total_wait_seconds) || $total_wait_seconds !~ /^\d+$/) {
+		$total_wait_seconds = 300;
+	}
+	
+	# Seconds to wait in between loop attempts
+	my $attempt_delay_seconds = shift;
+	if (!defined($attempt_delay_seconds) || $attempt_delay_seconds !~ /^\d+$/) {
+		$attempt_delay_seconds = 15;
+	}
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	
+	# Call the "can" function, it returns a code reference to the subroutine specified
+	# This is passed to code_loop_timeout which will then execute the code until it returns true
+	my $sub_ref = $self->can("is_ssh_responding");
+	
+	my $message = "waiting for $computer_node_name to respond to SSH";
+
+	return $self->code_loop_timeout($sub_ref, [$self], $message, $total_wait_seconds, $attempt_delay_seconds);
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 is_ssh_responding
+
+ Parameters  : None
+ Returns     : If computer responds to SSH: 1
+               If computer never responds to SSH: 0
+ Description : Checks if the reservation computer is responding to SSH.
+
+=cut
+
+sub is_ssh_responding {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	
+	# Try nmap to see if any of the ssh ports are open before attempting to run a test command
+	if (!nmap_port($computer_node_name, 22) && !nmap_port($computer_node_name, 24)) {
+		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, port 22 or 24 are not open");
+		return 0;
+	}
+	
+	# Run a test SSH command
+	my ($exit_status, $output) = run_ssh_command({
+		node => $computer_node_name,
+		command => "echo testing ssh on $computer_node_name",
+		max_attempts => 1,
+		output_level => 0,
+	});
+	
+	# The exit status will be 0 if the command succeeded
+	if (defined($exit_status) && $exit_status == 0) {
+		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is responding to SSH");
+		return 1;
+	}
+	else {
+		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, SSH command failed");
+		return 0;
+	}
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 wait_for_response
+
+ Parameters  : Initial delay seconds (optional), SSH response timeout seconds (optional)
+ Returns     : If successful: true
+               If failed: false
+ Description : Waits for the reservation computer to respond to SSH after it
+               has been loaded.
+
+=cut
+
+sub wait_for_response {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	my $start_time = time();
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	
+	my $initial_delay_seconds = shift;
+	if (!defined $initial_delay_seconds) {
+		$initial_delay_seconds = 120;
+	}
+	
+	my $ssh_response_timeout_seconds = shift;
+	if (!defined $ssh_response_timeout_seconds) {
+		$ssh_response_timeout_seconds = 600;
+	}
+	
+	# Sleep for the initial delay value if it has been set
+	# Check SSH once to bypass the initial delay if SSH is already responding
+	if ($initial_delay_seconds && !$self->is_ssh_responding()) {
+		notify($ERRORS{'OK'}, 0, "waiting $initial_delay_seconds seconds for $computer_node_name to boot");
+		sleep $initial_delay_seconds;
+		notify($ERRORS{'OK'}, 0, "waited $initial_delay_seconds seconds for $computer_node_name to boot");
+	}
+	
+	# Wait for SSH to respond, loop until timeout is reached
+	notify($ERRORS{'OK'}, 0, "waiting for $computer_node_name to respond to SSH, maximum of $ssh_response_timeout_seconds seconds");
+	if (!$self->wait_for_ssh($ssh_response_timeout_seconds)) {
+		notify($ERRORS{'WARNING'}, 0, "failed to connect to $computer_node_name via SSH after $ssh_response_timeout_seconds seconds");
+		return;
+	}
+	
+	my $end_time = time();
+	my $duration = ($end_time - $start_time);
+	
+	notify($ERRORS{'OK'}, 0, "$computer_node_name is responding to SSH after $duration seconds");
+	return 1;
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
 1;
 __END__
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Mon Jan 25 18:33:21 2010
@@ -209,6 +209,12 @@
 
 	notify($ERRORS{'OK'}, 0, "initiating Linux post_load: $image_name on $computer_short_name");
 
+	# Wait for computer to respond to SSH
+	if (!$self->wait_for_response(60, 600)) {
+		notify($ERRORS{'WARNING'}, 0, "$computer_node_name never responded to SSH");
+		return 0;
+	}
+
 	# Change password
 	if ($self->changepasswd($computer_node_name, "root")) {
 		notify($ERRORS{'OK'}, 0, "successfully changed root password on $computer_node_name");

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Mon Jan 25 18:33:21 2010
@@ -442,15 +442,25 @@
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
 		return;
 	}
-
-	my $management_node_keys = $self->data->get_management_node_keys();
+	
 	my $computer_node_name   = $self->data->get_computer_node_name();
 	my $imagemeta_postoption = $self->data->get_imagemeta_postoption();
-
-	notify($ERRORS{'OK'}, 0, "beginning Windows post-load tasks");
+	
+	notify($ERRORS{'OK'}, 0, "beginning Windows post-load tasks on $computer_node_name");
 
 =item 1
 
+ Wait for computer to respond to SSH
+
+=cut
+
+	if (!$self->wait_for_response(120, 600)) {
+		notify($ERRORS{'WARNING'}, 0, "$computer_node_name never responded to SSH");
+		return 0;
+	}
+
+=item *
+
  Wait for root to log off
 
 =cut
@@ -1302,7 +1312,7 @@
 	
 	# Find lines with the state = Active or Disc
 	# Disc will occur if the user disconnected the RDP session but didn't logoff
-	my @connection_lines = grep(/(Active|Disc)/, @{$output});
+	my @connection_lines = grep(/(Active)/, @{$output});
 	return 1 if !@connection_lines;
 	
 	#notify($ERRORS{'OK'}, 0, "connections on $computer_node_name:\n@connection_lines");
@@ -2905,7 +2915,7 @@
 		} ## end if ($wait_attempt > 1)
 
 		# Wait maximum of 3 minutes for the computer to become unresponsive
-		if (!$self->wait_for_no_ping(3)) {
+		if (!$self->wait_for_no_ping(180)) {
 			# Computer never stopped responding to ping
 			notify($ERRORS{'WARNING'}, 0, "$computer_node_name never became unresponsive to ping");
 			next WAIT_ATTEMPT;
@@ -2917,7 +2927,7 @@
 		sleep 15;
 
 		# Wait maximum of 6 minutes for the computer to come back up
-		if (!$self->wait_for_ping(6)) {
+		if (!$self->wait_for_ping(360)) {
 			# Check if the computer was ever offline, it should have been or else reboot never happened
 			notify($ERRORS{'WARNING'}, 0, "$computer_node_name never responded to ping");
 			next WAIT_ATTEMPT;
@@ -2926,7 +2936,7 @@
 		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is pingable, waiting for ssh to respond");
 
 		# Wait maximum of 3 minutes for ssh to respond
-		if (!$self->wait_for_ssh(3)) {
+		if (!$self->wait_for_ssh(180)) {
 			notify($ERRORS{'WARNING'}, 0, "ssh never responded on $computer_node_name");
 			next WAIT_ATTEMPT;
 		}
@@ -2940,7 +2950,7 @@
 		#sleep 20;
 		#
 		## Wait maximum of 2 minutes for ssh to respond
-		#if (!$self->wait_for_ssh(2)) {
+		#if (!$self->wait_for_ssh(120)) {
 		#	notify($ERRORS{'WARNING'}, 0, "ssh responded then stopped responding on $computer_node_name");
 		#	next WAIT_ATTEMPT;
 		#}
@@ -2986,7 +2996,7 @@
 		notify($ERRORS{'DEBUG'}, 0, "executed shutdown command on $computer_node_name");
 		
 		# Wait maximum of 3 minutes for the computer to become unresponsive
-		if ($self->wait_for_no_ping(3)) {
+		if ($self->wait_for_no_ping(180)) {
 			notify($ERRORS{'OK'}, 0, "computer has become unresponsive after shutdown command was issued");
 			return 1;
 		}
@@ -3016,190 +3026,6 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 wait_for_ping
-
- Parameters  : Maximum number of minutes to wait (optional)
- Returns     : 1 if computer is pingable, 0 otherwise
- Description : Attempts to ping the computer specified in the DataStructure
-               for the current reservation. It will wait up to a maximum number
-					of minutes. This can be specified by passing the subroutine an
-					integer value or the default value of 5 minutes will be used.
-
-=cut
-
-sub wait_for_ping {
-	my $self = shift;
-	if (ref($self) !~ /windows/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-
-	my $computer_node_name = $self->data->get_computer_node_name();
-
-	# Attempt to get the total number of minutes to wait from the command line
-	my $total_wait_minutes = shift;
-	if (!defined($total_wait_minutes) || $total_wait_minutes !~ /^\d+$/) {
-		$total_wait_minutes = 5;
-	}
-
-	# Looping configuration variables
-	# Seconds to wait in between loop attempts
-	my $attempt_delay = 5;
-	# Total loop attempts made
-	# Add 1 to the number of attempts because if you're waiting for x intervals, you check x+1 times including at 0
-	my $attempts = ($total_wait_minutes * 12) + 1;
-
-	notify($ERRORS{'OK'}, 0, "waiting for $computer_node_name to respond to ping, maximum of $total_wait_minutes minutes");
-
-	# Loop until computer is pingable
-	for (my $attempt = 1; $attempt <= $attempts; $attempt++) {
-		if ($attempt > 1) {
-			notify($ERRORS{'OK'}, 0, "attempt " . ($attempt - 1) . "/" . ($attempts - 1) . ": $computer_node_name is not pingable, sleeping for $attempt_delay seconds");
-			sleep $attempt_delay;
-		}
-
-		if (_pingnode($computer_node_name)) {
-			notify($ERRORS{'OK'}, 0, "$computer_node_name is pingable");
-			return 1;
-		}
-	} ## end for (my $attempt = 1; $attempt <= $attempts...
-
-	# Calculate how long this waited
-	my $total_wait = ($attempts * $attempt_delay);
-	notify($ERRORS{'WARNING'}, 0, "$computer_node_name is NOT pingable after waiting for $total_wait seconds");
-	return 0;
-} ## end sub wait_for_ping
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 wait_for_no_ping
-
- Parameters  : Maximum number of minutes to wait (optional)
- Returns     : 1 if computer is not pingable, 0 otherwise
- Description : Attempts to ping the computer specified in the DataStructure
-               for the current reservation. It will wait up to a maximum number
-					of minutes for ping to fail.
-
-=cut
-
-sub wait_for_no_ping {
-	my $self = shift;
-	if (ref($self) !~ /windows/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-
-	my $computer_node_name = $self->data->get_computer_node_name();
-
-	# Attempt to get the total number of minutes to wait from the command line
-	my $total_wait_minutes = shift;
-	if (!defined($total_wait_minutes) || $total_wait_minutes !~ /^\d+$/) {
-		$total_wait_minutes = 5;
-	}
-
-	# Looping configuration variables
-	# Seconds to wait in between loop attempts
-	my $attempt_delay = 5;
-	# Total loop attempts made
-	# Add 1 to the number of attempts because if you're waiting for x intervals, you check x+1 times including at 0
-	my $attempts = ($total_wait_minutes * 12) + 1;
-
-	notify($ERRORS{'OK'}, 0, "waiting for $computer_node_name to become unresponsive, maximum of $total_wait_minutes minutes");
-
-	# Loop until computer is offline
-	for (my $attempt = 1; $attempt <= $attempts; $attempt++) {
-		if ($attempt > 1) {
-			notify($ERRORS{'OK'}, 0, "attempt " . ($attempt - 1) . "/" . ($attempts - 1) . ": $computer_node_name is still pingable, sleeping for $attempt_delay seconds");
-			sleep $attempt_delay;
-		}
-
-		if (!_pingnode($computer_node_name)) {
-			notify($ERRORS{'OK'}, 0, "$computer_node_name is not pingable, returning 1");
-			return 1;
-		}
-	} ## end for (my $attempt = 1; $attempt <= $attempts...
-
-	# Calculate how long this waited
-	my $total_wait = ($attempts * $attempt_delay);
-	notify($ERRORS{'WARNING'}, 0, "$computer_node_name is still pingable after waiting for $total_wait seconds");
-	return 0;
-} ## end sub wait_for_no_ping
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 wait_for_ssh
-
- Parameters  : Maximum number of minutes to wait (optional)
- Returns     : 1 if ssh succeeded to computer, 0 otherwise
- Description : Attempts to communicate to the computer specified in the
-               DataStructure for the current reservation via SSH. It will wait
-					up to a maximum number of minutes. This can be specified by
-					passing the subroutine an integer value or the default value
-					of 5 minutes will be used.
-
-=cut
-
-sub wait_for_ssh {
-	my $self = shift;
-	if (ref($self) !~ /windows/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-
-	my $management_node_keys = $self->data->get_management_node_keys();
-	my $computer_node_name   = $self->data->get_computer_node_name();
-
-	# Attempt to get the total number of minutes to wait from the arguments
-	# If not specified, use default value
-	my $total_wait_minutes = shift;
-	if (!defined($total_wait_minutes) || $total_wait_minutes !~ /^\d+$/) {
-		$total_wait_minutes = 5;
-	}
-
-	# Looping configuration variables
-	# Seconds to wait in between loop attempts
-	my $attempt_delay = 5;
-	# Total loop attempts made
-	# Add 1 to the number of attempts because if you're waiting for x intervals, you check x+1 times including at 0
-	my $attempts = ($total_wait_minutes * 12) + 1;
-
-	notify($ERRORS{'OK'}, 0, "waiting for $computer_node_name to respond to ssh, maximum of $total_wait_minutes minutes");
-
-	# Loop until ssh is available
-	my $ssh_result = 0;
-	for (my $attempt = 1; $attempt <= $attempts; $attempt++) {
-		if ($attempt > 1) {
-			notify($ERRORS{'OK'}, 0, "attempt " . ($attempt - 1) . "/" . ($attempts - 1) . ": $computer_node_name did not respond to ssh, sleeping for $attempt_delay seconds");
-			sleep $attempt_delay;
-		}
-
-		# Try nmap to see if any of the ssh ports are open before attempting to run a test command
-		if (!nmap_port($computer_node_name, 22) && !nmap_port($computer_node_name, 24)) {
-			notify($ERRORS{'DEBUG'}, 0, "ports 22 and 24 are closed on $computer_node_name according to nmap");
-			next;
-		}
-
-		# Run a test SSH command
-		my ($exit_status, $output) = run_ssh_command({
-			node => $computer_node_name,
-			command => "echo testing ssh on $computer_node_name",
-			max_attempts => 1,
-			output_level => 0,
-		});
-		
-		# The exit status will be 0 if the command succeeded
-		if (defined($exit_status) && $exit_status == 0) {
-			notify($ERRORS{'OK'}, 0, "$computer_node_name is responding to ssh");
-			return 1;
-		}
-	} ## end for (my $attempt = 1; $attempt <= $attempts...
-
-	notify($ERRORS{'WARNING'}, 0, "$computer_node_name is not available via ssh");
-	return 0;
-} ## end sub wait_for_ssh
-
-#/////////////////////////////////////////////////////////////////////////////
-
 =head2 set_service_startup_mode
 
  Parameters  : 
@@ -8325,6 +8151,142 @@
 	return 1;
 }
 
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 get_driver_inf_paths
+
+ Parameters  : Driver class (optional)
+ Returns     : Array containing driver .inf paths
+ Description : This subroutine searches the node configuration drivers directory
+               on the computer for .inf files and returns an array containing
+               the paths of the .inf files. The node configuration drivers
+               directory is: C:\cygwin\home\root\VCL\Drivers
+               
+               An optional driver class argument can be supplied which will
+               cause this subroutine to only return drivers matching the class
+               specified. Each driver .inf file should have a Class= line which
+               specified the type of device the driver is intended for. This
+               argument can be a regular expression. For example, to search for
+               all storage drivers, pass the following string to this
+               subroutine:
+               (scsiadapter|hdc)
+               
+               The driver paths are formatted with forward slashes.
+
+=cut
+
+sub get_driver_inf_paths {
+	my $self = shift;
+	if (ref($self) !~ /windows/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	my $management_node_keys = $self->data->get_management_node_keys();
+	my $computer_node_name   = $self->data->get_computer_node_name();
+	
+	# Check if a driver class argument was specified
+	my $driver_class = shift;
+	if ($driver_class) {
+		notify($ERRORS{'DEBUG'}, 0, "attempting to locate driver .inf paths matching class: $driver_class");
+	}
+	else {
+		notify($ERRORS{'DEBUG'}, 0, "attempting to locate driver .inf paths matching any class");
+	}
+	
+	my $drivers_directory = $self->get_node_configuration_directory() . '/Drivers';
+	
+	# Find the paths of .inf files in the drivers directory with a Class=SCSIAdapter or HDC line
+	# These are the storage driver .inf files
+	my @inf_paths;
+	my $grep_command .= '/usr/bin/grep.exe -Eirl --include="*.[iI][nN][fF]" ';
+	if ($driver_class) {
+		$grep_command .= '"class[ ]*=[ ]*' . $driver_class . '" ';
+	}
+	else {
+		$grep_command .= '".*" ';
+	}
+	$grep_command .= $drivers_directory;
+	
+	my ($grep_exit_status, $grep_output) = run_ssh_command($computer_node_name, $management_node_keys, $grep_command, '', '', 1);
+	if (defined($grep_exit_status) && $grep_exit_status == 0) {
+		@inf_paths = @$grep_output;
+		notify($ERRORS{'DEBUG'}, 0, "found " . scalar(@inf_paths) . " driver .inf paths");
+	}
+	elsif ($grep_exit_status) {
+		notify($ERRORS{'WARNING'}, 0, "failed to find driver paths, exit status: $grep_exit_status, output:\n@{$grep_output}");
+		return;
+	}
+	else {
+		notify($ERRORS{'WARNING'}, 0, "failed to run SSH command to find driverpaths");
+		return;
+	}
+	
+	return @inf_paths;
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 set_device_path_key
+
+ Parameters  : None
+ Returns     : If successful: true
+               If failed: false
+ Description : Determines the paths to all of the driver .inf files copied to
+               the computer and sets the following Windows registry key:
+               HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath
+               
+               This key contains paths to driver .inf files. Windows searches
+               these files when attempting to load a device driver.
+
+=cut
+
+sub set_device_path_key {
+	my $self = shift;
+	if (ref($self) !~ /windows/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	my $management_node_keys = $self->data->get_management_node_keys();
+	my $computer_node_name   = $self->data->get_computer_node_name();
+	
+	# Find the paths of .inf files in the drivers directory
+	my @inf_paths = $self->get_driver_inf_paths();
+	if (!@inf_paths) {
+		notify($ERRORS{'WARNING'}, 0, "failed to locate driver .inf paths");
+		return;
+	}
+	
+	# Remove the .inf filenames from the paths
+	map(s/\/[^\/]*$//, @inf_paths);
+	
+	# Remove duplicate paths
+	my %inf_path_hash;
+	my @inf_paths_unique = grep { !$inf_path_hash{$_}++ } @inf_paths;
+	
+	# Assemble the device path value
+	my $device_path_value = '%SystemRoot%\\inf;' . join(";", @inf_paths_unique);
+	
+	# Replace forward slashes with backslashes
+	$device_path_value =~ s/\//\\/g;
+	
+	notify($ERRORS{'DEBUG'}, 0, "device path value: $device_path_value");
+	
+	# Attempt to set the DevicePath key
+	my $registry_key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion';
+	if ($self->reg_add($registry_key, 'DevicePath', 'REG_EXPAND_SZ', $device_path_value)) {
+		notify($ERRORS{'OK'}, 0, "set the DevicePath registry key");
+	}
+	else {
+		notify($ERRORS{'WARNING'}, 0, "failed to set the DevicePath registry key");
+		return;
+	}
+	
+	return 1;
+}
+
 #/////////////////////////////////////////////////////////////////////////////
 
 1;

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_5.pm Mon Jan 25 18:33:21 2010
@@ -281,7 +281,7 @@
 	}
 
 	# Wait maximum of 10 minutes for the computer to become unresponsive
-	if (!$self->wait_for_no_ping(10)) {
+	if (!$self->wait_for_no_ping(600)) {
 		# Computer never stopped responding to ping
 		notify($ERRORS{'WARNING'}, 0, "$computer_node_name never became unresponsive to ping");
 		return 0;
@@ -544,143 +544,6 @@
 	return $mass_storage_section;
 }
 
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 get_driver_inf_paths
-
- Parameters  : Driver class (optional)
- Returns     : Array containing driver .inf paths
- Description : This subroutine searches the node configuration drivers directory
-               on the computer for .inf files and returns an array containing
-               the paths of the .inf files. The node configuration drivers
-               directory is: C:\cygwin\home\root\VCL\Drivers
-               
-               An optional driver class argument can be supplied which will
-               cause this subroutine to only return drivers matching the class
-               specified. Each driver .inf file should have a Class= line which
-               specified the type of device the driver is intended for. This
-               argument can be a regular expression. For example, to search for
-               all storage drivers, pass the following string to this
-               subroutine:
-               (scsiadapter|hdc)
-               
-               The driver paths are formatted with forward slashes.
-
-=cut
-
-sub get_driver_inf_paths {
-	my $self = shift;
-	if (ref($self) !~ /windows/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-	
-	my $management_node_keys = $self->data->get_management_node_keys();
-	my $computer_node_name   = $self->data->get_computer_node_name();
-	
-	# Check if a driver class argument was specified
-	my $driver_class = shift;
-	if ($driver_class) {
-		notify($ERRORS{'DEBUG'}, 0, "attempting to locate driver .inf paths matching class: $driver_class");
-	}
-	else {
-		notify($ERRORS{'DEBUG'}, 0, "attempting to locate driver .inf paths matching any class");
-	}
-	
-	my $drivers_directory = $self->get_node_configuration_directory() . '/Drivers';
-	
-	# Find the paths of .inf files in the drivers directory with a Class=SCSIAdapter or HDC line
-	# These are the storage driver .inf files
-	my @inf_paths;
-	my $grep_command .= '/usr/bin/grep.exe -Eirl --include="*.[iI][nN][fF]" ';
-	if ($driver_class) {
-		$grep_command .= '"class[ ]*=[ ]*' . $driver_class . '" ';
-	}
-	else {
-		$grep_command .= '".*" ';
-	}
-	$grep_command .= $drivers_directory;
-	
-	my ($grep_exit_status, $grep_output) = run_ssh_command($computer_node_name, $management_node_keys, $grep_command, '', '', 1);
-	if (defined($grep_exit_status) && $grep_exit_status == 0) {
-		@inf_paths = @$grep_output;
-		notify($ERRORS{'DEBUG'}, 0, "found " . scalar(@inf_paths) . " driver .inf paths");
-	}
-	elsif ($grep_exit_status) {
-		notify($ERRORS{'WARNING'}, 0, "failed to find driver paths, exit status: $grep_exit_status, output:\n@{$grep_output}");
-		return;
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to run SSH command to find driverpaths");
-		return;
-	}
-	
-	return @inf_paths;
-}
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 set_device_path_key
-
- Parameters  : None
- Returns     : If successful: true
-               If failed: false
- Description : Determines the paths to all of the driver .inf files copied to
-               the computer and sets the following Windows registry key:
-               HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath
-               
-               This key contains paths to driver .inf files. Windows searches
-               these files when attempting to load a device driver.
-
-=cut
-
-sub set_device_path_key {
-	my $self = shift;
-	if (ref($self) !~ /windows/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-	
-	my $management_node_keys = $self->data->get_management_node_keys();
-	my $computer_node_name   = $self->data->get_computer_node_name();
-	
-	# Find the paths of .inf files in the drivers directory
-	my @inf_paths = $self->get_driver_inf_paths();
-	if (!@inf_paths) {
-		notify($ERRORS{'WARNING'}, 0, "failed to locate driver .inf paths");
-		return;
-	}
-	
-	# Remove the .inf filenames from the paths
-	map(s/\/[^\/]*$//, @inf_paths);
-	
-	# Remove duplicate paths
-	my %inf_path_hash;
-	my @inf_paths_unique = grep { !$inf_path_hash{$_}++ } @inf_paths;
-	
-	# Assemble the device path value
-	my $device_path_value = '%SystemRoot%\\inf;' . join(";", @inf_paths_unique);
-	
-	# Replace forward slashes with backslashes
-	$device_path_value =~ s/\//\\/g;
-	
-	notify($ERRORS{'DEBUG'}, 0, "device path value: $device_path_value");
-	
-	# Attempt to set the DevicePath key
-	my $registry_key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion';
-	if ($self->reg_add($registry_key, 'DevicePath', 'REG_EXPAND_SZ', $device_path_value)) {
-		notify($ERRORS{'OK'}, 0, "set the DevicePath registry key");
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to set the DevicePath registry key");
-		return;
-	}
-	
-	return 1;
-
-}
-
 #/////////////////////////////////////////////////////////////////////////////
 
 1;

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Version_6.pm Mon Jan 25 18:33:21 2010
@@ -1324,6 +1324,13 @@
 		notify($ERRORS{'WARNING'}, 0, "failed to add Installation Sources registry key");
 	}
 	
+	# Set the DevicePath registry key
+	# This is used to locate device drivers
+	if (!$self->set_device_path_key()) {
+		notify($ERRORS{'WARNING'}, 0, "failed to set the DevicePath registry key");
+		return;
+	}
+	
 	# Reset the Windows setup registry keys
 	# If Sysprep fails it will set keys which make running Sysprep again impossible
 	# These keys never get reset, Microsoft instructs you to reinstall the OS
@@ -1366,7 +1373,7 @@
 	}
 	
 	# Wait maximum of 5 minutes for the computer to become unresponsive
-	if (!$self->wait_for_no_ping(5)) {
+	if (!$self->wait_for_no_ping(300)) {
 		# Computer never stopped responding to ping
 		notify($ERRORS{'WARNING'}, 0, "$computer_node_name never became unresponsive to ping");
 		return 0;
@@ -1465,6 +1472,41 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 wait_for_response
+
+ Parameters  : None
+ Returns     : If successful: true
+               If failed: false
+ Description : Waits for the reservation computer to respond to SSH after it
+               has been loaded.
+
+=cut
+
+sub wait_for_response {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	my $initial_delay_seconds;
+	my $ssh_response_timeout_seconds;
+	
+	if ($self->data->get_imagemeta_sysprep()) {
+		$initial_delay_seconds = 240;
+		$ssh_response_timeout_seconds = 1800; 
+	}
+	else {
+		$initial_delay_seconds = 180;
+		$ssh_response_timeout_seconds = 600; 
+	}
+	
+	# Call parent class's wait_for_response subroutine
+	return $self->SUPER::wait_for_response($initial_delay_seconds, $ssh_response_timeout_seconds);
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
 1;
 __END__
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm Mon Jan 25 18:33:21 2010
@@ -504,32 +504,21 @@
 	else {
 		notify($ERRORS{'OK'}, 0, "IP is known for $computer_shortname");
 	}
-	# Start waiting for SSH to come up
-	my $sshdstatus = 0;
-	$wait_loops = 0;
-	my $sshd_status = "off";
-	notify($ERRORS{'DEBUG'}, 0, "Waiting for ssh to come up on $computer_shortname");
-	while (!$sshdstatus) {
-		my $sshd_status = _sshd_status($computer_shortname, $image_name, $image_os_type);
-		if ($sshd_status eq "on") {
-			$sshdstatus = 1;
-			notify($ERRORS{'OK'}, 0, "$computer_shortname now has active sshd running");
+	
+	# Call OS module's post_load() subroutine
+	if ($self->os->can("post_load")) {
+		notify($ERRORS{'DEBUG'}, 0, "calling " . ref($self->os) . "->post_load()");
+		if ($self->os->post_load()) {
+			notify($ERRORS{'DEBUG'}, 0, "successfully ran OS post_load subroutine");
 		}
 		else {
-			#either sshd is off or N/A, we wait
-			if ($wait_loops > 50) {
-				notify($ERRORS{'CRITICAL'}, 0, "waited acceptable amount of time for sshd to become active, please check $computer_shortname on $vmhost_shortname");
-				#need to check power, maybe reboot it. for now fail it
-				return 0;
-			}
-			else {
-				$wait_loops++;
-				# to give post config a chance
-				notify($ERRORS{'OK'}, 0, "going to sleep 5 seconds, waiting for computer to start SSH. Try $wait_loops");
-				sleep 5;
-			}
-		}    # else
-	}    #while
+			notify($ERRORS{'WARNING'}, 0, "failed to run OS post_load subroutine");
+			return;
+		}
+	}
+	else {
+		notify($ERRORS{'DEBUG'}, 0, ref($self->os) . "::post_load() has not been implemented");
+	}
 
 	# Set IP info
 	if ($IPCONFIGURATION ne "manualDHCP") {

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm Mon Jan 25 18:33:21 2010
@@ -841,143 +841,6 @@
 	} ## end for my $l (@{$sshcmd[1]})
 	my $sloop = 0;
 	if ($s1) {
-		#stage1 complete monitor local messages log for boot up info
-		if (open(TAIL, "</var/log/messages")) {
-			seek TAIL, -1, 2;    #
-			for (;;) {
-				notify($ERRORS{'OK'}, 0, "$computer_shortname ROUND 1 checks loop $sloop of 40");
-
-				# re-check state of vm
-				my @vmstate = run_ssh_command($hostnode, $identity, "vmware-cmd $myvmx getstate", "root");
-				notify($ERRORS{'OK'}, 0, "rechecking state of vm $computer_shortname $myvmx");
-				for my $l (@{$vmstate[1]}) {
-					next if ($l =~ /Warning:/);
-					if ($l =~ /= on/) {
-						#good vm still on
-						notify($ERRORS{'OK'}, 0, "vm $computer_shortname reports on");
-						
-						my $sshd_status = _sshd_status($computer_shortname, $requestedimagename);
-						if ($sshd_status eq "on") {
-							notify($ERRORS{'OK'}, 0, "$computer_shortname now has active sshd running, maybe we missed the READY flag setting STAGE5 flag");
-							$s5 = 1;
-							#speed this up a bit
-							close(TAIL);
-							goto VMWAREROUND2;
-						}
-						else {
-							notify($ERRORS{'OK'}, 0, "sshd is NOT active on $computer_shortname yet");
-						}
-						
-					} ## end if ($l =~ /= on/)
-					elsif ($l =~ /= off/) {
-						#good vm still on
-						notify($ERRORS{'CRITICAL'}, 0, "state of vm $computer_shortname reports off after pass number $sloop attempting to restart: start attempts $vmware_starts");
-						close(TAIL);
-						goto VMWARESTART;
-					}
-					elsif ($l =~ /= stuck/) {
-						notify($ERRORS{'CRITICAL'}, 0, "vm $computer_shortname reports stuck on pass $sloop attempting to kill pid and restart: restart attempts $vmware_starts");
-						close(TAIL);
-						#kill stuck process
-						#list processes for vmx and kill pid
-						notify($ERRORS{'OK'}, 0, "vm reported in stuck state, attempting to kill process");
-						my @ssh_pid = run_ssh_command($hostnode, $identity, "vmware-cmd -q $myvmx getpid");
-						foreach my $p (@{$ssh_pid[1]}) {
-							if ($p =~ /(\D*)(\s*)([0-9]*)/) {
-								my $vmpid = $3;
-								if (defined(run_ssh_command($hostnode, $identity, "kill -9 $vmpid"))) {
-									notify($ERRORS{'OK'}, 0, "killed $vmpid $myvmx");
-								}
-							}
-						}
-					} ## end elsif ($l =~ /= stuck/)  [ if ($l =~ /= on/)
-				} ## end for my $l (@{$vmstate[1]})
-
-				while (<TAIL>) {
-					if ($_ =~ /$vmclient_eth0MAC|$vmclient_privateIPaddress|$computer_shortname/) {
-						notify($ERRORS{'DEBUG'}, 0, "DEBUG output for $computer_shortname $_");
-					}
-					if (!$s2) {
-						if ($_ =~ /dhcpd: DHCPDISCOVER from $vmclient_eth0MAC/) {
-							$s2 = 1;
-							insertloadlog($reservation_id, $vmclient_computerid, "vmstage2", "detected DHCP request for node");
-							notify($ERRORS{'OK'}, 0, "$computer_shortname STAGE 2 set DHCPDISCOVER from $vmclient_eth0MAC");
-						}
-					}
-					if (!$s3) {
-						if ($_ =~ /dhcpd: DHCPACK on $vmclient_privateIPaddress to $vmclient_eth0MAC/) {
-							$s3 = 1;
-							insertloadlog($reservation_id, $vmclient_computerid, "vmstage3", "detected DHCPACK for node");
-							notify($ERRORS{'OK'}, 0, "$computer_shortname STAGE 3 set DHCPACK on $vmclient_privateIPaddress to $vmclient_eth0MAC}");
-						}
-					}
-					if (!$s4) {
-						if ($_ =~ /dhcpd: DHCPACK on $vmclient_privateIPaddress to $vmclient_eth0MAC/) {
-							$s4 = 1;
-							insertloadlog($reservation_id, $vmclient_computerid, "vmstage4", "detected 2nd DHCPACK for node");
-							notify($ERRORS{'OK'}, 0, "$computer_shortname STAGE 4 set another DHCPACK on $vmclient_privateIPaddress to $vmclient_eth0MAC");
-						}
-					}
-					if (!$s5) {
-						if ($_ =~ /$computer_shortname is READY\./) {
-							$s5 = 1;
-							notify($ERRORS{'OK'}, 0, "$computer_shortname STAGE 5 set found READY flag");
-							insertloadlog($reservation_id, $vmclient_computerid, "vmstage5", "detected READY flag proceeding to post configuration");
-							#speed this up a bit
-							close(TAIL);
-							goto VMWAREROUND2;
-						}
-
-					} ## end if (!$s5)
-					if ($sloop > 20) {
-						#are we getting close
-						if ($_ =~ /DHCPACK on $vmclient_privateIPaddress to $vmclient_eth0MAC}/) {
-							#getting close -- extend it a bit
-							notify($ERRORS{'OK'}, 0, "$computer_shortname is getting close extending wait time");
-							insertloadlog($reservation_id, $vmclient_computerid, "info", "getting close node is booting");
-							$sloop = $sloop - 8;
-						}
-						if ($_ =~ /$computer_shortname sshd/) {
-							#getting close -- extend it a bit
-							notify($ERRORS{'OK'}, 0, "$computer_shortname is getting close sshd is starting extending wait time");
-							insertloadlog($reservation_id, $vmclient_computerid, "info", "getting close services are starting on node");
-							$sloop = $sloop - 5;
-						}
-
-						my $sshd_status = _sshd_status($computer_shortname, $requestedimagename, $image_os_type);
-						if ($sshd_status eq "on") {
-							notify($ERRORS{'OK'}, 0, "$computer_shortname now has active sshd running, maybe we missed the READY flag setting STAGE5 flag");
-							$s5 = 1;
-							#speed this up a bit
-							close(TAIL);
-							goto VMWAREROUND2;
-						}
-					} ## end if ($sloop > 20)
-
-				}    #while
-
-				if ($s5) {
-					#good
-					close(TAIL);
-					goto VMWAREROUND2;
-				}
-				elsif ($sloop > 65) {
-					#taken too long -- do something different or fail it
-
-					notify($ERRORS{'CRITICAL'}, 0, "could not load $myvmx on $computer_shortname on host $hostnode");
-					insertloadlog($reservation_id, $vmclient_computerid, "failed", "could not load vmx on $hostnode");
-					close(TAIL);
-					return 0;
-
-				}
-				else {
-					#keep check the log
-					$sloop++;
-					sleep 10;
-					seek TAIL, 0, 1;
-				}
-			}    # for loop
-		}    #if tail
 	}    #if stage1
 	else {
 		notify($ERRORS{'CRITICAL'}, 0, "stage1 not confirmed, could not determine if $computer_shortname was turned on on host $hostnode");
@@ -987,43 +850,24 @@
 	my $sshd_attempts = 0;
 
 	VMWAREROUND2:
-
-	#READY flag set
-	#attempt to login via ssh
+	
 	insertloadlog($reservation_id, $vmclient_computerid, "vmround2", "waiting for ssh to become active");
-	notify($ERRORS{'OK'}, 0, "READY flag set for $myvmx, proceeding");
-	my $sshdstatus = 0;
-	my $wait_loops = 0;
-	$sshd_attempts++;
-	my $sshd_status = "off";
-	while (!$sshdstatus) {
-		my $sshd_status = _sshd_status($computer_shortname, $requestedimagename, $image_os_type);
-		if ($sshd_status eq "on") {
-			$sshdstatus = 1;
-			notify($ERRORS{'OK'}, 0, "$computer_shortname now has active sshd running, ok to proceed to sync ssh keys");
+	
+	if ($self->os->can("post_load")) {
+		notify($ERRORS{'DEBUG'}, 0, "calling " . ref($self->os) . "->post_load()");
+		if ($self->os->post_load()) {
+			notify($ERRORS{'DEBUG'}, 0, "successfully ran OS post_load subroutine");
 		}
 		else {
-			#either sshd is off or N/A, we wait
-			if ($wait_loops > 5) {
-				if ($sshd_attempts < 3) {
-					goto VMWAREROUND2;
-				}
-				else {
-					notify($ERRORS{'WARNING'}, 0, "waited acceptable amount of time for sshd to become active, please check $computer_shortname on $hostnode");
-					insertloadlog($reservation_id, $vmclient_computerid, "failed", "waited acceptable amout of time for core services to start on $hostnode");
-					#need to check power, maybe reboot it. for now fail it
-					return 0;
-				}
-			} ## end if ($wait_loops > 5)
-			else {
-				$wait_loops++;
-				# to give post config a chance
-				notify($ERRORS{'OK'}, 0, "going to sleep 5 seconds, waiting for post config to finish");
-				sleep 5;
-			}
-		}    # else
-	}    #while
-
+			my $vm_state = $self->power_status() || 'unknown';
+			notify($ERRORS{'WARNING'}, 0, "failed to run OS post_load subroutine, VM state: $vm_state");
+			return;
+		}
+	}
+	else {
+		notify($ERRORS{'DEBUG'}, 0, ref($self->os) . "::post_load() has not been implemented");
+	}
+	
 	#clear ssh public keys from /root/.ssh/known_hosts
 	my $known_hosts = "/root/.ssh/known_hosts";
 	my $ssh_keyscan = "/usr/bin/ssh-keyscan";
@@ -1458,41 +1302,6 @@
 		return 0;
 	}
 } ## end sub _vmwareclone
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 vmrun_cmd
-
- Parameters  : hostnode, hostnode type,full vmx path,cmd
- Returns     : 0 or 1
- Description : execute specific vmware-cmd cmd
-
-=cut
-
-sub _vmrun_cmd {
-	my ($hostnode, $hosttype, $hostidentity, $vmx, $cmd) = @_;
-	my ($package, $filename, $line, $sub) = caller(0);
-	notify($ERRORS{'WARNING'}, 0, "hostnode is not defined")     if (!(defined($hostnode)));
-	notify($ERRORS{'WARNING'}, 0, "hosttype is not defined")     if (!(defined($hosttype)));
-	notify($ERRORS{'WARNING'}, 0, "hostidentity is not defined") if (!(defined($hostidentity)));
-	notify($ERRORS{'WARNING'}, 0, "vmx is not defined")          if (!(defined($vmx)));
-	notify($ERRORS{'WARNING'}, 0, "cmd is not defined")          if (!(defined($cmd)));
-
-	if ($hosttype eq "blade") {
-
-		if ($cmd eq "off") {
-			notify($ERRORS{'OK'}, 0, "$hostnode,$hosttype,$hostidentity,$vmx,$cmd");
-			my @sshcmd = run_ssh_command($hostnode, $hostidentity, "vmware-cmd $vmx stop hard", "root");
-			foreach my $l (@{$sshcmd[1]}) {
-				next if ($l =~ /Warning: Permanently added/);
-				if ($l =~ /Error/) {
-					notify($ERRORS{'CRITICAL'}, 0, "$l output for $hostnode,$hosttype,$hostidentity,$vmx,$cmd");
-					return 0;
-				}
-			}
-		} ## end if ($cmd eq "off")
-	} ## end if ($hosttype eq "blade")
-	return 1;
-} ## end sub _vmrun_cmd
 
 #/////////////////////////////////////////////////////////////////////////////
 
@@ -1762,7 +1571,7 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2  getimagesize
+=head2  get_image_size
 
  Parameters  : imagename
  Returns     : 0 failure or size of image

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Mon Jan 25 18:33:21 2010
@@ -649,187 +649,42 @@
 	}
 
 	ROUND3:
-
-	my $nodeset_status;
-
-	# Round 3 checks, machine has been installed we wait here for boot process which could include sysprep
-	# we are checking for the boot state in the OS status
+	
 	insertloadlog($reservation_id, $computer_id, "xcatround3", "starting round 3 checks - finishing post configuration");
-	$wait_loops = 0;
-	while (!$bootstatus) {
-		my $nodeset_status = _nodeset($computer_node_name);
-
-		if ($nodeset_status =~ /boot/) {
-			$bootstatus = 1;
-			notify($ERRORS{'OK'}, 0, "$computer_node_name has been reinstalled with $image_name");
-			notify($ERRORS{'OK'}, 0, "xcat has set the boot flag");
-			if ($image_os_type =~ /windows/i) {
-				notify($ERRORS{'OK'}, 0, "waiting 3 minutes to allow OS to reboot and initialize machine");
-				sleep 180;
-			}
-
-			elsif ($image_os_type =~ /linux/i) {
-				notify($ERRORS{'OK'}, 0, "waiting 65 sec to allow OS to reboot and initialize machine");
-				sleep 65;
+	
+	if ($self->os->can("post_load")) {
+		notify($ERRORS{'DEBUG'}, 0, "calling " . ref($self->os) . "->post_load()");
+		my $post_load_result = $self->os->post_load($rinstall_attempts);
+		
+		if (!defined $post_load_result) {
+			notify($ERRORS{'WARNING'}, 0, "post_load returned undefined");
+			return;
+		}
+		elsif (!$post_load_result) {
+			notify($ERRORS{'WARNING'}, 0, "post_load subroutine returned $post_load_result");
+			
+			if ($rinstall_attempts < 2) {
+				my $debugging_message = "*reservation has NOT failed yet*\n";
+				$debugging_message .= "this notice is for debugging purposes so that node can be watched during 2nd rinstall attempt\n";
+				$debugging_message .= "sshd did not become active on $computer_node_name after first rinstall attempt\n\n";
+				$debugging_message .= $self->data->get_reservation_info_string();
+				notify($ERRORS{'CRITICAL'}, 0, "$debugging_message");
+				
+				goto XCATRINSTALL;
 			}
 			else {
-				notify($ERRORS{'OK'}, 0, "waiting 3 minutes to allow OS to reboot and initialize machine");
-				sleep 180;
+				return;
 			}
-			my ($readycount, $ready) = 0;
-			READYFLAG:
-
-			#check /var/log/messages file for READY
-
-			# Wait for READY flag
-			if (open(TAIL, "</var/log/messages")) {
-				seek TAIL, -1, 2;
-				for (;;) {
-					notify($ERRORS{'OK'}, 0, "$computer_node_name checking for READY FLAG loop count is $readycount of 10");
-					while (<TAIL>) {
-						if ($_ =~ /READY/) {
-							$ready = 1 if ($_ =~ /$computer_node_name/);
-						}
-						if ($image_os_type =~ /linux/i) {
-							if ($_ =~ /$computer_node_name|$computer_node_name kernel/) {
-								notify($ERRORS{'OK'}, 0, "$computer_node_name booting up");
-								sleep 5;
-								$ready = 1;
-								close(TAIL);
-								goto SSHDATTEMPT;
-							}
-						}
-					}    #while
-
-					if ($readycount > 10) {
-						notify($ERRORS{'OK'}, 0, "taking longer than expected, readycount==$readycount moving to next set of checks");
-						$ready = 1;
-						close(TAIL);
-						goto SSHDATTEMPT;
-					}
-					#if ($readycount > 2) {
-
-					#check ssh status just in case we missed the flag
-					my $sshd = _sshd_status($computer_node_name, $image_name, $image_os_type);
-					if ($sshd eq "on") {
-						$ready = 1;
-						notify($ERRORS{'OK'}, 0, "we may have missed start flag going next stage");
-						close(TAIL);
-						goto SSHDATTEMPT;
-					}
-					#} ## end if ($readycount > 2)
-					if (!$ready) {
-						notify($ERRORS{'OK'}, 0, "$computer_node_name not ready yet, sleeping for 40 seconds");
-						sleep 40;
-						seek TAIL, 0, 1;
-					}
-					else {
-						notify($ERRORS{'OK'}, 0, "/var/log/messages reports $computer_node_name is ready");
-						insertloadlog($reservation_id, $computer_id, "xcatREADY", "detected ready signal from node - proceeding");
-						close(TAIL);
-						goto SSHDATTEMPT;
-					}
-
-					#placing out side of if statements for loop control
-					$readycount++;
-				}    #for
-			} ## end if (open(TAIL, "</var/log/messages"))
-			else {
-				notify($ERRORS{'CRITICAL'}, 0, "could not open messages at READYFLAG $!");
-			}
-			notify($ERRORS{'OK'}, 0, "proceeding for sync sshd active");
-		} ## end if ($nodeset_status =~ /boot/)
-		else {
-
-			# check for strange states
-
 		}
-	} ## end while (!$bootstatus)
-
-	# we need to wait for sshd to become active
-	my $sshd_attempts = 0;
-	SSHDATTEMPT:
-	my $sshdstatus = 0;
-	$wait_loops = 0;
-	$sshd_attempts++;
-	my $sshd_status = "off";
-
-	# Set the sshd start time to now if it hasn't been set already
-	# This is used to report how long sshd took to become active
-	$sshd_start_time = time() if !$sshd_start_time;
-
-	while (!$sshdstatus) {
-		notify($ERRORS{'DEBUG'}, 0, "checking sshd status of $computer_node_name");
-		my $sshd_status = _sshd_status($computer_node_name, $image_name, $image_os_type);
-		if ($sshd_status eq "on") {
-
-			# Set the sshd end time to now to capture how long it took sshd to become active
-			$sshd_end_time = time();
-			my $sshd_duration = $sshd_end_time - $sshd_start_time;
-
-			$sshdstatus = 1;
-			notify($ERRORS{'OK'}, 0, "$computer_node_name sshd has become active, took $sshd_duration secs, ok to proceed to sync ssh keys");
-			insertloadlog($reservation_id, $computer_id, "info", "synchronizing keys");
-		} ## end if ($sshd_status eq "on")
 		else {
-			notify($ERRORS{'DEBUG'}, 0, "sshd is not responding yet");
-
-			#either sshd is off or N/A, we wait
-			if ($wait_loops >= 14) {
-				if ($sshd_attempts < 3) {
-					goto SSHDATTEMPT;
-				}
-				else {
-
-					# Waited long enough for sshd to become active
-
-					# Set the sshd end time to now to capture how long process waited for sshd to become active
-					$sshd_end_time = time();
-					my $sshd_duration = $sshd_end_time - $sshd_start_time;
-
-					notify($ERRORS{'WARNING'}, 0, "$computer_node_name waited acceptable amount of time for sshd to become active, $sshd_duration secs");
-
-					#need to check power, maybe reboot it. for now fail it
-					#try to reinstall it once
-					if ($rinstall_attempts < 2) {
-						my $debugging_message = "*reservation has NOT failed yet*\n";
-						$debugging_message .= "this notice is for debugging purposes so that node can be watched during 2nd rinstall attempt\n";
-						$debugging_message .= "sshd did not become active on $computer_node_name after first rinstall attempt\n\n";
-
-						$debugging_message .= "management node:     " . $self->data->get_management_node_hostname() . "\n";
-						$debugging_message .= "pid:                 " . $PID . "\n";
-						$debugging_message .= "request:             " . $self->data->get_request_id() . "\n";
-						$debugging_message .= "reservation:         " . $self->data->get_reservation_id() . "\n";
-						$debugging_message .= "state/laststate:     " . $self->data->get_request_state_name() . "/" . $self->data->get_request_laststate_name() . "\n";
-						$debugging_message .= "computer:            " . $self->data->get_computer_host_name() . " (id: " . $self->data->get_computer_id() . ")\n";
-						$debugging_message .= "user:                " . $self->data->get_user_login_id() . " (id: " . $self->data->get_user_id() . ")\n";
-						$debugging_message .= "image:               " . $self->data->get_image_name() . " (id: " . $self->data->get_image_id() . ")\n";
-						$debugging_message .= "image prettyname:    " . $self->data->get_image_prettyname() . "\n";
-						$debugging_message .= "image size:          " . $self->data->get_image_size() . "\n";
-						$debugging_message .= "reload time:         " . $self->data->get_image_reload_time() . "\n";
-
-						notify($ERRORS{'CRITICAL'}, 0, "$debugging_message");
-						insertloadlog($reservation_id, $computer_id, "repeat", "starting install process");
-						close(TAIL);
-						goto XCATRINSTALL;
-					} ## end if ($rinstall_attempts < 2)
-					else {
-						notify($ERRORS{'WARNING'}, 0, "$computer_node_name: sshd never became active after 2 rinstall attempts");
-						insertloadlog($reservation_id, $computer_id, "failed", "exceeded maximum install attempts");
-						return 0;
-					}
-				} ## end else [ if ($sshd_attempts < 3)
-			} ## end if ($wait_loops >= 7)
-			else {
-				$wait_loops++;
-
-				# to give post config a chance
-				notify($ERRORS{'OK'}, 0, "going to sleep 15 seconds, waiting for post config to finish");
-				sleep 15;
-			}
-		}    # else
-	}    #while
-
+			notify($ERRORS{'OK'}, 0, "post_load subroutine returned $post_load_result");
+		}
+	}
+	else {
+		notify($ERRORS{'DEBUG'}, 0, ref($self->os) . "::post_load() has not been implemented");
+	}
+	
+	
 	# Clear ssh public keys from /root/.ssh/known_hosts
 	my $known_hosts = "/root/.ssh/known_hosts";
 	my @file;
@@ -945,107 +800,8 @@
 	} ## end if ($IPCONFIGURATION ne "manualDHCP")
 
 	# Perform post load tasks
-
-	# Check if OS module has implemented a post_load() subroutine
-	if ($self->os->can('post_load')) {
-		# If post-load has been implemented by the OS module, don't perform these tasks here
-		# new.pm calls the OS module's post_load() subroutine
-		notify($ERRORS{'DEBUG'}, 0, "post_load() has been implemented by the OS module, returning 1");
-		return 1;
-	}
 	
-	# Linux post-load tasks
-	# TODO: The following should be removed once Linux.pm post_load() has been implemented
-	elsif ($image_os_type =~ /linux/i) {
-
-		#linux specfic routines
-		#FIXME move to generic post options on per image basis
-		if ($image_os_name =~ /^(esx[0-9]*)/) {
-
-			#esx specific post
-			my $cmdstring = "/usr/sbin/esxcfg-vswitch -a vSwitch1;/usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch1;/usr/sbin/esxcfg-vswitch -A \"Virtual Machine Public Network\" vSwitch1";
-
-			my @sshd = run_ssh_command($computer_node_name, $IDENTITY_bladerhel, $cmdstring, "root");
-			foreach my $l (@{$sshd[1]}) {
-
-				#any response is a potential  problem
-				notify($ERRORS{'DEBUG'}, 0, "esxcfg-vswitch output: $l");
-			}
-
-			#restart mgmt-vmware
-			sleep(8);    # sleep briefly before attemping to restart
-			             # restart needs to include "&" for some reason it doesn't return but completes - dunno?
-			@sshd = run_ssh_command($computer_node_name, $IDENTITY_bladerhel, "/etc/init.d/mgmt-vmware restart &", "root");
-			foreach my $l (@sshd) {
-				if ($l =~ /failed/i) {
-					notify($ERRORS{'WARNING'}, 0, "failed to restart mgmt-vmware @sshd");
-					return 0;
-				}
-			}
-		} ## end if ($image_os_name =~ /^(esx[0-9]*)/)
-		                #FIXME - could be an issue for esx servers
-		if (changelinuxpassword($computer_node_name, "root")) {
-			notify($ERRORS{'OK'}, 0, "successfully changed root password on $computer_node_name");
-
-#insertloadlog($reservation_id, $computer_id, "info", "SUCCESS randomized roots password");
-		}
-		else {
-			notify($ERRORS{'OK'}, 0, "failed to edit root password on $computer_node_name");
-		}
-
-		#disable ext_sshd
-		my @stopsshd = run_ssh_command($computer_node_name, $IDENTITY_bladerhel, "/etc/init.d/ext_sshd stop", "root");
-		foreach my $l (@{$stopsshd[1]}) {
-			if ($l =~ /Stopping ext_sshd/) {
-				notify($ERRORS{'OK'}, 0, "ext sshd stopped on $computer_node_name");
-				last;
-			}
-		}
-
-		#if an image, clear wtmp and krb token files
-		# FIXME - move to createimage
-		if ($image_os_type =~ /linux/i) {
-			my @cleartmp = run_ssh_command($computer_node_name, $IDENTITY_bladerhel, "/usr/sbin/tmpwatch -f 0 /tmp; /bin/cp /dev/null /var/log/wtmp", "root");
-			foreach my $l (@{$cleartmp[1]}) {
-				notify($ERRORS{'DEBUG'}, 0, "output from cleartmp post load $computer_node_name $l");
-			}
-		}
-
-		# clear external_sshd file of any AllowUsers string
-		my $path1 = "$computer_node_name:/etc/ssh/external_sshd_config";
-		my $path2 = "/tmp/$computer_node_name.sshd";
-		if (run_scp_command($path1, $path2, $IDENTITY_bladerhel)) {
-			notify($ERRORS{'DEBUG'}, 0, "scp success retrieved $path1");
-		}
-		else {
-			notify($ERRORS{'WARNING'}, 0, "failed to retrieve $path1");
-		}
-		#remove from sshd
-		if (open(SSHDCFG, "/tmp/$computer_node_name.sshd")) {
-			@file = <SSHDCFG>;
-			close SSHDCFG;
-			foreach my $l (@file) {
-				$l = "" if ($l =~ /AllowUsers/);
-			}
-			if (open(SCP, ">/tmp/$computer_node_name.sshd")) {
-				print SCP @file;
-				close SCP;
-			}
-			undef $path1;
-			undef $path2;
-			$path1 = "/tmp/$computer_node_name.sshd";
-			$path2 = "$computer_node_name:/etc/ssh/external_sshd_config";
-			if (run_scp_command($path1, $path2, $IDENTITY_bladerhel)) {
-				notify($ERRORS{'DEBUG'}, 0, "scp success copied $path1 to $path2");
-				unlink $path1;
-			}
-			else {
-				notify($ERRORS{'WARNING'}, 0, "failed to copy $path1 to $path2");
-			}
-		} ## end if (open(SSHDCFG, "/tmp/$computer_node_name.sshd"...
-
 
-	} ## end elsif ($image_os_type =~ /linux/i)  [ if ($self->os->can('post_load'))
 
 	return 1;
 } ## end sub load

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm Mon Jan 25 18:33:21 2010
@@ -748,171 +748,40 @@
 
 
 	ROUND3:
-	# Round 3 checks, machine has been installed we wait here for boot process which could include sysprep
-	# we are checking for the boot state in the OS status
+	
 	insertloadlog($reservation_id, $computer_id, "xcatround3", "starting round 3 checks - finishing post configuration");
-	$wait_loops = 0;
-	while (!$bootstatus) {
-		my $nodeset_status = _nodeset($computer_node_name);
-
-		if ($nodeset_status =~ /boot/) {
-			$bootstatus = 1;
-			notify($ERRORS{'OK'}, 0, "$computer_node_name has been reinstalled with $image_name");
-			notify($ERRORS{'OK'}, 0, "xcat has set the boot flag");
-			if ($image_os_type =~ /windows/i) {
-				notify($ERRORS{'OK'}, 0, "waiting 3 minutes to allow OS to reboot and initialize machine");
-				sleep 180;
-			}
-			elsif ($image_os_type =~ /linux/i) {
-				notify($ERRORS{'OK'}, 0, "waiting 65 sec to allow OS to reboot and initialize machine");
-				sleep 65;
+	
+	if ($self->os->can("post_load")) {
+		notify($ERRORS{'DEBUG'}, 0, "calling " . ref($self->os) . "->post_load()");
+		my $post_load_result = $self->os->post_load($rinstall_attempts);
+		
+		if (!defined $post_load_result) {
+			notify($ERRORS{'WARNING'}, 0, "post_load returned undefined");
+			return;
+		}
+		elsif (!$post_load_result) {
+			notify($ERRORS{'WARNING'}, 0, "post_load subroutine returned $post_load_result");
+			
+			if ($rinstall_attempts < 2) {
+				my $debugging_message = "*reservation has NOT failed yet*\n";
+				$debugging_message .= "this notice is for debugging purposes so that node can be watched during 2nd rinstall attempt\n";
+				$debugging_message .= "sshd did not become active on $computer_node_name after first rinstall attempt\n\n";
+				$debugging_message .= $self->data->get_reservation_info_string();
+				notify($ERRORS{'CRITICAL'}, 0, "$debugging_message");
+				
+				goto XCATRINSTALL;
 			}
 			else {
-				notify($ERRORS{'OK'}, 0, "waiting 3 minutes to allow OS to reboot and initialize machine");
-				sleep 180;
+				return;
 			}
-			my ($readycount, $ready) = 0;
-			READYFLAG:
-			#check /var/log/messages file for READY
-
-			if (open(TAIL, "</var/log/messages")) {
-				seek TAIL, -1, 2;
-				for (;;) {
-					notify($ERRORS{'OK'}, 0, "$computer_node_name checking for READY FLAG loop count is $readycount of 10");
-					while (<TAIL>) {
-						if ($_ =~ /READY|ready|Starting firstboot:  succeeded/) {
-							$ready = 1 if ($_ =~ /$computer_node_name/);
-						}
-						if ($image_os_type =~ /linux/i) {
-							# TODO update for v2
-							if ($_ =~ /$computer_node_name|$computer_node_name kernel/) {
-								notify($ERRORS{'OK'}, 0, "$computer_node_name booting up");
-								sleep 5;
-								$ready = 1;
-								close(TAIL);
-								goto SSHDATTEMPT;
-							}
-						} ## end if ($image_os_type =~ /linux/i)
-					}    #while
-
-					if ($readycount > 10) {
-						notify($ERRORS{'OK'}, 0, "taking longer than expected, readycount==$readycount moving to next set of checks");
-						$ready = 1;
-						close(TAIL);
-						goto SSHDATTEMPT;
-					}
-					if ($readycount > 2) {
-						#check ssh status just in case we missed the flag
-						my $sshd = _sshd_status($computer_node_name, $image_name);
-						if ($sshd eq "on") {
-							$ready = 1;
-							notify($ERRORS{'OK'}, 0, "we may have missed start flag going next stage");
-							close(TAIL);
-							goto SSHDATTEMPT;
-						}
-					} ## end if ($readycount > 2)
-					if (!$ready) {
-						notify($ERRORS{'OK'}, 0, "$computer_node_name not ready yet, sleeping for 40 seconds");
-						sleep 40;
-						seek TAIL, 0, 1;
-					}
-					else {
-						notify($ERRORS{'OK'}, 0, "/var/log/messages reports $computer_node_name is ready");
-						insertloadlog($reservation_id, $computer_id, "xcatREADY", "detected ready signal from node - proceeding");
-						close(TAIL);
-						goto SSHDATTEMPT;
-					}
-					#placing out side of if statements for loop control
-					$readycount++;
-				}    #for
-			} ## end if (open(TAIL, "</var/log/messages"))
-			else {
-				notify($ERRORS{'CRITICAL'}, 0, "could not open messages at READYFLAG $!");
-			}
-			notify($ERRORS{'OK'}, 0, "proceeding for sync sshd active");
-		} ## end if ($nodeset_status =~ /boot/)
-		else {
-			# check for strange states
-		}
-	} ## end while (!$bootstatus)
-
-	# we need to wait for sshd to become active
-	my $sshd_attempts = 0;
-	SSHDATTEMPT:
-	my $sshdstatus = 0;
-	$wait_loops = 0;
-	$sshd_attempts++;
-	my $sshd_status = "off";
-
-	# Set the sshd start time to now if it hasn't been set already
-	# This is used to report how long sshd took to become active
-	$sshd_start_time = time() if !$sshd_start_time;
-
-	while (!$sshdstatus) {
-		my $sshd_status = _sshd_status($computer_node_name, $image_name, $image_os_type);
-		if ($sshd_status eq "on") {
-			# Set the sshd end time to now to capture how long it took sshd to become active
-			$sshd_end_time = time();
-			my $sshd_duration = $sshd_end_time - $sshd_start_time;
-
-			$sshdstatus = 1;
-			notify($ERRORS{'OK'}, 0, "$computer_node_name sshd has become active, took $sshd_duration secs, ok to proceed to sync ssh keys");
-			insertloadlog($reservation_id, $computer_id, "info", "synchronizing keys");
 		}
 		else {
-			#either sshd is off or N/A, we wait
-			if ($wait_loops >= 7) {
-				if ($sshd_attempts < 3) {
-					goto SSHDATTEMPT;
-				}
-				else {
-					# Waited long enough for sshd to become active
-
-					# Set the sshd end time to now to capture how long process waited for sshd to become active
-					$sshd_end_time = time();
-					my $sshd_duration = $sshd_end_time - $sshd_start_time;
-
-					notify($ERRORS{'WARNING'}, 0, "$computer_node_name waited acceptable amount of time for sshd to become active, $sshd_duration secs");
-					#need to check power, maybe reboot it. for now fail it
-					#try to reinstall it once
-					if ($rinstall_attempts < 2) {
-						my $debugging_message = "*reservation has NOT failed yet*\n";
-						$debugging_message .= "this notice is for debugging purposes so that node can be watched during 2nd rinstall attempt\n";
-						$debugging_message .= "sshd did not become active on $computer_node_name after first rinstall attempt\n\n";
-
-						$debugging_message .= "management node:     " . $self->data->get_management_node_hostname() . "\n";
-						$debugging_message .= "pid:                 " . $PID . "\n";
-						$debugging_message .= "request:             " . $self->data->get_request_id() . "\n";
-						$debugging_message .= "reservation:         " . $self->data->get_reservation_id() . "\n";
-						$debugging_message .= "state/laststate:     " . $self->data->get_request_state_name() . "/" . $self->data->get_request_laststate_name() . "\n";
-						$debugging_message .= "computer:            " . $self->data->get_computer_host_name() . " (id: " . $self->data->get_computer_id() . ")\n";
-						$debugging_message .= "user:                " . $self->data->get_user_login_id() . " (id: " . $self->data->get_user_id() . ")\n";
-						$debugging_message .= "image:               " . $self->data->get_image_name() . " (id: " . $self->data->get_image_id() . ")\n";
-						$debugging_message .= "image prettyname:    " . $self->data->get_image_prettyname() . "\n";
-						$debugging_message .= "image size:          " . $self->data->get_image_size() . "\n";
-						$debugging_message .= "reload time:         " . $self->data->get_image_reload_time() . "\n";
-
-						notify($ERRORS{'CRITICAL'}, 0, "$debugging_message");
-						insertloadlog($reservation_id, $computer_id, "repeat", "starting install process");
-						close(TAIL);
-						goto XCATRINSTALL;
-					} ## end if ($rinstall_attempts < 2)
-					else {
-						notify($ERRORS{'CRITICAL'}, 0, "$computer_node_name: sshd never became active after 2 rinstall attempts");
-						insertloadlog($reservation_id, $computer_id, "failed", "exceeded maximum install attempts");
-						return 0;
-					}
-				} ## end else [ if ($sshd_attempts < 3)
-			} ## end if ($wait_loops >= 7)
-			else {
-				$wait_loops++;
-				# to give post config a chance
-				notify($ERRORS{'OK'}, 0, "going to sleep 15 seconds, waiting for post config to finish");
-				sleep 15;
-			}
-		}    # else
-	}    #while
-
+			notify($ERRORS{'OK'}, 0, "post_load subroutine returned $post_load_result");
+		}
+	}
+	else {
+		notify($ERRORS{'DEBUG'}, 0, ref($self->os) . "::post_load() has not been implemented");
+	}
 
 	# Clear ssh public keys from /root/.ssh/known_hosts
 
@@ -1034,45 +903,6 @@
 		} ## end elsif ($IPCONFIGURATION eq "static")  [ if ($IPCONFIGURATION eq "dynamicDHCP")
 	} ## end if ($IPCONFIGURATION ne "manualDHCP")
 
-	# Perform post load tasks
-
-	# Windows specific routines
-	if ($self->os->can('post_load')) {
-		# If post-load has been implemented by the OS module, don't perform these tasks here
-		# new.pm calls the Windows module's post_load() subroutine to perform the same tasks as below
-		notify($ERRORS{'OK'}, 0, "post_load() has been implemented by the OS module, skipping these tasks in xCAT.pm, returning 1");
-		return 1;
-	}
-	
-	# Linux post-load tasks
-	# TODO: The following should be removed once Linux.pm post_load() has been implemented
-	elsif ($image_os_type =~ /linux/i) {
-		#linux specfic routines
-		#FIXME move to generic post options on per image basis
-		if ($image_os_name =~ /^(esx[0-9]*)/) {
-			#esx specific post
-			my $cmdstring = "/usr/sbin/esxcfg-vswitch -a vSwitch1;/usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch1;/usr/sbin/esxcfg-vswitch -A \"Virtual Machine Public Network\" vSwitch1";
-
-			my @sshd = run_ssh_command($computer_node_name, $IDENTITY_bladerhel, $cmdstring, "root");
-			foreach my $l (@{$sshd[1]}) {
-				#any response is a potential  problem
-				notify($ERRORS{'DEBUG'}, 0, "esxcfg-vswitch output: $l");
-			}
-			#restart mgmt-vmware
-			sleep(8);    # sleep briefly before attemping to restart
-			             # restart needs to include "&" for some reason it doesn't return but completes - dunno?
-			@sshd = run_ssh_command($computer_node_name, $IDENTITY_bladerhel, "/etc/init.d/mgmt-vmware restart &", "root");
-			foreach my $l (@sshd) {
-				if ($l =~ /failed/i) {
-					notify($ERRORS{'WARNING'}, 0, "failed to restart mgmt-vmware @sshd");
-					return 0;
-				}
-			}
-		} ## end if ($image_os_name =~ /^(esx[0-9]*)/)
-		                #FIXME - could be an issue for esx servers
-
-	} ## end elsif ($image_os_type =~ /linux/i)  [ if ($self->os->can('post_load'))
-
 	return 1;
 } ## end sub load
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/new.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/new.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/new.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/new.pm Mon Jan 25 18:33:21 2010
@@ -682,27 +682,6 @@
 	}
 	
 	
-	# Check if OS module's post_load() subroutine exists
-	if ($self->os->can("post_load")) {
-		notify($ERRORS{'OK'}, 0, ref($self->os) . "->post_load() subroutine exists");
-	
-		# Call OS module's post_load() subroutine
-		notify($ERRORS{'OK'}, 0, "calling " . ref($self->os) . "->post_load() subroutine");
-		insertloadlog($reservation_id, $computer_id, "info", "calling " . ref($self->os) . "->post_load() subroutine");
-		if ($self->os->post_load()) {
-			notify($ERRORS{'OK'}, 0, "successfully performed OS post-load tasks for $image_name on $computer_short_name");
-			insertloadlog($reservation_id, $computer_id, "info", "performed OS post-load tasks for $image_name on $computer_short_name");
-		}
-		else {
-			notify($ERRORS{'CRITICAL'}, 0, "failed to perform OS post-load tasks for $image_name on $computer_short_name, returning");
-			insertloadlog($reservation_id, $computer_id, "loadimagefailed", "failed to perform OS post-load tasks for $image_name on $computer_short_name");
-			return;
-		}
-	}
-	else {
-		notify($ERRORS{'OK'}, 0, ref($self->os) . "->post_load() subroutine does not exist");
-	}
-	
 	#Post operations not to be handled by provisioning modules
 	if($image_os_install_type eq "kickstart"){
 		notify($ERRORS{'OK'}, 0, "Detected kickstart install on $computer_short_name, writing current_image.txt");

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=902913&r1=902912&r2=902913&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Mon Jan 25 18:33:21 2010
@@ -2973,6 +2973,10 @@
 
 sub _pingnode {
 	my ($hostname) = $_[0];
+	if (!$hostname) {
+		notify($ERRORS{'WARNING'}, 0, "hostname argument was not supplied");
+		return;
+	}
 
 	my $p = Net::Ping->new("icmp");
 	my $result = $p->ping($hostname, 1);
@@ -5888,7 +5892,9 @@
 
 		# Check the exit status
 		# ssh exits with the exit status of the remote command or with 255 if an error occurred.
-		if ($exit_status == 255 || $ssh_output_formatted =~ /lost connection|reset by peer|no route to host|connection refused|connection timed out/i) {
+		# Check for vmware-cmd usage message, it returns 255 if the vmware-cmd usage output is returned
+		if (($exit_status == 255 && $ssh_output_formatted !~ /usage.*vmware-cmd/i) ||
+			 $ssh_output_formatted =~ /lost connection|reset by peer|no route to host|connection refused|connection timed out/i) {
 			notify($ERRORS{'WARNING'}, 0, "attempt $attempts/$max_attempts: failed to execute SSH command on $node: $command, exit status: $exit_status, SSH exits with the exit status of the remote command or with 255 if an error occurred, output:\n$ssh_output_formatted") if $output_level;
 			next;
 		}