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/01/09 22:55:25 UTC
svn commit: r733162 - in /incubator/vcl/trunk/managementnode/lib/VCL:
DataStructure.pm reclaim.pm
Author: arkurth
Date: Fri Jan 9 13:55:25 2009
New Revision: 733162
URL: http://svn.apache.org/viewvc?rev=733162&view=rev
Log:
VCL-40
Added code to DataStructure.pm get_next_image_dataStructure so that it returns the current image information if it fails to determine the the next image to be loaded.
Fixed reclaim.pm insert_reload_and_exit. It was calling get_next_image instead of get_next_image_dataStructure.
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
incubator/vcl/trunk/managementnode/lib/VCL/reclaim.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=733162&r1=733161&r2=733162&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Fri Jan 9 13:55:25 2009
@@ -967,12 +967,28 @@
sub get_next_image_dataStructure {
my $self = shift;
+
+ # Get the current image data in case something goes wrong
+ my $image_name = $self->get_image_name();
+ my $image_id = $self->get_image_id();
+ my $imagerevision_id = $self->get_imagerevision_id();
+
+ # Assemble an array with the current image information
+ # This will be returned if the predictive method fails
+ my @current_image;
+ if ($image_name && $image_id && $imagerevision_id) {
+ @current_image = ($image_name, $image_id, $imagerevision_id);
+ }
+ else {
+ notify($ERRORS{'WARNING'}, 0, "unable to obtain current image information");
+ @current_image = ();
+ }
#collect predictive reload information from database.
my $management_predictive_info = get_management_predictive_info();
if(!$management_predictive_info->{predictivemoduleid}){
- notify($ERRORS{'CRITICAL'}, 0, "unable to obtain management node info for this node");
- return 0;
+ notify($ERRORS{'CRITICAL'}, 0, "unable to obtain management node info for this node, returning current reservation image information");
+ return @current_image;
}
#update ENV in case other modules need to know
@@ -992,22 +1008,29 @@
if ($EVAL_ERROR) {
notify($ERRORS{'WARNING'}, 0, "$predictive_perl_package module could not be loaded");
- notify($ERRORS{'OK'}, 0, "returning 0");
- return 0;
+ notify($ERRORS{'OK'}, 0, "returning current reservation image information");
+ return @current_image;
}
if (my $predictor = ($predictive_perl_package)->new({data_structure => $self})) {
notify($ERRORS{'OK'}, 0, ref($predictor) . " predictive loading object successfully created");
@nextimage = $predictor->get_next_image();
- return @nextimage;
+ if (scalar(@nextimage) == 3) {
+ notify($ERRORS{'OK'}, 0, "predictive loading module retreived image information: @nextimage");
+ return @nextimage;
+ }
+ else {
+ notify($ERRORS{'WARNING'}, 0, "predictive loading module failed to retrieve image information, returning current reservation image information");
+ return @current_image;
+ }
}
else {
- notify($ERRORS{'WARNING'}, 0, "predictive loading object could not be created, returning 0");
- return 0;
+ notify($ERRORS{'WARNING'}, 0, "predictive loading object could not be created, returning current reservation image information");
+ return @current_image;
}
} ## end if ($predictive_perl_package)
else {
- notify($ERRORS{'OK'}, 0, "predictive loading module not loaded, Perl package is not defined");
- return 0
+ notify($ERRORS{'OK'}, 0, "predictive loading module not loaded, Perl package is not defined, returning current reservation image information");
+ return @current_image;
}
}
Modified: incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm?rev=733162&r1=733161&r2=733162&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm Fri Jan 9 13:55:25 2009
@@ -442,12 +442,12 @@
my $next_image_name;
my $next_image_id;
my $next_imagerevision_id;
-
- if($self->predictor->can("get_next_image")){
- ($next_image_name, $next_image_id, $next_imagerevision_id) = $self->predictor->get_next_image();
+
+ if($self->data->can("get_next_image_dataStructure")){
+ ($next_image_name, $next_image_id, $next_imagerevision_id) = $self->data->get_next_image_dataStructure();
}
else{
- notify($ERRORS{'WARNING'}, 0, "predictor module does not support get_next_image, calling get_next_image_default");
+ notify($ERRORS{'WARNING'}, 0, "predictor module does not support get_next_image_dataStructure, calling get_next_image_default from utils");
($next_image_name, $next_image_id, $next_imagerevision_id) = get_next_image_default($computer_id);
}