Author: fapeeler
Date: Thu Sep  4 19:37:48 2014
New Revision: 1622538

URL: http://svn.apache.org/r1622538
Log:
VCL-777
fixed issue with server reinstalls

fixed other minor things - 
check_block requests if end time had pasted the blocktimeid entry was not being 
removed
changed Critical to warning for attempts to change firewall for port 22


Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS.pm?rev=1622538&r1=1622537&r2=1622538&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS.pm Thu Sep  4 19:37:48 2014
@@ -2542,6 +2542,8 @@ sub manage_server_access {
        # Collect users in reservationaccounts table
        my %res_accounts = get_reservation_accounts($reservation_id);
        my $not_standalone_list = 
$self->data->get_management_node_not_standalone();
+       #notify($ERRORS{'WARNING'}, 0, "request_laststate_name= 
$request_laststate_name Res account info" . format_data(%res_accounts));
+       #notify($ERRORS{'WARNING'}, 0, "request_laststate_name= 
$request_laststate_name User_hash info" . format_data(%user_hash));
 
        #Add users
        foreach my $userid (sort keys %user_hash) {
@@ -2552,12 +2554,13 @@ sub manage_server_access {
                }
                my $standalone = $user_hash{$userid}{user_info}{STANDALONE};
 
-               if(!$self->user_exists($user_hash{$userid}{unityid})){
+               if(!$self->user_exists($user_hash{$userid}{username})){
                        delete($res_accounts{$userid});
                }
                
                if(!exists($res_accounts{$userid}) || $request_laststate_name 
eq "reinstall" ){
                        if($request_laststate_name ne "reinstall" ){    
+
                                $user_hash{$userid}{"passwd"} = 0;
                                # Generate password if linux and standalone 
affiliation
                                unless ($image_os_type =~ /linux/ && 
!$standalone) {
@@ -2569,15 +2572,21 @@ sub manage_server_access {
                                }
                        }
                        # if reinstall and standalone check for existing 
password
-                       if($request_laststate_name eq "reinstall" && 
$standalone) {
+                       if($request_laststate_name eq "reinstall") {
+                               #notify($ERRORS{'OK'}, 0, "Reinstall mode for 
$user_hash{$userid}{unityid}" . format_data(%res_accounts));
                                if ( $res_accounts{$userid}{password} ) {
-                                       $user_hash{$userid}{passwd} = 
$res_accounts{$userid}{password}
+                                       $user_hash{$userid}{passwd} = 
$res_accounts{$userid}{password};
                                }
                                else {
                                        #should have password for standalone 
accounts
-                                       $user_hash{$userid}{"passwd"} = getpw();
+                                       unless ($image_os_type =~ /linux/ && 
!$standalone) {
+                                               $user_hash{$userid}{"passwd"} = 
getpw();
+                                       }
+
+                                       if 
(update_reservation_accounts($reservation_id,$userid,0,"delete")) {
+                                       }
                                        if 
(update_reservation_accounts($reservation_id,$userid,$user_hash{$userid}{passwd},"add"))
 {
-                                               notify($ERRORS{'OK'}, 0, 
"Inserted $reservation_id,$userid into reservationsaccounts table");
+                                               notify($ERRORS{'OK'}, 0, 
"Inserted new password for $reservation_id,$userid into reservationsaccounts 
table");
                                        }
                                }
                        }
@@ -2597,7 +2606,7 @@ sub manage_server_access {
 
        #Remove anyone listed in reservationaccounts list that is not in 
user_hash
        foreach my $res_userid (sort keys %res_accounts) {
-               notify($ERRORS{'OK'}, 0, "res_userid= $res_userid username= 
$res_accounts{$res_userid}{username}");
+               #notify($ERRORS{'OK'}, 0, "res_userid= $res_userid username= 
$res_accounts{$res_userid}{username}");
                #Skip reservation owner, this account is not to be removed from 
the reservation.
       if ($res_userid eq $user_login_id_owner) {
                        #Skip group checks as the owner may not be a member

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=1622538&r1=1622537&r2=1622538&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Thu Sep  4 19:37:48 2014
@@ -3726,7 +3726,7 @@ sub disable_firewall_port {
                return;
        }
        elsif ($port eq '22') {
-               notify($ERRORS{'CRITICAL'}, 0, "disabling firewall port 22 is 
not allowed because it will cut off access from the management node");
+               notify($ERRORS{'WARNING'}, 0, "disabling firewall port 22 is 
not allowed because it will cut off access from the management node");
                return;
        }
        

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1622538&r1=1622537&r2=1622538&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Thu Sep  4 19:37:48 2014
@@ -964,6 +964,13 @@ sub check_blockrequest_time {
 
        #notify($ERRORS{'DEBUG'}, 0, "start:  $start_datetime,  epoch: 
$start_time_epoch_seconds,  delta: $start_delta_minutes minutes");
        #notify($ERRORS{'DEBUG'}, 0, "end:    $end_datetime,    epoch: 
$end_time_epoch_seconds,    delta: $end_delta_minutes minutes");
+       
+       # End time it is less than 1 minute
+       if ($end_delta_minutes < 0) {
+               # Block request end time is reached
+               notify($ERRORS{'OK'}, 0, "block request end time has been 
reached ($end_delta_minutes minutes from now), returning 'end'");
+               return "end";
+       }
 
        # if 1min to 6 hrs in advance: start assigning resources
        if ($start_delta_minutes <= (6 * 60)) {
@@ -972,12 +979,6 @@ sub check_blockrequest_time {
                return "start";
        }
 
-       # End time it is less than 1 minute
-       if ($end_delta_minutes < 0) {
-               # Block request end time is near
-               notify($ERRORS{'OK'}, 0, "block request end time has been 
reached ($end_delta_minutes minutes from now), returning 'end'");
-               return "end";
-       }
 
        #notify($ERRORS{'DEBUG'}, 0, "block request does not need to be 
processed now, returning 0");
        return 0;


Reply via email to