You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2014/06/20 00:29:03 UTC
svn commit: r1604043 - in /vcl/trunk/managementnode/lib/VCL: ./ Module/
Module/OS/ Module/OS/Linux/ Module/Provisioning/
Author: arkurth
Date: Thu Jun 19 22:29:02 2014
New Revision: 1604043
URL: http://svn.apache.org/r1604043
Log:
VCL-767
Updated DataStructure.pm::get_computer_private_ip_address to not read /etc/hosts to determine the private IP address.
Updated DataStructure.pm::set_computer_private_ip_address to also update the database if the address changed.
Updated utils.pm::update_computer_private_ip_address to accept an argument of 'null' to unset the value in the database.
Changed hash key in DataStructure.pm from 'computer_ip_address' to 'computer_public_ip_address' to make it clear which address is being worked with. Changed all calls to data->{get|set}_computer_ip_address to data->{get|set}_computer_public_ip_address in all files.
Modified:
vcl/trunk/managementnode/lib/VCL/DataStructure.pm
vcl/trunk/managementnode/lib/VCL/Module/OS.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ManagementNode.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
vcl/trunk/managementnode/lib/VCL/inuse.pm
vcl/trunk/managementnode/lib/VCL/new.pm
vcl/trunk/managementnode/lib/VCL/reserved.pm
vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: vcl/trunk/managementnode/lib/VCL/DataStructure.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/DataStructure.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/DataStructure.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/DataStructure.pm Thu Jun 19 22:29:02 2014
@@ -204,7 +204,6 @@ $SUBROUTINE_MAPPINGS{computer_host_name}
#$SUBROUTINE_MAPPINGS{computer_hostpub} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{hostpub}';
$SUBROUTINE_MAPPINGS{computer_id} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{id}';
$SUBROUTINE_MAPPINGS{computer_imagerevision_id} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{imagerevisionid}';
-$SUBROUTINE_MAPPINGS{computer_ip_address} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{IPaddress}';
$SUBROUTINE_MAPPINGS{computer_lastcheck_time} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{lastcheck}';
$SUBROUTINE_MAPPINGS{computer_location} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{location}';
$SUBROUTINE_MAPPINGS{computer_networking_speed} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{network}';
@@ -214,6 +213,7 @@ $SUBROUTINE_MAPPINGS{computer_owner_id}
$SUBROUTINE_MAPPINGS{computer_platform_id} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{platformid}';
$SUBROUTINE_MAPPINGS{computer_nextimage_id} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{nextimageid}';
$SUBROUTINE_MAPPINGS{computer_private_ip_address} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{privateIPaddress}';
+$SUBROUTINE_MAPPINGS{computer_public_ip_address} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{IPaddress}';
$SUBROUTINE_MAPPINGS{computer_processor_count} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{procnumber}';
$SUBROUTINE_MAPPINGS{computer_processor_speed} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{procspeed}';
$SUBROUTINE_MAPPINGS{computer_ram} = '$self->request_data->{reservation}{RESERVATION_ID}{computer}{RAM}';
@@ -1620,139 +1620,54 @@ sub get_log_data {
=head2 get_computer_private_ip_address
- Parameters : computer name (optional)
- Returns : If successful: string containing IP address
- If failed: false
- Description : Retrieves the IP address for a computer from the
- management node's local /etc/hosts file.
-
- An optional argument can
- be supplied containing the name of the computer for which the IP
- address will be retrieved.
-
- This subroutine may or may not be called as a DataStructure
- object method. If this subroutine is called as an object method,
- the computer name argument is optional. If it is not called as an
- object method, the computer name argument must be supplied.
-
- The first time this subroutine is called as an object method
- without an argument, the reservation computer's IP address is
- retrieved from the /etc/hosts file and saved in the DataStructure
- object's data. Subsequent calls as an object method without an
- argument will return the IP address retrieved the first time for
- efficiency.
+ Parameters : $suppress_warning (optional)
+ Returns : string
+ Description : Retrieves the private IP address for a computer. If an address is
+ already stored in the DataStructure object, then that address is
+ returned. If no address is stored, null is returned and a warning
+ message is displayed in the log file. This can be suppressed via
+ the argument.
=cut
sub get_computer_private_ip_address {
- my $self;
- my $argument = shift;
- my $computer_name;
-
- # Check if subroutine was called as an object method
- if (ref($argument) && $argument->isa('VCL::DataStructure')) {
- # Subroutine was called as an object method, check if an argument was specified
- $self = $argument;
- $argument = shift;
- if ($argument) {
- # Argument was specified, use this as the computer name
- $computer_name = $argument;
- }
- else {
- # Argument was not specified, check if private IP address for this reservation's computer was already retrieved
- if (defined $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS}) {
- my $existing_private_ip_address = $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS};
-
- # This subroutine has already been run for the reservation computer, return IP address retrieved earlier
- notify($ERRORS{'DEBUG'}, 0, "returning private IP address previously retrieved: $existing_private_ip_address");
- return $existing_private_ip_address;
- }
-
- # Argument was not specified and private IP address has not yet been saved in the request data
- # Get the computer short name for this reservation
- $computer_name = $self->get_computer_short_name();
- }
- }
- elsif (ref($argument)) {
- notify($ERRORS{'WARNING'}, 0, "subroutine was called with an illegal argument type: " . ref($argument));
- return;
- }
- else {
- # Subroutine was not called as an object method
- $computer_name = $argument;
- }
-
- # Make sure the computer name was determined either from an argument or the request data
- if (!$computer_name) {
- notify($ERRORS{'WARNING'}, 0, "unable to determine computer name from argument or request data");
+ my $self = shift;
+ unless (ref($self) && $self->isa('VCL::DataStructure')) {
+ notify($ERRORS{'WARNING'}, 0, "subroutine can only be called as a VCL::DataStructure module object method");
return;
}
- notify($ERRORS{'DEBUG'}, 0, "attempting to retrieve private IP address for computer: $computer_name");
+ my $suppress_warning = shift;
- # Make sure mn_os is defined
- my $mn_os = $self->mn_os;
- if (!$mn_os) {
- notify($ERRORS{'WARNING'}, 0, "unable to retrieve private IP address for computer: $computer_name, management node OS object is not available");
+ my $computer_hostname = $self->get_computer_hostname();
+ if (!$computer_hostname) {
+ notify($ERRORS{'WARNING'}, 0, "computer hostname is not stored in this DataStructure object");
return;
}
- my @hosts_lines = $mn_os->get_file_contents('/etc/hosts');
- if (!@hosts_lines) {
- notify($ERRORS{'WARNING'}, 0, "failed to retrieve contents of /etc/hosts on this management node");
- return;
+ # Check if this is being called by set_computer_private_ip_address
+ # Don't display log messages if this is the case to avoid confusion
+ my $display_output = 1;
+ if (get_calling_subroutine() =~ /set_computer_private_ip_address/) {
+ $display_output = 0;
}
- # Find lines containing the computer name followed by a space or period
- my %matching_computer_ip_addresses;
-
- for my $line (@hosts_lines) {
- # Ignore commented lines
- next if ($line =~ /^\s*#/);
-
- # Ignore lines which don't contain the computer name
- next if ($line !~ /((?:[0-9]{1,3}\.?){4})\s+$computer_name($|\.|\s)/i);
-
- # Extract the IP address from the matching line
- my ($ip_address) = $line =~ /\s*((?:[0-9]{1,3}\.?){4})\s/i;
-
- if (!$ip_address) {
- notify($ERRORS{'WARNING'}, 0, "unable to extract IP address from line: $line");
- next;
- }
-
- # Add the IP address and line to the hash
- $matching_computer_ip_addresses{$ip_address} = $line;
+ # Check if the IP address is already stored
+ my $private_ip_address = $self->request_data->{reservation}{$self->reservation_id}{computer}{privateIPaddress};
+ if ($private_ip_address) {
+ notify($ERRORS{'DEBUG'}, 0, "returning private IP address of $computer_hostname already stored in this DataStructure object: $private_ip_address") if $display_output;
+ return $private_ip_address;
}
-
- # Check the hash, it should contain 1 key
- # Make sure 1 uncommented line was found
- my $found_count = scalar keys %matching_computer_ip_addresses;
- if ($found_count == 0) {
- if (my $database_ip_address = $self->request_data->{reservation}{$self->reservation_id}{computer}{privateIPaddress}) {
- notify($ERRORS{'OK'}, 0, "did not find any lines in /etc/hosts containing '$computer_name', returning private IP address defined in the database: $database_ip_address");
- $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS} = $database_ip_address;
- return $database_ip_address;
+
+ if ($display_output) {
+ if ($suppress_warning) {
+ notify($ERRORS{'DEBUG'}, 0, "private IP address of $computer_hostname is not set in DataStructure object")
}
else {
- notify($ERRORS{'WARNING'}, 0, "did not find any lines in /etc/hosts containing '$computer_name' and the private IP address is not defined in the database");
- return;
+ notify($ERRORS{'WARNING'}, 0, "private IP address of $computer_hostname is not set in DataStructure object")
}
}
- elsif ($found_count > 1) {
- notify($ERRORS{'WARNING'}, 0, "found multiple lines in /etc/hosts containing '$computer_name' with different IP addresses:\n" . join("\n", values(%matching_computer_ip_addresses)));
- return;
- }
-
- my $ip_address = (keys %matching_computer_ip_addresses)[0];
-
- # Update the request data if subroutine was called as an object method without an argument
- if ($self && !$argument) {
- $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS} = $ip_address;
- }
-
- notify($ERRORS{'DEBUG'}, 0, "returning IP address from /etc/hosts file: $ip_address");
- return $ip_address;
+ return;
}
#/////////////////////////////////////////////////////////////////////////////
@@ -1761,7 +1676,9 @@ sub get_computer_private_ip_address {
Parameters : $private_ip_address
Returns : boolean
- Description : Sets the computer private IP address in the DataStructure.
+ Description : Sets the computer private IP address in the DataStructure. If the
+ IP address argument is different than the value currently stored
+ in the DataStructure object, the database is updated.
=cut
@@ -1774,28 +1691,53 @@ sub set_computer_private_ip_address {
return;
}
- my $private_ip_address = shift;
- if (!$private_ip_address) {
+ my $private_ip_address_argument = shift;
+ if (!$private_ip_address_argument) {
notify($ERRORS{'WARNING'}, 0, "computer private IP address argument was not supplied");
return;
}
- elsif (!is_valid_ip_address($private_ip_address)) {
- notify($ERRORS{'WARNING'}, 0, "computer private IP address argument is not valid: '$private_ip_address'");
+ elsif ($private_ip_address_argument !~ /null/i && !is_valid_ip_address($private_ip_address_argument)) {
+ notify($ERRORS{'WARNING'}, 0, "computer private IP address argument is not valid: '$private_ip_address_argument'");
return;
}
- notify($ERRORS{'DEBUG'}, 0, "updated computer private IP address: '$private_ip_address'");
- $self->request_data->{reservation}{$self->reservation_id}{computer}{PRIVATE_IP_ADDRESS} = $private_ip_address;
+ my $computer_id = $self->get_computer_id();
+ my $computer_hostname = $self->get_computer_hostname();
+ if (!$computer_id || !$computer_hostname) {
+ notify($ERRORS{'WARNING'}, 0, "computer hostname and ID are not stored in this DataStructure object");
+ return;
+ }
+
+ my $existing_private_ip_address = $self->get_computer_private_ip_address();
+
+ if (!$existing_private_ip_address && $private_ip_address_argument =~ /null/i) {
+ notify($ERRORS{'DEBUG'}, 0, "setting private IP address of $computer_hostname to '$private_ip_address_argument' not necessary, it is not set in this DataStructure object");
+ return 1;
+ }
+ elsif ($existing_private_ip_address && $existing_private_ip_address eq $private_ip_address_argument) {
+ notify($ERRORS{'DEBUG'}, 0, "private IP address of $computer_hostname is already set to $private_ip_address_argument");
+ return 1;
+ }
+ else {
+ # Update this DataStructure object
+ if ($private_ip_address_argument =~ /null/i) {
+ delete $self->request_data->{reservation}{$self->reservation_id}{computer}{privateIPaddress};
+ }
+ else {
+ $self->request_data->{reservation}{$self->reservation_id}{computer}{privateIPaddress} = $private_ip_address_argument;
+ }
+
+ # Update the database
+ if (!update_computer_private_ip_address($computer_id, $private_ip_address_argument)) {
+ notify($ERRORS{'WARNING'}, 0, "failed to update private IP address of $computer_hostname to $private_ip_address_argument, unable to update the database");
+ return;
+ }
+ }
+
+ notify($ERRORS{'DEBUG'}, 0, "private IP address of $computer_hostname set to $private_ip_address_argument");
return 1;
}
-
-#/////////////////////////////////////////////////////////////////////////////
-
-#/////////////////////////////////////////////////////////////////////////////
-
-#/////////////////////////////////////////////////////////////////////////////
-
#/////////////////////////////////////////////////////////////////////////////
=head2 get_image_affiliation_name
@@ -2249,7 +2191,7 @@ sub get_reservation_info_string {
$string .= "computer eth0 MAC address: " . (defined($_ = $self->get_computer_eth0_mac_address(0)) ? $_ : '<undefined>') . "\n";
$string .= "computer eth1 MAC address: " . (defined($_ = $self->get_computer_eth1_mac_address(0)) ? $_ : '<undefined>') . "\n";
$string .= "computer private IP address: " . (defined($_ = $self->get_computer_private_ip_address(0)) ? $_ : '<undefined>') . "\n";
- $string .= "computer public IP address: " . (defined($_ = $self->get_computer_ip_address(0)) ? $_ : '<undefined>') . "\n";
+ $string .= "computer public IP address: " . (defined($_ = $self->get_computer_public_ip_address(0)) ? $_ : '<undefined>') . "\n";
$string .= "computer in block allocation: " . (defined($_ = is_inblockrequest($self->get_computer_id(0))) ? ($_ ? 'yes' : 'no') : '<undefined>') . "\n";
$string .= "provisioning module: " . (defined($_ = $self->get_computer_provisioning_module_perl_package(0)) ? $_ : '<undefined>') . "\n";
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS.pm Thu Jun 19 22:29:02 2014
@@ -898,15 +898,15 @@ sub server_request_set_fixedIP {
return;
}
- my $reservation_id = $self->data->get_reservation_id() || return;
- my $computer_id = $self->data->get_computer_id() || return;
- my $computer_node_name = $self->data->get_computer_node_name() || return;
- my $image_os_name = $self->data->get_image_os_name() || return;
- my $image_os_type = $self->data->get_image_os_type() || return;
- my $computer_ip_address = $self->data->get_computer_ip_address();
- my $public_ip_configuration = $self->data->get_management_node_public_ip_configuration() || return;
- my $server_request_id = $self->data->get_server_request_id();
- my $server_request_fixedIP = $self->data->get_server_request_fixedIP();
+ my $reservation_id = $self->data->get_reservation_id() || return;
+ my $computer_id = $self->data->get_computer_id() || return;
+ my $computer_node_name = $self->data->get_computer_node_name() || return;
+ my $image_os_name = $self->data->get_image_os_name() || return;
+ my $image_os_type = $self->data->get_image_os_type() || return;
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
+ my $public_ip_configuration = $self->data->get_management_node_public_ip_configuration() || return;
+ my $server_request_id = $self->data->get_server_request_id();
+ my $server_request_fixedIP = $self->data->get_server_request_fixedIP();
if($server_request_id) {
if($server_request_fixedIP) {
@@ -925,7 +925,7 @@ sub server_request_set_fixedIP {
if ($self->can("set_static_public_address")) {
if ($self->set_static_public_address()) {
notify($ERRORS{'DEBUG'}, 0, "set static public IP address on $computer_node_name using OS module's set_static_public_address() method");
- $self->data->set_computer_ip_address($server_request_fixedIP);
+ $self->data->set_computer_public_ip_address($server_request_fixedIP);
# Delete cached network configuration information so it is retrieved next time it is needed
delete $self->{network_configuration};
@@ -1030,21 +1030,21 @@ sub update_public_ip_address {
my $computer_node_name = $self->data->get_computer_node_name() || return;
my $image_os_name = $self->data->get_image_os_name() || return;
my $image_os_type = $self->data->get_image_os_type() || return;
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $public_ip_configuration = $self->data->get_management_node_public_ip_configuration() || return;
if ($public_ip_configuration =~ /dhcp/i) {
notify($ERRORS{'DEBUG'}, 0, "IP configuration is set to $public_ip_configuration, attempting to retrieve dynamic public IP address from $computer_node_name");
- my $public_ip_address;
+ my $retrieved_public_ip_address;
# Try to retrieve the public IP address from the OS module
if (!$self->can("get_public_ip_address")) {
notify($ERRORS{'WARNING'}, 0, "unable to retrieve public IP address from $computer_node_name, OS module " . ref($self) . " does not implement a 'get_public_ip_address' subroutine");
return;
}
- elsif ($public_ip_address = $self->get_public_ip_address()) {
- notify($ERRORS{'DEBUG'}, 0, "retrieved public IP address from $computer_node_name using the OS module: $public_ip_address");
+ elsif ($retrieved_public_ip_address = $self->get_public_ip_address()) {
+ notify($ERRORS{'DEBUG'}, 0, "retrieved public IP address from $computer_node_name using the OS module: $retrieved_public_ip_address");
}
else {
notify($ERRORS{'WARNING'}, 0, "failed to retrieve dynamic public IP address from $computer_node_name");
@@ -1053,21 +1053,21 @@ sub update_public_ip_address {
}
# Update the Datastructure and computer table if the retrieved IP address does not match what is in the database
- if ($computer_ip_address ne $public_ip_address) {
- $self->data->set_computer_ip_address($public_ip_address);
+ if ($computer_public_ip_address ne $retrieved_public_ip_address) {
+ $self->data->set_computer_public_ip_address($retrieved_public_ip_address);
- if (update_computer_public_ip_address($computer_id, $public_ip_address)) {
- notify($ERRORS{'OK'}, 0, "updated dynamic public IP address in computer table for $computer_node_name, $public_ip_address");
- insertloadlog($reservation_id, $computer_id, "dynamicDHCPaddress", "updated dynamic public IP address in computer table for $computer_node_name, $public_ip_address");
+ if (update_computer_public_ip_address($computer_id, $retrieved_public_ip_address)) {
+ notify($ERRORS{'OK'}, 0, "updated dynamic public IP address in computer table for $computer_node_name, $retrieved_public_ip_address");
+ insertloadlog($reservation_id, $computer_id, "dynamicDHCPaddress", "updated dynamic public IP address in computer table for $computer_node_name, $retrieved_public_ip_address");
}
else {
- notify($ERRORS{'WARNING'}, 0, "failed to update dynamic public IP address in computer table for $computer_node_name, $public_ip_address");
- insertloadlog($reservation_id, $computer_id, "dynamicDHCPaddress", "failed to update dynamic public IP address in computer table for $computer_node_name, $public_ip_address");
+ notify($ERRORS{'WARNING'}, 0, "failed to update dynamic public IP address in computer table for $computer_node_name, $retrieved_public_ip_address");
+ insertloadlog($reservation_id, $computer_id, "dynamicDHCPaddress", "failed to update dynamic public IP address in computer table for $computer_node_name, $retrieved_public_ip_address");
return;
}
}
else {
- notify($ERRORS{'DEBUG'}, 0, "public IP address in computer table is already correct for $computer_node_name: $computer_ip_address");
+ notify($ERRORS{'DEBUG'}, 0, "public IP address in computer table is already correct for $computer_node_name: $computer_public_ip_address");
}
}
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=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Thu Jun 19 22:29:02 2014
@@ -728,21 +728,21 @@ sub set_static_public_address {
return;
}
- my $ip_address = $self->data->get_computer_ip_address() || '<undefined>';
- my $subnet_mask = $self->data->get_management_node_public_subnet_mask() || '<undefined>';
- my $default_gateway = $self->data->get_management_node_public_default_gateway() || '<undefined>';
- my @dns_servers = $self->data->get_management_node_public_dns_servers();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address() || '<undefined>';
+ my $subnet_mask = $self->data->get_management_node_public_subnet_mask() || '<undefined>';
+ my $default_gateway = $self->data->get_management_node_public_default_gateway() || '<undefined>';
+ my @dns_servers = $self->data->get_management_node_public_dns_servers();
if ($server_request_fixedIP) {
- $ip_address = $server_request_fixedIP;
- $subnet_mask = $self->data->get_server_request_netmask();
- $default_gateway = $self->data->get_server_request_router();
- @dns_servers = $self->data->get_server_request_DNSservers();
+ $computer_public_ip_address = $server_request_fixedIP;
+ $subnet_mask = $self->data->get_server_request_netmask();
+ $default_gateway = $self->data->get_server_request_router();
+ @dns_servers = $self->data->get_server_request_DNSservers();
}
# Assemble a string containing the static IP configuration
my $configuration_info_string = <<EOF;
-public IP address: $ip_address
+public IP address: $computer_public_ip_address
public subnet mask: $subnet_mask
public default gateway: $default_gateway
public DNS server(s): @dns_servers
@@ -752,12 +752,12 @@ EOF
# Pass the $ignore_error flag to prevent warnings if not defined
my $current_public_ip_address = $self->get_public_ip_address(1);
if ($current_public_ip_address) {
- if ($current_public_ip_address eq $ip_address) {
+ if ($current_public_ip_address eq $computer_public_ip_address) {
notify($ERRORS{'DEBUG'}, 0, "static public IP address does not need to be set, $computer_name is already configured to use $current_public_ip_address");
return 1;
}
else {
- notify($ERRORS{'DEBUG'}, 0, "static public IP address needs to be set, public IP address currently being used by $computer_name $current_public_ip_address does NOT match correct public IP address: $ip_address");
+ notify($ERRORS{'DEBUG'}, 0, "static public IP address needs to be set, public IP address currently being used by $computer_name $current_public_ip_address does NOT match correct public IP address: $computer_public_ip_address");
}
}
else {
@@ -766,7 +766,7 @@ EOF
# Make sure required info was retrieved
- if ("$ip_address $subnet_mask $default_gateway" =~ /undefined/) {
+ if ("$computer_public_ip_address $subnet_mask $default_gateway" =~ /undefined/) {
notify($ERRORS{'WARNING'}, 0, "failed to retrieve required network configuration for $computer_name:\n$configuration_info_string");
return;
}
@@ -776,8 +776,8 @@ EOF
# Try to ping address to make sure it's available
# FIXME -- need to add other tests for checking ip_address is or is not available.
- if ((_pingnode($ip_address))) {
- notify($ERRORS{'WARNING'}, 0, "ip_address $ip_address is pingable, can not assign to $computer_name ");
+ if ((_pingnode($computer_public_ip_address))) {
+ notify($ERRORS{'WARNING'}, 0, "ip_address $computer_public_ip_address is pingable, can not assign to $computer_name ");
return;
}
@@ -790,7 +790,7 @@ EOF
my $ifcfg_contents = <<EOF;
DEVICE=$interface_name
BOOTPROTO=static
-IPADDR=$ip_address
+IPADDR=$computer_public_ip_address
NETMASK=$subnet_mask
GATEWAY=$default_gateway
STARTMODE=onboot
@@ -857,7 +857,7 @@ EOF
$self->remove_lines_from_file($ext_sshd_config_file_path, 'ListenAddress') || return;
# Add ListenAddress line to the end of the file
- $self->append_text_file($ext_sshd_config_file_path, "ListenAddress $ip_address\n") || return;
+ $self->append_text_file($ext_sshd_config_file_path, "ListenAddress $computer_public_ip_address\n") || return;
# Update resolv.conf if DNS server address is configured for the management node
my $resolv_conf_path = "/etc/resolv.conf";
@@ -1311,10 +1311,10 @@ sub is_connected {
return;
}
- my $computer_node_name = $self->data->get_computer_node_name();
- my $identity = $self->data->get_image_identity;
- my $remote_ip = $self->data->get_reservation_remote_ip();
- my $computer_ipaddress = $self->data->get_computer_ip_address();
+ my $computer_node_name = $self->data->get_computer_node_name();
+ my $identity = $self->data->get_image_identity;
+ my $remote_ip = $self->data->get_reservation_remote_ip();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my @SSHCMD = run_ssh_command($computer_node_name, $identity, "netstat -an", "root", 22, 0);
foreach my $line (@{$SSHCMD[1]}) {
@@ -1325,7 +1325,7 @@ sub is_connected {
notify($ERRORS{'WARNING'}, 0, "$line");
return 1;
}
- if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_ipaddress:22)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
+ if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_public_ip_address:22)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
return 1;
}
} ## end foreach my $line (@{$SSHCMD[1]})
@@ -3153,12 +3153,12 @@ sub check_connection_on_port {
return;
}
- my $management_node_keys = $self->data->get_management_node_keys();
- my $computer_node_name = $self->data->get_computer_node_name();
- my $remote_ip = $self->data->get_reservation_remote_ip();
- my $computer_ip_address = $self->data->get_computer_ip_address();
- my $request_state_name = $self->data->get_request_state_name();
- my $username = $self->data->get_user_login_id();
+ my $management_node_keys = $self->data->get_management_node_keys();
+ my $computer_node_name = $self->data->get_computer_node_name();
+ my $remote_ip = $self->data->get_reservation_remote_ip();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
+ my $request_state_name = $self->data->get_request_state_name();
+ my $username = $self->data->get_user_login_id();
my $port = shift;
if (!$port) {
@@ -3182,7 +3182,7 @@ sub check_connection_on_port {
}
return $ret_val;
} ## end if ($line =~ /Connection refused|Permission denied/)
- if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_ip_address:$port)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
+ if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_public_ip_address:$port)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
if ($4 eq $remote_ip) {
$ret_val = "connected";
return $ret_val;
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ESXi.pm Thu Jun 19 22:29:02 2014
@@ -350,7 +350,7 @@ sub check_connection_on_port {
my $computer_node_name = $self->data->get_computer_node_name();
my $remote_ip = $self->data->get_reservation_remote_ip();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $port = shift;
if (!$port) {
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ManagementNode.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ManagementNode.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ManagementNode.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/ManagementNode.pm Thu Jun 19 22:29:02 2014
@@ -85,7 +85,7 @@ sub initialize {
$self->data->set_computer_hostname($management_node_hostname);
$self->data->set_computer_node_name($management_node_short_name);
$self->data->set_computer_short_name($management_node_short_name);
- $self->data->set_computer_ip_address($management_node_ip_address);
+ $self->data->set_computer_public_ip_address($management_node_ip_address);
#print "\n\n" . format_data($self->data->get_request_data()) . "\n\n";
return 1;
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm Thu Jun 19 22:29:02 2014
@@ -643,20 +643,20 @@ sub set_static_public_address {
# Get the IP configuration
my $interface_name = $self->get_public_interface_name() || '<undefined>';
- my $ip_address = $self->data->get_computer_ip_address() || '<undefined>';
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address() || '<undefined>';
my $subnet_mask = $self->data->get_management_node_public_subnet_mask() || '<undefined>';
my $default_gateway = $self->data->get_management_node_public_default_gateway() || '<undefined>';
my @dns_servers = $self->data->get_management_node_public_dns_servers();
if ($server_request_fixedIP) {
- $ip_address = $server_request_fixedIP;
+ $computer_public_ip_address = $server_request_fixedIP;
$subnet_mask = $self->data->get_server_request_netmask();
$default_gateway = $self->data->get_server_request_router();
@dns_servers = $self->data->get_server_request_DNSservers();
}
# Make sure required info was retrieved
- if ("$interface_name $ip_address $subnet_mask $default_gateway" =~ /undefined/) {
+ if ("$interface_name $computer_public_ip_address $subnet_mask $default_gateway" =~ /undefined/) {
notify($ERRORS{'WARNING'}, 0, "failed to retrieve required network configuration for $computer_name");
return;
}
@@ -666,8 +666,8 @@ sub set_static_public_address {
#Try to ping address to make sure it's available
#FIXME -- need to add other tests for checking ip_address is or is not available.
- if(_pingnode($ip_address)) {
- notify($ERRORS{'WARNING'}, 0, "ip_address $ip_address is pingable, can not assign to $computer_name ");
+ if(_pingnode($computer_public_ip_address)) {
+ notify($ERRORS{'WARNING'}, 0, "ip_address $computer_public_ip_address is pingable, can not assign to $computer_name ");
return;
}
@@ -705,7 +705,7 @@ sub set_static_public_address {
if($l =~ /^iface $interface_name/) {
push(@new_interfaces_file, "iface $interface_name inet static\n");
- push(@new_interfaces_file, "address $ip_address\n");
+ push(@new_interfaces_file, "address $computer_public_ip_address\n");
push(@new_interfaces_file, "netmask $subnet_mask\n");
push(@new_interfaces_file, "gateway $default_gateway\n");
}
@@ -777,7 +777,7 @@ sub set_static_public_address {
$self->remove_lines_from_file($ext_sshd_config_file_path, 'ListenAddress') || return;
# Add ListenAddress line to the end of the file
- $self->append_text_file($ext_sshd_config_file_path, "ListenAddress $ip_address\n") || return;
+ $self->append_text_file($ext_sshd_config_file_path, "ListenAddress $computer_public_ip_address\n") || return;
# Update resolv.conf if DNS server address is configured for the management node
my $resolv_conf_path = "/etc/resolv.conf";
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/UnixLab.pm Thu Jun 19 22:29:02 2014
@@ -77,10 +77,10 @@ sub revoke_access {
return 0;
}
- my $computer_ip_address = $self->data->get_computer_ip_address;
- my $computer_node_name = $self->data->get_computer_node_name();
- my $user_login_id = $self->data->get_user_login_id();
- my $identity = $self->data->get_image_identity();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address;
+ my $computer_node_name = $self->data->get_computer_node_name();
+ my $user_login_id = $self->data->get_user_login_id();
+ my $identity = $self->data->get_image_identity();
if (!$user_login_id) {
notify($ERRORS{'WARNING'}, 0, "user could not be determined");
@@ -104,7 +104,7 @@ sub revoke_access {
my @lines;
my $l;
# create clientdata file
- my $clientdata = "/tmp/clientdata.$computer_ip_address";
+ my $clientdata = "/tmp/clientdata.$computer_public_ip_address";
if (open(CLIENTDATA, ">$clientdata")) {
print CLIENTDATA "$state\n";
print CLIENTDATA "$user_login_id\n";
@@ -112,20 +112,20 @@ sub revoke_access {
close CLIENTDATA;
# scp to hostname
- my $target = "vclstaff\@$computer_ip_address:/home/vclstaff/clientdata";
+ my $target = "vclstaff\@$computer_public_ip_address:/home/vclstaff/clientdata";
if (run_scp_command($clientdata, $target, $identity, "24")) {
notify($ERRORS{'OK'}, 0, "Success copied $clientdata to $target");
unlink($clientdata);
# send flag to activate changes
- my @sshcmd = run_ssh_command($computer_ip_address, $identity, "echo 1 > /home/vclstaff/flag", "vclstaff", "24");
- notify($ERRORS{'OK'}, 0, "setting flag to 1 on $computer_ip_address");
+ my @sshcmd = run_ssh_command($computer_public_ip_address, $identity, "echo 1 > /home/vclstaff/flag", "vclstaff", "24");
+ notify($ERRORS{'OK'}, 0, "setting flag to 1 on $computer_public_ip_address");
my $nmapchecks = 0;
# return nmap check
NMAPPORT:
- if (!(nmap_port($computer_ip_address, 22))) {
+ if (!(nmap_port($computer_public_ip_address, 22))) {
return 1;
}
else {
@@ -136,10 +136,10 @@ sub revoke_access {
goto NMAPPORT;
}
else {
- notify($ERRORS{'WARNING'}, 0, "port 22 never closed on client $computer_ip_address");
+ notify($ERRORS{'WARNING'}, 0, "port 22 never closed on client $computer_public_ip_address");
return 0;
}
- } ## end else [ if (!(nmap_port($computer_ip_address, 22)))
+ } ## end else [ if (!(nmap_port($computer_public_ip_address, 22)))
} ## end if (run_scp_command($clientdata, $target, ...
else {
notify($ERRORS{'OK'}, 0, "could not copy src=$clientdata to target=$target");
@@ -147,7 +147,7 @@ sub revoke_access {
}
} ## end if (open(CLIENTDATA, ">$clientdata"))
else {
- notify($ERRORS{'WARNING'}, 0, "could not open /tmp/clientdata.$computer_ip_address $! ");
+ notify($ERRORS{'WARNING'}, 0, "could not open /tmp/clientdata.$computer_public_ip_address $! ");
return 0;
}
@@ -192,12 +192,12 @@ sub grant_access {
return 0;
}
- my $user = $self->data->get_user_login_id();
- my $computer_node_name = $self->data->get_computer_node_name();
- my $computer_ip_address = $self->data->get_computer_ip_address;
- my $identity = $self->data->get_image_identity;
- my $remoteIP = $self->data->get_reservation_remote_ip();
- my $state = "new";
+ my $user = $self->data->get_user_login_id();
+ my $computer_node_name = $self->data->get_computer_node_name();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address;
+ my $identity = $self->data->get_image_identity;
+ my $remoteIP = $self->data->get_reservation_remote_ip();
+ my $state = "new";
notify($ERRORS{'OK'}, 0, "In grant_access routine $user,$computer_node_name");
@@ -205,7 +205,7 @@ sub grant_access {
my ($package, $filename, $line, $sub) = caller(0);
# create clientdata file
- my $clientdata = "/tmp/clientdata.$computer_ip_address";
+ my $clientdata = "/tmp/clientdata.$computer_public_ip_address";
if (open(CLIENTDATA, ">$clientdata")) {
print CLIENTDATA "$state\n";
print CLIENTDATA "$user\n";
@@ -213,19 +213,19 @@ sub grant_access {
close CLIENTDATA;
# scp to hostname
- my $target = "vclstaff\@$computer_ip_address:/home/vclstaff/clientdata";
+ my $target = "vclstaff\@$computer_public_ip_address:/home/vclstaff/clientdata";
if (run_scp_command($clientdata, $target, $identity, "24")) {
notify($ERRORS{'OK'}, 0, "Success copied $clientdata to $target");
unlink($clientdata);
# send flag to activate changes
- my @sshcmd = run_ssh_command($computer_ip_address, $identity, "echo 1 > /home/vclstaff/flag", "vclstaff", "24");
- notify($ERRORS{'OK'}, 0, "setting flag to 1 on $computer_ip_address");
+ my @sshcmd = run_ssh_command($computer_public_ip_address, $identity, "echo 1 > /home/vclstaff/flag", "vclstaff", "24");
+ notify($ERRORS{'OK'}, 0, "setting flag to 1 on $computer_public_ip_address");
my $nmapchecks = 0;
NMAPPORT:
- if (nmap_port($computer_ip_address, 22)) {
+ if (nmap_port($computer_public_ip_address, 22)) {
notify($ERRORS{'OK'}, 0, "sshd opened");
return 1;
}
@@ -237,10 +237,10 @@ sub grant_access {
goto NMAPPORT;
}
else {
- notify($ERRORS{'WARNING'}, 0, "port 22 never opened on client $computer_ip_address");
+ notify($ERRORS{'WARNING'}, 0, "port 22 never opened on client $computer_public_ip_address");
return 0;
}
- } ## end else [ if (nmap_port($computer_ip_address, 22))
+ } ## end else [ if (nmap_port($computer_public_ip_address, 22))
} ## end if (run_scp_command($clientdata, $target, ...
else {
notify($ERRORS{'WARNING'}, 0, "could not copy src=$clientdata to target= $target");
@@ -248,7 +248,7 @@ sub grant_access {
}
} ## end if (open(CLIENTDATA, ">$clientdata"))
else {
- notify($ERRORS{'WARNING'}, 0, "could not open /tmp/clientdata.$computer_ip_address $! ");
+ notify($ERRORS{'WARNING'}, 0, "could not open /tmp/clientdata.$computer_public_ip_address $! ");
return 0;
}
@@ -354,7 +354,7 @@ sub check_connection_on_port {
my $management_node_keys = $self->data->get_management_node_keys();
my $computer_node_name = $self->data->get_computer_node_name();
my $remote_ip = $self->data->get_reservation_remote_ip();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $request_state_name = $self->data->get_request_state_name();
my $port = shift;
@@ -379,7 +379,7 @@ sub check_connection_on_port {
}
return $ret_val;
} ## end if ($line =~ /Connection refused|Permission denied/)
- if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_ip_address:$port)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
+ if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s($computer_public_ip_address:$port)\s+([.0-9]*):([0-9]*)(.*)(ESTABLISHED)/) {
if ($4 eq $remote_ip) {
$ret_val = "connected";
return $ret_val;
@@ -390,7 +390,7 @@ sub check_connection_on_port {
return $ret_val;
}
} # Linux
- if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s::ffff:($computer_ip_address:$port)\s+::ffff:([.0-9]*):([0-9]*)(.*)(ESTABLISHED) /) {
+ if ($line =~ /tcp\s+([0-9]*)\s+([0-9]*)\s::ffff:($computer_public_ip_address:$port)\s+::ffff:([.0-9]*):([0-9]*)(.*)(ESTABLISHED) /) {
if ($4 eq $remote_ip) {
$ret_val = "connected";
return $ret_val;
@@ -401,7 +401,7 @@ sub check_connection_on_port {
return $ret_val;
}
} ##
- if ($line =~ /\s*($computer_ip_address\.$port)\s+([.0-9]*)\.([0-9]*)(.*)(ESTABLISHED)/) {
+ if ($line =~ /\s*($computer_public_ip_address\.$port)\s+([.0-9]*)\.([0-9]*)(.*)(ESTABLISHED)/) {
if ($4 eq $remote_ip) {
$ret_val = "connected";
return $ret_val;
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/OSX.pm Thu Jun 19 22:29:02 2014
@@ -817,7 +817,7 @@ sub check_connection_on_port {
my $computer_node_name = $self->data->get_computer_node_name();
my $remote_ip = $self->data->get_reservation_remote_ip();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $port = shift;
if (!$port) {
@@ -833,7 +833,7 @@ sub check_connection_on_port {
foreach my $line (@{$output}) {
- if ($line =~ /tcp4\s+([0-9]*)\s+([0-9]*)\s+($computer_ip_address.$port)\s+($remote_ip).([0-9]*)(.*)(ESTABLISHED)/) {
+ if ($line =~ /tcp4\s+([0-9]*)\s+([0-9]*)\s+($computer_public_ip_address.$port)\s+($remote_ip).([0-9]*)(.*)(ESTABLISHED)/) {
$ret_val = "connected";
}
}
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=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Windows.pm Thu Jun 19 22:29:02 2014
@@ -8386,13 +8386,13 @@ sub set_static_public_address {
# Get the IP configuration
my $interface_name = $self->get_public_interface_name() || '<undefined>';
- my $ip_address = $self->data->get_computer_ip_address() || '<undefined>';
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address() || '<undefined>';
my $subnet_mask = $self->data->get_management_node_public_subnet_mask() || '<undefined>';
my $default_gateway = $self->data->get_management_node_public_default_gateway() || '<undefined>';
my @dns_servers = $self->data->get_management_node_public_dns_servers();
if ($server_request_fixedIP) {
- $ip_address = $server_request_fixedIP;
+ $computer_public_ip_address = $server_request_fixedIP;
$subnet_mask = $self->data->get_server_request_netmask();
$default_gateway = $self->data->get_server_request_router();
@dns_servers = $self->data->get_server_request_DNSservers();
@@ -8401,14 +8401,14 @@ sub set_static_public_address {
# Assemble a string containing the static IP configuration
my $configuration_info_string = <<EOF;
public interface name: $interface_name
-public IP address: $ip_address
+public IP address: $computer_public_ip_address
public subnet mask: $subnet_mask
public default gateway: $default_gateway
public DNS server(s): @dns_servers
EOF
# Make sure required info was retrieved
- if ("$interface_name $ip_address $subnet_mask $default_gateway" =~ /undefined/) {
+ if ("$interface_name $computer_public_ip_address $subnet_mask $default_gateway" =~ /undefined/) {
notify($ERRORS{'WARNING'}, 0, "failed to retrieve required network configuration for $computer_name:\n$configuration_info_string");
return;
}
@@ -8418,8 +8418,8 @@ EOF
#Try to ping address to make sure it's available
#FIXME -- need to add other tests for checking ip_address is or is not available.
- if(_pingnode($ip_address)) {
- notify($ERRORS{'WARNING'}, 0, "ip_address $ip_address is pingable, can not assign to $computer_name ");
+ if(_pingnode($computer_public_ip_address)) {
+ notify($ERRORS{'WARNING'}, 0, "ip_address $computer_public_ip_address is pingable, can not assign to $computer_name ");
return;
}
@@ -8433,7 +8433,7 @@ EOF
delete $self->{network_configuration};
# Set the static public IP address
- my $command = "$system32_path/netsh.exe interface ip set address name=\"$interface_name\" source=static addr=$ip_address mask=$subnet_mask gateway=$default_gateway gwmetric=0";
+ my $command = "$system32_path/netsh.exe interface ip set address name=\"$interface_name\" source=static addr=$computer_public_ip_address mask=$subnet_mask gateway=$default_gateway gwmetric=0";
# Set the static DNS server address
$command .= " && $system32_path/netsh.exe interface ip set dns name=\"$interface_name\" source=static addr=$primary_dns_server_address register=none";
@@ -11043,10 +11043,10 @@ sub check_connection_on_port {
return;
}
- my $management_node_keys = $self->data->get_management_node_keys();
- my $computer_node_name = $self->data->get_computer_node_name();
- my $remote_ip = $self->data->get_reservation_remote_ip();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $management_node_keys = $self->data->get_management_node_keys();
+ my $computer_node_name = $self->data->get_computer_node_name();
+ my $remote_ip = $self->data->get_reservation_remote_ip();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $request_state_name = $self->data->get_request_state_name();
my $port = shift;
@@ -11074,7 +11074,7 @@ sub check_connection_on_port {
return $ret_val;
} ## end if ($line =~ /Connection refused|Permission denied/)
- if ($line =~ /\s+($computer_ip_address:$port)\s+([.0-9]*):([0-9]*)\s+(ESTABLISHED)/) {
+ if ($line =~ /\s+($computer_public_ip_address:$port)\s+([.0-9]*):([0-9]*)\s+(ESTABLISHED)/) {
if ($2 eq $remote_ip) {
$ret_val = "connected";
return $ret_val;
Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/Lab.pm Thu Jun 19 22:29:02 2014
@@ -141,7 +141,7 @@ sub node_status {
my $self = shift;
my ($computer_node_name, $log);
- my ($management_node_os_name, $management_node_keys, $computer_host_name, $computer_short_name, $computer_ip_address, $image_os_name);
+ my ($management_node_os_name, $management_node_keys, $computer_host_name, $computer_short_name, $computer_public_ip_address, $image_os_name);
# Check if subroutine was called as a class method
if (ref($self) !~ /lab/i) {
@@ -154,12 +154,12 @@ sub node_status {
notify($ERRORS{'DEBUG'}, 0, "self is a array reference");
}
- $computer_node_name = $self->{hostname};
- $management_node_os_name = $self->{managementnode}->{OSNAME};
- $management_node_keys = $self->{managementnode}->{keys};
- $computer_host_name = $self->{hostname};
- $computer_ip_address = $self->{IPaddress};
- $image_os_name = $self->{currentimage}->{OS}->{name};
+ $computer_node_name = $self->{hostname};
+ $management_node_os_name = $self->{managementnode}->{OSNAME};
+ $management_node_keys = $self->{managementnode}->{keys};
+ $computer_host_name = $self->{hostname};
+ $computer_public_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]*)(\.?)/);
@@ -171,21 +171,23 @@ sub node_status {
# Check if this was called as a class method, but a node name was also specified as an argument
my $node_name_argument = shift;
- $computer_node_name = $node_name_argument if $node_name_argument;
- $management_node_os_name = $self->data->get_management_node_os_name();
- $management_node_keys = $self->data->get_management_node_keys();
- $computer_host_name = $self->data->get_computer_host_name();
- $computer_short_name = $self->data->get_computer_short_name();
- $computer_ip_address = $self->data->get_computer_ip_address();
- $image_os_name = $self->data->get_image_os_name();
- $log = 0;
+ $computer_node_name = $node_name_argument if $node_name_argument;
+
+ $management_node_os_name = $self->data->get_management_node_os_name();
+ $management_node_keys = $self->data->get_management_node_keys();
+ $computer_host_name = $self->data->get_computer_host_name();
+ $computer_short_name = $self->data->get_computer_short_name();
+ $computer_public_ip_address = $self->data->get_computer_public_ip_address();
+ $image_os_name = $self->data->get_image_os_name();
+
+ $log = 0;
} ## end else [ if (ref($self) !~ /lab/i)
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, "computer_public_ip_address= $computer_public_ip_address");
notify($ERRORS{'DEBUG'}, $log, "management_node_keys= $management_node_keys");
@@ -209,7 +211,7 @@ sub node_status {
# Check if host is listed in management node's known_hosts file
notify($ERRORS{'DEBUG'}, $log, "checking if $computer_host_name in management node known_hosts file");
- if (known_hosts($computer_host_name, $management_node_os_name, $computer_ip_address)) {
+ if (known_hosts($computer_host_name, $management_node_os_name, $computer_public_ip_address)) {
notify($ERRORS{'OK'}, $log, "$computer_host_name public key added to management node known_hosts file");
}
else {
@@ -218,31 +220,31 @@ sub node_status {
# Check if node is pingable
- notify($ERRORS{'DEBUG'}, $log, "checking if $computer_ip_address is pingable");
- if (_pingnode($computer_ip_address)) {
- notify($ERRORS{'OK'}, $log, "$computer_ip_address is pingable");
+ notify($ERRORS{'DEBUG'}, $log, "checking if $computer_public_ip_address is pingable");
+ if (_pingnode($computer_public_ip_address)) {
+ notify($ERRORS{'OK'}, $log, "$computer_public_ip_address is pingable");
$status{ping} = 1;
}
else {
- notify($ERRORS{'OK'}, $log, "$computer_ip_address is not pingable");
+ notify($ERRORS{'OK'}, $log, "$computer_public_ip_address is not pingable");
$status{ping} = 0;
}
# Check if sshd is open on the admin port (24)
- notify($ERRORS{'DEBUG'}, $log, "checking if $computer_ip_address sshd admin port 24 is accessible");
- if (check_ssh($computer_ip_address, 24, $log)) {
- notify($ERRORS{'OK'}, $log, "$computer_ip_address admin sshd port 24 is accessible");
+ notify($ERRORS{'DEBUG'}, $log, "checking if $computer_public_ip_address sshd admin port 24 is accessible");
+ if (check_ssh($computer_public_ip_address, 24, $log)) {
+ notify($ERRORS{'OK'}, $log, "$computer_public_ip_address admin sshd port 24 is accessible");
# Run uname -n to make sure ssh is usable
- notify($ERRORS{'OK'}, $log, "checking if ssh command can be run on $computer_ip_address");
- my ($uname_exit_status, $uname_output) = run_ssh_command($computer_ip_address, $management_node_keys, "uname -n", "vclstaff", 24);
+ notify($ERRORS{'OK'}, $log, "checking if ssh command can be run on $computer_public_ip_address");
+ my ($uname_exit_status, $uname_output) = run_ssh_command($computer_public_ip_address, $management_node_keys, "uname -n", "vclstaff", 24);
if (!defined($uname_output) || !$uname_output) {
- notify($ERRORS{'WARNING'}, $log, "unable to run 'uname -n' ssh command on $computer_ip_address");
+ notify($ERRORS{'WARNING'}, $log, "unable to run 'uname -n' ssh command on $computer_public_ip_address");
$status{ssh} = 0;
}
else {
- notify($ERRORS{'OK'}, $log, "successfully ran 'uname -n' ssh command on $computer_ip_address");
+ notify($ERRORS{'OK'}, $log, "successfully ran 'uname -n' ssh command on $computer_public_ip_address");
$status{ssh} = 1;
}
@@ -258,10 +260,10 @@ sub node_status {
#}
# Check if is VCL client daemon is running
- notify($ERRORS{'OK'}, $log, "checking if VCL client daemon is running on $computer_ip_address");
- my ($pgrep_exit_status, $pgrep_output) = run_ssh_command($computer_ip_address, $management_node_keys, "pgrep vclclient", "vclstaff", 24);
+ notify($ERRORS{'OK'}, $log, "checking if VCL client daemon is running on $computer_public_ip_address");
+ my ($pgrep_exit_status, $pgrep_output) = run_ssh_command($computer_public_ip_address, $management_node_keys, "pgrep vclclient", "vclstaff", 24);
if (!defined($pgrep_output) || !$pgrep_output) {
- notify($ERRORS{'WARNING'}, $log, "unable to run 'pgrep vclclient' command on $computer_ip_address");
+ notify($ERRORS{'WARNING'}, $log, "unable to run 'pgrep vclclient' command on $computer_public_ip_address");
$status{vcl_client} = 0;
}
@@ -275,9 +277,9 @@ sub node_status {
notify($ERRORS{'WARNING'}, $log, "VCL client daemon is not running, unable to find running process in 'pgrep vclclient' output:\n$pgrep_output_string");
$status{vcl_client} = 0;
}
- } ## end if (check_ssh($computer_ip_address, 24, $log...
+ } ## end if (check_ssh($computer_public_ip_address, 24, $log...
else {
- notify($ERRORS{'WARNING'}, $log, "$computer_ip_address sshd admin port 24 is not accessible");
+ notify($ERRORS{'WARNING'}, $log, "$computer_public_ip_address sshd admin port 24 is not accessible");
$status{ssh} = 0;
$status{vcl_client} = 0;
}
@@ -288,7 +290,7 @@ sub node_status {
}
else {
# Lab machine is not available, return undefined to indicate error occurred
- notify($ERRORS{'WARNING'}, 0, "lab machine $computer_host_name ($computer_ip_address) is not available");
+ notify($ERRORS{'WARNING'}, 0, "lab machine $computer_host_name ($computer_public_ip_address) is not available");
$status{status} = 'RELOAD';
}
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=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm Thu Jun 19 22:29:02 2014
@@ -132,7 +132,7 @@ sub load {
my $vmclient_imageminram = $self->data->get_image_minram;
my $vmhost_RAM = $self->data->get_vmhost_ram;
my $vmclient_drivetype = $self->data->get_computer_drive_type;
- my $vmclient_privateIPaddress = $self->data->get_computer_ip_address;
+ my $vmclient_privateIPaddress = $self->data->get_computer_public_ip_address;
my $vmclient_publicIPaddress = $self->data->get_computer_private_ip_address;
my $vmclient_OSname = $self->data->get_image_os_name;
Modified: vcl/trunk/managementnode/lib/VCL/inuse.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/inuse.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/inuse.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/inuse.pm Thu Jun 19 22:29:02 2014
@@ -458,7 +458,7 @@ sub _notify_user_endtime {
my $computer_short_name = $self->data->get_computer_short_name();
my $computer_type = $self->data->get_computer_type();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $image_os_name = $self->data->get_image_os_name();
my $image_prettyname = $self->data->get_image_prettyname();
my $image_os_type = $self->data->get_image_os_type();
@@ -539,7 +539,7 @@ EOF
} ## end if ($computer_type =~ /blade|virtualmachine/)
elsif ($computer_type eq "lab") {
# Notify via wall
- notify_via_wall($computer_ip_address, $user_login_id, $short_message, $image_os_name, $computer_type);
+ notify_via_wall($computer_public_ip_address, $user_login_id, $short_message, $image_os_name, $computer_type);
}
# Send IM
@@ -579,7 +579,7 @@ sub _notify_user_disconnect {
my $computer_short_name = $self->data->get_computer_short_name();
my $computer_type = $self->data->get_computer_type();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $image_os_name = $self->data->get_image_os_name();
my $image_prettyname = $self->data->get_image_prettyname();
my $image_os_type = $self->data->get_image_os_type();
@@ -700,7 +700,7 @@ EOF
} ## end if ($computer_type =~ /blade|virtualmachine/)
elsif ($computer_type eq "lab") {
# Notify via wall
- notify_via_wall($computer_ip_address, $user_login_id, $short_message, $image_os_name, $computer_type);
+ notify_via_wall($computer_public_ip_address, $user_login_id, $short_message, $image_os_name, $computer_type);
}
return 1;
@@ -722,7 +722,7 @@ sub _notify_user_timeout {
my $computer_short_name = $self->data->get_computer_short_name();
my $computer_type = $self->data->get_computer_type();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $image_os_name = $self->data->get_image_os_name();
my $image_prettyname = $self->data->get_image_prettyname();
my $image_os_type = $self->data->get_image_os_type();
@@ -737,7 +737,7 @@ sub _notify_user_timeout {
my $message = <<"EOF";
-Your reservation has timed out due to inactivity for image $image_prettyname at address $computer_ip_address.
+Your reservation has timed out due to inactivity for image $image_prettyname at address $computer_public_ip_address.
To make another reservation, please revisit:
$user_affiliation_sitewwwaddress
@@ -797,7 +797,7 @@ sub _notify_user_request_ended {
my $computer_id = $self->data->get_computer_id();
my $computer_short_name = $self->data->get_computer_short_name();
my $computer_type = $self->data->get_computer_type();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $image_os_name = $self->data->get_image_os_name();
my $image_prettyname = $self->data->get_image_prettyname();
my $image_os_type = $self->data->get_image_os_type();
@@ -902,12 +902,12 @@ sub _notify_user_no_login {
my $affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress();
my $affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress();
my $image_prettyname = $self->data->get_image_prettyname();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $is_parent_reservation = $self->data->is_parent_reservation();
my $message = <<"EOF";
-Your reservation has timed out for image $image_prettyname at address $computer_ip_address because no initial connection was made.
+Your reservation has timed out for image $image_prettyname at address $computer_public_ip_address because no initial connection was made.
To make another reservation, please revisit $affiliation_sitewwwaddress.
Modified: vcl/trunk/managementnode/lib/VCL/new.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/new.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/new.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/new.pm Thu Jun 19 22:29:02 2014
@@ -940,14 +940,14 @@ sub reserve_computer {
# Retrieve the computer IP address after reserve() is called because it may change
# Reserve may retrieve a dynamically assigned IP address and should update the DataStructure object
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
# Update sublog table with the IP address of the machine
- if (update_sublog_ipaddress($request_logid, $computer_ip_address)) {
- notify($ERRORS{'DEBUG'}, 0, "updated computer IP address in sublog table, log ID: $request_logid, IP address: $computer_ip_address");
+ if (update_sublog_ipaddress($request_logid, $computer_public_ip_address)) {
+ notify($ERRORS{'DEBUG'}, 0, "updated computer IP address in sublog table, log ID: $request_logid, IP address: $computer_public_ip_address");
}
else {
- notify($ERRORS{'WARNING'}, 0, "could not update sublog $request_logid for node $computer_short_name IP address $computer_ip_address");
+ notify($ERRORS{'WARNING'}, 0, "could not update sublog $request_logid for node $computer_short_name IP address $computer_public_ip_address");
}
# Check if request has been deleted
Modified: vcl/trunk/managementnode/lib/VCL/reserved.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/reserved.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/reserved.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/reserved.pm Thu Jun 19 22:29:02 2014
@@ -284,12 +284,12 @@ sub _notify_user_timeout {
my $affiliation_sitewwwaddress = $self->data->get_user_affiliation_sitewwwaddress();
my $affiliation_helpaddress = $self->data->get_user_affiliation_helpaddress();
my $image_prettyname = $self->data->get_image_prettyname();
- my $computer_ip_address = $self->data->get_computer_ip_address();
+ my $computer_public_ip_address = $self->data->get_computer_public_ip_address();
my $is_parent_reservation = $self->data->is_parent_reservation();
my $message = <<"EOF";
-Your reservation has timed out for image $image_prettyname at address $computer_ip_address because no initial connection was made.
+Your reservation has timed out for image $image_prettyname at address $computer_public_ip_address because no initial connection was made.
To make another reservation, please revisit $affiliation_sitewwwaddress.
Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1604043&r1=1604042&r2=1604043&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Thu Jun 19 22:29:02 2014
@@ -4997,7 +4997,8 @@ sub update_lastcheckin {
Parameters : $computer_id, $private_ip_address
Returns : boolean
Description : Updates the computer.privateIPaddress value of the computer
- specified by the argument.
+ specified by the argument. The value can be set to null by
+ passing 'null' as the argument.
=cut
@@ -5006,19 +5007,27 @@ sub update_computer_private_ip_address {
if (!defined($computer_id)) {
notify($ERRORS{'WARNING'}, 0, "computer ID argument was not specified");
- return
+ return;
}
if (!defined($private_ip_address)) {
notify($ERRORS{'WARNING'}, 0, "private IP address argument was not specified");
- return ();
+ return;
}
-
+
+ my $private_ip_address_text;
+ if ($private_ip_address =~ /null/i) {
+ $private_ip_address_text = 'NULL';
+ }
+ else {
+ $private_ip_address_text = "'$private_ip_address'";
+ }
+
# Construct the update statement
my $update_statement = <<EOF;
UPDATE
computer
SET
-privateIPaddress = '$private_ip_address'
+privateIPaddress = $private_ip_address_text
WHERE
id = $computer_id
EOF
@@ -5050,11 +5059,11 @@ sub update_computer_public_ip_address {
if (!defined($computer_id)) {
notify($ERRORS{'WARNING'}, 0, "computer ID argument was not specified");
- return
+ return;
}
if (!defined($public_ip_address)) {
notify($ERRORS{'WARNING'}, 0, "public IP address argument was not specified");
- return ();
+ return;
}
# Construct the update statement
@@ -5846,7 +5855,7 @@ sub clearfromblockrequest {
=head2 update_sublog_ipaddress
- Parameters : $computer_id
+ Parameters : $computer_id, $computer_public_ip_address
Returns : 0 or 1
Description : updates log table with IPaddress of node when dynamic dhcp is
enabled there is no way to track which IP was used
@@ -5854,11 +5863,11 @@ sub clearfromblockrequest {
=cut
sub update_sublog_ipaddress {
- my ($logid, $computer_ip_address) = @_;
+ my ($logid, $computer_public_ip_address) = @_;
my ($package, $filename, $line, $sub) = caller(0);
# Check the passed parameter
- if (!(defined($computer_ip_address))) {
- notify($ERRORS{'WARNING'}, 0, "computer_ip_address was not specified");
+ if (!(defined($computer_public_ip_address))) {
+ notify($ERRORS{'WARNING'}, 0, "computer public IP address argument was not specified");
return 0;
}
if (!(defined($logid))) {
@@ -5867,14 +5876,14 @@ sub update_sublog_ipaddress {
}
# Construct the SQL statement
- my $sql_statement = "UPDATE sublog SET IPaddress = \'$computer_ip_address\' WHERE logid=$logid";
+ my $sql_statement = "UPDATE sublog SET IPaddress = \'$computer_public_ip_address\' WHERE logid=$logid";
# Call the database execute subroutine
if (database_execute($sql_statement)) {
return 1;
}
else {
- notify($ERRORS{'WARNING'}, 0, "unable to update sublog table logid = $logid with ipaddress $computer_ip_address");
+ notify($ERRORS{'WARNING'}, 0, "unable to update sublog table logid = $logid with ipaddress $computer_public_ip_address");
return 0;
}
} ## end sub update_sublog_ipaddress
@@ -8286,7 +8295,7 @@ sub is_valid_ip_address {
return 0;
}
- notify($ERRORS{'DEBUG'}, 0, "IP address is valid: $ip_address");
+ #notify($ERRORS{'DEBUG'}, 0, "IP address is valid: $ip_address");
return 1;
}