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 2013/11/07 20:24:49 UTC

svn commit: r1539772 - in /vcl/trunk/managementnode/lib/VCL: Module/Provisioning/vbox.pm utils.pm

Author: fapeeler
Date: Thu Nov  7 19:24:49 2013
New Revision: 1539772

URL: http://svn.apache.org/r1539772
Log:
VCL-683

retired _sshd_status


Modified:
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
    vcl/trunk/managementnode/lib/VCL/utils.pm

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=1539772&r1=1539771&r2=1539772&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm Thu Nov  7 19:24:49 2013
@@ -964,11 +964,29 @@ sub node_status {
         } ## end foreach my $l (@{$sshcmd[1]})
         notify($ERRORS{'OK'}, $log, "$vmclient_shortname vmstate reports $status{vmstate}");
 
-        #can I ssh into it
-        my $sshd = _sshd_status($vmclient_shortname, $requestedimagename, $image_os_type);
-
-        #is it running the requested image
-        if ($sshd eq "on") {
+			# Check if $self->os is defined, it may not be if xCAT.pm object is created from a monitoring script
+			my $os = $self->os(0);
+			if (!$os) {
+				my $data = $self->create_datastructure_object({computer_identifier => $computer_node_name, image_identifier => $requestedimagename});
+				if (!$data) {
+					notify($ERRORS{'WARNING'}, 0, "unable to determine status of $computer_node_name, \$self->os is not defined, failed to create DataStructure object for image set as image: '$requestedimagename'");
+					return;
+			   }
+			 
+		   	# Set the data, create_os_object copies the data from the calling object to the new OS object
+		   	$self->set_data($data);
+	
+       		my $image_os_module_perl_package = $data->get_image_os_module_perl_package();
+		 		$os = $self->create_os_object($image_os_module_perl_package);
+		 		if (!$os) {
+		    		notify($ERRORS{'WARNING'}, 0, "unable to determine status of $computer_node_name, failed to create OS object for image set as imagename: 'requestedimagename'");
+		    		return;
+		 		}
+		 	}
+
+			# Check if the node is responding to SSH
+			my $ssh_responding = $os->is_ssh_responding();
+		   if ($ssh_responding) {
 
                 $status{ssh} = 1;
 

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1539772&r1=1539771&r2=1539772&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Thu Nov  7 19:24:49 2013
@@ -82,7 +82,6 @@ our @ISA = qw(Exporter);
 
 our @EXPORT = qw(
   _pingnode
-  _sshd_status
   check_blockrequest_time
   check_endtimenotice_interval
   check_ssh
@@ -2054,43 +2053,6 @@ sub check_ssh {
 
 #/////////////////////////////////////////////////////////////////////////////
 
-=head2 _sshd_status
-
- Parameters  : $node, $imagename, $log
- Returns     : on or off
- Description : actually logs into remote node
-=cut
-
-sub _sshd_status {
-	my ($node, $imagename,$image_os_type, $log) = @_;
-	my ($package, $filename, $line, $sub) = caller(0);
-	$log = 0 if (!defined($log));
-	notify($ERRORS{'WARNING'}, $log, "node is not defined") if (!(defined($node)));
-
-	if (!nmap_port($node, 22)) {
-		return "off";
-	}
-
-	my $identity_keys = get_management_node_info()->{keys};
-
-	my @sshcmd = run_ssh_command($node, $identity_keys, "uname -s", "root");
-	
-	return "off" if (!defined($sshcmd[0]) || !defined($sshcmd[1]) || $sshcmd[0] == 1);
-	foreach my $l (@{$sshcmd[1]}) {
-		if ($l =~ /^Warning:/) {
-			#if (VCL::Module::Provisioning::xCAT::makesshgkh($node)) {
-			#}
-		}
-		return "off" if ($l =~ /noping/);
-		return "off" if ($l =~ /No route to host/);
-		return "off" if ($l =~ /Connection refused/);
-		return "off" if ($l =~ /Permission denied/);
-	} ## end foreach my $l (@{$sshcmd[1]})
-	return "on";
-} ## end sub _sshd_status
-
-#/////////////////////////////////////////////////////////////////////////////
-
 =head2 nmap_port
 
  Parameters  : $hostname,n $port