Author: arkurth Date: Mon Feb 28 19:24:39 2011 New Revision: 1075497 URL: http://svn.apache.org/viewvc?rev=1075497&view=rev Log: VCL-424 Removed unused variables from the subroutines in the state modules. There were several variables initialized via $self->get_... but never used as the result of copy/paste.
Updated inuse.pm to not retrieve data directly from the hash. Removed code from new.pm which wrote currentimage.txt for Linux Kickstart installs. This has been moved to Linux.pm. Modified: incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm incubator/vcl/trunk/managementnode/lib/VCL/image.pm incubator/vcl/trunk/managementnode/lib/VCL/inuse.pm incubator/vcl/trunk/managementnode/lib/VCL/makeproduction.pm incubator/vcl/trunk/managementnode/lib/VCL/new.pm incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm incubator/vcl/trunk/managementnode/lib/VCL/reserved.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=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/blockrequest.pm Mon Feb 28 19:24:39 2011 @@ -119,8 +119,7 @@ sub initialize { sub process { my $self = shift; - my ($package, $filename, $line) = caller; - + # Retrieve data from the data structure my $blockrequest_id = $self->data->get_blockrequest_id(); my $blockrequest_mode = $self->data->get_blockrequest_mode(); @@ -132,8 +131,8 @@ sub process { my $blocktime_start = $self->data->get_blocktime_start(); my $blocktime_end = $self->data->get_blocktime_end(); my $blockrequest_name = $self->data->get_blockrequest_name(); - my $blockrequest_owner_id = $self->data->get_blockrequest_owner_id(); - my $block_group_name = $self->data->get_blockrequest_group_name(); + my $blockrequest_owner_id = $self->data->get_blockrequest_owner_id(); + my $block_group_name = $self->data->get_blockrequest_group_name(); # Get user info my $user_info; @@ -246,7 +245,7 @@ sub process { if($allocated < $blockrequest_number_machines){ $subject = "VCL Block allocation warning for $blockrequest_name"; - $mailstring .= << "EOF"; + $mailstring .= <<"EOF"; WARNING - The block allocation for $blockrequest_name was not successfully processed for the following session. REASON: machines allocated were less than requested @@ -411,9 +410,7 @@ sub process_block_time { sub update_blockTimes_processing { my ($blockTimes_id, $processing) = @_; - - my ($package, $filename, $line, $sub) = caller(0); - + # Check the arguments if (!defined($blockTimes_id)) { notify($ERRORS{'WARNING'}, 0, "blockTimes ID was not specified"); Modified: incubator/vcl/trunk/managementnode/lib/VCL/image.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/image.pm?rev=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/image.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/image.pm Mon Feb 28 19:24:39 2011 @@ -92,12 +92,9 @@ sub process { my $reservation_id = $self->data->get_reservation_id(); my $user_id = $self->data->get_user_id(); my $user_unityid = $self->data->get_user_login_id(); - my $user_email = $self->data->get_user_email(); - my $affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); my $affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); my $image_id = $self->data->get_image_id(); my $image_name = $self->data->get_image_name(); - my $image_prettyname = $self->data->get_image_prettyname(); my $image_size = $self->data->get_image_size(); my $imagerevision_id = $self->data->get_imagerevision_id(); my $imagemeta_sysprep = $self->data->get_imagemeta_sysprep(); @@ -301,7 +298,6 @@ sub reservation_successful { my $imagerevision_id = $self->data->get_imagerevision_id(); my $imagemeta_sysprep = $self->data->get_imagemeta_sysprep(); my $computer_id = $self->data->get_computer_id(); - my $computer_type = $self->data->get_computer_type(); my $computer_shortname = $self->data->get_computer_short_name(); my $managementnode_shortname = $self->data->get_management_node_short_name(); my $sysadmin_mail_address = $self->data->get_management_node_sysadmin_email(); @@ -369,22 +365,18 @@ END sub reservation_failed { my $self = shift; - my $request_data = $self->data->get_request_data(); my $request_id = $self->data->get_request_id(); my $reservation_id = $self->data->get_reservation_id(); my $user_id = $self->data->get_user_id(); my $user_unityid = $self->data->get_user_login_id(); my $user_email = $self->data->get_user_email(); - my $affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); my $affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); my $image_id = $self->data->get_image_id(); my $image_name = $self->data->get_image_name(); my $image_prettyname = $self->data->get_image_prettyname(); - my $image_size = $self->data->get_image_size(); my $imagerevision_id = $self->data->get_imagerevision_id(); my $imagemeta_sysprep = $self->data->get_imagemeta_sysprep(); my $computer_id = $self->data->get_computer_id(); - my $computer_type = $self->data->get_computer_type(); my $computer_shortname = $self->data->get_computer_short_name(); my $managementnode_shortname = $self->data->get_management_node_short_name(); my $sysadmin_mail_address = $self->data->get_management_node_sysadmin_email(); @@ -583,6 +575,8 @@ sub setup_capture_base_image { else { $computer_id = (keys %computer_info)[0]; } + + } my $computer_hostname = $computer_info{$computer_id}{hostname}; Modified: incubator/vcl/trunk/managementnode/lib/VCL/inuse.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/inuse.pm?rev=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/inuse.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/inuse.pm Mon Feb 28 19:24:39 2011 @@ -100,31 +100,27 @@ use VCL::utils; sub process { my $self = shift; - my ($package, $filename, $line, $sub) = caller(0); - - # Store hash variables into local variables - my $request_data = $self->data->get_request_data; - - my $request_id = $request_data->{id}; - my $reservation_id = $request_data->{RESERVATIONID}; - my $request_end = $request_data->{end}; - my $request_logid = $request_data->{logid}; - my $request_checktime = $request_data->{CHECKTIME}; - my $reservation_remoteip = $request_data->{reservation}{$reservation_id}{remoteIP}; - my $computer_id = $request_data->{reservation}{$reservation_id}{computer}{id}; - my $computer_shortname = $request_data->{reservation}{$reservation_id}{computer}{SHORTNAME}; - my $computer_type = $request_data->{reservation}{$reservation_id}{computer}{type}; - my $computer_hostname = $request_data->{reservation}{$reservation_id}{computer}{hostname}; - my $computer_nodename = $request_data->{reservation}{$reservation_id}{computer}{NODENAME}; - my $computer_ipaddress = $request_data->{reservation}{$reservation_id}{computer}{IPaddress}; - my $image_os_name = $request_data->{reservation}{$reservation_id}{image}{OS}{name}; - my $imagemeta_checkuser = $request_data->{reservation}{$reservation_id}{image}{imagemeta}{checkuser}; - my $user_unityid = $request_data->{user}{unityid}; - my $request_forimaging = $request_data->{forimaging}; - my $identity_key = $request_data->{reservation}{$reservation_id}{image}{IDENTITY}; + + my $request_id = $self->data->get_request_id(); + my $reservation_id = $self->data->get_reservation_id(); + my $request_end = $self->data->get_request_end_time(); + my $request_logid = $self->data->get_request_log_id(); + my $request_checktime = $self->data->get_request_check_time(); + my $reservation_remoteip = $self->data->get_reservation_remote_ip(); + my $computer_id = $self->data->get_computer_id(); + my $computer_short_name = $self->data->get_computer_short_name(); + my $computer_type = $self->data->get_computer_type(); + my $computer_hostname = $self->data->get_computer_hostname(); + my $computer_nodename = $self->data->get_computer_node_name(); + my $computer_ip_address = $self->data->get_computer_ip_address(); + my $image_os_name = $self->data->get_image_os_name(); + my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); + my $user_login_id = $self->data->get_user_login_id(); + my $request_forimaging = $self->data->get_request_forimaging(); my $image_os_type = $self->data->get_image_os_type(); my $reservation_count = $self->data->get_reservation_count(); my $is_parent_reservation = $self->data->is_parent_reservation(); + my $identity_key = $self->data->get_image_identity(); # Set the user connection timeout limit in minutes my $connect_timeout_limit = 15; @@ -258,14 +254,14 @@ sub process { my $sleep_time = $time_difference - (10 * 60); notify($ERRORS{'OK'}, 0, "sleeping for $sleep_time seconds"); sleep $sleep_time; - $request_data->{CHECKTIME} = "end"; + $request_checktime = "end"; goto ENDTIME; } # Close if poll, checkuser=1, and end time is 10-15 minutes away notify($ERRORS{'OK'}, 0, "end time not yet reached, polling machine for user connection"); # Check the user connection, this will loop until user connects or time limit is reached - my $check_connection = check_connection($computer_nodename, $computer_ipaddress, $computer_type, $reservation_remoteip, $connect_timeout_limit, $image_os_name, 0, $request_id, $user_unityid,$image_os_type); + my $check_connection = check_connection($computer_nodename, $computer_ip_address, $computer_type, $reservation_remoteip, $connect_timeout_limit, $image_os_name, 0, $request_id, $user_login_id,$image_os_type); #TESTING #$check_connection = 'timeout'; @@ -327,7 +323,7 @@ sub process { # Check if computer is in maintenance state if ($computer_state =~ /maintenance/) { - notify($ERRORS{'OK'}, 0, "computer $computer_shortname in maintenance state, skipping update"); + notify($ERRORS{'OK'}, 0, "computer $computer_short_name in maintenance state, skipping update"); } else { # Computer is not in maintenance state, set its state to timeout @@ -418,13 +414,13 @@ sub process { # Perform some actions at 5 minutes until end of request if ($disconnect_time == 5) { # Check for connection - if (isconnected($computer_hostname, $computer_type, $reservation_remoteip, $image_os_name, $computer_ipaddress,$image_os_type)) { + if (isconnected($computer_hostname, $computer_type, $reservation_remoteip, $image_os_name, $computer_ip_address,$image_os_type)) { insertloadlog($reservation_id, $computer_id, "inuseend5", "notifying user of endtime"); $self->_notify_user_disconnect($disconnect_time); } else { insertloadlog($reservation_id, $computer_id, "inuseend5", "user is not connected, notification skipped"); - notify($ERRORS{'OK'}, 0, "user has disconnected from $computer_shortname, skipping additional notices"); + notify($ERRORS{'OK'}, 0, "user has disconnected from $computer_short_name, skipping additional notices"); } } # Close if disconnect time = 5 @@ -495,7 +491,7 @@ sub process { # Check if computer is in maintenance state if ($computer_state =~ /maintenance/) { - notify($ERRORS{'OK'}, 0, "computer $computer_shortname in maintenance state, skipping computer state update"); + notify($ERRORS{'OK'}, 0, "computer $computer_short_name in maintenance state, skipping computer state update"); } else { notify($ERRORS{'OK'}, 0, "computer not in maintenance, setting computer to timeout state"); @@ -554,33 +550,32 @@ sub process { sub _notify_user_endtime { my $self = shift; my $notice_interval = shift; - - my ($package, $filename, $line, $sub) = caller(0); - - my $request_data = $self->data->get_request_data; - my $is_parent_reservation = $self->data->is_parent_reservation(); - + # Check to make sure notice interval is set if (!defined($notice_interval)) { notify($ERRORS{'WARNING'}, 0, "end time message not set, notice interval was not passed"); return 0; } - - # Store hash variables into local variables - my $request_id = $request_data->{id}; - my $reservation_id = $request_data->{RESERVATIONID}; - my $user_email = $request_data->{user}{email}; - my $user_emailnotices = $request_data->{user}{emailnotices}; - my $user_im_name = $request_data->{user}{IMtype}{name}; - my $user_im_id = $request_data->{user}{IMid}; - my $user_unityid = $request_data->{user}{unityid}; - my $affiliation_sitewwwaddress = $request_data->{user}{affiliation}{sitewwwaddress}; - my $affiliation_helpaddress = $request_data->{user}{affiliation}{helpaddress}; - my $image_prettyname = $request_data->{reservation}{$reservation_id}{image}{prettyname}; - my $image_os_name = $request_data->{reservation}{$reservation_id}{image}{OS}{name}; - my $computer_ipaddress = $request_data->{reservation}{$reservation_id}{computer}{IPaddress}; - my $computer_type = $request_data->{reservation}{$reservation_id}{computer}{type}; - my $computer_shortname = $request_data->{reservation}{$reservation_id}{computer}{SHORTNAME}; + + my $is_parent_reservation = $self->data->is_parent_reservation(); + if (!$is_parent_reservation) { + notify($ERRORS{'DEBUG'}, 0, "child reservation - not notifying user of endtime"); + return 1; + } + + my $computer_short_name = $self->data->get_computer_short_name(); + my $computer_type = $self->data->get_computer_type(); + my $computer_ip_address = $self->data->get_computer_ip_address(); + my $image_os_name = $self->data->get_image_os_name(); + my $image_prettyname = $self->data->get_image_prettyname(); + my $image_os_type = $self->data->get_image_os_type(); + my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); + my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); + my $user_login_id = $self->data->get_user_login_id(); + my $user_email = $self->data->get_user_email(); + my $user_emailnotices = $self->data->get_user_emailnotices(); + my $user_imtype_name = $self->data->get_user_imtype_name(); + my $user_im_id = $self->data->get_user_im_id(); my $message = <<"EOF"; @@ -589,7 +584,7 @@ You have $notice_interval until the end Reservation extensions are available if the machine you are on does not have a reservation immediately following. To edit this reservation: --Visit $affiliation_sitewwwaddress +-Visit $user_affiliation_sitewwwaddress -Select Current Reservations Thank You, @@ -602,7 +597,7 @@ with detailed information on the issue a generated. To disable email notices --Visit $affiliation_sitewwwaddress +-Visit $user_affiliation_sitewwwaddress -Select User Preferences -Select General Preferences @@ -612,13 +607,21 @@ EOF my $subject = "VCL -- $notice_interval until end of reservation"; # Send mail - if ($is_parent_reservation && $user_emailnotices) { - mail($user_email, $subject, $message, $affiliation_helpaddress); + if ($user_emailnotices) { + notify($ERRORS{'DEBUG'}, 0, "user $user_login_id email notices enabled - notifying user of endtime"); + mail($user_email, $subject, $message, $user_affiliation_helpaddress); + } + else { + notify($ERRORS{'DEBUG'}, 0, "user $user_login_id email notices disabled - not notifying user of endtime"); } # Send IM - if ($is_parent_reservation && $user_im_name ne "none") { - notify_via_IM($user_im_name, $user_im_id, $message); + if ($user_imtype_name ne "none") { + notify($ERRORS{'DEBUG'}, 0, "user $user_login_id IM type: $user_imtype_name - notifying user of endtime"); + notify_via_IM($user_imtype_name, $user_im_id, $message); + } + else { + notify($ERRORS{'DEBUG'}, 0, "user $user_login_id IM type: $user_imtype_name - not notifying user of endtime"); } return 1; @@ -640,34 +643,28 @@ EOF sub _notify_user_disconnect { my $self = shift; my $disconnect_time = shift; - my ($package, $filename, $line, $sub) = caller(0); - - my $request_data = $self->data->get_request_data; - my $is_parent_reservation = $self->data->is_parent_reservation(); - + # Check to make sure disconnect time was passed if (!defined($disconnect_time)) { notify($ERRORS{'WARNING'}, 0, "disconnect time message not set, disconnect time was not passed"); return 0; } - - # Store hash variables into local variables - my $request_id = $request_data->{id}; - my $reservation_id = $request_data->{RESERVATIONID}; - my $user_email = $request_data->{user}{email}; - my $user_emailnotices = $request_data->{user}{emailnotices}; - my $user_im_name = $request_data->{user}{IMtype}{name}; - my $user_im_id = $request_data->{user}{IMid}; - my $user_unityid = $request_data->{user}{unityid}; - my $affiliation_sitewwwaddress = $request_data->{user}{affiliation}{sitewwwaddress}; - my $affiliation_helpaddress = $request_data->{user}{affiliation}{helpaddress}; - my $image_prettyname = $self->data->get_image_prettyname(); - my $image_os_name = $self->data->get_image_os_name(); - my $computer_ipaddress = $request_data->{reservation}{$reservation_id}{computer}{IPaddress}; - my $computer_type = $self->data->get_computer_type(); - my $image_os_type = $self->data->get_image_os_type(); - my $computer_shortname = $self->data->get_computer_short_name(); - + + my $computer_short_name = $self->data->get_computer_short_name(); + my $computer_type = $self->data->get_computer_type(); + my $computer_ip_address = $self->data->get_computer_ip_address(); + my $image_os_name = $self->data->get_image_os_name(); + my $image_prettyname = $self->data->get_image_prettyname(); + my $image_os_type = $self->data->get_image_os_type(); + my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); + my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); + my $user_login_id = $self->data->get_user_login_id(); + my $user_email = $self->data->get_user_email(); + my $user_emailnotices = $self->data->get_user_emailnotices(); + my $user_imtype_name = $self->data->get_user_imtype_name(); + my $user_im_id = $self->data->get_user_im_id(); + my $is_parent_reservation = $self->data->is_parent_reservation(); + my $disconnect_string; if ($disconnect_time == 0) { $disconnect_string = "0 minutes"; @@ -685,7 +682,7 @@ You have $disconnect_string until the en Reservation extensions are available if the machine you are on does not have a reservation immediately following. -Visit $affiliation_sitewwwaddress and select Current Reservations to edit this reservation. +Visit $user_affiliation_sitewwwaddress and select Current Reservations to edit this reservation. Thank You, VCL Team @@ -697,7 +694,7 @@ with detailed information on the issue a generated. To disable email notices --Visit $affiliation_sitewwwaddress +-Visit $user_affiliation_sitewwwaddress -Select User Preferences -Select General Preferences @@ -710,28 +707,28 @@ EOF # Send mail if ($is_parent_reservation && $user_emailnotices) { - mail($user_email, $subject, $message, $affiliation_helpaddress); + mail($user_email, $subject, $message, $user_affiliation_helpaddress); } # Send IM - if ($is_parent_reservation && $user_im_name ne "none") { - notify_via_IM($user_im_name, $user_im_id, $message); + if ($is_parent_reservation && $user_imtype_name ne "none") { + notify_via_IM($user_imtype_name, $user_im_id, $message); } # Send message to machine if ($computer_type =~ /blade|virtualmachine/) { if ($image_os_type =~ /windows/) { # Notify via windows msg cmd - notify_via_msg($computer_shortname, $user_unityid, $short_message); + notify_via_msg($computer_short_name, $user_login_id, $short_message); } elsif ($image_os_type =~ /linux/){ # Notify via wall - notify_via_wall($computer_shortname, $user_unityid, $short_message, $image_os_name, $computer_type); + notify_via_wall($computer_short_name, $user_login_id, $short_message, $image_os_name, $computer_type); } } ## end if ($computer_type =~ /blade|virtualmachine/) elsif ($computer_type eq "lab") { # Notify via wall - notify_via_wall($computer_ipaddress, $user_unityid, $short_message, $image_os_name, $computer_type); + notify_via_wall($computer_ip_address, $user_login_id, $short_message, $image_os_name, $computer_type); } return 1; @@ -750,28 +747,28 @@ EOF sub _notify_user_timeout { my $self = shift; - my ($package, $filename, $line, $sub) = caller(0); - - my $request_data = $self->data->get_request_data; - my $is_parent_reservation = $self->data->is_parent_reservation(); - - # Store some hash variables into local variables - my $reservation_id = $request_data->{RESERVATIONID}; - my $user_email = $request_data->{user}{email}; - my $user_emailnotices = $request_data->{user}{emailnotices}; - my $user_im_name = $request_data->{user}{IMtype}{name}; - my $user_im_id = $request_data->{user}{IMid}; - my $affiliation_sitewwwaddress = $request_data->{user}{affiliation}{sitewwwaddress}; - my $affiliation_helpaddress = $request_data->{user}{affiliation}{helpaddress}; - my $image_prettyname = $request_data->{reservation}{$reservation_id}{image}{prettyname}; - my $computer_ipaddress = $request_data->{reservation}{$reservation_id}{computer}{IPaddress}; + + my $computer_short_name = $self->data->get_computer_short_name(); + my $computer_type = $self->data->get_computer_type(); + my $computer_ip_address = $self->data->get_computer_ip_address(); + my $image_os_name = $self->data->get_image_os_name(); + my $image_prettyname = $self->data->get_image_prettyname(); + my $image_os_type = $self->data->get_image_os_type(); + my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); + my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); + my $user_login_id = $self->data->get_user_login_id(); + my $user_email = $self->data->get_user_email(); + my $user_emailnotices = $self->data->get_user_emailnotices(); + my $user_imtype_name = $self->data->get_user_imtype_name(); + my $user_im_id = $self->data->get_user_im_id(); + my $is_parent_reservation = $self->data->is_parent_reservation(); my $message = <<"EOF"; -Your reservation has timed out due to inactivity for image $image_prettyname at address $computer_ipaddress. +Your reservation has timed out due to inactivity for image $image_prettyname at address $computer_ip_address. To make another reservation, please revisit: -$affiliation_sitewwwaddress +$user_affiliation_sitewwwaddress Thank You, VCL Team @@ -783,7 +780,7 @@ with detailed information on the issue a generated. To disable email notices --Visit $affiliation_sitewwwaddress +-Visit $user_affiliation_sitewwwaddress -Select User Preferences -Select General Preferences @@ -794,12 +791,12 @@ EOF # Send mail if ($is_parent_reservation && $user_emailnotices) { - mail($user_email, $subject, $message, $affiliation_helpaddress); + mail($user_email, $subject, $message, $user_affiliation_helpaddress); } # Send IM - if ($is_parent_reservation && $user_im_name ne "none") { - notify_via_IM($user_im_name, $user_im_id, $message); + if ($is_parent_reservation && $user_imtype_name ne "none") { + notify_via_IM($user_imtype_name, $user_im_id, $message); } return 1; @@ -818,26 +815,34 @@ EOF sub _notify_user_request_ended { my $self = shift; - my ($package, $filename, $line, $sub) = caller(0); - - my $request_data = $self->data->get_request_data; - my $is_parent_reservation = $self->data->is_parent_reservation(); - # Store some hash variables into local variables - my $reservation_id = $request_data->{RESERVATIONID}; - my $user_email = $request_data->{user}{email}; - my $user_emailnotices = $request_data->{user}{emailnotices}; - my $user_im_name = $request_data->{user}{IMtype}{name}; - my $user_im_id = $request_data->{user}{IMid}; - my $affiliation_helpaddress = $request_data->{user}{affiliation}{helpaddress}; - my $affiliation_sitewwwaddress = $request_data->{user}{affiliation}{sitewwwaddress}; - my $image_prettyname = $request_data->{reservation}{$reservation_id}{image}{prettyname}; + my $request_id = $self->data->get_request_id(); + my $request_logid = $self->data->get_request_log_id(); + my $request_forimaging = $self->data->get_request_forimaging(); + my $reservation_count = $self->data->get_reservation_count(); + my $reservation_id = $self->data->get_reservation_id(); + my $reservation_is_parent = $self->data->is_parent_reservation; + my $computer_id = $self->data->get_computer_id(); + my $computer_short_name = $self->data->get_computer_short_name(); + my $computer_type = $self->data->get_computer_type(); + my $computer_ip_address = $self->data->get_computer_ip_address(); + my $image_os_name = $self->data->get_image_os_name(); + my $image_prettyname = $self->data->get_image_prettyname(); + my $image_os_type = $self->data->get_image_os_type(); + my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); + my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); + my $user_standalone = $self->data->get_user_standalone(); + my $user_email = $self->data->get_user_email(); + my $user_emailnotices = $self->data->get_user_emailnotices(); + my $user_imtype_name = $self->data->get_user_imtype_name(); + my $user_im_id = $self->data->get_user_im_id(); + my $is_parent_reservation = $self->data->is_parent_reservation(); my $subject = "VCL -- End of reservation"; my $message = <<"EOF"; -Your reservation of $image_prettyname has ended. Thank you for using $affiliation_sitewwwaddress. +Your reservation of $image_prettyname has ended. Thank you for using $user_affiliation_sitewwwaddress. Regards, VCL Team @@ -849,7 +854,7 @@ with detailed information on the issue a generated. To disable email notices --Visit $affiliation_sitewwwaddress +-Visit $user_affiliation_sitewwwaddress -Select User Preferences -Select General Preferences @@ -858,12 +863,12 @@ EOF # Send mail if ($is_parent_reservation && $user_emailnotices) { - mail($user_email, $subject, $message, $affiliation_helpaddress); + mail($user_email, $subject, $message, $user_affiliation_helpaddress); } # Send IM - if ($is_parent_reservation && $user_im_name ne "none") { - notify_via_IM($user_im_name, $user_im_id, $message); + if ($is_parent_reservation && $user_imtype_name ne "none") { + notify_via_IM($user_imtype_name, $user_im_id, $message); } return 1; Modified: incubator/vcl/trunk/managementnode/lib/VCL/makeproduction.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/makeproduction.pm?rev=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/makeproduction.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/makeproduction.pm Mon Feb 28 19:24:39 2011 @@ -87,10 +87,6 @@ use VCL::utils; sub process { my $self = shift; my $request_data = $self->data->get_request_data(); - my $request_id = $self->data->get_request_id(); - my $reservation_id = $self->data->get_reservation_id(); - my $request_state_name = $self->data->get_request_state_name(); - my $image_id = $self->data->get_image_id(); my $image_name = $self->data->get_image_name(); # Update the image and imagerevision tables: @@ -201,11 +197,8 @@ sub set_imagerevision_to_production { =cut sub notify_imagerevision_to_production { - my $self = shift; - my $image_id = $self->data->get_image_id(); - my $image_name = $self->data->get_image_name(); + my $self = shift; my $image_prettyname = $self->data->get_image_prettyname(); - my $imagerevision_id = $self->data->get_imagerevision_id(); my $imagerevision_revision = $self->data->get_imagerevision_revision(); my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); my $user_email = $self->data->get_user_email(); Modified: incubator/vcl/trunk/managementnode/lib/VCL/new.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/new.pm?rev=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/new.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/new.pm Mon Feb 28 19:24:39 2011 @@ -89,53 +89,19 @@ sub process { my $request_data = $self->data->get_request_data(); my $request_id = $self->data->get_request_id(); - my $request_logid = $self->data->get_request_log_id(); my $request_state_name = $self->data->get_request_state_name(); - my $request_laststate_name = $self->data->get_request_laststate_name(); - my $request_forimaging = $self->data->get_request_forimaging(); my $request_preload_only = $self->data->get_request_preload_only(); my $reservation_count = $self->data->get_reservation_count(); my $reservation_id = $self->data->get_reservation_id(); my $reservation_is_parent = $self->data->is_parent_reservation; my $computer_id = $self->data->get_computer_id(); - my $computer_host_name = $self->data->get_computer_host_name(); my $computer_short_name = $self->data->get_computer_short_name(); - my $computer_type = $self->data->get_computer_type(); - my $computer_ip_address = $self->data->get_computer_ip_address(); my $computer_state_name = $self->data->get_computer_state_name(); - my $computer_next_image_id = $self->data->get_computer_nextimage_id(); - my $computer_next_image_name = $self->data->get_computer_nextimage_name(); + my $computer_next_image_name = $self->data->get_computer_nextimage_name(0); my $image_id = $self->data->get_image_id(); - my $image_os_name = $self->data->get_image_os_name(); my $image_name = $self->data->get_image_name(); - my $image_prettyname = $self->data->get_image_prettyname(); - my $image_project = $self->data->get_image_project(); - my $image_reloadtime = $self->data->get_image_reload_time(); - my $image_architecture = $self->data->get_image_architecture(); - my $image_os_type = $self->data->get_image_os_type(); - my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); - my $imagemeta_usergroupid = $self->data->get_imagemeta_usergroupid(); - my $imagemeta_usergroupmembercount = $self->data->get_imagemeta_usergroupmembercount(); - my $imagemeta_usergroupmembers = $self->data->get_imagemeta_usergroupmembers(); my $imagerevision_id = $self->data->get_imagerevision_id(); - my $managementnode_id = $self->data->get_management_node_id(); - my $managementnode_hostname = $self->data->get_management_node_hostname(); - my $user_unityid = $self->data->get_user_login_id(); - my $user_uid = $self->data->get_user_uid(); - my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); - my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); my $user_standalone = $self->data->get_user_standalone(); - my $user_email = $self->data->get_user_email(); - my $user_emailnotices = $self->data->get_user_emailnotices(); - my $user_imtype_name = $self->data->get_user_imtype_name(); - my $user_im_id = $self->data->get_user_im_id(); - - notify($ERRORS{'OK'}, 0, "reservation is parent = $reservation_is_parent"); - notify($ERRORS{'OK'}, 0, "preload only = $request_preload_only"); - notify($ERRORS{'OK'}, 0, "originating request state = $request_state_name"); - notify($ERRORS{'OK'}, 0, "originating request laststate = $request_laststate_name"); - notify($ERRORS{'OK'}, 0, "originating computer state = $computer_state_name"); - notify($ERRORS{'OK'}, 0, "originating computer type = $computer_type"); # If state is tomaintenance, place machine into maintenance state and set request to complete if ($request_state_name =~ /tomaintenance/) { @@ -156,10 +122,10 @@ sub process { else { notify($ERRORS{'OK'}, 0, "post action skipped, post_maintenance_action not implemented by " . ref($self->provisioner) . ", assuming no steps required"); } - + notify($ERRORS{'OK'}, 0, "exiting"); exit; - } ## end if ($request_state_name =~ /tomaintenance/) + } #If reload state is not new (reload) and computer is part of block allocation #confirm imagerevisionid is the production image. @@ -477,50 +443,15 @@ sub process { sub reload_image { my $self = shift; - my $request_data = $self->data->get_request_data(); - my $request_id = $self->data->get_request_id(); - my $request_logid = $self->data->get_request_log_id(); my $request_state_name = $self->data->get_request_state_name(); - my $request_laststate_name = $self->data->get_request_laststate_name(); - my $request_forimaging = $self->data->get_request_forimaging(); - my $request_preload_only = $self->data->get_request_preload_only(); - my $reservation_count = $self->data->get_reservation_count(); my $reservation_id = $self->data->get_reservation_id(); - my $reservation_is_parent = $self->data->is_parent_reservation; my $computer_id = $self->data->get_computer_id(); - my $computer_host_name = $self->data->get_computer_host_name(); my $computer_short_name = $self->data->get_computer_short_name(); - my $computer_type = $self->data->get_computer_type(); - my $computer_ip_address = $self->data->get_computer_ip_address(); my $computer_state_name = $self->data->get_computer_state_name(); - my $computer_next_image_id = $self->data->get_computer_nextimage_id(); - my $computer_next_image_name = $self->data->get_computer_nextimage_name(); - my $computer_currentimage_name = $self->data->get_computer_currentimage_name(); my $image_id = $self->data->get_image_id(); - my $image_os_name = $self->data->get_image_os_name(); my $image_name = $self->data->get_image_name(); - my $image_prettyname = $self->data->get_image_prettyname(); - my $image_project = $self->data->get_image_project(); - my $image_reloadtime = $self->data->get_image_reload_time(); - my $image_architecture = $self->data->get_image_architecture(); my $image_os_install_type = $self->data->get_image_os_install_type(); - my $image_os_type = $self->data->get_image_os_type(); - my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); - my $imagemeta_usergroupid = $self->data->get_imagemeta_usergroupid(); - my $imagemeta_usergroupmembercount = $self->data->get_imagemeta_usergroupmembercount(); - my $imagemeta_usergroupmembers = $self->data->get_imagemeta_usergroupmembers(); my $imagerevision_id = $self->data->get_imagerevision_id(); - my $managementnode_id = $self->data->get_management_node_id(); - my $managementnode_hostname = $self->data->get_management_node_hostname(); - my $user_unityid = $self->data->get_user_login_id(); - my $user_uid = $self->data->get_user_uid(); - my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); - my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); - my $user_standalone = $self->data->get_user_standalone(); - my $user_email = $self->data->get_user_email(); - my $user_emailnotices = $self->data->get_user_emailnotices(); - my $user_imtype_name = $self->data->get_user_imtype_name(); - my $user_im_id = $self->data->get_user_im_id(); # Try to get the node status if the provisioning engine has implemented a node_status() subroutine my $node_status; @@ -694,14 +625,6 @@ sub reload_image { return; } - #Post operations not to be handled by provisioning modules - if($image_os_install_type eq "kickstart"){ - notify($ERRORS{'OK'}, 0, "detected kickstart install on $computer_short_name, writing current_image.txt"); - if(write_currentimage_txt($self->data)){ - notify($ERRORS{'OK'}, 0, "Successfully wrote current_image.txt on $computer_short_name"); - } - } - notify($ERRORS{'OK'}, 0, "node ready: successfully reloaded $computer_short_name with $image_name"); insertloadlog($reservation_id, $computer_id, "nodeready", "$computer_short_name was reloaded with $image_name"); } @@ -731,48 +654,12 @@ sub reload_image { sub computer_not_being_used { my $self = shift; - my $request_data = $self->data->get_request_data(); - my $request_id = $self->data->get_request_id(); - my $request_logid = $self->data->get_request_log_id(); - my $request_state_name = $self->data->get_request_state_name(); - my $request_laststate_name = $self->data->get_request_laststate_name(); - my $request_forimaging = $self->data->get_request_forimaging(); - my $request_preload_only = $self->data->get_request_preload_only(); - my $reservation_count = $self->data->get_reservation_count(); my $reservation_id = $self->data->get_reservation_id(); - my $reservation_is_parent = $self->data->is_parent_reservation; my $computer_id = $self->data->get_computer_id(); - my $computer_host_name = $self->data->get_computer_host_name(); my $computer_short_name = $self->data->get_computer_short_name(); - my $computer_type = $self->data->get_computer_type(); - my $computer_ip_address = $self->data->get_computer_ip_address(); my $computer_state_name = $self->data->get_computer_state_name(); - my $computer_next_image_id = $self->data->get_computer_nextimage_id(); - my $computer_next_image_name = $self->data->get_computer_nextimage_name(); - my $image_id = $self->data->get_image_id(); - my $image_os_name = $self->data->get_image_os_name(); my $image_name = $self->data->get_image_name(); - my $image_prettyname = $self->data->get_image_prettyname(); - my $image_project = $self->data->get_image_project(); my $image_reloadtime = $self->data->get_image_reload_time(); - my $image_architecture = $self->data->get_image_architecture(); - my $image_os_type = $self->data->get_image_os_type(); - my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); - my $imagemeta_usergroupid = $self->data->get_imagemeta_usergroupid(); - my $imagemeta_usergroupmembercount = $self->data->get_imagemeta_usergroupmembercount(); - my $imagemeta_usergroupmembers = $self->data->get_imagemeta_usergroupmembers(); - my $imagerevision_id = $self->data->get_computer_imagerevision_id(); - my $managementnode_id = $self->data->get_management_node_id(); - my $managementnode_hostname = $self->data->get_management_node_hostname(); - my $user_unityid = $self->data->get_user_login_id(); - my $user_uid = $self->data->get_user_uid(); - my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); - my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); - my $user_standalone = $self->data->get_user_standalone(); - my $user_email = $self->data->get_user_email(); - my $user_emailnotices = $self->data->get_user_emailnotices(); - my $user_imtype_name = $self->data->get_user_imtype_name(); - my $user_im_id = $self->data->get_user_im_id(); # Possible computer states: # available @@ -972,38 +859,17 @@ sub reserve_computer { my $request_data = $self->data->get_request_data(); my $request_id = $self->data->get_request_id(); my $request_logid = $self->data->get_request_log_id(); - my $request_state_name = $self->data->get_request_state_name(); - my $request_laststate_name = $self->data->get_request_laststate_name(); my $request_forimaging = $self->data->get_request_forimaging(); - my $request_preload_only = $self->data->get_request_preload_only(); my $reservation_count = $self->data->get_reservation_count(); my $reservation_id = $self->data->get_reservation_id(); my $reservation_is_parent = $self->data->is_parent_reservation; my $computer_id = $self->data->get_computer_id(); - my $computer_host_name = $self->data->get_computer_host_name(); my $computer_short_name = $self->data->get_computer_short_name(); my $computer_type = $self->data->get_computer_type(); my $computer_ip_address = $self->data->get_computer_ip_address(); - my $computer_state_name = $self->data->get_computer_state_name(); - my $computer_next_image_id = $self->data->get_computer_nextimage_id(); - my $computer_next_image_name = $self->data->get_computer_nextimage_name(); - my $image_id = $self->data->get_image_id(); my $image_os_name = $self->data->get_image_os_name(); - my $image_name = $self->data->get_image_name(); my $image_prettyname = $self->data->get_image_prettyname(); - my $image_project = $self->data->get_image_project(); - my $image_reloadtime = $self->data->get_image_reload_time(); - my $image_architecture = $self->data->get_image_architecture(); my $image_os_type = $self->data->get_image_os_type(); - my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); - my $imagemeta_usergroupid = $self->data->get_imagemeta_usergroupid(); - my $imagemeta_usergroupmembercount = $self->data->get_imagemeta_usergroupmembercount(); - my $imagemeta_usergroupmembers = $self->data->get_imagemeta_usergroupmembers(); - my $imagerevision_id = $self->data->get_computer_imagerevision_id(); - my $managementnode_id = $self->data->get_management_node_id(); - my $managementnode_hostname = $self->data->get_management_node_hostname(); - my $user_unityid = $self->data->get_user_login_id(); - my $user_uid = $self->data->get_user_uid(); my $user_affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress(); my $user_affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress(); my $user_standalone = $self->data->get_user_standalone(); @@ -1011,8 +877,7 @@ sub reserve_computer { my $user_emailnotices = $self->data->get_user_emailnotices(); my $user_imtype_name = $self->data->get_user_imtype_name(); my $user_im_id = $self->data->get_user_im_id(); - my $ip_configuration = $self->data->get_management_node_public_ip_configuration(); - + notify($ERRORS{'OK'}, 0, "user_standalone=$user_standalone, image OS type=$image_os_type"); my ($mailstring, $subject, $r); @@ -1241,9 +1106,9 @@ EOF sub wait_for_child_reservations { my $self = shift; + my $request_data = $self->data->get_request_data(); my $request_id = $self->data->get_request_id(); - my $reservation_count = $self->data->get_reservation_count(); my $reservation_id = $self->data->get_reservation_id(); my @reservation_ids = $self->data->get_reservation_ids(); Modified: incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm?rev=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/reclaim.pm Mon Feb 28 19:24:39 2011 @@ -96,7 +96,7 @@ sub process { my $computer_type = $self->data->get_computer_type(); my $computer_shortname = $self->data->get_computer_short_name(); my $computer_state_name = $self->data->get_computer_state_name(); - my $computer_currentimage_name = $self->data->get_computer_currentimage_name(); + my $computer_currentimage_name = $self->data->get_computer_currentimage_name(0); # Insert into computerloadlog if request state = timeout if ($request_state_name =~ /timeout|deleted/) { @@ -186,7 +186,6 @@ sub insert_reload_and_exit { my $self = shift; my $request_data = $self->data->get_request_data; my $computer_id = $self->data->get_computer_id(); - my $computer_host_name = $self->data->get_computer_hostname(); # Retrieve next image my ($next_image_name, $next_image_id, $next_imagerevision_id) = $self->data->get_next_image_dataStructure(); Modified: incubator/vcl/trunk/managementnode/lib/VCL/reserved.pm URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/reserved.pm?rev=1075497&r1=1075496&r2=1075497&view=diff ============================================================================== --- incubator/vcl/trunk/managementnode/lib/VCL/reserved.pm (original) +++ incubator/vcl/trunk/managementnode/lib/VCL/reserved.pm Mon Feb 28 19:24:39 2011 @@ -92,30 +92,26 @@ use VCL::utils; sub process { my $self = shift; - my ($package, $filename, $line, $sub) = caller(0); - - # Store hash variables into local variables - my $request_data = $self->data->get_request_data; - - my $request_id = $self->data->get_request_id(); - my $request_logid = $self->data->get_request_log_id(); - my $reservation_id = $self->data->get_reservation_id(); - my $reservation_password = $request_data->{reservation}{$reservation_id}{pw}; - my $computer_id = $self->data->get_computer_id(); - my $computer_hostname = $self->data->get_computer_host_name(); - my $computer_short_name = $self->data->get_computer_short_name(); - my $computer_type = $self->data->get_computer_type(); - my $computer_ip_address = $self->data->get_computer_ip_address(); - my $image_os_name = $self->data->get_image_os_name(); - my $image_os_type = $self->data->get_image_os_type(); - my $request_forimaging = $self->data->get_request_forimaging; - my $image_name = $self->data->get_image_name(); - my $user_unityid = $self->data->get_user_login_id(); - my $user_standalone = $self->data->get_user_standalone(); - my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); + + my $request_data = $self->data->get_request_data(); + my $request_id = $self->data->get_request_id(); + my $request_logid = $self->data->get_request_log_id(); + my $reservation_id = $self->data->get_reservation_id(); + my $computer_id = $self->data->get_computer_id(); + my $computer_hostname = $self->data->get_computer_host_name(); + my $computer_short_name = $self->data->get_computer_short_name(); + my $computer_type = $self->data->get_computer_type(); + my $computer_ip_address = $self->data->get_computer_ip_address(); + my $image_os_name = $self->data->get_image_os_name(); + my $image_os_type = $self->data->get_image_os_type(); + my $request_forimaging = $self->data->get_request_forimaging; + my $image_name = $self->data->get_image_name(); + my $user_unityid = $self->data->get_user_login_id(); + my $user_standalone = $self->data->get_user_standalone(); + my $imagemeta_checkuser = $self->data->get_imagemeta_checkuser(); my $reservation_count = $self->data->get_reservation_count(); + my $imagemeta_usergroupid = $self->data->get_imagemeta_usergroupid(); - # Update the log table, set the loaded time to now for this request if (update_log_loaded_time($request_logid)) { notify($ERRORS{'OK'}, 0, "updated log table, set loaded time to now for id:$request_logid"); @@ -125,14 +121,12 @@ sub process { } # Figure out if image has usergroupid set in meta data and how many members it has - my $imagemeta_usergroupid = ''; my @user_group_members; my $user_group_member_count = 0; - if (defined $request_data->{reservation}{$reservation_id}{image}{imagemeta}{usergroupid}) { - notify($ERRORS{'OK'}, 0, "imagemeta user group defined $request_data->{reservation}{$reservation_id}{image}{imagemeta}{usergroupid}"); - $imagemeta_usergroupid = $request_data->{reservation}{$reservation_id}{image}{imagemeta}{usergroupid}; - @user_group_members = getusergroupmembers($imagemeta_usergroupid); - $user_group_member_count = scalar @user_group_members; + if ($imagemeta_usergroupid) { + notify($ERRORS{'OK'}, 0, "imagemeta user group defined: $imagemeta_usergroupid"); + @user_group_members = $self->data->get_imagemeta_usergroupmembers(); + $user_group_member_count = $self->data->get_imagemeta_usergroupmembercount(); } notify($ERRORS{'OK'}, 0, "imagemeta user group membership count = $user_group_member_count");