You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2009/09/22 22:08:07 UTC
svn commit: r817811 - in /incubator/vcl/trunk/managementnode/lib/VCL:
Module/Predictive/Level_0.pm Module/Predictive/Level_1.pm utils.pm
Author: fapeeler
Date: Tue Sep 22 20:08:05 2009
New Revision: 817811
URL: http://svn.apache.org/viewvc?rev=817811&view=rev
Log:
VCL-207
Added checks for predictive preload modules to use image if it is part of a block reservation for reloads.
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm
incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm
incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm?rev=817811&r1=817810&r2=817811&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_0.pm Tue Sep 22 20:08:05 2009
@@ -89,6 +89,20 @@
notify($ERRORS{'OK'}, 0, "$notify_prefix for $computer_id");
+ #check if node is part of block reservation
+ if(is_inblockrequest($computer_id)){
+ notify($ERRORS{'DEBUG'}, 0, "computer id $computer_id is in blockComputers table");
+ my @block_ret_array = get_block_request_image_info($computer_id);
+
+ if(defined($block_ret_array[0]) && $block_ret_array[0]){
+ return @block_ret_array;
+ }
+ else{
+ notify($ERRORS{'WARNING'}, 0, "computer $computer_id is part of blockComputers, failed to return image info");
+ }
+
+ }
+
my $select_statement = "
SELECT DISTINCT
req.start AS starttime,
Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm?rev=817811&r1=817810&r2=817811&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm Tue Sep 22 20:08:05 2009
@@ -85,10 +85,26 @@
my $computer_id = $self->data->get_computer_id();
my $computer_short_name = $self->data->get_computer_short_name();
+ my @ret_array;
my $notify_prefix = "predictive_reload_Level_1 :";
notify($ERRORS{'OK'}, 0, "$notify_prefix starting predictive_reload_level_1 for $computer_id");
+ #check if node is part of block reservation
+ if(is_inblockrequest($computer_id)){
+ notify($ERRORS{'DEBUG'}, 0, "computer id $computer_id is in blockComputers table");
+ my @block_ret_array = get_block_request_image_info($computer_id);
+
+ if(defined($block_ret_array[0]) && $block_ret_array[0]){
+ return @block_ret_array;
+ }
+ else{
+ notify($ERRORS{'WARNING'}, 0, "computer $computer_id is part of blockComputers, failed to return image info");
+ }
+
+ }
+
+
my $select_statement = "
SELECT DISTINCT
req.start AS starttime,
@@ -113,7 +129,7 @@
# Call the database select subroutine
# This will return an array of one or more rows based on the select statement
my @selected_rows = database_select($select_statement);
- my @ret_array;
+
# Check to make sure 1 or more rows were returned
if (scalar @selected_rows > 0) {
Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=817811&r1=817810&r2=817811&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Tue Sep 22 20:08:05 2009
@@ -110,6 +110,7 @@
enablesshd
firewall_compare_update
format_data
+ get_block_request_image_info
get_computer_current_state_name
get_computer_grp_members
get_computer_info
@@ -10083,6 +10084,66 @@
return 1;
}
}
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 get_block_request_image_info
+
+ Parameters : computer ID
+ Returns : imagename imageid imagerevisionid
+ Description : Checks the blockcomputers table matching computer id
+
+=cut
+#/////////////////////////////////////////////////////////////////////////////
+
+sub get_block_request_image_info {
+ my ($computerid) = @_;
+
+ my ($package, $filename, $line, $sub) = caller(0);
+
+ # Check the passed parameters
+ if (!(defined($computerid))) {
+ notify($ERRORS{'WARNING'}, 0, "computer ID was not specified");
+ return ();
+ }
+ # Construct the select statement
+ my $select_statement = "
+ SELECT DISTINCT
+ image.name AS image_name,
+ image.id AS image_id,
+ imagerevision.id AS imagerevision_id,
+ blockTimes.start AS starttime
+ FROM
+ image,
+ imagerevision,
+ blockComputers,
+ blockTimes
+ WHERE
+ blockComputers.imageid = image.id
+ AND imagerevision.imageid = image.id
+ AND imagerevision.production = 1
+ AND blockTimes.id = blockComputers.blockTimeid
+ AND blockComputers.computerid = $computerid
+ ORDER BY blockTimes.start LIMIT 1
+ ";
+
+ # Call the database select subroutine
+ # This will return an array of one or more rows based on the select statement
+ my @block_image_info = database_select($select_statement);
+
+ # Check to make sure 1 row was returned
+ if (scalar @block_image_info == 0) {
+ notify($ERRORS{'WARNING'}, 0, "no block reservation image information existed for $computerid, 0 rows were returned");
+ return;
+ }
+
+ if (scalar @block_image_info == 1) {
+ my @ret_array;
+ push (@ret_array, $block_image_info[0]{image_name},$block_image_info[0]{image_id},$block_image_info[0]{imagerevision_id});
+ return @ret_array;
+ }
+
+ return;
+}
#/////////////////////////////////////////////////////////////////////////////