You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by di...@apache.org on 2013/09/05 21:24:51 UTC

svn commit: r1520393 - in /vcl/trunk/managementnode/lib/VCL/Module/OS: Linux.pm Windows.pm

Author: dimach
Date: Thu Sep  5 19:24:51 2013
New Revision: 1520393

URL: http://svn.apache.org/r1520393
Log:
VCL-722: changes to Linux.pm and Windows.pm to send shutdown via ONE controller

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.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=1520393&r1=1520392&r2=1520393&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Thu Sep  5 19:24:51 2013
@@ -2245,6 +2245,20 @@ sub shutdown {
 		notify($ERRORS{'DEBUG'}, 0, "shutting down $computer_node_name and NOT waiting for power off");
 	}
 	
+	# If computer is on ONE cloud, shutdown via ONE controls:
+	
+	if ($self->provisioner->can("opennebula")) {
+		if(!$self->provisioner->power_off()) {
+			notify($ERRORS{'CRITICAL'}, 0, "Couldn't shutdown $computer_node_name with provisioner->power_off()");
+			return 0;
+		} 
+		else {
+			notify($ERRORS{'DEBUG'}, 0, "Powered off computer $computer_node_name via provisioning module");
+			return 1;
+		}
+	}
+	######################################################
+	
 	# Check if computer responds to ssh before preparing for shut down
 	if ($self->wait_for_ssh(0)) {
 		my $command = '/sbin/shutdown -h now';

Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm?rev=1520393&r1=1520392&r2=1520393&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Thu Sep  5 19:24:51 2013
@@ -3668,6 +3668,23 @@ sub shutdown {
 		notify($ERRORS{'DEBUG'}, 0, "shutting down $computer_node_name");
 	}
 	
+	# If computer is in ONE cloud, shutdown via ONE controls, else shutdown via shutdown.exe
+	
+	if($self->provisioner->can("opennebula")) {
+		if ($enable_dhcp) {
+			my ($shutdown_exit_status, $shutdown_output) = run_ssh_command($computer_node_name, $management_node_keys, $shutdown_command);
+			notify($ERRORS{'DEBUG'}, 0, "Executed pre_shutdown command on $computer_node_name, exit status: $shutdown_exit_status, output:\n@{$shutdown_output}");
+		}
+		if(!$self->provisioner->power_off()) {
+			notify($ERRORS{'CRITICAL'}, 0, "Couldn't shutdown $computer_node_name with provisioner->power_off()");
+			return 0;
+		} 
+		else {
+			notify($ERRORS{'DEBUG'}, 0, "Powered off computer $computer_node_name via provisioning module");
+			return 1;
+		}
+	}
+	
 	# Check if tsshutdn.exe exists on the computer
 	# tsshutdn.exe is the preferred utility for Windows 2003, shutdown.exe often fails
 	my $windows_product_name = $self->get_product_name() || '';