Author: fapeeler
Date: Wed Aug 18 19:54:32 2010
New Revision: 986893

URL: http://svn.apache.org/viewvc?rev=986893&view=rev
Log:
VCL-254

emailing owner of block allocation when requested < allocated

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.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=986893&r1=986892&r2=986893&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm Wed Aug 18 
19:54:32 2010
@@ -138,14 +138,12 @@ sub process {
 
        # Get user info 
        my %info;
-       my $owner_affiliation_sitewwwaddress;
        my $owner_affiliation_helpaddress;
        my $owner_email;
 
        if( %info = get_user_info($blockrequest_owner_id)){
                $owner_email = $info{email};
                $owner_affiliation_helpaddress = $info{helpaddress};
-               $owner_affiliation_sitewwwaddress = $info{sitewwwaddress};
        }
                
        #Set local timer
@@ -161,7 +159,6 @@ sub process {
        notify($ERRORS{'DEBUG'}, 0, "blocktime start: $blocktime_start");
        notify($ERRORS{'DEBUG'}, 0, "owner email: $owner_email");
        notify($ERRORS{'DEBUG'}, 0, "help address: $owner_email");
-       notify($ERRORS{'DEBUG'}, 0, "owner www addr: 
$owner_affiliation_sitewwwaddress");
 
        if ($blockrequest_mode eq "start") {
 
@@ -174,6 +171,12 @@ sub process {
                my $loop_control = 0;
                my $xmlcall;
                my ($warningmsg, $errormsg);
+               
+               my $urla = $XMLRPC_URL;
+               my $blockAlloc_URL;
+               if($urla =~ /(.*)(=xmlrpccall)/){
+                       $blockAlloc_URL = $1 . "=blockallocations";
+               }
 
                my($allocated,$unallocated) = 0;
 
@@ -215,6 +218,8 @@ sub process {
                }
                
                my $body;
+               my $subject = "VCL Block allocation results for 
$blockrequest_name";
+               my $mailstring;
        
                if(defined($warningmsg) || defined($errormsg) || ($allocated < 
$blockrequest_number_machines)){
                        $body .= "Problem processing block allocation \n\n";
@@ -229,16 +234,41 @@ sub process {
                        $body .= "\n";
 
                        notify($ERRORS{'CRITICAL'}, 0, "$body");
+
+                       if($allocated < $blockrequest_number_machines){
+                       $subject = "VCL Block allocation warning for 
$blockrequest_name";
+       
+                       $mailstring .= << "EOF";
+WARNING - The block allocation for $blockrequest_name was not successfully 
processed for the following session.
+
+REASON: machines allocated were less than requested
+
+Block allocation name   = $blockrequest_name
+Machines allocated      = $allocated
+Machines requested      = $blockrequest_number_machines
+Block Start time        = $blocktime_start
+Block End time          = $blocktime_end
+User Group              = $block_group_name
+
+
+The VCL staff have been notified to attempt to correct the issue.
+
+If you wish to cancel this session or make changes to future sessions. Please 
visit
+the VCL site: $blockAlloc_URL
+
+EOF
+                               if(defined($owner_email)){
+                                       mail($owner_email, $subject, 
$mailstring, $owner_affiliation_helpaddress);
+                               }
+                       }
+                       
                
                }
-
+               elsif($completed){
                # Notify block request owner for given time slot has been 
processed.
-       
-               if($completed){
                        
-                       my $subject = "VCL Block allocation results for 
$blockrequest_name";
                        my $mailstring .= <<"EOF";
-The block allocation for $blockrequest_name was processed with the following 
results:
+The block allocation for $blockrequest_name was processed successfully with 
the following results:
 
 Block allocation name  = $blockrequest_name
 Machines allocated     = $allocated
@@ -251,8 +281,8 @@ The machines for this block allocation w
 Once loaded the users listed in the user group $block_group_name will be able 
to login up to 15 minutes 
 before the start time.
 
-To make changes or to view the status of this block allocation. Please visit,
-$owner_affiliation_sitewwwaddress/scheduling/index.php?mode=blockAllocations
+If you wish to cancel this session or need to make changes to future sessions. 
Please visit 
+the VCL site: $blockAlloc_URL
 
 EOF
                        if(defined($owner_email)){


Reply via email to