vcl-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fapee...@apache.org
Subject svn commit: r1208737 - in /incubator/vcl/trunk/managementnode: bin/ etc/vcl/ lib/VCL/ lib/VCL/Module/Provisioning/ lib/VCL/Module/Provisioning/VMware/
Date Wed, 30 Nov 2011 19:53:49 GMT
Author: fapeeler
Date: Wed Nov 30 19:53:47 2011
New Revision: 1208737

URL: http://svn.apache.org/viewvc?rev=1208737&view=rev
Log:
VCL-468

Modified healthcheck to make use of datastructure.
Minor updates to provisionin modules


Modified:
    incubator/vcl/trunk/managementnode/bin/S99vcld.linux
    incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf
    incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm
    incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: incubator/vcl/trunk/managementnode/bin/S99vcld.linux
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/bin/S99vcld.linux?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/bin/S99vcld.linux (original)
+++ incubator/vcl/trunk/managementnode/bin/S99vcld.linux Wed Nov 30 19:53:47 2011
@@ -22,15 +22,16 @@
 # description: VCL management node daemon
 
 # DAEMON: Name of the daemon executable
-DAEMON=vcld
+DAEMON=vcldfap
 
 # DAEMON_PATH: Path to the daemon, no trailing '/'
-DAEMON_PATH=/usr/local/vcl/bin
+DAEMON_PATH=/usr/local/vcldev/fap/managementnode/bin
 
 # DAEMON_OPTIONS: options for the daemon, these can be overridden by
 # setting DAEMON_OPTIONS in /etc/sysconfig/$DAEMON
-DAEMON_OPTIONS='-v -conf=/etc/vcl/vcld.conf'
+DAEMON_OPTIONS='-v -conf=/usr/local/vcldev/fap/managementnode/etc/vcl/vcld.conf'
 
+cp /dev/null /usr/local/vcldev/fap/managementnode/vcldfap.log
 
 # You shouldn't need to edit anything below here
 # --------------------------------------------------------------------

Modified: incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf (original)
+++ incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf Wed Nov 30 19:53:47 2011
@@ -34,31 +34,31 @@
 
 # FQDN: DNS name of the management node
 # Example: mgtnode1.hpc.someschool.edu
-FQDN=
+FQDN=vcl00mn.hpc.ncsu.edu
 
 # processname: name to call VCL daemon process
 # Default: vcld
-processname=vcld
+processname=vcldfap
 
 # log: log file location
 # Default: /var/log/vcld.log
 # If left undefined it will be named according to the above processname
 # i.e. /var/log/$PROCESSNAME.log
-log=/var/log/vcld.log
+log=/usr/local/vcldev/fap/managementnode/vcldfap.log
 
 # pidfile: process id file location 
-# Default: /var/run/vcld.pid
+# Default: /var/run/vcldfap.pid
 # If left undefined it will be named according to the above processname
 # i.e. /var/run/$PROCESSNAME.pid
-pidfile=/var/run/vcld.pid
+pidfile=/var/run/vcldfap.pid
 
 # Database connection information
 
 # database: name of MySQL database (required)
-database=vcl
+database=vcldev
 
 # server: IP address or FQDN of the database server (required)
-server=
+server=152.7.98.108
 
 # LockerWrtUser: MySQL user account name with write privileges (required)
 LockerWrtUser=vcl-wrt
@@ -66,7 +66,7 @@ LockerWrtUser=vcl-wrt
 # wrtPass: MySQL password of the above LockerWrtUser (required)
 # Any length is supported by MySQL
 # Must be a string of characters: A-Z a-z 0-9
-wrtPass=
+wrtPass=iM5jNOPWyStu6
 
 # xml-rpc username password and url information
 # Required for block reservation processing
@@ -76,9 +76,9 @@ wrtPass=
 #   for example, if you install the VCL web code at https://vcl.example.org/vcl/
 #   set xmlrpc_url to https://vcl.example.org/vcl/index.php?mode=xmlrpccall
 
