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 2009/06/04 22:22:41 UTC

svn commit: r781848 - in /incubator/vcl/trunk/managementnode/lib/VCL: Module/OS/Windows_mod.pm Module/Provisioning/xCAT.pm image.pm

Author: arkurth
Date: Thu Jun  4 20:22:40 2009
New Revision: 781848

URL: http://svn.apache.org/viewvc?rev=781848&view=rev
Log:
VCL-144
Changed name of image_creation_failed() sub in image.pm to reservation_failed(). There is a sub named reservation_failed() in State.pm. Having a sub with the same name in image.pm will cause any calls to this sub for imaging reservations to use the one in image.pm because of inheritance. Also changed name of image_creation_successful() to reservation_successful() for consistency. 

VCL-144
There were calls in xCAT.pm to image_creation_failed(). This is a state module function and provisioning modules don't have access to call state module functions so the call would have failed. I changed these calls to return 0. This will return control to the state module, which will then call reservation_failed();

VCL-23
Changed behavior in xCAT.pm::capture() when the OS module returns from pre_capture(). It now waits up to 2 minutes for the computer to shut down instead of shutting the computer down immediately. This will fix a problem where the OS initiates a shutdown then returns immediately, then xCAT.pm forces a power off while the OS is shutting down.

VCL-23
Added check for the existence of the TransardAFSDaemon service before attempting to stop it in clean_hard_drive(). This prevents an error from appearing in the log file if the service isn't installed.


Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
    incubator/vcl/trunk/managementnode/lib/VCL/image.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm?rev=781848&r1=781847&r2=781848&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows_mod.pm Thu Jun  4 20:22:40 2009
@@ -5857,7 +5857,9 @@
 	);
 
 	# Attempt to stop the AFS service, needed to delete AFS files
-	$self->stop_service('TransarcAFSDaemon');
+	if ($self->service_exists('TransarcAFSDaemon')) {
+		$self->stop_service('TransarcAFSDaemon');
+	}
 
 	# Loop through the directories to empty
 	# Don't care if they aren't emptied

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=781848&r1=781847&r2=781848&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Thu Jun  4 20:22:40 2009
@@ -1242,14 +1242,13 @@
 			notify($ERRORS{'WARNING'}, 0, "OS module pre_capture() failed");
 			return 0;
 		}
-
-		# Get the power status, make sure computer is off
-		my $power_status = $self->power_status();
-		notify($ERRORS{'DEBUG'}, 0, "retrieved power status: $power_status");
-		if ($power_status eq 'off') {
-			notify($ERRORS{'OK'}, 0, "verified $computer_node_name power is off");
+		
+		# The OS module should turn the computer power off
+		# Wait up to 2 minutes for the computer's power status to be off
+		if ($self->wait_for_off(2)) {
+			notify($ERRORS{'OK'}, 0, "computer $computer_node_name power is off");
 		}
-		elsif ($power_status eq 'on') {
+		else {
 			notify($ERRORS{'WARNING'}, 0, "$computer_node_name power is still on, turning computer off");
 
 			# Attempt to power off computer
@@ -1260,22 +1259,18 @@
 				notify($ERRORS{'WARNING'}, 0, "failed to power off $computer_node_name");
 				return 0;
 			}
-		} ## end elsif ($power_status eq 'on')  [ if ($power_status eq 'off')
-		else {
-			notify($ERRORS{'WARNING'}, 0, "failed to determine power status of $computer_node_name");
-			return 0;
 		}
 	} ## end if ($self->os->can("pre_capture"))
 	elsif ($self->os->can("capture_prepare")) {
 		notify($ERRORS{'OK'}, 0, "calling OS module's capture_prepare() subroutine");
 		if (!$self->os->capture_prepare()) {
 			notify($ERRORS{'WARNING'}, 0, "OS module capture_prepare() failed");
-			$self->image_creation_failed();
+			return 0;
 		}
 	}
 	else {
 		notify($ERRORS{'WARNING'}, 0, "OS module does not have either a pre_capture() or capture_prepare() subroutine");
-		$self->image_creation_failed();
+		return 0;
 	}
 
 
