You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2016/10/26 19:46:03 UTC

svn commit: r1766727 - in /vcl/trunk/managementnode/lib/VCL: Module.pm Module/OS.pm Module/OS/Linux.pm Module/OS/Linux/UnixLab.pm Module/Provisioning.pm Module/Provisioning/openstack.pm reclaim.pm

Author: arkurth
Date: Wed Oct 26 19:46:03 2016
New Revision: 1766727

URL: http://svn.apache.org/viewvc?rev=1766727&view=rev
Log:
VCL-999
Rewrote much of UnixLab.pm. Added initialize subroutine which sets ssh_port and ssh_user keys in the OS object. These are used by OS.pm::execute and is_ssh_responding so that the correct port and username are used.

Replaced OS.pm::get_current_image_info with get_current_imagerevision_id. The old subroutine accepted various text strings to specify which piece of data to retrieve. This isn't very elegant. Separate subs should be written for each if necessary. All of the callers of get_current_image_info really only needed the imagerevision ID.

Updated OS.pm::is_ssh_responding to not check both port 22 and 24. It now checks if $self->{ssh_port} is set. If not, defaults only to 22.

Added OS.pm::wait_for_port_open and wait_for_port_closed. Similar functionality had existed in UnixLab.pm but was messy and didn't use the code_loop_timeout sub for the looping countdown.

Other
Added double quotes to the message string in Linux.pm::notify_user_console. It wasn't working if the message contained a newline.

Modified:
    vcl/trunk/managementnode/lib/VCL/Module.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm
    vcl/trunk/managementnode/lib/VCL/reclaim.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module.pm?rev=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module.pm Wed Oct 26 19:46:03 2016
