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 2014/11/21 16:38:06 UTC
svn commit: r1640940 - in /vcl/trunk/managementnode: bin/vcld
lib/VCL/Module/State.pm lib/VCL/utils.pm
Author: arkurth
Date: Fri Nov 21 15:38:06 2014
New Revision: 1640940
URL: http://svn.apache.org/r1640940
Log:
VCL-800
Updated utils.pm::switch_state to not set log.ending to failed if the request.state = image, checkpoint, or inuse.
Updated State.pm::reservation_failed to only update log.ending to failed if the state is new or reserved.
Other
Changed abbreviated $reservation_cnt variable in vcld to $reservation_count.
Modified:
vcl/trunk/managementnode/bin/vcld
vcl/trunk/managementnode/lib/VCL/Module/State.pm
vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: vcl/trunk/managementnode/bin/vcld
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/bin/vcld?rev=1640940&r1=1640939&r2=1640940&view=diff
==============================================================================
--- vcl/trunk/managementnode/bin/vcld (original)
+++ vcl/trunk/managementnode/bin/vcld Fri Nov 21 15:38:06 2014
@@ -207,7 +207,7 @@ sub main () {
my @reservation_ids = sort { $a <=> $b } keys %{$info{request}{$request_id}{reservation}};
- my $reservation_cnt = @reservation_ids;
+ my $reservation_count = @reservation_ids;
$ENV{request_id} = $request_id;
$ENV{reservation_id} = 0;
@@ -249,7 +249,7 @@ sub main () {
# Figure out the status of this reservation based on reservation times and the request state
# check_time_result can be: start, preload, end, poll, old, remove, 0
- my $check_time_result = check_time($request_start, $request_end, $reservation_lastcheck, $request_state_name, $request_laststate_name, $server_request_id,$reservation_cnt);
+ my $check_time_result = check_time($request_start, $request_end, $reservation_lastcheck, $request_state_name, $request_laststate_name, $server_request_id, $reservation_count);
# Do nothing if check_time returned 0
# Check this before querying for the large set of request data
@@ -579,7 +579,7 @@ sub make_new_child {
$state_object = ($state_module)->new({%{$request_data}, data_structure => $data_structure});
};
- if ($state_object) {
+ if (!$state_object) {
notify($ERRORS{'OK'}, $LOGFILE, "$state_module object created and initialized");
# Call the state object's process() subroutine
Modified: vcl/trunk/managementnode/lib/VCL/Module/State.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/State.pm?rev=1640940&r1=1640939&r2=1640940&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/State.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/State.pm Fri Nov 21 15:38:06 2014
@@ -342,7 +342,7 @@ sub reservation_failed {
notify($ERRORS{'WARNING'}, 0, "unable to set request to $new_request_state_name/$request_state_name");
}
- if ($request_state_name =~ /^(new|reserved|inuse|image)/){
+ if ($request_state_name =~ /^(new|reserved)/){
# Update log table ending column to failed for this request
if (update_log_ending($request_logid, "failed")) {
notify($ERRORS{'OK'}, 0, "updated log ending value to 'failed', logid=$request_logid");
Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1640940&r1=1640939&r2=1640940&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Fri Nov 21 15:38:06 2014
@@ -6067,8 +6067,8 @@ sub switch_state {
my $request_id = $request_data->{id};
my $request_logid = $request_data->{logid};
my $reservation_id = $request_data->{RESERVATIONID};
- my $request_state_name_old = $request_data->{state}{name};
- my $request_laststate_name_old = $request_data->{laststate}{name};
+ my $request_state_name_old = $request_data->{state}{name} || '';
+ my $request_laststate_name_old = $request_data->{laststate}{name} || '';
my $computer_id = $request_data->{reservation}{$reservation_id}{computer}{id};
my $computer_type = $request_data->{reservation}{$reservation_id}{computer}{type};
my $computer_state_name_old = $request_data->{reservation}{$reservation_id}{computer}{state}{name};
@@ -6094,7 +6094,7 @@ sub switch_state {
# Don't set request state to failed if previous state is image or inuse
if ($request_state_name_new && $request_state_name_new eq 'failed') {
- if ($request_state_name_old eq 'image') {
+ if ($request_state_name_old =~ /(image|checkpoint)/) {
notify($ERRORS{'DEBUG'}, 0, "previous request state is $request_state_name_old, not setting request state to $request_state_name_new, setting request state to maintenance");
$request_state_name_new = 'maintenance';
$computer_state_name_new = 'maintenance';
@@ -6106,6 +6106,15 @@ sub switch_state {
}
}
+ # Don't set log.ending to failed for inuse - this throws off the counts on the dashboard page
+ # Don't set log.ending to failed for image or checkpoint
+ if ($request_log_ending && $request_log_ending =~ /(failed)/) {
+ if ($request_state_name_old =~ /(image|checkpoint|inuse)/) {
+ notify($ERRORS{'DEBUG'}, 0, "request state is $request_state_name_old, not setting log.ending to $request_log_ending");
+ $request_log_ending = 0;
+ }
+ }
+
# Check if new request state was passed
if (!$request_state_name_new) {
notify($ERRORS{'DEBUG'}, 0, "request state was not specified, state not changed");