@@ -1324,12 +1319,12 @@
 		notify($ERRORS{'OK'}, 0, "calling OS module's capture_start() subroutine");
 		if (!$self->os->capture_start()) {
 			notify($ERRORS{'WARNING'}, 0, "OS module capture_start() failed");
-			$self->image_creation_failed();
+			return 0;
 		}
 	}
 	else {
 		notify($ERRORS{'WARNING'}, 0, "OS module does not have either a pre_capture() or capture_start() subroutine");
-		$self->image_creation_failed();
+		return 0;
 	}
 
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/image.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/image.pm?rev=781848&r1=781847&r2=781848&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/image.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/image.pm Thu Jun  4 20:22:40 2009
@@ -135,11 +135,11 @@
 	my $image_already_exists = $self->provisioner->does_image_exist();
 	if ($image_already_exists) {
 		notify($ERRORS{'CRITICAL'}, 0, "image $image_name already exists in the repository");
-		$self->image_creation_failed();
+		$self->reservation_failed();
 	}
 	elsif (!defined($image_already_exists)) {
 		notify($ERRORS{'CRITICAL'}, 0, "image $image_name already partially exists in the repository");
-		$self->image_creation_failed();
+		$self->reservation_failed();
 	}
 	else {
 		notify($ERRORS{'OK'}, 0, "image $image_name does not exist in the repository");
@@ -164,7 +164,7 @@
 		}
 		else {
 			notify($ERRORS{'WARNING'}, 0, "$image_name image failed to be captured by provisioning module");
-			$self->image_creation_failed();
+			$self->reservation_failed();
 		}
 	}
 	# --- END NEW MODULARIZED METHOD ---
@@ -175,25 +175,25 @@
 		notify($ERRORS{'OK'}, 0, "OS modularization supported, beginning OS module capture prepare");
 		if (!$self->os->capture_prepare()) {
 			notify($ERRORS{'WARNING'}, 0, "OS module capture prepare failed");
-			$self->image_creation_failed();
+			$self->reservation_failed();
 		}
 
 		notify($ERRORS{'OK'}, 0, "beginning provisioning module capture prepare");
 		if (!$self->provisioner->capture_prepare()) {
 			notify($ERRORS{'WARNING'}, 0, "provisioning module capture prepare failed");
-			$self->image_creation_failed();
+			$self->reservation_failed();
 		}
 		
 		notify($ERRORS{'OK'}, 0, "beginning OS module capture start");
 		if (!$self->os->capture_start()) {
 			notify($ERRORS{'WARNING'}, 0, "OS module capture start failed");
-			$self->image_creation_failed();
+			$self->reservation_failed();
 		}
 
 		notify($ERRORS{'OK'}, 0, "beginning provisioning module capture monitor");
 		if (!$self->provisioner->capture_monitor()) {
 			notify($ERRORS{'WARNING'}, 0, "provisioning module capture monitor failed");
-			$self->image_creation_failed();
+			$self->reservation_failed();
 		}
 
 	} ## end if ($computer_type eq "blade" && $self->os)
@@ -210,7 +210,7 @@
 	}
 	else {
 		notify($ERRORS{'CRITICAL'}, 0, "unsupported computer type: $computer_type");
-		$self->image_creation_failed();
+		$self->reservation_failed();
 	}
 
 	# Image creation was successful, proceed to update database tables
@@ -268,18 +268,18 @@
 	# Check if image creation was successful and database tables were successfully updated
 	# Notify user and admins of the results
 	if ($create_image_result) {
-		$self->image_creation_successful($image_size);
+		$self->reservation_successful($image_size);
 	}
 
 	else {
 		notify($ERRORS{'CRITICAL'}, 0, "image creation failed, see previous log messages");
-		$self->image_creation_failed();
+		$self->reservation_failed();
 	}
 
 } ## end sub process
 #/////////////////////////////////////////////////////////////////////////////
 
-sub image_creation_successful {
+sub reservation_successful {
 	my $self           = shift;
 	my $image_size_old = shift;
 
@@ -359,11 +359,11 @@
 
 	notify($ERRORS{'OK'}, 0, "exiting");
 	exit;
-} ## end sub image_creation_successful
+} ## end sub reservation_successful
 
 #/////////////////////////////////////////////////////////////////////////////
 
-sub image_creation_failed {
+sub reservation_failed {
 	my $self = shift;
 
 	my $request_data               = $self->data->get_request_data();
@@ -456,7 +456,7 @@
 
 	notify($ERRORS{'OK'}, 0, "exiting");
 	exit;
-} ## end sub image_creation_failed
+} ## end sub reservation_failed
 
 #/////////////////////////////////////////////////////////////////////////////