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/07/23 20:28:36 UTC
svn commit: r1612910 -
/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
Author: fapeeler
Date: Wed Jul 23 18:28:36 2014
New Revision: 1612910
URL: http://svn.apache.org/r1612910
Log:
VCL-772
removed node_status from xCAT module
Modified:
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
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=1612910&r1=1612909&r2=1612910&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Wed Jul 23 18:28:36 2014
@@ -26,11 +26,9 @@ VCL::Provisioning::xCAT - VCL module to
From another VCL module instantiated normally for a reservation:
$self->provisioner->load();
- my $status = $self->provisioner->node_status();
From a script:
my $xcat = new VCL::Module::Provisioning::xCAT();
- my $status = $xcat->node_status('node1a2-3');
=head1 DESCRIPTION
@@ -607,215 +605,6 @@ sub capture {
notify($ERRORS{'OK'}, 0, "successfully captured $image_name on $computer_node_name");
return 1;
}
-
-#/////////////////////////////////////////////////////////////////////////////
-
-=head2 node_status
-
- Parameters : $computer_node_name (optional)
- Returns : string
- Description : Checks the status of an xCAT-provisioned machine. If no
- arguments are supplied, the node and image for the current
- reservation will be used. The return value will be one of the
- following:
-
- READY
- If $self->data contains image information:
- - The computer is responding to SSH
- - nodetype.profile is set to the image defined in $self->data
- - Current image retrieved from computer's OS matches $self->data
- If $self->data does not contain image:
- - The computer is responding to SSH
- - Current image retrieved from computer's OS matches
- nodetype.profile
-
- RELOAD
- - Only returned if $self->data contains image information
- - Either nodetype.profile does not match $self->data or the
- current image retrieved from computer's OS does not match
- $self->data
-
- UNRESPONSIVE
- - The computer is not responding to SSH
-
- INCONSISTENT
- - nodetype.profile does not match the current image retrieved
- from computer's OS
-
-=cut
-
-sub node_status {
- my $self = shift;
- if (ref($self) !~ /xCAT/i) {
- notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a function, it must be called as a class method");
- return;
- }
-
- # Get the computer name argument
- my $computer_node_name = shift;
-
- if ($computer_node_name) {
- notify($ERRORS{'DEBUG'}, 0, "checking status of node specified by argument: $computer_node_name");
- }
- else {
- $computer_node_name = $self->data->get_computer_node_name();
- if ($computer_node_name) {
- notify($ERRORS{'DEBUG'}, 0, "checking status of node assigned to reservation: $computer_node_name");
- }
- else {
- notify($ERRORS{'WARNING'}, 0, "computer name argument was not specified and could not be retrieved from the DataStructure object");
- return;
- }
- }
-
- my $request_state_name = $self->data->get_request_state_name(0);
- my $image_name = $self->data->get_image_name(0);
-
- # If request state is 'new' and necessary objects are available, go straight to checking currentimage.txt
- # Calling the xCAT functions can overload the management node when several computers are being loaded concurrently (cluster requests)
- if ($image_name && $request_state_name && $request_state_name eq 'new' && $self->os(0)) {
- # Check image name reported from OS
- my $current_image_name = $self->os->get_current_image_info('current_image_name');
- if (!defined($current_image_name)) {
- my $return_value = 'RELOAD';
- notify($ERRORS{'WARNING'}, 0, "unable to determine status of $computer_node_name, failed to retrieve current image name from OS, returning '$return_value'");
- return 'RELOAD';
- }
-
- if ($current_image_name ne $image_name) {
- my $return_value = 'RELOAD';
- notify($ERRORS{'DEBUG'}, 0, "current image reported by OS '$current_image_name' does NOT match the reservation image name: '$image_name', returning '$return_value'");
- return $return_value;
- }
-
- # Check if currentimage.txt contains a 'vcld_post_load' line
- my $vcld_post_load_status = $self->data->get_computer_currentimage_vcld_post_load(0);
- if ($vcld_post_load_status) {
- my $return_value = 'READY';
- notify($ERRORS{'DEBUG'}, 0, "OS module post_load tasks have been completed on VM $computer_node_name, returning '$return_value'");
- return $return_value;
- }
- else {
- my $return_value = 'POST_LOAD';
- notify($ERRORS{'OK'}, 0, "OS module post_load tasks have not been completed on VM $computer_node_name, returning '$return_value'");
- return $return_value;
- }
- }
-
- # Check if the node is powered on
- my $power_status = $self->power_status($computer_node_name);
- if (!defined($power_status)) {
- notify($ERRORS{'WARNING'}, 0, "unable to determine status of $computer_node_name, failed to retrieve power status");
- return;
- }
- elsif ($power_status !~ /on/) {
- my $return_value = uc($power_status);
- notify($ERRORS{'DEBUG'}, 0, "power status of $computer_node_name is '$power_status', returning '$return_value'");
- return $return_value;
- }
-
- # Get the xCAT definition for the node
- my $node_info = $self->_lsdef($computer_node_name);
- if (!$node_info) {
- notify($ERRORS{'WARNING'}, 0, "unable to determine status of $computer_node_name, failed to retrieve xCAT object definition using lsdef utility");
- return;
- }
-
- # Make sure node.profile is configured
- my $node_profile = $node_info->{profile};
- if (!$node_profile) {
- my $return_value = 'RELOAD';
- notify($ERRORS{'DEBUG'}, 0, "unable to determine status of $computer_node_name, node.profile is not configured:\n" . format_data($node_info) . "\nreturning '$return_value'");
- return $return_value;
- }
-
- # Check if node.profile matches the reservation image name
- if ($image_name) {
- if ($node_profile eq $image_name) {
- notify($ERRORS{'DEBUG'}, 0, "nodetype.profile matches the reservation image name: $image_name");
- }
- else {
- my $return_value = 'INCONSISTENT';
- notify($ERRORS{'DEBUG'}, 0, "nodetype.profile '$node_profile' does NOT match the reservation image name: '$image_name', returning '$return_value'");
- return $return_value;
- }
- }
-
- # 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 => $node_profile});
- 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 nodetype.profile: '$node_profile'");
- 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 nodetype.profile: '$node_profile'");
- return;
- }
- }
-
- # Check if the node is responding to SSH
- my $ssh_responding = $os->is_ssh_responding();
- if (!$ssh_responding) {
- my $return_value = 'UNRESPONSIVE';
- notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is NOT responding to SSH, returning '$return_value'");
- return $return_value;
- }
-
- # Check image name reported from OS
- my $current_image_name = $os->get_current_image_info('current_image_name');
- if (!defined($current_image_name)) {
- my $return_value = 'UNRESPONSIVE';
- notify($ERRORS{'WARNING'}, 0, "unable to determine status of $computer_node_name, failed to retrieve current image name from OS, returning '$return_value'");
- return $return_value;
- }
-
- # Check if OS's current image matches the reservation image name
- if ($image_name) {
- if ($current_image_name eq $image_name) {
- notify($ERRORS{'DEBUG'}, 0, "current image reported by OS matches the reservation image name: $image_name");
- }
- else {
- my $return_value = 'RELOAD';
- notify($ERRORS{'DEBUG'}, 0, "current image reported by OS '$current_image_name' does NOT match the reservation image name: '$image_name', returning '$return_value'");
- return $return_value;
- }
- }
-
- # Check if the OS matches xCAT
- if ($current_image_name eq $node_profile) {
- notify($ERRORS{'DEBUG'}, 0, "nodetype.profile matches current image reported by OS: '$current_image_name'");
- }
- else {
- my $return_value = 'INCONSISTENT';
- notify($ERRORS{'DEBUG'}, 0, "nodetype.profile '$node_profile' does NOT match current image reported by OS: '$current_image_name', returning '$return_value'");
- return $return_value;
- }
-
- # Check if currentimage.txt contains a 'vcld_post_load' line
- my $vcld_post_load_status = $self->data->get_computer_currentimage_vcld_post_load(0);
- if ($vcld_post_load_status) {
- notify($ERRORS{'DEBUG'}, 0, "OS module post_load tasks have been completed on VM $computer_node_name");
- }
- else {
- my $return_value = 'POST_LOAD';
- notify($ERRORS{'OK'}, 0, "OS module post_load tasks have not been completed on VM $computer_node_name, returning '$return_value'");
- return $return_value;
- }
-
- my $return_value = 'READY';
- notify($ERRORS{'DEBUG'}, 0, "$computer_node_name is loaded with the correct image: $current_image_name, returning '$return_value'");
- return $return_value;
-} ## end sub node_status
-
#/////////////////////////////////////////////////////////////////////////////
=head2 does_image_exist