Author: fapeeler
Date: Wed May  4 19:50:59 2011
New Revision: 1099573

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

adding serverrequest data to data structure
 - if data does not exist, zero out the values. This is to prevent get_data_ 
calls to not complain about uninitilized data.



Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
    incubator/vcl/trunk/managementnode/lib/VCL/utils.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=1099573&r1=1099572&r2=1099573&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Wed May  4 
19:50:59 2011
@@ -384,6 +384,13 @@ $SUBROUTINE_MAPPINGS{image_os_module_per
 
 $SUBROUTINE_MAPPINGS{image_platform_name} = 
'$self->request_data->{reservation}{RESERVATION_ID}{image}{platform}{name}';
 
+$SUBROUTINE_MAPPINGS{server_request_id} = 
'$self->request_data->{reservation}{RESERVATION_ID}{serverrequest}{id}';
+$SUBROUTINE_MAPPINGS{server_request_fixedIP} = 
'$self->request_data->{reservation}{RESERVATION_ID}{serverrequest}{fixedIP}';
+$SUBROUTINE_MAPPINGS{server_request_fixedMAC} = 
'$self->request_data->{reservation}{RESERVATION_ID}{serverrequest}{fixedMAC}';
+$SUBROUTINE_MAPPINGS{server_request_admingroupid} = 
'$self->request_data->{reservation}{RESERVATION_ID}{serverrequest}{admingroupid}';
+$SUBROUTINE_MAPPINGS{server_request_logingroupid} = 
'$self->request_data->{reservation}{RESERVATION_ID}{serverrequest}{logingroupid}';
+$SUBROUTINE_MAPPINGS{server_request_monitored} = 
'$self->request_data->{reservation}{RESERVATION_ID}{serverrequest}{monitored}';
+
 $SUBROUTINE_MAPPINGS{imagerevision_comments}     = 
'$self->request_data->{reservation}{RESERVATION_ID}{imagerevision}{comments}';
 $SUBROUTINE_MAPPINGS{imagerevision_date_created} = 
'$self->request_data->{reservation}{RESERVATION_ID}{imagerevision}{datecreated}';
 $SUBROUTINE_MAPPINGS{imagerevision_deleted}      = 
'$self->request_data->{reservation}{RESERVATION_ID}{imagerevision}{deleted}';

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1099573&r1=1099572&r2=1099573&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Wed May  4 19:50:59 2011
@@ -4206,10 +4206,19 @@ sub get_request_info {
        computerprovisioningmodule.name AS computerprovisioningmodule_name,
        computerprovisioningmodule.prettyname AS 
computerprovisioningmodule_prettyname,
        computerprovisioningmodule.description AS 
computerprovisioningmodule_description,
-       computerprovisioningmodule.perlpackage AS 
computerprovisioningmodule_perlpackage
+       computerprovisioningmodule.perlpackage AS 
computerprovisioningmodule_perlpackage,
+       
+       serverrequest.id AS serverrequest_id,
+       serverrequest.requestid AS serverrequest_requestid,
+       serverrequest.fixedIP AS serverrequest_fixedIP,
+       serverrequest.fixedMAC AS serverrequest_fixedMAC,
+       serverrequest.admingroupid AS serverrequest_admingroupid,
+       serverrequest.logingroupid AS serverrequest_logingroupid,
+       serverrequest.monitored AS serverrequest_monitored
 
    FROM
-   request,
+   request 
+   LEFT JOIN (serverrequest) ON (serverrequest.requestid = request.id),
    user,
    adminlevel,
    affiliation,
@@ -4350,7 +4359,8 @@ sub get_request_info {
                else {
                        notify($ERRORS{'DEBUG'}, 0, "imagerevisionid is not set 
for computer");
                }
-               
+
+       
                # Loop through all the columns returned for the reservation
                foreach my $key (keys %reservation_row) {
                        my $value = $reservation_row{$key};
@@ -4417,6 +4427,9 @@ sub get_request_info {
                        elsif ($key =~ /computerprovisioningmodule_/) {
                                
$request_info{reservation}{$reservation_id}{computer}{provisioning}{module}{$original_key}
 = $value;
                        }
+                       elsif ($key =~ /serverrequest_/) {
+                               
$request_info{reservation}{$reservation_id}{$original_key} = $value;
+                       }
                        else {
                                notify($ERRORS{'WARNING'}, 0, "unknown key 
found in SQL data: $key");
                        }
@@ -4448,7 +4461,7 @@ sub get_request_info {
        # Each selected row represents a reservation associated with this 
request
 
        # Fix some of the data
-
+       
        # Set the user's preferred name to the first name if it isn't defined
        if (!defined($request_info{user}{preferredname}) || 
!$request_info{user}{preferredname}) {
                $request_info{user}{preferredname} = 
$request_info{user}{firstname};
@@ -4510,6 +4523,38 @@ sub get_request_info {
 
        # Loop through all the reservations
        foreach my $reservation_id (keys %{$request_info{reservation}}) {
+       
+               # Set server request NULL values to 0
+               if 
(defined($request_info{reservation}{$reservation_id}{serverrequest}{id})) {
+                       
+                       notify($ERRORS{'DEBUG'}, 0, "Server Request load - 
disabling user checks");
+                       
$request_info{reservation}{$reservation_id}{image}{imagemeta}{checkuser} = 0;
+
+                       if 
(!defined($request_info{reservation}{$reservation_id}{serverrequest}{fixedIP})){
+                               
$request_info{reservation}{$reservation_id}{serverrequest}{fixedIP} = 0;
+                       }
+                       if 
(!defined($request_info{reservation}{$reservation_id}{serverrequest}{fixedMAC})){
+                               
$request_info{reservation}{$reservation_id}{serverrequest}{fixedMAC} = 0;
+                       }
+                       if 
(!defined($request_info{reservation}{$reservation_id}{serverrequest}{admingroupid})){
+                               
$request_info{reservation}{$reservation_id}{serverrequest}{admingroupid} = 0;
+                       }
+                       if 
(!defined($request_info{reservation}{$reservation_id}{serverrequest}{logingroupid})){
+                               
$request_info{reservation}{$reservation_id}{serverrequest}{logingroupid} = 0;
+                       }
+                       if 
(!defined($request_info{reservation}{$reservation_id}{serverrequest}{monitored})){
+                               
$request_info{reservation}{$reservation_id}{serverrequest}{monitored} = 0;
+                       }
+               }
+               else {
+                       #No server request, set all values to 0, so 
datastructure doesn't complain
+                       
$request_info{reservation}{$reservation_id}{serverrequest}{id} = 0;
+                       
$request_info{reservation}{$reservation_id}{serverrequest}{fixedIP} = 0;
+                       
$request_info{reservation}{$reservation_id}{serverrequest}{fixedMAC} = 0;
+                       
$request_info{reservation}{$reservation_id}{serverrequest}{admingroupid} = 0;
+                       
$request_info{reservation}{$reservation_id}{serverrequest}{logingroupid} = 0;
+                       
$request_info{reservation}{$reservation_id}{serverrequest}{monitored} = 0;
+               }
 
                # Confirm lastcheck time is not NULL
                if 
(!defined($request_info{reservation}{$reservation_id}{lastcheck})) {
@@ -7605,7 +7650,7 @@ sub get_computers_controlled_by_MN {
                                        notify($ERRORS{'DEBUG'}, $LOGFILE, 
"retrieved computers from computer groupname= 
$info{manageable_resoucegroups}{$grp_id}{$id}{groupname}");
                                }
                                else{ 
-                                       notify($ERRORS{'DEBUG'}, $LOGFILE, "no 
computers in computer groupname= 
$info{managementnode}{resoucegroups}{$grp_id}{$id}{groupname}");
+                                       notify($ERRORS{'DEBUG'}, $LOGFILE, "no 
computers in computer groupid= $computer_group_id}");
                                        delete 
$info{manageable_resoucegroups}{$grp_id}{$id};
                                }
                        }


Reply via email to