You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2014/12/11 18:15:35 UTC

svn commit: r1644705 - in /vcl/trunk/managementnode/lib/VCL: ./ Module/OS/ Module/OS/Linux/ Module/Provisioning/

Author: fapeeler
Date: Thu Dec 11 17:15:34 2014
New Revision: 1644705

URL: http://svn.apache.org/r1644705
Log:
VCL-678

removed old routine write_currentimage_txt
pre-capture is using new routine create_currentimage_txt in OS.pm

removed debug statement from get_variable to cut down on log output


Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
    vcl/trunk/managementnode/lib/VCL/utils.pm

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=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Thu Dec 11 17:15:34 2014
@@ -435,8 +435,8 @@ sub post_load {
 	# Kickstart installations likely won't have currentimage.txt, generate it
 	if ($image_os_install_type eq "kickstart") {
 		notify($ERRORS{'OK'}, 0, "detected kickstart install on $computer_node_name, writing current_image.txt");
-		if (!write_currentimage_txt($self->data)) {
-			notify($ERRORS{'WARNING'}, 0, "failed to write current_image.txt on $computer_node_name");
+		if (!$self->create_currentimage_txt()) {
+			notify($ERRORS{'WARNING'}, 0, "failed to create currentimage.txt on $computer_node_name");
 		}
 	}
 	

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm?rev=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm Thu Dec 11 17:15:34 2014
@@ -86,11 +86,10 @@ sub post_load {
 		return 0;
 	}
 	
-	if (write_currentimage_txt($self->data)) {
-		notify($ERRORS{'OK'}, 0, "wrote current_image.txt on $computer_short_name");
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to write current_image.txt on $computer_short_name");
+	# Create the currentimage.txt file
+	if (!$self->OS->create_currentimage_txt()) {
+		notify($ERRORS{'WARNING'}, 0, "failed to create currentimage.txt on $computer_short_name");
+		return 0;
 	}
 	
 	$self->set_vcld_post_load_status();

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm?rev=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm Thu Dec 11 17:15:34 2014
@@ -571,10 +571,6 @@ sub capture {
 	}
 	notify($ERRORS{'DEBUG'}, 0, "found previous name= $old_imagename");
 
-	notify($ERRORS{'OK'}, 0, "SSHing to node to configure currentimage.txt");
-	# XXX SHOULD INSTEAD USE write_currentimage_txt IN utils.pm
-	my @sshcmd = run_ssh_command($computer_shortname, $image_identity, "echo $new_imagename > /root/currentimage.txt");
-
 	my $poweroff_command = "$VMTOOL_ROOT/vm/vmcontrol.pl";
 	$poweroff_command .= " --server '$vmhost_shortname'";
 	$poweroff_command .= " --vmname $computer_shortname";

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm?rev=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm Thu Dec 11 17:15:34 2014
@@ -1220,10 +1220,6 @@ sub capture {
 	# These three vars are useful:
 	# $old_vmpath, $new_vmpath, $new_imagename
 
-	notify($ERRORS{'OK'}, 0, "SSHing to node to configure currentimage.txt");
-	# XXX SHOULD INSTEAD USE write_currentimage_txt IN utils.pm
-	my @sshcmd = run_ssh_command($computer_shortname, $image_identity, "echo $new_imagename > /root/currentimage.txt");
-
 	my $poweroff_command = "$VMTOOL_ROOT/vm/vmcontrol.pl";
 	$poweroff_command .= " --server '$vmhost_shortname'";
 	$poweroff_command .= " --vmname $computer_shortname";

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=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/openstack.pm Thu Dec 11 17:15:34 2014
@@ -981,14 +981,6 @@ sub _prepare_capture {
 		return 0;
 	}
 
-	if (write_currentimage_txt($self->data)) {
-		notify($ERRORS{'DEBUG'}, 0, "currentimage.txt updated on $computer_name");
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "unable to update currentimage.txt on $computer_name");
-		return 0;
-	}
-
 	if (!$self->data->set_imagemeta_sysprep(0)) {
 		notify($ERRORS{'WARNING'}, 0, "failed to set the imagemeta Sysprep value to 0");
 		return 0;

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm?rev=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm Thu Dec 11 17:15:34 2014
@@ -500,14 +500,6 @@ sub capture { ## This is going to need t
 	notify($ERRORS{'OK'}, 0, "$notify_prefix vmhost_hostname: $vmhost_hostname");
 	notify($ERRORS{'OK'}, 0, "$notify_prefix vmtype_name: $vmtype_name");
 
-	# Modify currentimage.txt
-	if (write_currentimage_txt($self->data)) {
-		notify($ERRORS{'OK'}, 0, "$notify_prefix currentimage.txt updated on $computer_shortname");
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "$notify_prefix unable to update currentimage.txt on $computer_shortname");
-		return 0;
-	}
 	my @sshcmd;
 
 	# Check if pre_capture() subroutine has been implemented by the OS module

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm?rev=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Thu Dec 11 17:15:34 2014
@@ -473,21 +473,6 @@ sub capture {
 	# Print some preliminary information
 	notify($ERRORS{'OK'}, 0, "attempting to capture image '$image_name' on $computer_node_name");
 	
-	# Make sure the computer is powered on
-	my $power_status = $self->power_status();
-	if (!$power_status || $power_status !~ /on/i) {
-		if (!$self->power_on()) {
-			notify($ERRORS{'WARNING'}, 0, "failed to power on computer before monitoring image capture");
-			return;
-		}
-	}
-	
-	# Modify currentimage.txt
-	if (!write_currentimage_txt($self->data)) {
-		notify($ERRORS{'WARNING'}, 0, "unable to update currentimage.txt on $computer_node_name");
-		return;
-	}
-	
 	# Check if pre_capture() subroutine has been implemented by the OS module
 	if ($self->os->can("pre_capture")) {
 		# Call OS pre_capture() - it should perform all OS steps necessary to capture an image

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1644705&r1=1644704&r2=1644705&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Thu Dec 11 17:15:34 2014
@@ -264,7 +264,6 @@ our @EXPORT = qw(
 	update_reservation_lastcheck
 	update_reservation_password
 	update_sublog_ipaddress
-	write_currentimage_txt
 	xml_string_to_hash
 	xmlrpc_call
 	yaml_deserialize
@@ -4386,79 +4385,6 @@ sub run_scp_command {
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2  write_currentimage_txt
-
- Parameters  : hash of hashes hash{image} contains image info
- Returns     : 0 failed or 1 successful
- Description : runs an ssh command on the specified node and returns the output
-
-=cut
-
-sub write_currentimage_txt {
-	my ($data) = @_;
-
-	# Store some hash variables into local variables
-	my $computer_node_name         = $data->get_computer_node_name();
-	my $computer_host_name         = $data->get_computer_host_name();
-	my $computer_id                = $data->get_computer_id();
-	my $image_identity             = $data->get_image_identity();
-	my $image_id                   = $data->get_image_id();
-	my $image_name                 = $data->get_image_name();
-	my $image_prettyname           = $data->get_image_prettyname();
-	my $imagerevision_id           = $data->get_imagerevision_id();
-	my $imagerevision_date_created = $data->get_imagerevision_date_created();
-	my $image_os_type              = $data->get_image_os_type();
-
-	my @current_image_lines;
-	push @current_image_lines, "$image_name";
-	push @current_image_lines, "id=$image_id";
-	push @current_image_lines, "prettyname=$image_prettyname";
-	push @current_image_lines, "imagerevision_id=$imagerevision_id";
-	push @current_image_lines, "imagerevision_datecreated=$imagerevision_date_created";
-	push @current_image_lines, "computer_id=$computer_id";
-	push @current_image_lines, "computer_hostname=$computer_host_name";
-
-	my $current_image_contents = join('\\r\\n', @current_image_lines);
-	
-	# Remove single quotes - they cause echo command to break
-	$current_image_contents =~ s/'//g;
-
-	#Make sure currentimage.txt writable
-	my $chown_command = "chown root currentimage.txt; chmod 777 currentimage.txt";
-	if (run_ssh_command($computer_node_name, $image_identity, $chown_command)) {
-		notify($ERRORS{'OK'}, 0, "updated ownership and permissions  on currentimage.txt");
-	}
-
-	my $command;
-	if ($image_os_type =~ /osx/i) {
-		$command = 'echo "';
-	}
-	else {
-		$command = 'echo -e "';		
-	}
-
-	$command .= $current_image_contents . '" > currentimage.txt && cat currentimage.txt';
-
-	# Copy the temp file to the node as currentimage.txt
-	my ($ssh_exit_status, $ssh_output) = run_ssh_command($computer_node_name, $image_identity, $command);
-
-	if (defined($ssh_exit_status) && $ssh_exit_status == 0) {
-		notify($ERRORS{'OK'}, 0, "created currentimage.txt file on $computer_node_name:\n" . join "\n", @{$ssh_output});
-		return 1;
-	}
-	elsif (defined($ssh_output)) {
-		notify($ERRORS{'WARNING'}, 0, "failed to create currentimage.txt file on $computer_node_name:\n" . join "\n", @{$ssh_output});
-		return;
-	}
-	else {
-		notify($ERRORS{'WARNING'}, 0, "failed to run ssh command to create currentimage.txt file on $computer_node_name");
-		return;
-	}
-
-} ## end sub write_currentimage_txt
-
-#/////////////////////////////////////////////////////////////////////////////
-
 =head2 get_management_node_info
 
  Parameters  : Either a management node hostname or database ID
@@ -11463,7 +11389,6 @@ EOF
 		return;
 	}
 	
-	notify($ERRORS{'DEBUG'}, 0, "retrieved variable '$variable_name', serialization: $serialization_type");
 	return $deserialized_value;
 }