Author: fapeeler
Date: Thu Jul 24 18:33:51 2014
New Revision: 1613241

URL: http://svn.apache.org/r1613241
Log:
VCL-772

removed node_status from helloworld.pm, esx.pm, esxthin.pm for consistency 

Modified:
    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/helloworld.pm

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=1613241&r1=1613240&r2=1613241&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm Thu Jul 24 
18:33:51 2014
@@ -642,167 +642,6 @@ sub capture {
 
 #/////////////////////////////////////////////////////////////////////////
 
-=head2 node_status
-
- Parameters  : $nodename, $log
- Returns     : array of related status checks
- Description : checks on sshd, currentimage
-
-=cut
-
-sub node_status {
-       my $self = shift;
-
-       my ($package, $filename, $line, $sub) = caller(0);
-
-       my $vmpath             = 0;
-       my $datastorepath      = 0;
-       my $requestedimagename = 0;
-       my $vmhost_type        = 0;
-       my $vmhost_hostname    = 0;
-       my $vmhost_imagename   = 0;
-       my $image_os_type      = 0;
-       my $vmclient_shortname = 0;
-       my $request_forimaging = 0;
-       my $identity_keys      = 0;
-       my $log                = 0;
-       my $computer_node_name = 0;
-
-
-       # Check if subroutine was called as a class method
-       if (ref($self) !~ /esx/i) {
-               notify($ERRORS{'OK'}, 0, "subroutine was called as a function");
-               if (ref($self) eq 'HASH') {
-                       $log = $self->{logfile};
-                       #notify($ERRORS{'DEBUG'}, $log, "self is a hash 
reference");
-
-                       $vmpath             = 
$self->{vmhost}->{vmprofile}->{vmpath};
-                       $datastorepath      = 
$self->{vmhost}->{vmprofile}->{datastorepath};
-                       $requestedimagename = 
$self->{imagerevision}->{imagename};
-                       $vmhost_type        = 
$self->{vmhost}->{vmprofile}->{vmtype}->{name};
-                       $vmhost_hostname    = $self->{vmhost}->{hostname};
-                       $vmhost_imagename   = $self->{vmhost}->{imagename};
-                       $image_os_type      = $self->{image}->{OS}->{type};
-                       $computer_node_name = $self->{computer}->{hostname};
-                       $identity_keys      = $self->{managementnode}->{keys};
-
-               } ## end if (ref($self) eq 'HASH')
-                   # Check if node_status returned an array ref
-               elsif (ref($self) eq 'ARRAY') {
-                       notify($ERRORS{'DEBUG'}, $log, "self is a array 
reference");
-               }
-
-               $vmclient_shortname = $1 if ($computer_node_name =~ 
/([-_a-zA-Z0-9]*)(\.?)/);
-       } ## end if (ref($self) !~ /esx/i)
-       else {
-
-               # try to contact vm
-               # $self->data->get_request_data;
-               # get state of vm
-               $vmpath             = $self->data->get_vmhost_profile_vmpath;
-               $datastorepath      = 
$self->data->get_vmhost_profile_datastore_path;
-               $requestedimagename = $self->data->get_image_name;
-               $vmhost_type        = $self->data->get_vmhost_type;
-               $vmhost_hostname    = $self->data->get_vmhost_hostname;
-               $vmhost_imagename   = $self->data->get_vmhost_image_name;
-               $image_os_type      = $self->data->get_image_os_type;
-               $vmclient_shortname = $self->data->get_computer_short_name;
-               $request_forimaging = $self->data->get_request_forimaging();
-               $identity_keys      = $self->data->get_management_node_keys;
-       } ## end else [ if (ref($self) !~ /esx/i)
-
-       notify($ERRORS{'OK'},    0, "Entering node_status, checking status of 
$vmclient_shortname");
-       notify($ERRORS{'DEBUG'}, 0, "request_for_imaging: $request_forimaging");
-       notify($ERRORS{'DEBUG'}, 0, "requeseted image name: 
$requestedimagename");
-
-       my ($hostnode);
-
-       # Create a hash to store status components
-       my %status;
-
-       # Initialize all hash keys here to make sure they're defined
-       $status{status}       = 0;
-       $status{currentimage} = 0;
-       $status{ping}         = 0;
-       $status{ssh}          = 0;
-       $status{vmstate}      = 0;    #on or off
-       $status{image_match}  = 0;
-
-       if ($vmhost_type eq "blade") {
-               $hostnode = $1 if ($vmhost_hostname =~ /([-_a-zA-Z0-9]*)(\.?)/);
-       }
-       else {
-               #using FQHN
-               $hostnode = $vmhost_hostname;
-       }
-
-
-       # Check if node is pingable
-       notify($ERRORS{'DEBUG'}, 0, "checking if $vmclient_shortname is 
pingable");
-       if (_pingnode($vmclient_shortname)) {
-               $status{ping} = 1;
-               notify($ERRORS{'OK'}, 0, "$vmclient_shortname is pingable 
($status{ping})");
-       }
-       else {
-               notify($ERRORS{'OK'}, 0, "$vmclient_shortname is not pingable 
($status{ping})");
-               return $status{status};
-       }
-
-       #
-       #my $vmx_directory = "$requestedimagename$vmclient_shortname";
-       #my $myvmx         = 
"$vmpath/$requestedimagename$vmclient_shortname/$requestedimagename$vmclient_shortname.vmx";
-       #my $mybasedirname = $requestedimagename;
-       #my $myimagename   = $requestedimagename;
-
-       notify($ERRORS{'DEBUG'}, 0, "Trying to ssh...");
-
-       #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") {
-
-               notify($ERRORS{'DEBUG'}, 0, "SSH good, trying to query image 
name");
-
-               $status{ssh} = 1;
-               my @sshcmd = run_ssh_command($vmclient_shortname, 
$identity_keys, "cat currentimage.txt");
-               $status{currentimage} = $sshcmd[1][0];
-
-               notify($ERRORS{'DEBUG'}, 0, "Image name: 
$status{currentimage}");
-
-               if ($status{currentimage}) {
-                       chomp($status{currentimage});
-                       if ($status{currentimage} =~ /$requestedimagename/) {
-                               $status{image_match} = 1;
-                               notify($ERRORS{'OK'}, 0, "$vmclient_shortname 
is loaded with requestedimagename $requestedimagename");
-                       }
-                       else {
-                               notify($ERRORS{'OK'}, 0, "$vmclient_shortname 
reports current image is currentimage= $status{currentimage} 
requestedimagename= $requestedimagename");
-                       }
-               } ## end if ($status{currentimage})
-       } ## end if ($sshd eq "on")
-
-       # Determine the overall machine status based on the individual status 
results
-       if ($status{ssh} && $status{image_match}) {
-               $status{status} = 'READY';
-       }
-       else {
-               $status{status} = 'RELOAD';
-       }
-
-       notify($ERRORS{'DEBUG'}, 0, "status set to $status{status}");
-
-
-       if ($request_forimaging) {
-               $status{status} = 'RELOAD';
-               notify($ERRORS{'OK'}, 0, "request_forimaging set, setting 
status to RELOAD");
-       }
-
-       notify($ERRORS{'DEBUG'}, 0, "returning node status hash reference 
(\$node_status->{status}=$status{status})");
-       return \%status;
-
-} ## end sub node_status
 
 sub does_image_exist {
        my $self = shift;

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=1613241&r1=1613240&r2=1613241&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm Thu Jul 24 
18:33:51 2014
@@ -1245,168 +1245,6 @@ sub capture {
 
 #/////////////////////////////////////////////////////////////////////////
 
-=head2 node_status
-
- Parameters  : $nodename, $log
- Returns     : array of related status checks
- Description : checks on sshd, currentimage
-
-=cut
-
-sub node_status {
-       my $self = shift;
-
-       my ($package, $filename, $line, $sub) = caller(0);
-
-       my $vmpath             = 0;
-       my $datastorepath      = 0;
-       my $requestedimagename = 0;
-       my $vmhost_type        = 0;
-       my $vmhost_hostname    = 0;
-       my $vmhost_imagename   = 0;
-       my $image_os_type      = 0;
-       my $vmclient_shortname = 0;
-       my $request_forimaging = 0;
-       my $identity_keys      = 0;
-       my $log                = 0;
-       my $computer_node_name = 0;
-
-
-       # Check if subroutine was called as a class method
-       if (ref($self) !~ /esxthin/i) {
-               notify($ERRORS{'OK'}, 0, "subroutine was called as a function");
-               if (ref($self) eq 'HASH') {
-                       $log = $self->{logfile};
-                       #notify($ERRORS{'DEBUG'}, $log, "self is a hash 
reference");
-
-                       $vmpath             = 
$self->{vmhost}->{vmprofile}->{vmpath};
-                       $datastorepath      = 
$self->{vmhost}->{vmprofile}->{datastorepath};
-                       $requestedimagename = 
$self->{imagerevision}->{imagename};
-                       $vmhost_type        = 
$self->{vmhost}->{vmprofile}->{vmtype}->{name};
-                       $vmhost_hostname    = $self->{vmhost}->{hostname};
-                       $vmhost_imagename   = $self->{vmhost}->{imagename};
-                       $image_os_type      = $self->{image}->{OS}->{type};
-                       $computer_node_name = $self->{computer}->{hostname};
-                       $identity_keys      = $self->{managementnode}->{keys};
-
-               } ## end if (ref($self) eq 'HASH')
-                   # Check if node_status returned an array ref
-               elsif (ref($self) eq 'ARRAY') {
-                       notify($ERRORS{'DEBUG'}, $log, "self is a array 
reference");
-               }
-
-               $vmclient_shortname = $1 if ($computer_node_name =~ 
/([-_a-zA-Z0-9]*)(\.?)/);
-       } ## end if (ref($self) !~ /esxthin/i)
-       else {
-
-               # try to contact vm
-               # $self->data->get_request_data;
-               # get state of vm
-               $vmpath             = $self->data->get_vmhost_profile_vmpath;
-               $datastorepath      = 
$self->data->get_vmhost_profile_datastore_path;
-               $requestedimagename = $self->data->get_image_name;
-               $vmhost_type        = $self->data->get_vmhost_type;
-               $vmhost_hostname    = $self->data->get_vmhost_hostname;
-               $vmhost_imagename   = $self->data->get_vmhost_image_name;
-               $image_os_type      = $self->data->get_image_os_type;
-               $vmclient_shortname = $self->data->get_computer_short_name;
-               $request_forimaging = $self->data->get_request_forimaging();
-               $identity_keys      = $self->data->get_management_node_keys;
-       } ## end else [ if (ref($self) !~ /esxthin/i)
-
-       notify($ERRORS{'OK'},    0, "Entering node_status, checking status of 
$vmclient_shortname");
-       notify($ERRORS{'DEBUG'}, 0, "request_for_imaging: $request_forimaging");
-       notify($ERRORS{'DEBUG'}, 0, "requeseted image name: 
$requestedimagename");
-
-       my ($hostnode);
-
-       # Create a hash to store status components
-       my %status;
-
-       # Initialize all hash keys here to make sure they're defined
-       $status{status}       = 0;
-       $status{currentimage} = 0;
-       $status{ping}         = 0;
-       $status{ssh}          = 0;
-       $status{vmstate}      = 0;    #on or off
-       $status{image_match}  = 0;
-
-       if ($vmhost_type eq "blade") {
-               $hostnode = $1 if ($vmhost_hostname =~ /([-_a-zA-Z0-9]*)(\.?)/);
-       }
-       else {
-               #using FQHN
-               $hostnode = $vmhost_hostname;
-       }
-
-
-       # Check if node is pingable
-       notify($ERRORS{'DEBUG'}, 0, "checking if $vmclient_shortname is 
pingable");
-       if (_pingnode($vmclient_shortname)) {
-               $status{ping} = 1;
-               notify($ERRORS{'OK'}, 0, "$vmclient_shortname is pingable 
($status{ping})");
-       }
-       else {
-               notify($ERRORS{'OK'}, 0, "$vmclient_shortname is not pingable 
($status{ping})");
-               return $status{status};
-       }
-
-       #
-       #my $vmx_directory = "$requestedimagename$vmclient_shortname";
-       #my $myvmx         = 
"$vmpath/$requestedimagename$vmclient_shortname/$requestedimagename$vmclient_shortname.vmx";
-       #my $mybasedirname = $requestedimagename;
-       #my $myimagename   = $requestedimagename;
-
-       notify($ERRORS{'DEBUG'}, 0, "Trying to ssh...");
-
-       #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") {
-
-               notify($ERRORS{'DEBUG'}, 0, "SSH good, trying to query image 
name");
-
-               $status{ssh} = 1;
-               my @sshcmd = run_ssh_command($vmclient_shortname, 
$identity_keys, "cat currentimage.txt");
-               $status{currentimage} = $sshcmd[1][0];
-
-               notify($ERRORS{'DEBUG'}, 0, "Image name: 
$status{currentimage}");
-
-               if ($status{currentimage}) {
-                       chomp($status{currentimage});
-                       if ($status{currentimage} =~ /$requestedimagename/) {
-                               $status{image_match} = 1;
-                               notify($ERRORS{'OK'}, 0, "$vmclient_shortname 
is loaded with requestedimagename $requestedimagename");
-                       }
-                       else {
-                               notify($ERRORS{'OK'}, 0, "$vmclient_shortname 
reports current image is currentimage= $status{currentimage} 
requestedimagename= $requestedimagename");
-                       }
-               } ## end if ($status{currentimage})
-       } ## end if ($sshd eq "on")
-
-       # Determine the overall machine status based on the individual status 
results
-       if ($status{ssh} && $status{image_match}) {
-               $status{status} = 'READY';
-       }
-       else {
-               $status{status} = 'RELOAD';
-       }
-
-       notify($ERRORS{'DEBUG'}, 0, "status set to $status{status}");
-
-
-       if ($request_forimaging) {
-               $status{status} = 'RELOAD';
-               notify($ERRORS{'OK'}, 0, "request_forimaging set, setting 
status to RELOAD");
-       }
-
-       notify($ERRORS{'DEBUG'}, 0, "returning node status hash reference 
(\$node_status->{status}=$status{status})");
-       return \%status;
-
-} ## end sub node_status
-
 sub does_image_exist {
        my $self = shift;
        if (ref($self) !~ /esxthin/i) {

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/helloworld.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/helloworld.pm?rev=1613241&r1=1613240&r2=1613241&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/helloworld.pm 
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/helloworld.pm Thu Jul 
24 18:33:51 2014
@@ -144,65 +144,6 @@ sub capture {
 
 
 #/////////////////////////////////////////////////////////////////////////
-=head2 node_status
-
- Parameters  : $nodename, $log
- Returns     : array of related status checks.  See the $status variable for 
an example of the return
- Description : checks if sshd is active, and returns information regarding if 
a node should be reloaded or not.
-
-=cut
-
-sub node_status {
-       my $self = shift;
-
-       # Check if subroutine was called as a class method
-       if (ref($self) !~ /helloworld/i) {
-               notify($ERRORS{'CRITICAL'}, 0, "subroutine was called as a 
function, it must be called as a class method");
-               return 0;
-       }
-
-       #my ($vmhash) = shift;
-
-       my ($package, $filename, $line, $sub) = caller(0);
-
-       # try to contact vm
-       # $self->data->get_request_data;
-       # get state of vm
-       my $vmpath             = $self->data->get_vmhost_profile_vmpath;
-       my $datastorepath      = $self->data->get_vmhost_profile_datastore_path;
-       my $requestedimagename = $self->data->get_image_name;
-       my $vmhost_type        = $self->data->get_vmhost_type;
-       my $vmhost_hostname    = $self->data->get_vmhost_hostname;
-       my $vmhost_imagename   = $self->data->get_vmhost_image_name;
-       my $vmclient_shortname = $self->data->get_computer_short_name;
-       my $request_forimaging              = 
$self->data->get_request_forimaging();
-
-       #notify($ERRORS{'OK'}, 0, "Entering node_status, checking status of 
$vmclient_shortname");
-       #notify($ERRORS{'DEBUG'}, 0, "request_for_imaging: 
$request_forimaging");
-       #notify($ERRORS{'DEBUG'}, 0, "requeseted image name: 
$requestedimagename");
-
-       my ($hostnode, $identity);
-
-       # Create a hash to store status components
-       my %status;
-
-       # Initialize all hash keys here to make sure they're defined
-       $status{status}       = 0;
-       $status{currentimage} = 0;
-       $status{ping}         = 0;
-       $status{ssh}          = 0;
-       $status{vmstate}      = 0;    #on or off
-       $status{image_match}  = 0;
-
-       #$status{status} = 'READY';
-       #$status{status} = 'RELOAD';
-
-       notify($ERRORS{'DEBUG'}, 0, "status set to $status{status}");
-
-       notify($ERRORS{'DEBUG'}, 0, "returning node status hash reference 
(\$node_status->{status}=$status{status})");
-       return \%status;
-
-} ## end sub node_status
 
 sub does_image_exist {
        my $self = shift;


Reply via email to