-xmlrpc_username=vclsystem
-xmlrpc_pass=insecureDefault
-xmlrpc_url=
+xmlrpc_username=admin@local
+xmlrpc_pass=vclc1-5devserver
+xmlrpc_url=https://vcldev.csc.ncsu.edu/vcl/index.php?mode=xmlrpccall
 
 ######### END REQUIRED Configuration settings ##############
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/DataStructure.pm Wed Nov 30 19:53:47 2011
@@ -618,7 +618,13 @@ sub _initialize : Init {
 	# Set the request and reservation IDs in the request data hash if they are undefined
 	$self->request_data->{id} = ($self->request_id || 0) if (!defined($self->request_data->{id}));
 	$self->request_data->{RESERVATIONID} = ($self->reservation_id || 0) if (!defined($self->request_data->{RESERVATIONID}));
-	
+	if ($self->request_data->{RESERVATIONID} == 0) {
+		$self->request_data->{reservation}{0}{serverrequest}{id} = 0;
+		$self->request_data->{forimaging} = 0;
+		$self->request_data->{state}{name} = "available";
+		
+	}
+
 	my $computer_id = $self->computer_id;
 	my $image_id = $self->image_id;
 	my $imagerevision_id = $self->imagerevision_id;
@@ -656,13 +662,26 @@ sub _initialize : Init {
 		elsif ($computer_id) {
 			$imagerevision_id = $self->get_computer_imagerevision_id();
 			if (defined($imagerevision_id)) {
-				notify($ERRORS{'DEBUG'}, 0, "computer ID argument was specified ($computer_id) but image and imagerevision ID arguments were not, DataStructure object will contain image information for the computer's current imagerevision ID: $imagerevision_id");
+				notify($ERRORS{'OK'}, 0, "computer ID argument was specified ($computer_id) but image and imagerevision ID arguments were not, DataStructure object will contain image information for the computer's current imagerevision ID: $imagerevision_id");
+					  if(!$imagerevision_id) {
+						  notify($ERRORS{'OK'}, 0, "computer ID argument was specified ($computer_id) imagerevision_id is set to $imagerevision_id");
+						  $image_id = $self->get_computer_currentimage_id();
+						  if(defined($image_id)) {
+							  $imagerevision_info = get_production_imagerevision_info($image_id);
+						  }
+						  else {
+							  Exception::Class::Base->throw( error => "DataStructure object could not be initialized, computer's current imagerevision ID could not be retrieved from the current DataStructure data:\n" . format_data($self->get_request_data));
+								return;
+						  }
+					  }
+					  else {
+						  $imagerevision_info = get_imagerevision_info($imagerevision_id);
+					  }
 			}
 			else {
 				Exception::Class::Base->throw( error => "DataStructure object could not be initialized, computer's current imagerevision ID could not be retrieved from the current DataStructure data:\n" . format_data($self->get_request_data));
-				return;
+                        return;
 			}
-			$imagerevision_info = get_imagerevision_info($imagerevision_id);
 		}
 		
 		if ($imagerevision_info) {

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm Wed Nov 30 19:53:47 2011
@@ -154,12 +154,12 @@ sub node_status {
 			notify($ERRORS{'DEBUG'}, 0, "self is a array reference");
 		}
 
-		$computer_node_name      = $self->{computer}->{hostname};
+		$computer_node_name      = $self->{hostname};
 		$management_node_os_name = $self->{managementnode}->{OSNAME};
 		$management_node_keys    = $self->{managementnode}->{keys};
-		$computer_host_name      = $self->{computer}->{hostname};
-		$computer_ip_address     = $self->{computer}->{IPaddress};
-		$image_os_name           = $self->{image}->{OS}->{name};
+		$computer_host_name      = $self->{hostname};
+		$computer_ip_address     = $self->{IPaddress};
+		$image_os_name           = $self->{currentimage}->{OS}->{name};
 
 		$log = 0 if !$log;
 		$computer_short_name = $1 if ($computer_node_name =~ /([-_a-zA-Z0-9]*)(\.?)/);

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Wed Nov 30 19:53:47 2011
@@ -1036,7 +1036,7 @@ sub node_status {
 		my $computer_id;
 		if (ref($argument)) {
 			# Hash reference was passed
-			$computer_id = $argument->{computer}{id};
+			$computer_id = $argument->{id};
 		}
 		elsif ($argument =~ /^\d+$/) {
 			# Computer ID was passed
@@ -1048,10 +1048,10 @@ sub node_status {
 		}
 		
 		if ($computer_id) {
-			notify($ERRORS{'DEBUG'}, 0, "computer ID: $computer_id");
+			notify($ERRORS{'OK'}, 0, "computer ID: $computer_id");
 		}
 		else {
-			notify($ERRORS{'DEBUG'}, 0, "unable to determine computer ID from argument:\n" . format_data($argument));
+			notify($ERRORS{'OK'}, 0, "unable to determine computer ID from argument:\n" . format_data($argument));
 			return;
 		}
 		
@@ -1094,7 +1094,7 @@ sub node_status {
 	my $image_name = $self->data->get_image_name();
 	my $request_forimaging = $self->data->get_request_forimaging();
 	
-	notify($ERRORS{'DEBUG'}, 0, "attempting to check the status of computer $computer_name, image: $image_name");
+	notify($ERRORS{'OK'}, 0, "attempting to check the status of computer $computer_name, image: $image_name");
 	
 	# Create a hash reference and populate it with the default values
 	my $status;
@@ -1110,24 +1110,27 @@ sub node_status {
 	# Skip the ping and power status checks for a normal reservation to speed things up
 	if (!$reservation_id) {
 		if (_pingnode($computer_name)) {
-			notify($ERRORS{'DEBUG'}, 0, "VM $computer_name is pingable");
+			notify($ERRORS{'OK'}, 0, "VM $computer_name is pingable");
 			$status->{ping} = 1;
 		}
 		else {
-			notify($ERRORS{'DEBUG'}, 0, "VM $computer_name is not pingable");
+			notify($ERRORS{'OK'}, 0, "VM $computer_name is not pingable");
 			$status->{ping} = 0;
 		}
 		
 		$status->{vmstate} = $self->power_status();
+		if (!defined($status->{vmstate})) {
+			$status->{vmstate} = "off";
+		}
 	}
 	
 	# Check if SSH is available
 	if ($self->os->is_ssh_responding()) {
-		notify($ERRORS{'DEBUG'}, 0, "VM $computer_name is responding to SSH");
+		notify($ERRORS{'OK'}, 0, "VM $computer_name is responding to SSH");
 		$status->{ssh} = 1;
 	}
 	else {
-		notify($ERRORS{'DEBUG'}, 0, "VM $computer_name is not responding to SSH, returning 'RELOAD'");
+		notify($ERRORS{'OK'}, 0, "VM $computer_name is not responding to SSH, returning 'RELOAD'");
 		$status->{status} = 'RELOAD';
 		$status->{ssh} = 0;
 		
@@ -1140,15 +1143,15 @@ sub node_status {
 	$status->{currentimage} = $current_image_name;
 	
 	if (!$current_image_name) {
-		notify($ERRORS{'DEBUG'}, 0, "unable to retrieve image name from currentimage.txt on VM $computer_name, returning 'RELOAD'");
+		notify($ERRORS{'OK'}, 0, "unable to retrieve image name from currentimage.txt on VM $computer_name, returning 'RELOAD'");
 		return $status;
 	}
 	elsif ($current_image_name eq $image_name) {
-		notify($ERRORS{'DEBUG'}, 0, "currentimage.txt image ($current_image_name) matches requested image name ($image_name) on VM $computer_name");
+		notify($ERRORS{'OK'}, 0, "currentimage.txt image ($current_image_name) matches requested image name ($image_name) on VM $computer_name");
 		$status->{image_match} = 1;
 	}
 	else {
-		notify($ERRORS{'DEBUG'}, 0, "currentimage.txt image ($current_image_name) does not match requested image name ($image_name) on VM $computer_name, returning 'RELOAD'");
+		notify($ERRORS{'OK'}, 0, "currentimage.txt image ($current_image_name) does not match requested image name ($image_name) on VM $computer_name, returning 'RELOAD'");
 		return $status;
 	}
 	
@@ -1196,7 +1199,7 @@ sub node_status {
 			return $status;
 		}
 		
-		notify($ERRORS{'DEBUG'}, 0, "vmdk file path used by the VM already loaded: $vmdk_file_path, mode: $vmdk_mode");
+		notify($ERRORS{'OK'}, 0, "vmdk file path used by the VM already loaded: $vmdk_file_path, mode: $vmdk_mode");
 		
 		# Can't use if nonpersistent
 		if ($vmdk_mode =~ /nonpersistent/i) {
@@ -1210,18 +1213,18 @@ sub node_status {
 				return $status;
 			}
 			else {
-				notify($ERRORS{'DEBUG'}, 0, "VM already loaded may be used, the vmdk does NOT appear to be shared");
+				notify($ERRORS{'OK'}, 0, "VM already loaded may be used, the vmdk does NOT appear to be shared");
 			}
 		}
 	}
 	
 	# Check if the OS post_load tasks have run
 	if ($self->os->get_vcld_post_load_status()) {
-		notify($ERRORS{'DEBUG'}, 0, "OS module post_load tasks have been completed on VM $computer_name");
+		notify($ERRORS{'OK'}, 0, "OS module post_load tasks have been completed on VM $computer_name");
 		$status->{status} = 'READY';
 	}
 	else {
-		notify($ERRORS{'DEBUG'}, 0, "OS module post_load tasks have not been completed on VM $computer_name, returning 'POST_LOAD'");
+		notify($ERRORS{'OK'}, 0, "OS module post_load tasks have not been completed on VM $computer_name, returning 'POST_LOAD'");
 		$status->{status} = 'POST_LOAD';
 	}
 	

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Wed Nov 30 19:53:47 2011
@@ -2052,32 +2052,34 @@ sub _fix_rpower {
 
 sub node_status {
 	my $self = shift;
-	my ($computer_node_name, $log);
+	my ($log);
 
 	my $management_node_os_name = 0;
 	my $management_node_keys    = 0;
 	my $computer_host_name      = 0;
 	my $computer_short_name     = 0;
+	my $computer_node_name      = 0;
 	my $computer_ip_address     = 0;
 	my $image_os_name           = 0;
 	my $image_name              = 0;
 	my $image_os_type           = 0;
 
+
 	# Check if subroutine was called as a class method
 	if (ref($self) !~ /xcat/i) {
 
 		if (ref($self) eq 'HASH') {
 			$log = $self->{logfile};
-			notify($ERRORS{'DEBUG'}, $log, "self is a hash reference");
+			notify($ERRORS{'OK'}, $log, "self is a hash reference");
 
-			$computer_node_name      = $self->{computer}->{hostname};
+			$computer_node_name      = $self->{hostname};
 			$management_node_os_name = $self->{managementnode}->{OSNAME};
 			$management_node_keys    = $self->{managementnode}->{keys};
-			$computer_host_name      = $self->{computer}->{hostname};
-			$computer_ip_address     = $self->{computer}->{IPaddress};
-			$image_os_name           = $self->{image}->{OS}->{name};
-			$image_name              = $self->{imagerevision}->{imagename};
-			$image_os_type           = $self->{image}->{OS}->{type};
+			$computer_host_name      = $self->{hostname};
+			$computer_ip_address     = $self->{IPaddress};
+			$image_os_name           = $self->{currentimage}->{OS}->{name};
+			$image_name              = $self->{currentimagerevision}->{name};
+			$image_os_type           = $self->{currentimage}->{OS}->{type};
 
 		} ## end if (ref($self) eq 'HASH')
 		# Check if node_status returned an array ref
@@ -2109,15 +2111,15 @@ sub node_status {
 		notify($ERRORS{'WARNING'}, 0, "node name could not be determined");
 		return;
 	}
-	notify($ERRORS{'DEBUG'}, $log, "checking status of node: $computer_node_name");
-	notify($ERRORS{'DEBUG'}, $log, "computer_short_name= $computer_short_name ");
-	notify($ERRORS{'DEBUG'}, $log, "computer_node_name= $computer_node_name ");
-	notify($ERRORS{'DEBUG'}, $log, "image_os_name= $image_os_name");
-	notify($ERRORS{'DEBUG'}, $log, "management_node_os_name= $management_node_os_name");
-	notify($ERRORS{'DEBUG'}, $log, "computer_ip_address= $computer_ip_address");
-	notify($ERRORS{'DEBUG'}, $log, "management_node_keys= $management_node_keys");
-	notify($ERRORS{'DEBUG'}, $log, "image_name=  $image_name");
-	notify($ERRORS{'DEBUG'}, $log, "image_os_type=  $image_os_type");
+	notify($ERRORS{'OK'}, $log, "checking status of node: $computer_node_name");
+	notify($ERRORS{'OK'}, $log, "computer_short_name= $computer_short_name ");
+	notify($ERRORS{'OK'}, $log, "computer_node_name= $computer_node_name ");
+	notify($ERRORS{'OK'}, $log, "image_os_name= $image_os_name");
+	notify($ERRORS{'OK'}, $log, "management_node_os_name= $management_node_os_name");
+	notify($ERRORS{'OK'}, $log, "computer_ip_address= $computer_ip_address");
+	notify($ERRORS{'OK'}, $log, "management_node_keys= $management_node_keys");
+	notify($ERRORS{'OK'}, $log, "image_name=  $image_name");
+	notify($ERRORS{'OK'}, $log, "image_os_type=  $image_os_type");
 
 
 	# Create a hash to store status components

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm Wed Nov 30 19:53:47 2011
@@ -1710,21 +1710,21 @@ sub node_status {
 	if (ref($self) !~ /xcat/i) {
 		if (ref($self) eq 'HASH') {
 			$log = $self->{logfile};
-			notify($ERRORS{'DEBUG'}, $log, "self is a hash reference");
+			notify($ERRORS{'OK'}, $log, "self is a hash reference");
 
-			$computer_node_name      = $self->{computer}->{hostname};
+			$computer_node_name      = $self->{hostname};
 			$management_node_os_name = $self->{managementnode}->{OSNAME};
 			$management_node_keys    = $self->{managementnode}->{keys};
-			$computer_host_name      = $self->{computer}->{hostname};
-			$computer_ip_address     = $self->{computer}->{IPaddress};
-			$image_os_name           = $self->{image}->{OS}->{name};
-			$image_name              = $self->{imagerevision}->{imagename};
-			$image_os_type           = $self->{image}->{OS}->{type};
+			$computer_host_name      = $self->{hostname};
+			$computer_ip_address     = $self->{IPaddress};
+			$image_os_name           = $self->{currentimage}->{OS}->{name};
+			$image_name              = $self->{currentimagerevision}->{imagename};
+			$image_os_type           = $self->{currentimage}->{OS}->{type};
 
 		} ## end if (ref($self) eq 'HASH')
 		    # Check if node_status returned an array ref
 		elsif (ref($self) eq 'ARRAY') {
-			notify($ERRORS{'DEBUG'}, 0, "self is a array reference");
+			notify($ERRORS{'OK'}, 0, "self is a array reference");
 		}
 
 		$log = 0 if !$log;
@@ -1749,7 +1749,7 @@ sub node_status {
 		notify($ERRORS{'WARNING'}, 0, "node name could not be determined");
 		return;
 	}
-	notify($ERRORS{'DEBUG'}, 0, "checking status of node: $computer_node_name");
+	notify($ERRORS{'OK'}, 0, "checking status of node: $computer_node_name");
 
 
 
@@ -1766,14 +1766,14 @@ sub node_status {
 	$status{ssh}          = 0;
 
 	# Check the profile in the nodetype table
-	notify($ERRORS{'DEBUG'}, $log, "checking the current image listed in nodetype table for $computer_short_name");
+	notify($ERRORS{'OK'}, $log, "checking the current image listed in nodetype table for $computer_short_name");
 	if (open(NODELS, "$XCAT_ROOT/bin/nodels $computer_short_name nodetype.profile 2>&1 |")) {
 		my @file = <NODELS>;
 		close(NODELS);
 		foreach my $l (@file) {
 			if ($l =~ /^$computer_short_name:\s+(.+)/) {
 				my $nodetype_image_name = $1;
-				notify($ERRORS{'DEBUG'}, 0, "found image for $computer_short_name in nodetype table: $nodetype_image_name");
+				notify($ERRORS{'OK'}, 0, "found image for $computer_short_name in nodetype table: $nodetype_image_name");
 				$status{nodetype} = $nodetype_image_name;
 			}
 		}
@@ -1784,7 +1784,7 @@ sub node_status {
 	}
 
 	# Check if node is pingable
-	notify($ERRORS{'DEBUG'}, $log, "checking if $computer_host_name is pingable");
+	notify($ERRORS{'OK'}, $log, "checking if $computer_host_name is pingable");
 	if (_pingnode($computer_host_name)) {
 		$status{ping} = 1;
 		notify($ERRORS{'OK'}, $log, "$computer_host_name is pingable ($status{ping})");
@@ -1795,7 +1795,7 @@ sub node_status {
 	}
 
 	# Check the rpower status
-	notify($ERRORS{'DEBUG'}, $log, "checking $computer_short_name xCAT rpower status");
+	notify($ERRORS{'OK'}, $log, "checking $computer_short_name xCAT rpower status");
 	my $rpower_status = $self->_rpower($computer_short_name, "stat");
 	if ($rpower_status =~ /on/i) {
 		$status{rpower} = 1;
@@ -1806,22 +1806,22 @@ sub node_status {
 	notify($ERRORS{'OK'}, $log, "$computer_short_name rpower status: $rpower_status ($status{rpower})");
 
 	# Check the xCAT nodeset status
-	notify($ERRORS{'DEBUG'}, $log, "checking $computer_short_name xCAT nodeset status");
+	notify($ERRORS{'OK'}, $log, "checking $computer_short_name xCAT nodeset status");
 	my $nodeset_status = _nodeset($computer_short_name);
 	notify($ERRORS{'OK'}, $log, "$computer_short_name nodeset status: $nodeset_status");
 	$status{nodeset} = $nodeset_status;
 
 	# Check the sshd status
-	notify($ERRORS{'DEBUG'}, $log, "checking if $computer_short_name sshd service is accessible");
+	notify($ERRORS{'OK'}, $log, "checking if $computer_short_name sshd service is accessible");
 	my $sshd_status = _sshd_status($computer_short_name, $status{nodetype}, $log);
 
 	# If sshd is accessible, perform sshd-dependent checks
 	if ($sshd_status =~ /on/) {
 		$status{ssh} = 1;
-		notify($ERRORS{'DEBUG'}, $log, "$computer_short_name sshd service is accessible, performing dependent checks");
+		notify($ERRORS{'OK'}, $log, "$computer_short_name sshd service is accessible, performing dependent checks");
 
 		# Check the currentimage.txt file on the node
-		notify($ERRORS{'DEBUG'}, $log, "checking image specified in currentimage.txt file on $computer_short_name");
+		notify($ERRORS{'OK'}, $log, "checking image specified in currentimage.txt file on $computer_short_name");
 		my $status_currentimage = _getcurrentimage($computer_short_name);
 		if ($status_currentimage) {
 			notify($ERRORS{'OK'}, $log, "$computer_short_name currentimage.txt has: $status_currentimage");
@@ -1881,11 +1881,11 @@ sub node_status {
 		
 		# Check if the OS post_load tasks have run
 		if ($self->os->get_vcld_post_load_status()) {
-			notify($ERRORS{'DEBUG'}, 0, "OS module post_load tasks have been completed on $computer_short_name");
+			notify($ERRORS{'OK'}, 0, "OS module post_load tasks have been completed on $computer_short_name");
 			$status{status} = 'READY';
 		}
 		else {
-			notify($ERRORS{'DEBUG'}, 0, "OS module post_load tasks have not been completed on $computer_short_name, returning 'POST_LOAD'");
+			notify($ERRORS{'OK'}, 0, "OS module post_load tasks have not been completed on $computer_short_name, returning 'POST_LOAD'");
 			$status{status} = 'POST_LOAD';
 		}
 	}

Modified: incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/healthcheck.pm Wed Nov 30 19:53:47 2011
@@ -54,6 +54,8 @@ use diagnostics;
 use English qw( -no_match_vars );
 
 use VCL::utils;
+use VCL::DataStructure;
+#use VCL::Module::Provisioning::xCAT2;
 use DBI;
 
 ##############################################################################
@@ -112,7 +114,7 @@ sub _initialize {
 		notify($ERRORS{'OK'}, $LOG, "retrieved management node information from database");
 	}
 	else {
-		notify($ERRORS{'CRITICAL'}, $LOG, "unable to retrieve management node information from database");
+		notify($ERRORS{'WARNING'}, $LOG, "unable to retrieve management node information from database");
 		exit;
 	}
 
@@ -121,21 +123,10 @@ sub _initialize {
 		notify($ERRORS{'OK'}, $LOG, "retrieved management node resource groups from database");
 	}
 	else {
-		notify($ERRORS{'CRITICAL'}, $LOG, "unable to retrieve management node resource groups from database");
+		notify($ERRORS{'WARNING'}, $LOG, "unable to retrieve management node resource groups from database");
 		exit;
 	}
 
-	foreach my $cid (keys %{$info->{computertable}}) {
-		#notify($ERRORS{'OK'}, $LOGFILE, "computer_id= $info->{computertable}->{$cid}->{computer_id}");
-		#get computer information
-		if ($info->{computertable}->{$cid} = get_computer_info($cid)) {
-
-		}
-		else {
-			delete $info->{computertable}->{$cid};
-		}
-	} ## end foreach my $cid (keys %{$info->{computertable}})
-
 }    ### end sub _initialize
 
 #////////////////////////////////////////////////////////////////////////////////
@@ -154,9 +145,10 @@ sub process {
 	$info->{"globalmsg"}->{"body"} = "Summary of VCL node monitoring system:\n\n";
 
 	my $mn_hostname = $info->{managementnode}->{hostname};
+	my $last_check;
 
 	if($powerdownstage =~ /^(available|all)$/){
-		notify($ERRORS{'CRITICAL'}, $LOG, "ALERT: powerdown stage triggered,placing MN $mn_hostname in maintenance");
+		notify($ERRORS{'WARNING'}, $LOG, "ALERT: powerdown stage triggered,placing MN $mn_hostname in maintenance");
 		if (set_managementnode_state($info->{managementnode}, "maintenance")) {
 			notify($ERRORS{'OK'}, $LOG, "Successfully set $mn_hostname into maintenance");
 		}
@@ -165,7 +157,7 @@ sub process {
 		}
 	}
 	elsif($powerdownstage =~ /^restore/){
-		notify($ERRORS{'CRITICAL'}, $LOG, "ALERT: Environment OK: restoring state of MN $mn_hostname in available");
+		notify($ERRORS{'WARNING'}, $LOG, "ALERT: Environment OK: restoring state of MN $mn_hostname in available");
 		if (set_managementnode_state($info->{managementnode}, "available")) {
 			notify($ERRORS{'OK'}, $LOG, "Successfully set $mn_hostname into available");
 		}
@@ -177,36 +169,106 @@ sub process {
 		#proceed standard checks
 	}
 
+	
+
 	foreach my $cid (keys %{$info->{computertable}}) {
 		#set some local variables
-		my $comp_hostname             = $info->{computertable}->{$cid}->{computer}->{hostname};
-		my $comp_type                 = $info->{computertable}->{$cid}->{computer}->{type};
-		my $comp_state                = $info->{computertable}->{$cid}->{computer}->{state}->{name};
-		my $provisioning_perl_package = $info->{computertable}->{$cid}->{computer}->{provisioning}->{module}->{perlpackage};
-		my $last_check                = $info->{computertable}->{$cid}->{computer}->{lastcheck};
-		my $image_os_name             = $info->{computertable}->{$cid}->{image}->{OS}->{name};
-		my $comp_id                   = $cid;
-
-		#next if ($comp_type eq "lab");
-		#next if($comp_type eq "blade");
-		#next if ($comp_type eq "virtualmachine");
+		#notify($ERRORS{'OK'}, $LOG, " dumping data for computer id $cid\n" . format_data($info->{computertable}->{$cid}));
+		# Create a DataStructure object containing data for the computer specified as the argument
+                my $data;
+		my $self;
+		my $computer_id = $cid;
+                eval {
+                        $data= new VCL::DataStructure({computer_id => $computer_id});
+                };
+                if ($EVAL_ERROR) {
+                        notify($ERRORS{'WARNING'}, 0, "failed to create DataStructure object for computer ID: $computer_id, error: $EVAL_ERROR");
+                        return;
+                }
+                elsif (!$data) {
+                        notify($ERRORS{'WARNING'}, 0, "failed to create DataStructure object for computer ID: $computer_id, DataStructure object is not defined");
+                        return;
+                }
+                else {
+								#notify($ERRORS{'OK'}, 0, "created DataStructure object for computer ID: $computer_id\n". format_data($data->get_request_data));
+                }
+		
+		my $computer_state = $data->get_computer_state_name();
+		$last_check = $data->get_computer_lastcheck_time();
+		my $computer_currentimage_name = $data->get_computer_currentimage_name();
+
+                #Only preform actions on available or failed computers
+                #skip if is inuse, maintenance, tovmhost, etc.
+                if ($computer_state !~ /available|failed/) {
+
+                        notify($ERRORS{'OK'}, $LOG, "NODE computer_id $computer_id is in computer_state $computer_state skipping");
+                        $info->{computers}->{$cid}->{"skip"} = 1;
+                        $info->{"computersskipped"} += 1;
+                        next;
+                }
+
+                #check lastcheck
+                if (defined($last_check) && $computer_state !~ /failed/) {
+                        my $lastcheckepoch  = convert_to_epoch_seconds($last_check);
+                        my $currentimeepoch = convert_to_epoch_seconds();
+                        my $delta           = ($currentimeepoch - $lastcheckepoch);
+
+                        my $delta_minutes = round($delta / 60);
+
+                        if ($delta_minutes <= (60)) {
+                                notify($ERRORS{'OK'}, $LOG, "NODE $computer_id recently checked $delta_minutes minutes ago skipping");
+                                #this node was recently checked
+                                $info->{computers}->{$cid}->{"skip"} = 1;
+                                $info->{"computersskipped"} += 1;
+                                next;
+                        }
+                        $info->{"computerschecked"} += 1;
+                } ## end if (defined($last_check) && $computer_state !~...
+
+					 my $object_type = $data->get_computer_provisioning_module_perl_package();
+					 notify($ERRORS{'OK'}, 0, " object_type= $object_type" );
+					 eval "use $object_type";
+
+					 # Create a provisioning object
+                if ($self = ($object_type)->new({data_structure => $data})) {
+                        #notify($ERRORS{'OK'}, 0, "created $object_type object to check the status of computer ID: $computer_id\n" . format_data($self));
+                }
+                else {
+                        notify($ERRORS{'WARNING'}, 0, "failed to create $object_type object to check the status of computer ID: $computer_id");
+                        next;
+                }
+	
+
+
+
+		my $computer_hostname             = $data->get_computer_host_name();
+		my $computer_type                 = $data->get_computer_type(); 
+
+		#next if ($computer_type eq "lab");
+		#next if($computer_type eq "blade");
+		#next if ($computer_type eq "virtualmachine");
 		#need to pass some of the management node info to provisioing module node_status
 		$info->{computertable}->{$cid}->{"managementnode"} = $info->{managementnode};
 		$info->{computertable}->{$cid}->{"logfile"}        = $info->{logfile};
 
-		notify($ERRORS{'DEBUG'}, $LOG, "cid= $cid");
-		notify($ERRORS{'DEBUG'}, $LOG, "comp_hostname= $comp_hostname");
-		notify($ERRORS{'DEBUG'}, $LOG, "comp_type= $comp_type");
-		notify($ERRORS{'DEBUG'}, $LOG, "comp_state= $comp_state");
-		notify($ERRORS{'DEBUG'}, $LOG, "provisioning_perl_package= $provisioning_perl_package");
-		notify($ERRORS{'DEBUG'}, $LOG, "image_os_name= $image_os_name");
+		notify($ERRORS{'OK'}, $LOG, "cid= $cid");
+		notify($ERRORS{'OK'}, $LOG, "computer_hostname= $computer_hostname");
+		notify($ERRORS{'OK'}, $LOG, "computer_type= $computer_type");
+		notify($ERRORS{'OK'}, $LOG, "computer_state= $computer_state");
 
 		my ($datestring, $node_status_string);
+		my $node_status;
+
+		 # Create an OS object for the VMware object to access
+		  if (!$self->create_os_object()) {
+					 notify($ERRORS{'WARNING'}, 0, "failed to create OS object");
+					 next;
+		  }
 
 		# Collect current state of node - it could have changed since we started
 		if (my $comp_current_state = get_computer_current_state_name($cid)) {
 			$info->{computertable}->{$cid}->{computer}->{state}->{name} = $comp_current_state;
-			$comp_state = $comp_current_state;
+			$computer_state = $comp_current_state;
 		}
 		else {
 			#could not get it, use existing data
@@ -217,10 +279,10 @@ sub process {
 		if($powerdownstage =~ /^(available|all)$/){
 			$info->{computertable}->{$cid}->{"powerdownstage"} = $powerdownstage;
 			if(powerdown_event($info->{computertable}->{$cid})){
-				notify($ERRORS{'OK'}, $LOG, "Successfully powered down $comp_hostname");
+				notify($ERRORS{'OK'}, $LOG, "Successfully powered down $computer_hostname");
 			}
 			else {
-				#notify($ERRORS{'OK'}, $LOG, "Could not powerdown $comp_hostname");
+				#notify($ERRORS{'OK'}, $LOG, "Could not powerdown $computer_hostname");
 			}
 			next;
 		}
@@ -228,97 +290,106 @@ sub process {
 		 #proceed as normal
 		}
 
-		#Only preform actions on these available or failed computer states
-		#skip if is inuse, maintenance, tovmhost, etc.
-		if ($comp_state !~ /available|failed/) {
-
-			notify($ERRORS{'OK'}, $LOG, "NODE $comp_hostname $comp_state skipping");
-			$info->{computers}->{$cid}->{"skip"} = 1;
-			$info->{"computersskipped"} += 1;
-			next;
-		}
+		if ($self->can("node_status")) {
+			notify($ERRORS{'OK'}, 0, "calling " . ref($self) . "->node_status()");
+
+			# Call node_status(), check the return value
+			$node_status = $self->node_status();
 
-		#check lastcheck
-		if (defined($last_check) && $comp_state !~ /failed/) {
-			my $lastcheckepoch  = convert_to_epoch_seconds($last_check);
-			my $currentimeepoch = convert_to_epoch_seconds();
-			my $delta           = ($currentimeepoch - $lastcheckepoch);
-
-			my $delta_minutes = round($delta / 60);
-
-			if ($delta_minutes <= (60)) {
-				notify($ERRORS{'OK'}, $LOG, "NODE $comp_hostname recently checked $delta_minutes minutes ago skipping");
-				#this node was recently checked
-				$info->{computers}->{$cid}->{"skip"} = 1;
-				$info->{"computersskipped"} += 1;
+			# Make sure a return value is defined, an error occurred if it is undefined
+			if (!defined($node_status)) {
+				notify($ERRORS{'WARNING'}, 0, ref($self) . "->node_status() returned an undefined value, returning");
 				next;
 			}
-			$info->{"computerschecked"} += 1;
-		} ## end if (defined($last_check) && $comp_state !~...
 
-		#count the nodes processed
-		$info->{"computercount"} += 1;
-		eval "use $provisioning_perl_package";
-		if ($EVAL_ERROR) {
-			notify($ERRORS{'WARNING'}, $LOG, "$provisioning_perl_package module could not be loaded");
-			notify($ERRORS{'OK'},      $LOG, "returning 0");
-			return 0;
-		}
+			# Check what node_status returned and try to get the "status" string
+			# First see if it returned a hashref
+			if (ref($node_status) eq 'HASH') {
+				notify($ERRORS{'OK'}, 0, "node_status returned a hash reference");
+
+				# Check if the hash contains a key called "status"
+				if (defined $node_status->{status}) {
+					$node_status_string = $node_status->{status};
+					notify($ERRORS{'OK'}, 0, "node_status hash reference contains key {status}=$node_status_string");
+				}
+				else {
+					notify($ERRORS{'OK'}, 0, "node_status hash reference does not contain a key called 'status'");
+				}
+			} ## end if (ref($node_status) eq 'HASH')
 
-		my $node_status = eval "&$provisioning_perl_package" . '::node_status($info->{computertable}->{$cid});';
-		if (!$EVAL_ERROR) {
-			notify($ERRORS{'OK'}, $LOG, "loaded $provisioning_perl_package");
-		}
-		else {
-			notify($ERRORS{'WARNING'}, $LOG, "$provisioning_perl_package module could not be loaded $@");
-		}
+			# Check if node_status returned an array ref
+			elsif (ref($node_status) eq 'ARRAY') {
+				notify($ERRORS{'OK'}, 0, "node_status returned an array reference");
+
+				# Check if the hash contains a key called "status"
+				if (defined((@{$node_status})[0])) {
+					$node_status_string = (@{$node_status})[0];
+					notify($ERRORS{'OK'}, 0, "node_status array reference contains index [0]=$node_status_string");
+				}
+				else {
+					notify($ERRORS{'OK'}, 0, "node_status array reference is empty");
+				}
+			} ## end elsif (ref($node_status) eq 'ARRAY')  [ if (ref($node_status) eq 'HASH')
 
-		if (defined $node_status->{status}) {
-			$node_status_string = $node_status->{status};
-			notify($ERRORS{'DEBUG'}, $LOG, "node_status hash reference contains key {status}=$node_status_string");
-		}
+                # Check if node_status didn't return a reference
+                # Assume string was returned
+                elsif (!ref($node_status)) {
+                        # Use scalar value of node_status's return value
+                        $node_status_string = $node_status;
+                        notify($ERRORS{'OK'}, 0, "node_status returned a scalar: $node_status");
+                }
+                else {
+                        notify($ERRORS{'WARNING'}, 0, ref($self->provisioner) . "->node_status() returned an unsupported reference type: " . ref($node_status) . ", returning");
+                        next;
+                }
+		} ## end if ($self->provisioner->can("node_status"))        
 		else {
-			notify($ERRORS{'DEBUG'}, $LOG, "node_status hash reference does not contain a key called 'status'");
-		}
+					 notify($ERRORS{'OK'}, 0, "node status not checked, node_status() not implemented by " . ref($self->provisioner) . ", assuming load=true ");
+					 next;
+        }
 
-		if ($node_status_string =~ /^ready/i) {
+		#count the nodes processed
+		$info->{"computercount"} += 1;
+
+		if ($node_status_string =~ /(^ready)|(post_load)/i) {
 			#proceed
-			notify($ERRORS{'OK'}, $LOG, "nodestatus reports  $node_status_string for $comp_hostname");
+			notify($ERRORS{'OK'}, $LOG, "nodestatus reports  $node_status_string for $computer_hostname");
 
 			#update lastcheck datetime
 			$datestring = makedatestring;
-			if (update_computer_lastcheck($comp_id, $datestring, $LOG)) {
-				notify($ERRORS{'OK'}, $LOG, "updated lastcheckin for $comp_hostname");
+			if (update_computer_lastcheck($computer_id, $datestring, $LOG)) {
+				notify($ERRORS{'OK'}, $LOG, "updated lastcheckin for $computer_hostname");
 			}
 
 			#udpate state to available if old state is failed
-			if ($comp_state =~ /failed/i) {
-				if (update_computer_state($comp_id, "available", $LOG)) {
-					notify($ERRORS{'OK'}, $LOG, "updated state to available for $comp_hostname");
+			if ($computer_state =~ /failed/i) {
+				if (update_computer_state($computer_id, "available", $LOG)) {
+					notify($ERRORS{'OK'}, $LOG, "updated state to available for $computer_hostname");
 				}
 			}
 		} ## end if ($node_status_string =~ /^ready/i)
 		elsif ($node_status_string =~ /^reload/i) {
 
 			$info->{computertable}->{$cid}->{node_status} = \%{$node_status};
+			$info->{computertable}->{$cid}->{"computer_currentimage_name"} = $computer_currentimage_name;
 
-			notify($ERRORS{'OK'}, $LOG, "nodestatus reports $node_status_string for $comp_hostname");
+			notify($ERRORS{'OK'}, $LOG, "nodestatus reports $node_status_string for $computer_hostname");
 
 			#additional steps
 			my $node_available = 0;
 
-			if ($comp_type eq "lab") {
+			if ($computer_type eq "lab") {
 				#no additional checks required for lab type
 				#if(lab_investigator($info->{computertable}->{$cid})){
 				#	$node_available =1;
 				#}
 			}
-			elsif ($comp_type eq "virtualmachine") {
+			elsif ($computer_type eq "virtualmachine") {
 				if (_virtualmachine_investigator($info->{computertable}->{$cid})) {
 					$node_available = 1;
 				}
 			}
-			elsif ($comp_type eq "blade") {
+			elsif ($computer_type eq "blade") {
 				if (_blade_investigator($info->{computertable}->{$cid})) {
 					$node_available = 1;
 				}
@@ -326,22 +397,22 @@ sub process {
 
 			if ($node_available) {
 				#update state to available
-				if (update_computer_state($comp_id, "available", $LOG)) {
-					notify($ERRORS{'OK'}, $LOG, "updated state to available for $comp_hostname");
+				if (update_computer_state($computer_id, "available", $LOG)) {
+					notify($ERRORS{'OK'}, $LOG, "updated state to available for $computer_hostname");
 				}
 				#update lastcheck datetime
 				$datestring = makedatestring;
-				if (update_computer_lastcheck($comp_id, $datestring, $LOG)) {
-					notify($ERRORS{'OK'}, $LOG, "updated lastcheckin for $comp_hostname");
+				if (update_computer_lastcheck($computer_id, $datestring, $LOG)) {
+					notify($ERRORS{'OK'}, $LOG, "updated lastcheckin for $computer_hostname");
 				}
 			} ## end if ($node_available)
 			else{
-				$info->{globalmsg}->{failedbody} .= "$comp_hostname type= $comp_type offline\n";
+				$info->{globalmsg}->{failedbody} .= "$computer_hostname type= $computer_type offline\n";
 			}
 
 		} ## end elsif ($node_status_string =~ /^reload/i)  [ if ($node_status_string =~ /^ready/i)
 		else {
-			notify($ERRORS{'OK'}, $LOG, "node_status reports unknown value for $comp_hostname node_status_string= $node_status_string ");
+			notify($ERRORS{'OK'}, $LOG, "node_status reports unknown value for $computer_hostname node_status_string= $node_status_string ");
 
 		}
 
@@ -368,9 +439,9 @@ sub _blade_investigator {
 	my ($self) = @_;
 
 	my $retval                  = 0;
-	my $comp_hostname           = $self->{computer}->{hostname};
-	my $comp_imagename          = $self->{imagerevision}->{imagename};
-	my $comp_id                 = $self->{computer}->{id};
+	my $computer_hostname           = $self->{computer}->{hostname};
+	my $comp_imagename          = $self->{computer_currentimage_name};
+	my $computer_id                 = $self->{computer_id};
 	my $nodestatus_status       = $self->{node_status}->{status};
 	my $nodestatus_nodetype     = $self->{node_status}->{nodetype};
 	my $nodestatus_currentimage = $self->{node_status}->{currentimage};
@@ -379,18 +450,18 @@ sub _blade_investigator {
 	my $nodestatus_nodeset      = $self->{node_status}->{nodeset};
 	my $nodestatus_ssh          = $self->{node_status}->{ssh};
 
-	notify($ERRORS{'OK'}, $LOG, "comp_hostname= $comp_hostname node_status_status= $nodestatus_status");
+	notify($ERRORS{'OK'}, $LOG, "computer_hostname= $computer_hostname node_status_status= $nodestatus_status");
 
 	#If can ping and can ssh into it, compare loaded image with database imagename
 	if ($nodestatus_ping && $nodestatus_ssh) {
-		if (_image_revision_check($comp_id, $comp_imagename, $nodestatus_currentimage)) {
+		if (_image_revision_check($computer_id, $comp_imagename, $nodestatus_currentimage)) {
 			#return success
-			notify($ERRORS{'OK'}, $LOG, "comp_hostname= $comp_hostname imagename updated");
+			notify($ERRORS{'OK'}, $LOG, "computer_hostname= $computer_hostname imagename updated");
 			$retval = 1;
 		}
 	}
 	else {
-		notify($ERRORS{'OK'}, $LOG, "comp_hostname= $comp_hostname is confirmed down");
+		notify($ERRORS{'OK'}, $LOG, "computer_hostname= $computer_hostname is confirmed down");
 	}
 
 	return $retval;
@@ -414,12 +485,11 @@ sub powerdown_event {
 	my $computer_host_name      = $self->{computer}->{hostname};
 	my $computer_short_name     = 0;
 	my $computer_ip_address     = $self->{computer}->{IPaddress};
-	my $image_os_name           = $self->{image}->{OS}->{name};
 	my $image_name              = $self->{imagerevision}->{imagename};
 	my $image_os_type           = $self->{image}->{OS}->{type};
 	my $provisioning_perl_package = $self->{computer}->{provisioning}->{module}->{perlpackage};
-	my $comp_type                 = $self->{computer}->{type};
-	my $comp_state						= $self->{computer}->{state}->{name};
+	my $computer_type                 = $self->{computer}->{type};
+	my $computer_state						= $self->{computer}->{state}->{name};
 	my $computer_node_name 			= $self->{computer}->{hostname};
 	my $power_down_stage				= $self->{powerdownstage};
 
@@ -428,7 +498,7 @@ sub powerdown_event {
 	#If blade or vm and available|failed|maintenance - simply power-off
 	#If blade and vmhostinuse - check vms, if available power-down all
 
-	if(($comp_type =~ /blade/) && ($comp_state =~ /^(available|failed|maintenance)/)){
+	if(($computer_type =~ /blade/) && ($computer_state =~ /^(available|failed|maintenance)/)){
 		notify($ERRORS{'OK'}, $LOG, "calling provision module $provisioning_perl_package power_off routine $computer_short_name");
 		
 		eval "use $provisioning_perl_package";
@@ -446,7 +516,7 @@ sub powerdown_event {
 		return 0;
 	}
 	else{
-		 notify($ERRORS{'OK'}, $LOG, "SKIPPING $computer_short_name comp_type= $comp_type in   comp_state= $comp_state");
+		 notify($ERRORS{'OK'}, $LOG, "SKIPPING $computer_short_name computer_type= $computer_type in   computer_state= $computer_state");
 		 return 0;
 	}
 
@@ -468,9 +538,9 @@ sub _virtualmachine_investigator {
 	my ($self) = @_;
 
 	my $retval                  = 0;
-	my $comp_hostname           = $self->{computer}->{hostname};
-	my $comp_imagename          = $self->{imagerevision}->{imagename};
-	my $comp_id                 = $self->{computer}->{id};
+	my $computer_hostname           = $self->{computer}->{hostname};
+	my $comp_imagename          = $self->{computer_currentimage_name};
+	my $computer_id                 = $self->{computer_id};
 	my $nodestatus_status       = $self->{node_status}->{status};
 	my $nodestatus_currentimage = $self->{node_status}->{currentimage};
 	my $nodestatus_ping         = $self->{node_status}->{ping};
@@ -485,14 +555,14 @@ sub _virtualmachine_investigator {
 	}
 
 	if ($nodestatus_currentimage && $nodestatus_ssh) {
-		if (_image_revision_check($comp_id, $comp_imagename, $nodestatus_currentimage)) {
+		if (_image_revision_check($computer_id, $comp_imagename, $nodestatus_currentimage)) {
 			#return success
-			notify($ERRORS{'OK'}, $LOG, "comp_hostname= $comp_hostname imagename updated");
+			notify($ERRORS{'OK'}, $LOG, "computer_hostname= $computer_hostname imagename updated");
 			$retval = 1;
 		}
 	}
 	else {
-		notify($ERRORS{'OK'}, $LOG, "comp_hostname= $comp_hostname is confirmed down nodestatus_vmstate= $nodestatus_vmstate nodestatus_ssh= $nodestatus_ssh");
+		notify($ERRORS{'OK'}, $LOG, "computer_hostname= $computer_hostname is confirmed down nodestatus_vmstate= $nodestatus_vmstate nodestatus_ssh= $nodestatus_ssh");
 	}
 
 	return $retval;
@@ -512,13 +582,13 @@ sub _virtualmachine_investigator {
 
 sub _image_revision_check {
 
-	my ($comp_id, $comp_imagename, $nodestatus_currentimage) = @_;
+	my ($computer_id, $comp_imagename, $nodestatus_currentimage) = @_;
 
 	my $retval = 1;
 	#Return retval=1 only if update_computer_imagename fails
 	if ($comp_imagename !~ /$nodestatus_currentimage/) {
 		#update computer entry
-		if (update_computer_imagename($comp_id, $nodestatus_currentimage, $LOG)) {
+		if (update_computer_imagename($computer_id, $nodestatus_currentimage, $LOG)) {
 			$retval = 1;
 		}
 		else {
@@ -527,6 +597,9 @@ sub _image_revision_check {
 			$retval = 0;
 		}
 	} ## end if ($comp_imagename !~ /$nodestatus_currentimage/)
+	else {
+		notify($ERRORS{'OK'}, $LOG, " image revisions match - no update required");
+	}
 
 	return $retval;
 

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1208737&r1=1208736&r2=1208737&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Wed Nov 30 19:53:47 2011
@@ -106,7 +106,6 @@ our @EXPORT = qw(
   delete_request
   disablesshd
   escape_file_path
-  firewall_compare_update
   format_data
   format_number
   get_affiliation_info
@@ -301,6 +300,7 @@ INIT {
 			$CONF_FILE_PATH = "/etc/vcl/vcld.conf";
 		}
 	}
+#$CONF_FILE_PATH ="/usr/local/vcldev/fap/managementnode/etc/vcl/vcld.conf";
 
 	# Store the command line options in hash
 	our %OPTIONS;
@@ -5224,7 +5224,7 @@ EOF
 		$select_statement .= "imagerevision.id = '$imagerevision_identifier'";
 	}
 	else{
-		$select_statement .= "imagerevision.imagename = '$imagerevision_identifier'";
+		$select_statement .= "imagerevision.imagename = \'$imagerevision_identifier\'";
 	}
 
 	# Call the database select subroutine
@@ -5233,7 +5233,7 @@ EOF
 
 	# Check to make sure 1 row was returned
 	if (!@selected_rows) {
-		notify($ERRORS{'DEBUG'}, 0, "imagerevision '$imagerevision_identifier' was not found in the database, 0 rows were returned from database select statement:\n$select_statement");
+		notify($ERRORS{'WARNING'}, 0, "imagerevision '$imagerevision_identifier' was not found in the database, 0 rows were returned from database select statement:\n$select_statement");
 		return;
 	}
 	elsif (scalar @selected_rows > 1) {
@@ -8098,12 +8098,15 @@ sub get_computer_grp_members {
    FROM 
 	resourcegroupmembers,
 	resourcetype,
-	resource
+	resource,
+	computer
    WHERE 
 	resourcegroupmembers.resourceid = resource.id 
 	AND resourcetype.id = resource.resourcetypeid 
 	AND resourcetype.name = 'computer' 
 	AND resourcegroupmembers.resourcegroupid = $computer_grp_id
+	AND computer.deleted != '1'
+	AND computer.id = resource.subid
 	";
 
 	# Call the database select subroutine
@@ -8466,7 +8469,7 @@ EOF
 	# If the computer identifier is all digits match it to computer.id
 	# Otherwise, match computer.hostname
 	if ($computer_identifier =~ /^\d+$/) {
-		$select_statement .= "computer.id = $computer_identifier";
+		$select_statement .= "computer.id = \'$computer_identifier\'";
 	}
 	else {
 		$select_statement .= "computer.hostname REGEXP '$computer_identifier(\\\\.|\$)'";
@@ -8550,6 +8553,8 @@ EOF
 	my $next_image_id = $computer_info->{nextimageid};
 	if ($next_image_id && (my $nextimage_info = get_image_info($next_image_id))) {
 		my $next_image_name = $nextimage_info->{name};
+		#trim trailing white space
+		$next_image_name =~ s/\s+$//;
 		
 		my $next_imagerevision_info = get_imagerevision_info($next_image_name);
 		if ($next_imagerevision_info) {
@@ -8557,7 +8562,7 @@ EOF
 			$computer_info->{nextimage} = $next_imagerevision_info->{image};
 		}
 		else {
-			notify($ERRORS{'WARNING'}, 0, "failed to retrieve nextimage info for $computer_hostname, nextimageid=$next_image_id");
+			notify($ERRORS{'WARNING'}, 0, "failed to retrieve nextimage info for $computer_hostname, nextimageid=$next_image_id next_image_name=$next_image_name");
 		}
 		
 	}



Mime
View raw message