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 2015/02/05 23:47:06 UTC
svn commit: r1657707 - in /vcl/trunk/managementnode/lib/VCL/Module: OS.pm
OS/Linux/firewall/iptables.pm
Author: arkurth
Date: Thu Feb 5 22:47:06 2015
New Revision: 1657707
URL: http://svn.apache.org/r1657707
Log:
VCL-174
Fixed issue with iptables.pm::configure_nat. It didn't have access to the nathost table information when called via nathost_os. Changed it to accept $public_ip_address and $internal_ip_address arguments.
Modified:
vcl/trunk/managementnode/lib/VCL/Module/OS.pm
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS.pm?rev=1657707&r1=1657706&r2=1657707&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS.pm Thu Feb 5 22:47:06 2015
@@ -2805,6 +2805,7 @@ sub process_connect_methods {
my $computer_node_name = $self->data->get_computer_node_name();
my $nathost_hostname = $self->data->get_nathost_hostname(0);
my $nathost_public_ip_address = $self->data->get_nathost_public_ip_address(0);
+ my $nathost_internal_ip_address = $self->data->get_nathost_internal_ip_address(0);
# Retrieve the connect method info hash
my $connect_method_info = $self->data->get_connect_methods();
@@ -2843,6 +2844,14 @@ sub process_connect_methods {
notify($ERRORS{'WARNING'}, 0, "unable to process connect methods, $computer_node_name is assigned to NAT host $nathost_hostname but NAT host OS's firewall object is not available");
return;
}
+ elsif (!$nathost_public_ip_address) {
+ notify($ERRORS{'WARNING'}, 0, "unable to process connect methods, $computer_node_name is assigned to NAT host $nathost_hostname but NAT host public IP address could not be determined from the nathost table");
+ return;
+ }
+ elsif (!$nathost_internal_ip_address) {
+ notify($ERRORS{'WARNING'}, 0, "unable to process connect methods, $computer_node_name is assigned to NAT host $nathost_hostname but NAT host internal IP address could not be determined from the nathost table");
+ return;
+ }
# Get the IP address used to communicate between the NAT host and computer
$computer_ip_address = $self->get_public_ip_address();
@@ -2852,15 +2861,20 @@ sub process_connect_methods {
}
# Perform general NAT configuration
- if ($self->nathost_os->firewall->can('configure_nat')) {
- if (!$self->nathost_os->firewall->configure_nat()) {
- notify($ERRORS{'WARNING'}, 0, "unable to process connect methods, failed to configure NAT on $nathost_hostname");
+ if ($nathost_internal_ip_address) {
+ if ($self->nathost_os->firewall->can('configure_nat')) {
+ if (!$self->nathost_os->firewall->configure_nat($nathost_public_ip_address, $nathost_internal_ip_address)) {
+ notify($ERRORS{'WARNING'}, 0, "unable to process connect methods, failed to configure NAT on $nathost_hostname");
+ return;
+ }
+ }
+ else {
+ notify($ERRORS{'CRITICAL'}, 0, "NAT not configured on $nathost_hostname, " . ref($self->nathost_os->firewall) . " does not implement a 'configure_nat' subroutine");
return;
}
}
else {
- notify($ERRORS{'CRITICAL'}, 0, "NAT not configured on $nathost_hostname, " . ref($self->nathost_os->firewall) . " does not implement a 'configure_nat' subroutine");
- return;
+ notify($ERRORS{'DEBUG'}, 0, "unable to configure NAT, nathost.publicIPaddress is not set in the database for $nathost_hostname");
}
# Perform reservation-specific NAT configuration
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm?rev=1657707&r1=1657706&r2=1657707&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/firewall/iptables.pm Thu Feb 5 22:47:06 2015
@@ -580,7 +580,7 @@ sub get_table_info {
=head2 configure_nat
- Parameters : none
+ Parameters : $public_ip_address, $internal_ip_address
Returns : boolean
Description :
@@ -595,11 +595,14 @@ sub configure_nat {
my $computer_name = $self->data->get_computer_hostname();
- my $public_ip_address = $self->os->data->get_nathost_public_ip_address();
- my $internal_ip_address = $self->os->data->get_nathost_internal_ip_address(0);
+ my ($public_ip_address, $internal_ip_address) = @_;
+ if (!$public_ip_address) {
+ notify($ERRORS{'WARNING'}, 0, "unable to automatically configure NAT, nathost public IP address argument was not specified");
+ return;
+ }
if (!$internal_ip_address) {
- notify($ERRORS{'DEBUG'}, 0, "unable to automatically configure NAT, nathost.internalIPaddress is not set");
- return 1;
+ notify($ERRORS{'WARNING'}, 0, "unable to automatically configure NAT, nathost internal IP address argument was not specified");
+ return;
}
# Enable IP port forwarding