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 2010/08/06 21:31:21 UTC
svn commit: r983102 - in /incubator/vcl/trunk/managementnode/lib/VCL:
blockrequest.pm utils.pm
Author: fapeeler
Date: Fri Aug 6 19:31:20 2010
New Revision: 983102
URL: http://svn.apache.org/viewvc?rev=983102&view=rev
Log:
VCL-254
utils.pm: only collecting blockallocations that are in accepted state
blockrequest.pm: when expired - set the status to completed
Modified:
incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm
incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm?rev=983102&r1=983101&r2=983102&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm Fri Aug 6 19:31:20 2010
@@ -241,8 +241,8 @@ sub process {
if ($status eq "expire") {
#fork start processing
notify($ERRORS{'OK'}, 0, "Block Request $blockrequest_id has expired");
- if (delete_block_request($blockrequest_id)) {
- notify($ERRORS{'OK'}, 0, "Removed blockRequest id $blockrequest_id");
+ if(udpate_block_request_status($blockrequest_id,"completed"){
+ notify($ERRORS{'OK'}, 0, "Updated status of blockRequest id $blockrequest_id to completed");
}
return 1;
}
@@ -403,6 +403,49 @@ sub delete_block_request {
#/////////////////////////////////////////////////////////////////////////////
+=head2 udpate_block_request_status
+
+ Parameters : $blockrequest_id
+ Returns : 0 or 1
+ Description : update the status of a blockrequest from the blockrequest table
+
+=cut
+
+sub udpate_block_request_status {
+ my ($blockrequest_id,$status) = @_;
+
+ # Check the arguments
+ if (!defined($blockrequest_id)) {
+ notify($ERRORS{'WARNING'}, 0, "blockrequest ID was not specified");
+ return 0;
+ }
+ if (!defined($status)) {
+ notify($ERRORS{'WARNING'}, 0, "status was not specified for blockrequest_id $blockrequest_id ");
+ return 0;
+ }
+
+ # Construct the update statement
+ my $update_statement = "
+ UPDATE
+ blockRequest
+ SET blockRequest.status = $status
+ WHERE
+ blockRequest.id = $blockrequest_id
+ ";
+
+ # Call the database execute subroutine
+ if (database_execute($update_statement)) {
+ return 1;
+ }
+ else {
+ notify($ERRORS{'WARNING'}, 0, "unable to updated blockrequest $blockrequest_id blockRequest table ");
+ return 0;
+ }
+
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
=head2 clear_blockTimes
Parameters : $blockTimes_id
Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=983102&r1=983101&r2=983102&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Fri Aug 6 19:31:20 2010
@@ -7573,6 +7573,7 @@ sub get_management_node_blockrequests {
blockRequest.managementnodeid AS blockRequest_managementnodeid,
blockRequest.expireTime AS blockRequest_expireTime,
blockRequest.processing AS blockRequest_processing,
+ blockRequest.status AS blockRequest_status,
blockTimes.id AS blockTimes_id,
blockTimes.blockRequestid AS blockTimes_blockRequestid,
@@ -7585,7 +7586,8 @@ sub get_management_node_blockrequests {
LEFT JOIN
blockTimes ON (
- blockRequest.id = blockTimes.blockRequestid
+ blockRequest.id = blockTimes.blockRequestid AND
+ blockRequest.status = 'accepted'
)
WHERE