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 2008/12/30 20:26:51 UTC

svn commit: r730217 [1/3] - in /incubator/vcl/trunk/managementnode/lib/VCL: DataStructure.pm Module/OS/Windows/Desktop/Vista.pm Module/Provisioning/xCAT.pm new.pm reclaim.pm reserved.pm utils.pm

Author: arkurth
Date: Tue Dec 30 11:26:51 2008
New Revision: 730217

URL: http://svn.apache.org/viewvc?rev=730217&view=rev
Log:
Updated several modules to support Windows Vista. Vista.pm has been written as a modularized OS. The other state modules have been modified to call the generic OS subroutines if they have been implemented instead of checking for OS type and then proceeding. Existing OS's should not have been affected.

DataStructure.pm: Added get_reservation_remote_ip subroutine.  This queries the database whenever called so the data is current.

Vista.pm: Added and updated many subroutines.

xCAT.pm: Added check for Vista. xCAT skips the post-load tasks if the OS is Vista. These tasks are now handled by Vista.pm's post_load subroutine, which is called by new.pm. Modified reload checking loop to always attempt to connect via ssh while waiting for the READY flag. The if statement was commented out. It had only been checking after the 2nd attempt. This was causing Vista's reload to take longer because ssh was up but the loop wasn't catching the READY flag.

new.pm: Added check to see if OS module implements a post_load subroutine and calls it. Code was added to the reserve_computer subroutine to call Vista's set_password or add_users subroutines depending on whether or not it's an imaging request.

reclaim.pm: Added check to see if OS module implements get_current_image_name and sanitize subroutines. It calls these if they're implemented instead of calling the old subroutines to delete users and close RDP. A check was added to make sure the image loaded on a node matches what's set in the computer table for the computer's current image. If they differ, a reload is performed. This currently only applies to Vista. Added insert_reload_and_exit subroutine. There is some duplicated code in process. This subroutine will eventually replace the duplicated code.

reserved.pm: Added check to see if OS module implements a grant_access subroutine. It calls this instead of calling the old subroutine to open RDP.

utils.pm: Added check for image name = vista in get_request_info so it wouldn't complain about an unsupported OS.

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows/Desktop/Vista.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.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
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=730217&r1=730216&r2=730217&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Tue Dec 30 11:26:51 2008
@@ -871,6 +871,62 @@
 
 #/////////////////////////////////////////////////////////////////////////////
 
+=head2 get_reservation_remote_ip
+
+ Parameters  : None
+ Returns     : string
+ Description : 
+
+=cut
+
+sub get_reservation_remote_ip {
+	my $self = shift;
+	my $reservation_id  = $self->get_reservation_id();
+
+	# Create the select statement
+	my $select_statement = "
+	SELECT
+	remoteIP
+	FROM
+	reservation
+	WHERE
+	id = $reservation_id
+	";
+
+	# Call the database select subroutine
+	my @selected_rows = database_select($select_statement);
+
+	# Check to make sure 1 row was returned
+	if (scalar @selected_rows == 0) {
+		notify($ERRORS{'WARNING'}, 0, "failed to get reservation remote IP for reservation $reservation_id, zero rows were returned from database select");
+		return 0;
+	}
+	elsif (scalar @selected_rows > 1) {
+		notify($ERRORS{'WARNING'}, 0, "failed to get reservation remote IP for reservation $reservation_id, " . scalar @selected_rows . " rows were returned from database select");
+		return 0;
+	}
+
+	# Get the single returned row
+	# It contains a hash
+	my $remote_ip;
+
+	# Make sure we return undef if the column wasn't found
+	if (!defined $selected_rows[0]{remoteIP}) {
+		notify($ERRORS{'WARNING'}, 0, "failed to get reservation remote IP for reservation $reservation_id, remoteIP value is undefined");
+		return;
+	}
+	# Make sure we return undef if remote IP is blank
+	elsif ($selected_rows[0]{remoteIP} eq '') {
+		notify($ERRORS{'WARNING'}, 0, "failed to get reservation remote IP for reservation $reservation_id, remoteIP value is blank");
+		return;
+	}
+
+	notify($ERRORS{'DEBUG'}, 0, "retrieved remote IP for reservation $reservation_id: $selected_rows[0]{remoteIP}");
+	return $selected_rows[0]{remoteIP};
+} ## end sub get_reservation_remote_ip
+
+#/////////////////////////////////////////////////////////////////////////////
+
 =head2 get_state_name
 
  Parameters  : None