@@ -1440,7 +1440,7 @@ sub code_loop_timeout {
 		return;
 	}
 	elsif (ref($code_ref) ne 'CODE') {
-		notify($ERRORS{'WARNING'}, 0, "1st argument must be a code reference, not " . ref($code_ref));
+		notify($ERRORS{'WARNING'}, 0, "1st argument must be a code reference, not " . format_data($code_ref));
 		return;
 	}
 	

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS.pm?rev=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS.pm Wed Oct 26 19:46:03 2016
@@ -558,65 +558,22 @@ sub get_currentimage_txt_contents {
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 get_current_image_info
+=head2 get_current_imagerevision_id
+
+ Parameters  : none
+ Returns     : integer
+ Description : Retrieves the imagerevision ID value from currentimage.txt.
 
- Parameters  : optional 
-               id,computer_hostname,computer_id,current_image_name,imagerevision_datecreated,imagerevision_id,prettyname,vcld_post_load 
- Returns     : If successful: 
-               if no parameter return the imagerevision_id
-               return the value of parameter input
-               If failed: false
- Description : Collects currentimage hash on a computer and returns a
-               value containing of the input paramter or the imagerevision_id if no inputs.
-               This also updates the DataStructure.pm so data matches what is currently loaded.
 =cut
 
-sub get_current_image_info {
+sub get_current_imagerevision_id {
 	my $self = shift;
 	if (ref($self) !~ /VCL::Module/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
 		return;
 	}
-
-	my $input = shift;
-
-	if (!defined $input) {
-		$input = "imagerevision_id";
-	}
-
-	my $computer_node_name = $self->data->get_computer_node_name();
-
-	# Get the contents of the currentimage.txt file
-	my %current_image_txt_contents;
-	if (%current_image_txt_contents = $self->get_currentimage_txt_contents()) {
-		notify($ERRORS{'DEBUG'}, 0, "retrieved currentimage.txt contents from $computer_node_name");
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to retrieve currentimage.txt contents from $computer_node_name");
-		return;
-	}
-
-	# Make sure an empty hash wasn't returned
-	if (defined $current_image_txt_contents{imagerevision_id}) {
-		notify($ERRORS{'DEBUG'}, 0, "user selected content of image currently loaded on $computer_node_name: $current_image_txt_contents{current_image_name}");
-		
-		if (my $imagerevision_info = get_imagerevision_info($current_image_txt_contents{imagerevision_id})) {
-			$self->data->set_computer_currentimage_data($imagerevision_info->{image});
-			$self->data->set_computer_currentimagerevision_data($imagerevision_info);
-		}
-		
-		if (defined($current_image_txt_contents{$input})) {
-			return $current_image_txt_contents{$input};
-		}
-		else {
-			notify($ERRORS{'WARNING'}, 0, "$input was not defined in current_image_txt");	
-			return;
-		}
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "empty hash was returned when currentimage.txt contents were retrieved from $computer_node_name");
-		return;
-	}
+	
+	return $self->get_current_image_tag('imagerevision_id');
 }
 
 #/////////////////////////////////////////////////////////////////////////////
@@ -879,15 +836,14 @@ sub wait_for_ssh {
 =head2 is_ssh_responding
 
  Parameters  : $computer_name (optional), $max_attempts (optional)
- Returns     : If computer responds to SSH: 1
-               If computer never responds to SSH: 0
- Description : Checks if the computer is responding to SSH. Ports 22 and 24 are
-               first checked to see if either is open. If neither is open, 0 is
-               returned. If either of the ports is open a test SSH command which
-               simply echo's a string is attempted. The default is to only
-               attempt to run this command once. This can be changed by
-               supplying the $max_attempts argument. If the $max_attempts is
-               supplied but set to 0, only the port checks are done.
+ Returns     : boolean
+ Description : Checks if the computer is responding to SSH. The SSH port is
+					first checked. If not open, 0 is returned. If the port is open a
+					test SSH command which simply echo's a string is attempted. The
+					default is to only attempt to run this command once. This can be
+					changed by supplying the $max_attempts argument. If the
+					$max_attempts is supplied but set to 0, only the port checks are
+					done.
 
 =cut
 
@@ -919,15 +875,17 @@ sub is_ssh_responding {
 	if (!$computer_node_name) {
 		$computer_node_name = $self->data->get_computer_node_name();
 	}
-
+	
+	# If 'ssh_port' key is set in this object use it
+	my $port =  $self->{ssh_port} || 22;
+	
 	# Try nmap to see if any of the ssh ports are open before attempting to run a test command
-	my $port_22_status = nmap_port($computer_node_name, 22) ? "open" : "closed";
-	my $port_24_status = nmap_port($computer_node_name, 24) ? "open" : "closed";
-	if ($port_22_status ne 'open' && $port_24_status ne 'open') {
-		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, ports 22 or 24 are both closed");
+	my $nmap_status = nmap_port($computer_node_name, $port) ? "open" : "closed";
+	if ($nmap_status ne 'open') {
+		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, port $port is closed");
 		return 0;
 	}
-
+	
 	if ($max_attempts) {
 		# Run a test SSH command
 		#my ($exit_status, $output) = $self->execute({
@@ -949,11 +907,11 @@ sub is_ssh_responding {
 		
 		# The exit status will be 0 if the command succeeded
 		if (defined($output) && grep(/testing/, @$output)) {
-			notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is responding to SSH, port 22: $port_22_status, port 24: $port_24_status");
+			notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is responding to SSH, port $port: $nmap_status");
 			return 1;
 		}
 		else {
-			notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, SSH command failed, port 22: $port_22_status, port 24: $port_24_status");
+			notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, SSH command failed, port $port: $nmap_status");
 			return 0;
 		}
 	}
@@ -1026,6 +984,75 @@ sub wait_for_response {
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 wait_for_port_open
+
+ Parameters  : $port_number, $connection_target (optional), $total_wait_seconds (optional), $attempt_delay_seconds (optional)
+ Returns     : boolean
+ Description : Uses nmap to check if the port specified is open. Loops until the
+               port is open or $total_wait_seconds is reached.
+
+=cut
+
+sub wait_for_port_open {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	my $calling_subroutine = get_calling_subroutine();
+	
+	my $port_number = shift;
+	if (!defined($port_number)) {
+		notify($ERRORS{'WARNING'}, 0, "port number argument was not supplied");
+		return;
+	}
+	
+	my $connection_target = shift || $computer_node_name;
+	my $total_wait_seconds = shift || 60;
+	my $attempt_delay_seconds = shift || 5;
+	
+	my $mode = ($calling_subroutine =~ /wait_for_port_closed/ ? 'closed' : 'open');
+	
+	my $message = "waiting for port $port_number to be $mode on $connection_target";
+	$message .= " ($computer_node_name)" if ($connection_target ne $computer_node_name);
+	
+	# Essentially perform xnor on nmap_port result and $mode eq open
+	# Both either need to be true or false
+	# $mode eq open:true, nmap_port:true, result:true
+	# $mode eq open:false, nmap_port:true, result:false
+	# $mode eq open:true, nmap_port:false, result:false
+	# $mode eq open:false, nmap_port:false, result:true
+	my $sub_ref = sub{
+		my $nmap_result = nmap_port(@_) || 0;
+		return $mode =~ /open/ == $nmap_result;
+	};
+	return $self->code_loop_timeout($sub_ref, [$connection_target, $port_number], $message, $total_wait_seconds, $attempt_delay_seconds);
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
+=head2 wait_for_port_closed
+
+ Parameters  : $port_number, $connection_target (optional), $total_wait_seconds (optional), $attempt_delay_seconds (optional)
+ Returns     : boolean
+ Description : Uses nmap to check if the port specified is closed. Loops until
+               the port is open or $total_wait_seconds is reached.
+
+=cut
+
+sub wait_for_port_closed {
+	my $self = shift;
+	if (ref($self) !~ /VCL::Module/i) {
+		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
+		return;
+	}
+	return wait_for_port_open($self, @_);
+}
+
+#/////////////////////////////////////////////////////////////////////////////
+
 =head2 update_ssh_known_hosts
 
  Parameters  : $known_hosts_path (optional)
@@ -1381,8 +1408,9 @@ sub get_current_image_tag {
 	
 	my @lines = $self->get_file_contents($current_image_file_path);
 	for my $line (@lines) {
-		my ($tag_value, $timestamp) = $line =~ /^$tag_name=(.+)\s\((.+)\)$/g;
+		my ($tag_value, $timestamp) = $line =~ /^$tag_name=([^\s]+)\s?\(?(.+)?\)?$/gx;
 		if (defined($tag_value)) {
+			$timestamp = '' if (!defined($timestamp));
 			if (wantarray) {
 				notify($ERRORS{'DEBUG'}, 0, "found '$tag_name' tag line in $current_image_file_path: '$line', returning array: ('$tag_value', '$timestamp')");
 				return ($tag_value, $timestamp);
@@ -2795,10 +2823,12 @@ sub execute {
 	my ($argument) = @_;
 	my ($computer_name, $command, $display_output, $timeout_seconds, $max_attempts, $port, $user, $password, $identity_key, $ignore_error);
 	
+	my $self;
+	
 	# Check if this subroutine was called as an object method
 	if (ref($argument) && ref($argument) =~ /VCL::Module/) {
 		# Subroutine was called as an object method ($self->execute)
-		my $self = shift;
+		$self = shift;
 		($argument) = @_;
 		
 		#notify($ERRORS{'DEBUG'}, 0, "called as an object method: " . ref($self));
@@ -2871,6 +2901,26 @@ sub execute {
 		}
 	}
 	
+	# If 'ssh_user' key is set in this object, use it
+	# This allows OS modules to specify the username to use
+	if ($self && $self->{ssh_user}) {
+		#notify($ERRORS{'DEBUG'}, 0, "\$self->{ssh_user} is defined: $self->{ssh_user}");
+		$user = $self->{ssh_user};
+	}
+	elsif (!$port) {
+		$user = 'root';
+	}
+	
+	# If 'ssh_port' key is set in this object, use it
+	# This allows OS modules to specify the port to use
+	if ($self && $self->{ssh_port}) {
+		#notify($ERRORS{'DEBUG'}, 0, "\$self->{ssh_port} is defined: $self->{ssh_port}");
+		$port = $self->{ssh_port};
+	}
+	elsif (!$port) {
+		$port = 22;
+	}
+	
 	my $arguments = {
 		node => $computer_name,
 		command => $command,
@@ -2910,10 +2960,12 @@ sub execute_new {
 	my ($argument) = @_;
 	my ($computer_name, $command, $display_output, $timeout_seconds, $max_attempts, $port, $user, $password, $identity_key, $ignore_error);
 	
+	my $self;
+	
 	# Check if this subroutine was called as an object method
 	if (ref($argument) && ref($argument) =~ /VCL::Module/) {
 		# Subroutine was called as an object method ($self->execute)
-		my $self = shift;
+		$self = shift;
 		($argument) = @_;
 		
 		#notify($ERRORS{'DEBUG'}, 0, "called as an object method: " . ref($self));
@@ -2980,8 +3032,26 @@ sub execute_new {
 	$display_output = 0 unless $display_output;
 	$timeout_seconds = 60 unless $timeout_seconds;
 	$max_attempts = 3 unless $max_attempts;
-	$port = 22 unless $port;
-	$user = 'root' unless $user;
+	
+	# If 'ssh_user' key is set in this object, use it
+	# This allows OS modules to specify the username to use
+	if ($self && $self->{ssh_user}) {
+		#notify($ERRORS{'DEBUG'}, 0, "\$self->{ssh_user} is defined: $self->{ssh_user}");
+		$user = $self->{ssh_user};
+	}
+	elsif (!$port) {
+		$user = 'root';
+	}
+	
+	# If 'ssh_port' key is set in this object, use it
+	# This allows OS modules to specify the port to use
+	if ($self && $self->{ssh_port}) {
+		#notify($ERRORS{'DEBUG'}, 0, "\$self->{ssh_port} is defined: $self->{ssh_port}");
+		$port = $self->{ssh_port};
+	}
+	elsif (!$port) {
+		$port = 22;
+	}
 	
 	my $ssh_options = '-o StrictHostKeyChecking=no -o ConnectTimeout=30 -x';
 	
@@ -3026,7 +3096,7 @@ sub execute_new {
 		
 		if (!$ENV{net_ssh_expect}{$remote_connection_target}) {
 			eval {
-				$ssh = Net::SSH::Expect->new(
+				my $expect_options = {
 					host => $remote_connection_target,
 					user => $user,
 					port => $port,
@@ -3034,18 +3104,19 @@ sub execute_new {
 					no_terminal => 1,
 					ssh_option => $ssh_options,
 					#timeout => 5,
-				);
+				};
 				
+				$ssh = Net::SSH::Expect->new(%$expect_options);
 				if ($ssh) {
-					notify($ERRORS{'DEBUG'}, 0, "created " . ref($ssh) . " object to control $computer_string, SSH options: $ssh_options");
+					notify($ERRORS{'DEBUG'}, 0, "created " . ref($ssh) . " object to control $computer_string, options:\n" . format_data($expect_options));
 				}
 				else {
-					notify($ERRORS{'WARNING'}, 0, "failed to create Net::SSH::Expect object to control $computer_string, $!");
+					notify($ERRORS{'WARNING'}, 0, "failed to create Net::SSH::Expect object to control $computer_string, $!, options:\n" . format_data($expect_options));
 					next ATTEMPT;
 				}
 				
 				if (!$ssh->run_ssh()) {
-					notify($ERRORS{'WARNING'}, 0, ref($ssh) . " object failed to fork SSH process to control $computer_string, $!");
+					notify($ERRORS{'WARNING'}, 0, ref($ssh) . " object failed to fork SSH process to control $computer_string, $!, options:\n" . format_data($expect_options));
 					next ATTEMPT;
 				}
 				

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=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Wed Oct 26 19:46:03 2016
@@ -3995,8 +3995,8 @@ sub delete_service {
 =head2 check_connection_on_port
 
  Parameters  : $port
- Returns     : (connected|conn_wrong_ip|timeout|failed)
- Description : uses netstat to see if any thing is connected to the provided port
+ Returns     : boolean (1=connected, 0=not connected, NULL=error)
+ Description : Checks if a connection exists on the port specified.
 
 =cut
 
@@ -4010,15 +4010,15 @@ sub check_connection_on_port {
 	my $computer_node_name          = $self->data->get_computer_node_name();
 	my $remote_ip                   = $self->data->get_reservation_remote_ip();
 	my $computer_public_ip_address  = $self->get_public_ip_address();
-	my $request_state_name          = $self->data->get_request_state_name();
 	
 	my $port = shift;
 	if (!$port) {
 		notify($ERRORS{'WARNING'}, 0, "port variable was not passed as an argument");
-		return "failed";
+		return;
 	}
 	
 	my $port_connection_info = $self->get_port_connection_info();
+	
 	for my $protocol (keys %$port_connection_info) {
 		if (!defined($port_connection_info->{$protocol}{$port})) {
 			next;
@@ -4028,27 +4028,28 @@ sub check_connection_on_port {
 			my $connection_local_ip = $connection->{local_ip};
 			my $connection_remote_ip = $connection->{remote_ip};
 			
-			if ($connection_local_ip ne $computer_public_ip_address) {
-				notify($ERRORS{'DEBUG'}, 0, "ignoring connection, not connected to public IP address ($computer_public_ip_address): $connection_remote_ip --> $connection_local_ip:$port ($protocol)");
+			if (defined($computer_public_ip_address) && $connection_local_ip ne $computer_public_ip_address) {
+				notify($ERRORS{'DEBUG'}, 0, "ignoring connection to $computer_node_name, not connected to public IP address ($computer_public_ip_address): $connection_remote_ip --> $connection_local_ip:$port ($protocol)");
 				next;
 			}
 			
 			if ($connection_remote_ip eq $remote_ip) {
-				notify($ERRORS{'DEBUG'}, 0, "connection detected from reservation remote IP: $connection_remote_ip --> $connection_local_ip:$port ($protocol)");
+				notify($ERRORS{'DEBUG'}, 0, "connection to $computer_node_name detected from reservation remote IP: $connection_remote_ip --> $connection_local_ip:$port ($protocol)");
 				return 1;
 			}
 			
 			# Connection is not from reservation remote IP address, check if user is logged in
 			if ($self->user_logged_in()) {
-				notify($ERRORS{'DEBUG'}, 0, "connection detected from different remote IP address than current reservation remote IP ($remote_ip): $connection_remote_ip --> $connection_local_ip:$port ($protocol), updating reservation remote IP to $connection_remote_ip");
+				notify($ERRORS{'DEBUG'}, 0, "connection to $computer_node_name detected from different remote IP address than current reservation remote IP ($remote_ip): $connection_remote_ip --> $connection_local_ip:$port ($protocol), updating reservation remote IP to $connection_remote_ip");
 				$self->data->set_reservation_remote_ip($connection_remote_ip);
 				return 1;
 			}
 			
-			notify($ERRORS{'DEBUG'}, 0, "ignoring connection, user is not logged in and remote IP address does not match current reservation remote IP ($remote_ip): $connection_remote_ip --> $connection_local_ip:$port ($protocol)");
+			notify($ERRORS{'DEBUG'}, 0, "ignoring connection to $computer_node_name, user is not logged in and remote IP address does not match current reservation remote IP ($remote_ip): $connection_remote_ip --> $connection_local_ip:$port ($protocol)");
 		}
 	}
 	
+	notify($ERRORS{'DEBUG'}, 0, "connection to $computer_node_name NOT detected on port $port");
 	return 0;
 }
 
@@ -5834,7 +5835,7 @@ sub notify_user_console {
 
 	my $computer_node_name = $self->data->get_computer_node_name();
 
-	my $cmd = "echo $message \| write $username";
+	my $cmd = "echo \"$message\" \| write $username";
 	my ($exit_status, $output) = $self->execute($cmd, 1);
 	if (!defined($output)) {
 		notify($ERRORS{'WARNING'}, 0, "failed to execute command to determine if the '$cmd' shell command exists on $computer_node_name");

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm?rev=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm Wed Oct 26 19:46:03 2016
@@ -20,15 +20,7 @@
 
 =head1 NAME
 
-VCL::Module::OS::Linux.pm - VCL module to support Linux operating systems
-
-=head1 SYNOPSIS
-
- Needs to be written
-
-=head1 DESCRIPTION
-
- This module provides VCL support for Linux operating systems.
+VCL::Module::OS::UnixLab.pm - VCL module to support Unix and Linux operating systems on lab computers
 
 =cut
 
@@ -62,563 +54,283 @@ use VCL::utils;
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 revoke_access
+=head2 initialize
 
- Parameters  :
- Returns     :
- Description :
+ Parameters  : none
+ Returns     : boolean
+ Description : Sets keys in the object to override the default SSH username and
+               port in order for OS.pm::execute to be able to connect to the
+               computer:
+               $self->{ssh_port} = 24
+               $self->{ssh_user} = 'vclstaff'
 
 =cut
 
-sub revoke_access {
+sub initialize {
 	my $self = shift;
 	if (ref($self) !~ /unixlab/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return 0;
-	}
-
-	my $computer_public_ip_address = $self->data->get_computer_public_ip_address;
-	my $computer_node_name         = $self->data->get_computer_node_name();
-	my $user_login_id              = $self->data->get_user_login_id();
-	my $identity                   = $self->data->get_image_identity();
-
-	if (!$user_login_id) {
-		notify($ERRORS{'WARNING'}, 0, "user could not be determined");
-		return 0;
-	}
-
-	if (!$computer_node_name) {
-		notify($ERRORS{'WARNING'}, 0, "computer node name could not be determined");
-		return 0;
-	}
-
-	if (!$identity) {
-		notify($ERRORS{'WARNING'}, 0, "image identity keys could not be determined");
-		return 0;
-	}
-
-	# Filler for clientdata file
-	my $remoteIP = "127.0.0.1";
-	my $state    = "timeout";
-
-	my @lines;
-	my $l;
-	# create clientdata file
-	my $clientdata = "/tmp/clientdata.$computer_public_ip_address";
-	if (open(CLIENTDATA, ">$clientdata")) {
-		print CLIENTDATA "$state\n";
-		print CLIENTDATA "$user_login_id\n";
-		print CLIENTDATA "$remoteIP\n";
-		close CLIENTDATA;
-
-		# scp to hostname
-		my $target = "vclstaff\@$computer_public_ip_address:/home/vclstaff/clientdata";
-		if (run_scp_command($clientdata, $target, $identity, "24")) {
-			notify($ERRORS{'OK'}, 0, "Success copied $clientdata to $target");
-			unlink($clientdata);
-			
-			# send flag to activate changes
-			my @sshcmd = run_ssh_command($computer_public_ip_address, $identity, "echo 1 > /home/vclstaff/flag", "vclstaff", "24");
-			notify($ERRORS{'OK'}, 0, "setting flag to 1 on $computer_public_ip_address");
-			
-			my $nmapchecks = 0;
-			# return nmap check
-			
-			NMAPPORT:
-			if (!(nmap_port($computer_public_ip_address, 22))) {
-				return 1;
-			}
-			else {
-				if ($nmapchecks < 5) {
-					$nmapchecks++;
-					sleep 1;
-					notify($ERRORS{'OK'}, 0, "port 22 not closed yet calling NMAPPORT code block");
-					goto NMAPPORT;
-				}
-				else {
-					notify($ERRORS{'WARNING'}, 0, "port 22 never closed on client $computer_public_ip_address");
-					return 0;
-				}
-			} ## end else [ if (!(nmap_port($computer_public_ip_address, 22)))
-		} ## end if (run_scp_command($clientdata, $target, ...
-		else {
-			notify($ERRORS{'OK'}, 0, "could not copy src=$clientdata to target=$target");
-			return 0;
-		}
-	} ## end if (open(CLIENTDATA, ">$clientdata"))
-	else {
-		notify($ERRORS{'WARNING'}, 0, "could not open /tmp/clientdata.$computer_public_ip_address $! ");
-		return 0;
+		return;
 	}
-
+	
+	notify($ERRORS{'OK'}, 0, "initializing " . ref($self) . " module");
+	$self->{ssh_port} = 24;
+	$self->{ssh_user} = 'vclstaff';
 	return 1;
-} ## end sub revoke_access
+}
+
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 reserve
+=head2 grant_access
 
- Parameters  : called as an object
- Returns     : 1 - success , 0 - failure
- Description : adds user 
+ Parameters  : none
+ Returns     : boolean
+ Description : Updates /home/vclstaff/clientdata on the computer to include the
+               state 'new', the username, and reservation remote IP.
+               
+               Triggers the vclclient daemon to read the clientdata file and
+               configure the computer.
+               
+               Waits for port 22 to become open on the computer's public IP
+               address.
 
 =cut
 
-sub reserve {
+sub grant_access {
 	my $self = shift;
 	if (ref($self) !~ /unixlab/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
 		return 0;
 	}
 	
+	my $computer_node_name = $self->data->get_computer_node_name();
+	my $user_login_id = $self->data->get_user_login_id();
+	my $reservation_remote_ip = $self->data->get_reservation_remote_ip();
+	my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
+	
+	notify($ERRORS{'OK'}, 0, "attempting to grant access to $user_login_id on $computer_node_name");
+	
+	# Create the clientdata file
+	my $clientdata_file_path = "/home/vclstaff/clientdata";
+	my $clientdata_contents = <<EOF;
+new
+$user_login_id
+$reservation_remote_ip
+EOF
+	if (!$self->create_text_file($clientdata_file_path, $clientdata_contents)) {
+		notify($ERRORS{'WARNING'}, 0, "failed to grant access to $user_login_id on $computer_node_name, file could not be updated: $clientdata_file_path");
+		return;
+	}
+	
+	if (!$self->_trigger_vclclient()) {
+		notify($ERRORS{'WARNING'}, 0, "failed to grant access to $user_login_id on $computer_node_name, flag file could not be updated");
+		return;
+	}
+	
+	if (!$self->wait_for_port_open(22, $computer_public_ip_address)) {
+		notify($ERRORS{'WARNING'}, 0, "failed to grant access to $user_login_id on $computer_node_name, SSH port 22 is closed");
+		return;
+	}
+	
+	notify($ERRORS{'OK'}, 0, "granted access to $user_login_id on $computer_node_name");
 	return 1;
-}
+} ## end sub grant_access
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 grant_access
+=head2 sanitize
 
- Parameters  : called as an object
- Returns     : 1 - success , 0 - failure
- Description :  adds username to external_sshd_config and and starts sshd with custom config
+ Parameters  : none
+ Returns     : boolean
+ Description : Updates /home/vclstaff/clientdata on the computer to include the
+               state 'timeout', the username, and a dummy 127.0.0.1 address.
+               
+               Triggers the vclclient daemon to read the clientdata file and
+               configure the computer.
+               
+               Waits for port 22 to become closed on the computer's public IP
+               address.
 
 =cut
 
-sub grant_access {
+sub sanitize {
 	my $self = shift;
 	if (ref($self) !~ /unixlab/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
 		return 0;
 	}
+
+	my $computer_node_name = $self->data->get_computer_node_name();
+	my $user_login_id = $self->data->get_user_login_id();
+	my $reservation_remote_ip = $self->data->get_reservation_remote_ip();
+	my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
+	
+	notify($ERRORS{'OK'}, 0, "attempting to sanitize $computer_node_name");
+	
+	# Create the clientdata file
+	my $clientdata_file_path = "/home/vclstaff/clientdata";
+	my $clientdata_contents = <<EOF;
+timeout
+$user_login_id
+127.0.0.1
+EOF
+	if (!$self->create_text_file($clientdata_file_path, $clientdata_contents)) {
+		notify($ERRORS{'WARNING'}, 0, "failed to sanitize $computer_node_name, file could not be updated: $clientdata_file_path");
+		return;
+	}
 	
-	my $user                       = $self->data->get_user_login_id();
-	my $computer_node_name         = $self->data->get_computer_node_name();
-	my $computer_public_ip_address = $self->data->get_computer_public_ip_address;
-	my $identity                   = $self->data->get_image_identity;
-	my $remoteIP                   = $self->data->get_reservation_remote_ip();
-	my $state                      = "new";
-
-
-	notify($ERRORS{'OK'}, 0, "In grant_access routine $user,$computer_node_name");
-
-	my ($package, $filename, $line, $sub) = caller(0);
-
-	# create clientdata file
-	my $clientdata = "/tmp/clientdata.$computer_public_ip_address";
-	if (open(CLIENTDATA, ">$clientdata")) {
-		print CLIENTDATA "$state\n";
-		print CLIENTDATA "$user\n";
-		print CLIENTDATA "$remoteIP\n";
-		close CLIENTDATA;
-		
-		# scp to hostname
-		my $target = "vclstaff\@$computer_public_ip_address:/home/vclstaff/clientdata";
-		if (run_scp_command($clientdata, $target, $identity, "24")) {
-			notify($ERRORS{'OK'}, 0, "Success copied $clientdata to $target");
-			unlink($clientdata);
-			
-			# send flag to activate changes
-			my @sshcmd = run_ssh_command($computer_public_ip_address, $identity, "echo 1 > /home/vclstaff/flag", "vclstaff", "24");
-			notify($ERRORS{'OK'}, 0, "setting flag to 1 on $computer_public_ip_address");
-			
-			my $nmapchecks = 0;
-			
-			NMAPPORT:
-			if (nmap_port($computer_public_ip_address, 22)) {
-				notify($ERRORS{'OK'}, 0, "sshd opened");
-				return 1;
-			}
-			else {
-				if ($nmapchecks < 6) {
-					$nmapchecks++;
-					sleep 1;
-					#notify($ERRORS{'OK'},0,"calling NMAPPORT code block");
-					goto NMAPPORT;
-				}
-				else {
-					notify($ERRORS{'WARNING'}, 0, "port 22 never opened on client $computer_public_ip_address");
-					return 0;
-				}
-			} ## end else [ if (nmap_port($computer_public_ip_address, 22))
-		} ## end if (run_scp_command($clientdata, $target, ...
-		else {
-			notify($ERRORS{'WARNING'}, 0, "could not copy src=$clientdata to target= $target");
-			return 0;
-		}
-	} ## end if (open(CLIENTDATA, ">$clientdata"))
-	else {
-		notify($ERRORS{'WARNING'}, 0, "could not open /tmp/clientdata.$computer_public_ip_address $! ");
-		return 0;
+	if (!$self->_trigger_vclclient()) {
+		notify($ERRORS{'WARNING'}, 0, "failed to sanitize $computer_node_name, flag file could not be updated");
+		return;
 	}
-
-	return 1;
-} ## end sub grant_access
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 post_reserve
-
- Parameters  : 
- Returns     : 0,1
- Description : currently empty to prevent Linux.pm form trying to login 
-		different user
-
-=cut
-sub post_reserve {
+	
+	if (!$self->wait_for_port_closed(22, $computer_public_ip_address)) {
+		notify($ERRORS{'WARNING'}, 0, "failed to grant access to $user_login_id on $computer_node_name, SSH port 22 is still open");
+		return;
+	}
+	
+	notify($ERRORS{'OK'}, 0, "sanitized $computer_node_name");
 	return 1;
 }
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 sanitize
+=head2 _trigger_vclclient
 
- Parameters  :
- Returns     :
- Description :
+ Parameters  : none
+ Returns     : boolean
+ Description : Sets the contents of /home/vclstaff/flag to '1'. This triggers
+               the vclclient daemon on the computer to read the clientdata file
+               and configure the computer appropriately.
 
 =cut
 
-sub sanitize {
+sub _trigger_vclclient {
 	my $self = shift;
 	if (ref($self) !~ /unixlab/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
+		return 0;
 	}
 	
-	my $computer_node_name = $self->data->get_computer_node_name();
+	my $computer_name = $self->data->get_computer_node_name();
 	
-	# Delete all user associated with the reservation
-	if ($self->revoke_access()) {
-		notify($ERRORS{'OK'}, 0, "access has been disabled for $computer_node_name");
+	my $flag_file_path = '/home/vclstaff/flag';
+	my $flag_file_contents = '1';
+	if ($self->create_text_file($flag_file_path, $flag_file_contents)) {
+		notify($ERRORS{'OK'}, 0, "set value in $flag_file_path to $flag_file_contents on $computer_name");
+		return 1;
 	}
 	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to delete users from $computer_node_name");
-		return 0;
+		notify($ERRORS{'WARNING'}, 0, "failed to set value in $flag_file_path to $flag_file_contents on $computer_name");
+		return;
 	}
-	
-	notify($ERRORS{'OK'}, 0, "$computer_node_name has been sanitized");
-	return 1;
-} ## end sub sanitize
+}
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 get_current_image_name
+=head2 get_public_ip_address
 
- Parameters  : None
- Returns     : If successful: string
-               If failed: 0
- Description : Returns the name of the reservation image. This is used in
-               reclaim.pm to determine if a computer needs to be reloaded or
-					sanitized. Lab machines should always be sanitized.
+ Parameters  : none
+ Returns     : boolean
+ Description : Overrides the subroutine in OS.pm because that subroutine fails
+               if the lab computer only has a single network interface. This
+               returns the computer's public IP address stored in the database.
 
 =cut
 
-sub get_current_image_name {
+sub get_public_ip_address {
 	my $self = shift;
 	if (ref($self) !~ /VCL::Module/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
 		return;
 	}
-
-	my $image_name = $self->data->get_image_name();
-	if ($image_name) {
-		notify($ERRORS{'DEBUG'}, 0, "returning reservation image name: $image_name");
-		return $image_name;
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to retrieve reservation image name");
-		return 0;
-	}
+	return $self->data->get_computer_public_ip_address();
 }
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 check_connection_on_port
+=head2 get_current_imagerevision_id
+
+ Parameters  : none
+ Returns     : integer
+ Description : Returns the reservation imagerevision ID since lab computers
+               don't have a currentimage.txt file.
 
- Parameters  : $port
- Returns     : (connected|conn_wrong_ip|timeout|failed)
- Description : uses netstat to see if any thing is connected to the provided port
- 
 =cut
 
-sub check_connection_on_port {
+sub get_current_imagerevision_id {
 	my $self = shift;
 	if (ref($self) !~ /VCL::Module/i) {
 		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
 		return;
 	}
 	
-	my $management_node_keys        = $self->data->get_management_node_keys();
-	my $computer_node_name          = $self->data->get_computer_node_name();
-	my $remote_ip                   = $self->data->get_reservation_remote_ip();
-	my $computer_public_ip_address  = $self->data->get_computer_public_ip_address();
-	my $request_state_name          = $self->data->get_request_state_name();
-	
-	my $port = shift;
-	if (!$port) {
-		notify($ERRORS{'WARNING'}, 0, "port variable was not passed as an argument");
-		return "failed";
-	}
-	
-	my $ret_val = "no";
-	my $command = "netstat -an";
-	my ($status, $output) = run_ssh_command($computer_node_name, $management_node_keys, $command, 'vclstaff', 24, 1);
-	notify($ERRORS{'DEBUG'}, 0, "checking connections on node $computer_node_name on port $port");
-	foreach my $line (@{$output}) {
-		if ($line =~ /Connection refused|Permission denied/) {
-			chomp($line);
-			notify($ERRORS{'WARNING'}, 0, "$line");
-			if ($request_state_name =~ /reserved/) {
-				$ret_val = "failed";
-			}
-			else {
-				$ret_val = "timeout";
-			}
-			return $ret_val;
-		} ## end if ($line =~ /Connection refused|Permission denied/)
-		if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_public_ip_address:$port)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
-			if ($4 eq $remote_ip) {
-				$ret_val = "connected";
-				return $ret_val;
-			}
-			else {
-				#this isn't the remoteIP
-				$ret_val = "conn_wrong_ip";
-				return $ret_val;
-			}
-		}    # Linux
-		if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s::ffff:($computer_public_ip_address:$port)\s+::ffff:([.0-9]*):([0-9]*)(.*)(ESTABLISHED) /) {
-			if ($4 eq $remote_ip) {
-				$ret_val = "connected";
-				return $ret_val;
-			}
-			else {
-				#this isn't the remoteIP
-				$ret_val = "conn_wrong_ip";
-				return $ret_val;
-			}
-		} ##
-		if ($line =~ /\s*($computer_public_ip_address\.$port)\s+([.0-9]*)\.([0-9]*)(.*)(ESTABLISHED)/) {
-			if ($4 eq $remote_ip) {
-				$ret_val = "connected";
-				return $ret_val;                       
-			}
-			else {
-				#this isn't the remoteIP
-				$ret_val = "conn_wrong_ip";
-				return $ret_val;
-			}
-		} ##	
-	}
-	return $ret_val;
+	return $self->data->get_imagerevision_id();
 }
-#/////////////////////////////////////////////////////////////////////////////
 
-=head2 is_ssh_responding
+##############################################################################
 
- Parameters  : $computer_name (optional), $max_attempts (optional)
- Returns     : If computer responds to SSH: 1
-               If computer never responds to SSH: 0
-               Description : Checks if the computer is responding to SSH. Ports 22 and 24 are
-               first checked to see if either is open. If neither is open, 0 is
-               returned. If either of the ports is open a test SSH command which
-              simply echo's a string is attempted. The default is to only
-               attempt to run this command once. This can be changed by
-               supplying the $max_attempts argument. If the $max_attempts is
-               supplied but set to 0, only the port checks are done.
+=head1 BYPASSED SUBROUTINES
 
 =cut
 
-sub is_ssh_responding {
-	my $self = shift;
-	if (ref($self) !~ /VCL::Module/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
+#//////////////////////////////////////////////////////////////////////////////
 
-	my $computer_node_name;
-	my $max_attempts = 1;
-	
-	my $argument_1 = shift;
-	my $argument_2 = shift;
-	
-	if ($argument_1) {
-		# Check if the argument is an integer
-		if ($argument_1 =~ /^\d+$/) {
-			$max_attempts = $argument_1;
-		}
-		else {
-			$computer_node_name = $argument_1;
-			if ($argument_2 && $argument_2 =~ /^\d+$/) {
-				$max_attempts = $argument_2;
-			}
-		}
-	}
-
-	if (!$computer_node_name) {
-		$computer_node_name = $self->data->get_computer_node_name();
-	}
-
-	# Try nmap to see if any of the ssh ports are open before attempting to run a test command
-	my $port_22_status = nmap_port($computer_node_name, 22) ? "open" : "closed";
-	my $port_24_status = nmap_port($computer_node_name, 24) ? "open" : "closed";
-	if ($port_22_status ne 'open' && $port_24_status ne 'open') {
-		notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, ports 22 or 24 are both closed");
-		return 0;
-	}
+=head2 create_reservation_info_json_file
 
-	if ($max_attempts) {
-		my ($exit_status, $output) = run_ssh_command({
-			node => $computer_node_name,
-			command => "echo \"testing ssh on $computer_node_name\"",
-			max_attempts => $max_attempts,
-			output_level => 0,
-			timeout_seconds => 30,
-			port => 24,
-			user => "vclstaff",
-		});
-
-		# The exit status will be 0 if the command succeeded
-		if (defined($output) && grep(/testing/, @$output)) {
-			notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is responding to SSH, port 22: $port_22_status, port 24: $port_24_status");
-			return 1;
-		}
-		else {
-			notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, SSH command failed, port 22: $port_22_status, port 24: $port_24_status");
-			return 0;
-		}
-	}
-	else {
-		return 1;
-	}
-}
+=cut
 
-#/////////////////////////////////////////////////////////////////////////////
+sub create_reservation_info_json_file { return 1; }
+
+#//////////////////////////////////////////////////////////////////////////////
+
+=head2 delete_reservation_info_json_file
+
+=cut
+
+sub delete_reservation_info_json_file { return 1; }
+
+#//////////////////////////////////////////////////////////////////////////////
 
 =head2 firewall_compare_update
 
- Parameters  : $computer_name (optional), $max_attempts (optional)
- Returns     : returns true.
-               Since the vclstaff user doesn't have root on the lab machines, there is not much this routine can do.
+=cut
+
+sub firewall_compare_update {	return 1; }
 
-=cut 
+#//////////////////////////////////////////////////////////////////////////////
 
-sub firewall_compare_update {
-	return 1;
-}
+=head2 post_reserve
 
+=cut
 
-#/////////////////////////////////////////////////////////////////////////////
+sub post_reserve { return 1; }
 
-=head2 notify_user_console
+#//////////////////////////////////////////////////////////////////////////////
 
- Parameters  : message, username(optional)
- Returns     : boolean
- Description : Send a message to the user on the console
+=head2 process_connect_methods
 
 =cut
 
-sub notify_user_console {
-	my $self = shift;
-	if (ref($self) !~ /Module/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-	
-	my $message = shift;
-	if (!$message) {
-		notify($ERRORS{'WARNING'}, 0, "message argument was not supplied");
-		return;
-	}
-	
-	my $username = shift;
-	if (!$username) {
-		$username = $self->data->get_user_login_id();
-	}
-	
-	my $computer_node_name = $self->data->get_computer_node_name();
-	
-	my $cmd = "echo \"$message\" \| write $username";
-	my ($exit_status, $output) = $self->execute({
-		node => $computer_node_name,
-		command => $cmd,
-		display_output => 0,
-		timeout => 30,
-		max_attempts => 2,
-		port => 24,
-		user => "vclstaff",
-	});
-	if (!defined($output)) {
-		notify($ERRORS{'WARNING'}, 0, "failed to execute command to determine if the '$cmd' shell command exists on $computer_node_name");
-		return;
-	}
-	else {
-		notify($ERRORS{'DEBUG'}, 0, "executed command to determine if the '$cmd' shell command exists on $computer_node_name");
-		return 1;
-	}
-}
+sub process_connect_methods { return 1; }
 
-#/////////////////////////////////////////////////////////////////////////////
+#//////////////////////////////////////////////////////////////////////////////
 
-=head2 get_current_image_info
+=head2 reserve
 
- Parameters  : optional 
-					id,computer_hostname,computer_id,current_image_name,imagerevision_datecreated,imagerevision_id,prettyname,vcld_post_load 
- Returns     : If successful: 
-					if no parameter return the imagerevision_id
-					return the value of parameter input
-               If failed: false
- Description : Collects currentimage hash on a computer and returns a
-               value containing of the input paramter or the imagerevision_id if no inputs.
-					This also updates the DataStructure.pm so data matches what is currently loaded.
 =cut
 
-sub get_current_image_info {
-	my $self = shift;
-	if (ref($self) !~ /VCL::Module/i) {
-		notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
-		return;
-	}
-	
-	my $input = shift;
-	
-	if (!defined $input) {
-		$input = "imagerevision_id";
-	}
-	
-	my $computer_node_name = $self->data->get_computer_node_name();
-	my $imagerevision_id = $self->data->get_imagerevision_id();
-	
-	#The Lab machine image does have a currentimage.txt file.
-	#Predefine matching variables so it doesn't fail.
-	
-	my %current_image_txt_contents;
-	$current_image_txt_contents{"imagerevision_id"} = $imagerevision_id;
-	my $time = localtime;
-	$current_image_txt_contents{"vcld_post_load"} = "vcld_post_load=success ($time)";
-	
-	# Make sure an empty hash wasn't returned
-	if (defined $current_image_txt_contents{imagerevision_id}) {
-		notify($ERRORS{'DEBUG'}, 0, "user selected content of image currently loaded on $computer_node_name: $current_image_txt_contents{current_image_name}");
-	
-		if (my $imagerevision_info = get_imagerevision_info($current_image_txt_contents{imagerevision_id})) {
-			$self->data->set_computer_currentimage_data($imagerevision_info->{image});
-			$self->data->set_computer_currentimagerevision_data($imagerevision_info);
-		}
-		
-		if (defined($current_image_txt_contents{$input})) {
-			return $current_image_txt_contents{$input};
-		}
-		else {
-			notify($ERRORS{'WARNING'}, 0, "$input was not defined in current_image_txt");	
-			return;
-		}
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "empty hash was returned when currentimage.txt contents were retrieved from $computer_node_name");
-		return;
-	}
-}
+sub reserve { return 1; }
+
+#//////////////////////////////////////////////////////////////////////////////
+
+=head2 run_management_node_tools_scripts
+
+=cut
+
+sub run_management_node_tools_scripts { return 1; }
+
 #/////////////////////////////////////////////////////////////////////////////
 
 1;

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning.pm?rev=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning.pm Wed Oct 26 19:46:03 2016
@@ -106,7 +106,7 @@ sub node_status {
 	}
 	
 	# Check if the imagerevision ID loaded on the computer matches the reservation
-	my $current_image_revision_id = $self->os->get_current_image_info();
+	my $current_image_revision_id = $self->os->get_current_imagerevision_id();
 	if (!$current_image_revision_id) {
 		notify($ERRORS{'OK'}, 0, "unable to retrieve imagerevision ID from $computer_name, returning 'RELOAD'");
 		return 'RELOAD';

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm?rev=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm Wed Oct 26 19:46:03 2016
@@ -220,7 +220,7 @@ sub capture {
 	}
 
 	my $reservation_id = $self->data->get_reservation_id() || return;
-	my $current_imagerevision_id = $self->os->get_current_image_info();
+	my $current_imagerevision_id = $self->os->get_current_imagerevision_id();
 	my $computer_id = $self->data->get_computer_id() || return;
 	my $image_name = $self->data->get_image_name() || return;
 	my $computer_name = $self->data->get_computer_short_name() || return;
@@ -531,7 +531,7 @@ sub node_status {
 		return $status;
 	}
 
-	my $current_image_revision_id = $self->os->get_current_image_info();
+	my $current_image_revision_id = $self->os->get_current_imagerevision_id();
 	$status->{currentimagerevision_id} = $current_image_revision_id;
 
 	$status->{currentimage} = $self->data->get_computer_currentimage_name();

Modified: vcl/trunk/managementnode/lib/VCL/reclaim.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/reclaim.pm?rev=1766727&r1=1766726&r2=1766727&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/reclaim.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/reclaim.pm Wed Oct 26 19:46:03 2016
@@ -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(0);
+	my $computer_imagerevision_id           = $self->data->get_computer_imagerevision_id();
 	my $server_request_id                   = $self->data->get_server_request_id();
 	my $public_ip_configuration             = $self->data->get_management_node_public_ip_configuration() || return;
 	my @reservation_ids                     = $self->data->get_reservation_ids();
@@ -183,26 +183,26 @@ sub process {
 			$self->insert_reload_and_exit();
 		}
 		
-		# Make sure computer current image name was retrieved from the database
-		if (!$computer_currentimage_name) {
-			notify($ERRORS{'WARNING'}, 0, "failed to retrieve computer current image name from the database, computer will be reloaded");
+		# Make sure computer current imagerevision ID was retrieved from the database
+		if (!$computer_imagerevision_id) {
+			notify($ERRORS{'WARNING'}, 0, "failed to retrieve computer current imagerevision ID from the database, computer will be reloaded");
 			$self->insert_reload_and_exit();
 		}
 		
-		# Reload the computer if unable to retrieve the current image name
-		my $os_current_image_name = $self->os->get_current_image_info("current_image_name");
-		if (!$os_current_image_name) {
-			notify($ERRORS{'WARNING'}, 0, "failed to retrieve name of image currently loaded on $computer_shortname, computer will be reloaded");
+		# Reload the computer if unable to retrieve the current imagerevision ID from the OS
+		my $os_current_imagerevision_id = $self->os->get_current_imagerevision_id();
+		if (!$os_current_imagerevision_id) {
+			notify($ERRORS{'WARNING'}, 0, "failed to retrieve imagerevision ID currently loaded on $computer_shortname, computer will be reloaded");
 			$self->insert_reload_and_exit();
 		}
 		
-		# Compare the database current image value with what's on the computer
-		if ($computer_currentimage_name eq $os_current_image_name) {
-			notify($ERRORS{'DEBUG'}, 0, "computer table current image name ($computer_currentimage_name) matches image name on computer ($os_current_image_name), computer will be sanitized");
+		# Compare the database current imagerevision ID value with what's on the computer
+		if ($computer_imagerevision_id eq $os_current_imagerevision_id) {
+			notify($ERRORS{'DEBUG'}, 0, "computer table current imagerevision ID ($computer_imagerevision_id) matches imagerevision ID on computer ($os_current_imagerevision_id), computer will be sanitized");
 			$self->call_os_sanitize();
 		}
 		else {
-			notify($ERRORS{'DEBUG'}, 0, "computer table current image name ($computer_currentimage_name) does NOT match image name on computer ($os_current_image_name), computer will be reloaded");
+			notify($ERRORS{'DEBUG'}, 0, "computer table current imagerevision ID ($computer_imagerevision_id) does NOT match imagerevision ID on computer ($os_current_imagerevision_id), computer will be reloaded");
 			$self->insert_reload_and_exit();
 		}
 	}