Author: fapeeler
Date: Fri Jul 16 14:25:33 2010
New Revision: 964807

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

Moved ipconfiguration to database


Modified:
    incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm
    incubator/vcl/trunk/managementnode/lib/VCL/new.pm
    incubator/vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf (original)
+++ incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf Fri Jul 16 14:25:33 
2010
@@ -155,21 +155,6 @@ jabResource=vcl
 # Windows node root password
 WINDOWS_ROOT_PASSWORD=cl0udy
 
-#ip address configuration
-# for sites that use Dynamic DHCP or static address assignment.
-# default is Manual DHCP
-# options are:
-# manualDHCP -- address is statically assigned in dhcp server
-# dynamicDHCP -- address is dynamically assigned from dhcp server
-# static --   when public dhcp server is not available, assigments are made
-
-ipconfiguration=dynamicDHCP
-
-#dependiences for static assignments - required if set to static
-# DNSserver can be comma delimited up to three entries
-#DNSserver=
-#GATEWAY=
-#NETMASK=
 #ETHDEVICE=eth1
 
 # NOT_STANDALONE:

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Fri Jul 16 
14:25:33 2010
@@ -125,6 +125,7 @@ sub pre_capture {
        my $user_unityid             = $self->data->get_user_login_id();
        my $managementnode_shortname = 
$self->data->get_management_node_short_name();
        my $computer_private_ip      = 
$self->data->get_computer_private_ip_address();
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        notify($ERRORS{'OK'}, 0, "beginning Linux-specific image capture 
preparation tasks: $image_name on $computer_short_name");
 
@@ -150,7 +151,7 @@ sub pre_capture {
                notify($ERRORS{'WARNING'}, 0, "unable to clear known identity 
keys");
        }
 
-       if ($IPCONFIGURATION eq "static") {
+       if ($ip_configuration eq "static") {
                #so we don't have conflicts we should set the public adapter 
back to dhcp
                # reset ifcfg-eth1 back to dhcp
                # when boot strap it will be set to dhcp
@@ -174,7 +175,7 @@ sub pre_capture {
                }
                if (unlink($tmpfile)) {
                }
-       } ## end if ($IPCONFIGURATION eq "static")
+       } ## end if ($ip_configuration eq "static")
 
        #Write /etc/rc.local script
        if(!$self->generate_rc_local()){

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm Fri 
Jul 16 14:25:33 2010
@@ -92,6 +92,7 @@ sub capture_prepare {
        my $user_unityid             = $self->data->get_user_login_id();
        my $managementnode_shortname = 
$self->data->get_management_node_short_name();
        my $computer_private_ip      = 
$self->data->get_computer_private_ip_address();
+       my $ip_configuration = 
$self->data->get_management_node_public_ip_configuration();
 
        notify($ERRORS{'OK'}, 0, "beginning Ubuntu-specific image capture 
preparation tasks: $image_name on $computer_short_name");
 
@@ -101,7 +102,7 @@ sub capture_prepare {
        if ($self->delete_user()) {
                notify($ERRORS{'OK'}, 0, "$user_unityid deleted from 
$computer_node_name");
        }
-       if ($IPCONFIGURATION eq "static") {
+       if ($ip_configuration eq "static") {
                #so we don't have conflicts we should set the public adapter 
back to dhcp
                # reset ifcfg-eth1 back to dhcp
                # when boot strap it will be set to dhcp
@@ -125,7 +126,7 @@ sub capture_prepare {
                }
                if (unlink($tmpfile)) {
                }
-       } ## end if ($IPCONFIGURATION eq "static")
+       } ## end if ($ip_configuration eq "static")
 
        notify($ERRORS{'OK'}, 0, "returning 1");
        return 1;

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esx.pm Fri 
Jul 16 14:25:33 2010
@@ -164,6 +164,7 @@ sub load {
        my $vmhost_password = $self->data->get_vmhost_profile_password();
        my $vmhost_eth0generated = 
$self->data->get_vmhost_profile_eth0generated();
        my $vmhost_eth1generated = 
$self->data->get_vmhost_profile_eth1generated();
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        $vmhost_hostname =~ /([-_a-zA-Z0-9]*)(\.?)/;
        my $vmhost_shortname = $1;
@@ -501,9 +502,9 @@ sub load {
        }
 
        # Set IP info
-       if ($IPCONFIGURATION ne "manualDHCP") {
+       if ($ip_configuration ne "manualDHCP") {
                #not default setting
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        insertloadlog($reservation_id, $vmclient_computerid, 
"dynamicDHCPaddress", "collecting dynamic IP address for node");
                        notify($ERRORS{'DEBUG'}, 0, "Attempting to query 
vmclient for its public IP...");
                        my $assignedIPaddress = 
getdynamicaddress($computer_shortname, $vmclient_OSname, $image_os_type);
@@ -523,8 +524,8 @@ sub load {
                                insertloadlog($reservation_id, 
$vmclient_computerid, "failed", "could not collect dynamic IP address for 
node");
                                return 0;
                        }
-               } ## end if ($IPCONFIGURATION eq "dynamicDHCP")
-               elsif ($IPCONFIGURATION eq "static") {
+               } ## end if ($ip_configuration eq "dynamicDHCP")
+               elsif ($ip_configuration eq "static") {
                        notify($ERRORS{'CRITICAL'}, 0, "STATIC ASSIGNMENT NOT 
SUPPORTED. See vcld.conf");
                        return 0;
                        #insertloadlog($reservation_id, $vmclient_computerid, 
"staticIPaddress", "setting static IP address for node");
@@ -532,7 +533,7 @@ sub load {
                        #       # good set static address
                        #}
                }
-       } ## end if ($IPCONFIGURATION ne "manualDHCP")
+       } ## end if ($ip_configuration ne "manualDHCP")
 
        # Perform post load tasks
 

Modified: 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/esxthin.pm 
Fri Jul 16 14:25:33 2010
@@ -176,6 +176,8 @@ sub load {
        my $vmhost_eth0generated = 
$self->data->get_vmhost_profile_eth0generated();
         my $vmhost_eth1generated = 
$self->data->get_vmhost_profile_eth1generated();
 
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
+
 
        $vmhost_hostname =~ /([-_a-zA-Z0-9]*)(\.?)/;
        my $vmhost_shortname = $1;
@@ -560,9 +562,9 @@ sub load {
        }
 
        # Set IP info
-       if ($IPCONFIGURATION ne "manualDHCP") {
+       if ($ip_configuration ne "manualDHCP") {
                #not default setting
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        insertloadlog($reservation_id, $vmclient_computerid, 
"dynamicDHCPaddress", "collecting dynamic IP address for node");
                        notify($ERRORS{'DEBUG'}, 0, "Attempting to query 
vmclient for its public IP...");
                        my $assignedIPaddress = 
getdynamicaddress($computer_shortname, $vmclient_OSname, $image_os_type);
@@ -582,8 +584,8 @@ sub load {
                                insertloadlog($reservation_id, 
$vmclient_computerid, "failed", "could not collect dynamic IP address for 
node");
                                return 0;
                        }
-               } ## end if ($IPCONFIGURATION eq "dynamicDHCP")
-               elsif ($IPCONFIGURATION eq "static") {
+               } ## end if ($ip_configuration eq "dynamicDHCP")
+               elsif ($ip_configuration eq "static") {
                        notify($ERRORS{'CRITICAL'}, 0, "STATIC ASSIGNMENT NOT 
SUPPORTED. See vcld.conf");
                        return 0;
                        #insertloadlog($reservation_id, $vmclient_computerid, 
"staticIPaddress", "setting static IP address for node");
@@ -591,7 +593,7 @@ sub load {
                        #       # good set static address
                        #}
                }
-       } ## end if ($IPCONFIGURATION ne "manualDHCP")
+       } ## end if ($ip_configuration ne "manualDHCP")
        
        return 1;
 

Modified: 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vmware.pm 
Fri Jul 16 14:25:33 2010
@@ -151,6 +151,8 @@ sub load {
        my $vmclient_OSname           = $self->data->get_image_os_name;
        
        my $image_repository_path     = $self->_get_image_repository_path();
+       
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        # Assemble a consistent prefix for notify messages
        my $notify_prefix = "req=$request_id, res=$reservation_id:";
@@ -912,9 +914,9 @@ sub load {
        insertloadlog($reservation_id, $vmclient_computerid, "info", "starting 
post configurations on node");
        
        #ipconfiguration
-       if ($IPCONFIGURATION ne "manualDHCP") {
+       if ($ip_configuration ne "manualDHCP") {
                #not default setting
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        insertloadlog($reservation_id, $vmclient_computerid, 
"dynamicDHCPaddress", "collecting dynamic IP address for node");
                        my $assignedIPaddress = 
getdynamicaddress($computer_shortname, $vmclient_OSname, $image_os_type);
                        if ($assignedIPaddress) {
@@ -932,8 +934,8 @@ sub load {
                                insertloadlog($reservation_id, 
$vmclient_computerid, "failed", "could not collect dynamic IP address for 
node");
                                return 0;
                        }
-               } ## end if ($IPCONFIGURATION eq "dynamicDHCP")
-               elsif ($IPCONFIGURATION eq "static") {
+               } ## end if ($ip_configuration eq "dynamicDHCP")
+               elsif ($ip_configuration eq "static") {
                        insertloadlog($reservation_id, $vmclient_computerid, 
"staticIPaddress", "setting static IP address for node");
                        if ($self->os->can("set_static_public_address") && 
$self->os->set_static_public_address()) {
                                notify($ERRORS{'DEBUG'}, 0, "set static public 
address using OS module's set_static_public_address() method");
@@ -948,7 +950,7 @@ sub load {
                                return 0;
                        }
                }
-       } ## end if ($IPCONFIGURATION ne "manualDHCP")
+       } ## end if ($ip_configuration ne "manualDHCP")
            #
        insertloadlog($reservation_id, $vmclient_computerid, "vmwareready", 
"preformed post config on node");
        return 1;

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT.pm Fri 
Jul 16 14:25:33 2010
@@ -160,6 +160,7 @@ sub load {
        my $computer_id          = $self->data->get_computer_id();
        my $computer_node_name   = $self->data->get_computer_node_name();
        my $computer_ip_address  = $self->data->get_computer_ip_address();
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        notify($ERRORS{'OK'}, 0, "nodename not set")
          if (!defined($computer_node_name));
@@ -772,11 +773,11 @@ sub load {
        }
 
        # IP configuration
-       if ($IPCONFIGURATION ne "manualDHCP") {
+       if ($ip_configuration ne "manualDHCP") {
                insertloadlog($reservation_id, $computer_id, "info", "detected 
change required in IP address configuration on node");
 
                #not default setting
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        my $assignedIPaddress = 
getdynamicaddress($computer_node_name, $image_os_name, $image_os_type);
                        if ($assignedIPaddress) {
 
@@ -796,8 +797,8 @@ sub load {
                                insertloadlog($reservation_id, $computer_id, 
"dynamicDHCPaddress", "FAILED to collected dynamicDHCP address failing 
reservation");
                                return 0;
                        }
-               } ## end if ($IPCONFIGURATION eq "dynamicDHCP")
-               elsif ($IPCONFIGURATION eq "static") {
+               } ## end if ($ip_configuration eq "dynamicDHCP")
+               elsif ($ip_configuration eq "static") {
                        insertloadlog($reservation_id, $computer_id, "info", 
"setting staticIPaddress");
 
                        if ($self->os->can("set_static_public_address") && 
$self->os->set_static_public_address()) {
@@ -812,8 +813,8 @@ sub load {
                                insertloadlog($reservation_id, $computer_id, 
"staticIPaddress", "failed to set static IP address on public interface");
                                return 0;
                        }
-               } ## end elsif ($IPCONFIGURATION eq "static")  [ if 
($IPCONFIGURATION eq "dynamicDHCP")
-       } ## end if ($IPCONFIGURATION ne "manualDHCP")
+               } ## end elsif ($ip_configuration eq "static")  [ if 
($ip_configuration eq "dynamicDHCP")
+       } ## end if ($ip_configuration ne "manualDHCP")
 
        # Perform post load tasks
        

Modified: 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT2.pm Fri 
Jul 16 14:25:33 2010
@@ -162,6 +162,7 @@ sub load {
        my $computer_ip_address   = $self->data->get_computer_ip_address();
        my $computer_private_ip_address   = 
$self->data->get_computer_private_ip_address();
        my $image_os_install_type = $self->data->get_image_os_install_type();
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        notify($ERRORS{'OK'}, 0, "nodename not set") if 
(!defined($computer_node_name));
        notify($ERRORS{'OK'}, 0, "imagename not set") if 
(!defined($image_name));
@@ -744,11 +745,11 @@ sub load {
 
 
        # IP configuration
-       if ($IPCONFIGURATION ne "manualDHCP") {
+       if ($ip_configuration ne "manualDHCP") {
                insertloadlog($reservation_id, $computer_id, "info", "detected 
change required in IP address configuration on node");
 
                #not default setting
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        my $assignedIPaddress = 
getdynamicaddress($computer_node_name, $image_os_name, $image_os_type);
                        if ($assignedIPaddress) {
 
@@ -768,8 +769,8 @@ sub load {
                                insertloadlog($reservation_id, $computer_id, 
"dynamicDHCPaddress", "FAILED to collected dynamicDHCP address failing 
reservation");
                                return 0;
                        }
-               } ## end if ($IPCONFIGURATION eq "dynamicDHCP")
-               elsif ($IPCONFIGURATION eq "static") {
+               } ## end if ($ip_configuration eq "dynamicDHCP")
+               elsif ($ip_configuration eq "static") {
                        insertloadlog($reservation_id, $computer_id, "info", 
"setting staticIPaddress");
 
                        if ($self->os->can("set_static_public_address") && 
$self->os->set_static_public_address()) {
@@ -784,8 +785,8 @@ sub load {
                                insertloadlog($reservation_id, $computer_id, 
"staticIPaddress", "failed to set static IP address on public interface");
                                return 0;
                        }
-               } ## end elsif ($IPCONFIGURATION eq "static")  [ if 
($IPCONFIGURATION eq "dynamicDHCP")
-       } ## end if ($IPCONFIGURATION ne "manualDHCP")
+               } ## end elsif ($ip_configuration eq "static")  [ if 
($ip_configuration eq "dynamicDHCP")
+       } ## end if ($ip_configuration ne "manualDHCP")
 
        return 1;
 } ## end sub load

Modified: 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/xCAT21.pm 
Fri Jul 16 14:25:33 2010
@@ -162,6 +162,7 @@ sub load {
        my $computer_ip_address   = $self->data->get_computer_ip_address();
        my $computer_private_ip_address   = 
$self->data->get_computer_private_ip_address();
        my $image_os_install_type = $self->data->get_image_os_install_type();
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        notify($ERRORS{'OK'}, 0, "nodename not set")
          if (!defined($computer_node_name));
@@ -860,11 +861,11 @@ sub load {
 =cut
 
        # IP configuration
-       if ($IPCONFIGURATION ne "manualDHCP") {
+       if ($ip_configuration ne "manualDHCP") {
                insertloadlog($reservation_id, $computer_id, "info", "detected 
change required in IP address configuration on node");
 
                #not default setting
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        my $assignedIPaddress = 
getdynamicaddress($computer_node_name, $image_os_name, $image_os_type);
                        if ($assignedIPaddress) {
 
@@ -884,8 +885,8 @@ sub load {
                                insertloadlog($reservation_id, $computer_id, 
"dynamicDHCPaddress", "FAILED to collected dynamicDHCP address failing 
reservation");
                                return 0;
                        }
-               } ## end if ($IPCONFIGURATION eq "dynamicDHCP")
-               elsif ($IPCONFIGURATION eq "static") {
+               } ## end if ($ip_configuration eq "dynamicDHCP")
+               elsif ($ip_configuration eq "static") {
                        insertloadlog($reservation_id, $computer_id, "info", 
"setting staticIPaddress");
 
                        if ($self->os->can("set_static_public_address") && 
$self->os->set_static_public_address()) {
@@ -900,8 +901,8 @@ sub load {
                                insertloadlog($reservation_id, $computer_id, 
"staticIPaddress", "failed to set static IP address on public interface");
                                return 0;
                        }
-               } ## end elsif ($IPCONFIGURATION eq "static")  [ if 
($IPCONFIGURATION eq "dynamicDHCP")
-       } ## end if ($IPCONFIGURATION ne "manualDHCP")
+               } ## end elsif ($ip_configuration eq "static")  [ if 
($ip_configuration eq "dynamicDHCP")
+       } ## end if ($ip_configuration ne "manualDHCP")
 
        return 1;
 } ## end sub load

Modified: incubator/vcl/trunk/managementnode/lib/VCL/new.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/new.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/new.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/new.pm Fri Jul 16 14:25:33 2010
@@ -988,6 +988,7 @@ sub reserve_computer {
        my $user_emailnotices               = 
$self->data->get_user_emailnotices();
        my $user_imtype_name                = 
$self->data->get_user_imtype_name();
        my $user_im_id                      = $self->data->get_user_im_id();
+       my $ip_configuration         = 
$self->data->get_management_node_public_ip_configuration();
 
        notify($ERRORS{'OK'}, 0, "user_standalone=$user_standalone, image OS 
type=$image_os_type");
 
@@ -1002,7 +1003,7 @@ sub reserve_computer {
 
        if ($computer_type =~ /blade|virtualmachine/) {
                # If dynamic DHCP is used, update the public IP address in the 
computer table
-               if ($IPCONFIGURATION eq "dynamicDHCP") {
+               if ($ip_configuration eq "dynamicDHCP") {
                        $computer_ip_address = 
getdynamicaddress($computer_short_name, $image_os_name, $image_os_type);
                        if ($computer_ip_address) {
                                notify($ERRORS{'DEBUG'}, 0, "retrieved dynamic 
DHCP IP address from $computer_ip_address: $computer_ip_address");

Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=964807&r1=964806&r2=964807&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Fri Jul 16 14:25:33 2010
@@ -213,7 +213,6 @@ our @EXPORT = qw(
   $ETHDEVICE
   $GATEWAY
   $FQDN
-  $IPCONFIGURATION
   $jabPass
   $jabPort
   $jabResource
@@ -252,7 +251,6 @@ INIT {
        our ($XCATROOT) = 0;
        our ($FQDN)     = 0;
        our ($MYSQL_SSL,       $MYSQL_SSL_CERT);
-       our ($IPCONFIGURATION, $DNSserver, $GATEWAY, $NETMASK, $ETHDEVICE) = 0;
        our ($WINDOWS_ROOT_PASSWORD);
    our ($XMLRPC_USER, $XMLRPC_PASS, $XMLRPC_URL);
 
@@ -391,23 +389,6 @@ INIT {
                                $MYSQL_SSL_CERT = $1;
                        }
 
-                       #ipconfiguration
-                       if ($l =~ 
/^ipconfiguration=(static|manualDHCP|dynamicDHCP)/) {
-                               $IPCONFIGURATION = $1;
-                       }
-
-                       if ($l =~ /^DNSserver=([,.0-9]*)/) {
-                               $DNSserver = $1;
-                       }
-                       if ($l =~ /^GATEWAY=([.0-9]*)/) {
-                               $GATEWAY = $1;
-                       }
-                       if ($l =~ /^NETMASK=([.0-9]*)/) {
-                               $NETMASK = $1;
-                       }
-                       if ($l =~ /^ETHDEVICE=(eth[0-9])/) {
-                               $ETHDEVICE = $1;
-                       }
                        #Sysadmin list
                        if ($l =~ /^sysadmin=([,-...@a-za-z0-9_]*)/) {
                                $SYSADMIN = $1;
@@ -494,22 +475,6 @@ INIT {
        if (!($RETURNPATH)){
                $RETURNPATH="";
        }
-       if (!$IPCONFIGURATION) {
-               #default
-               $IPCONFIGURATION = "manualDHCP";
-       }
-       elsif ($IPCONFIGURATION eq "static") {
-               #check for dependiencies
-               if (!$DNSserver) {
-                       print STDOUT "pre-execution: ipconfiguration is 
$IPCONFIGURATION dnsserver setting is missing in configuration file\n";
-               }
-               if (!$GATEWAY) {
-                       print STDOUT "pre-execution: ipconfiguration is 
$IPCONFIGURATION gateway setting is missing in configuration file\n";
-               }
-               if (!$NETMASK) {
-                       print STDOUT "pre-execution: ipconfiguration is 
$IPCONFIGURATION netmask setting is missing in configuration file\n";
-               }
-       } ## end elsif ($IPCONFIGURATION eq "static")  [ if (!$IPCONFIGURATION)
 
        if ($JABBER) {
                #jabber is enabled - import required jabber module
@@ -520,15 +485,6 @@ INIT {
                import Net::Jabber qw(client);
        }
 
-       # Check ETH0 Generated
-       if(!defined($VMWARE_MAC_ETH0_GENERATED)){
-               $VMWARE_MAC_ETH0_GENERATED = 0;
-       }
-       # Check ETH1 Generated
-       if(!defined($VMWARE_MAC_ETH1_GENERATED)){
-               $VMWARE_MAC_ETH1_GENERATED = 0;
-       }
-       
        # Can't be both daemon mode and setup mode, use setup if both are set
        $DAEMON_MODE = 0 if ($DAEMON_MODE && $SETUP_MODE);
 
@@ -544,7 +500,6 @@ our ($vcldquerykey,  $SYSADMIN, $SHARED_
 our ($LOGFILE, $PIDFILE, $VCLDRPCQUERYKEY);
 our ($SERVER, $DATABASE, $WRTUSER, $WRTPASS);
 our ($MYSQL_SSL,       $MYSQL_SSL_CERT);
-our ($IPCONFIGURATION, $DNSserver, $GATEWAY, $NETMASK, $ETHDEVICE);
 our ($FQDN);
 our $XCATROOT           = "/opt/xcat";
 our $TOOLS              = "$FindBin::Bin/../tools";
@@ -1318,6 +1273,10 @@ sub setstaticaddress {
        notify($ERRORS{'OK'},       0, "nodename not set")  if 
(!defined($node));
        notify($ERRORS{'OK'},       0, "osname not set")    if 
(!defined($osname));
        notify($ERRORS{'CRITICAL'}, 0, "IPaddress not set") if 
(!defined($IPaddress));
+
+       my $subnetmask = $ENV{management_node_info}{PUBLIC_SUBNET_MASK};
+       my $default_gateway = 
$ENV{management_node_info}{PUBLIC_DEFAULT_GATEWAY}; 
+
        #collect private address -- read hosts file only useful if running
        # xcat setup and private addresses are listsed in the local
        # /etc/hosts file
@@ -1352,7 +1311,7 @@ sub setstaticaddress {
                push(@eth1file, "DEVICE=eth1\n");
                push(@eth1file, "BOOTPROTO=static\n");
                push(@eth1file, "IPADDR=$IPaddress\n");
-               push(@eth1file, "NETMASK=$NETMASK\n");
+               push(@eth1file, "NETMASK=$subnetmask\n");
                push(@eth1file, "STARTMODE=onboot\n");
                push(@eth1file, "ONBOOT=yes\n");
 
@@ -1421,15 +1380,15 @@ sub setstaticaddress {
 
                notify($ERRORS{'OK'}, 0, "Setting default route");
                undef @sshcmd;
-               @sshcmd = run_ssh_command($node, $identity, "/sbin/route add 
default gw $GATEWAY metric 0 $ETHDEVICE", "root");
+               @sshcmd = run_ssh_command($node, $identity, "/sbin/route add 
default gw $default_gateway metric 0 $ETHDEVICE", "root");
                #should be empty
                foreach my $l (@{$sshcmd[1]}) {
                        if ($l =~ /Usage:/) {
                                #potential problem
-                               notify($ERRORS{'OK'}, 0, "possible problem with 
route add default gw $GATEWAY metric 0 $ETHDEVICE");
+                               notify($ERRORS{'OK'}, 0, "possible problem with 
route add default gw $default_gateway metric 0 $ETHDEVICE");
                        }
                        if ($l =~ /No such process/) {
-                               notify($ERRORS{'CRITICAL'}, 0, "problem with 
$node $l add default gw $GATEWAY metric 0 $ETHDEVICE ");
+                               notify($ERRORS{'CRITICAL'}, 0, "problem with 
$node $l add default gw $default_gateway metric 0 $ETHDEVICE ");
                                return 0;
                        }
                } ## end foreach my $l (@{$sshcmd[1]})
@@ -6204,11 +6163,12 @@ AND managementnode.id != $management_nod
        $management_node_info->{OSNAME} = $os_name;
        
        # Add the public IP address configuration variables
-       $management_node_info->{PUBLIC_IP_CONFIGURATION} = $IPCONFIGURATION;
-       $management_node_info->{PUBLIC_SUBNET_MASK} = $NETMASK;
-       $management_node_info->{PUBLIC_DEFAULT_GATEWAY} = $GATEWAY;
-       $management_node_info->{PUBLIC_DNS_SERVER} = $DNSserver;
+       $management_node_info->{PUBLIC_IP_CONFIGURATION} = 
$management_node_info->{publicIPconfiguration};
+       $management_node_info->{PUBLIC_SUBNET_MASK} = 
$management_node_info->{publicSubnetMmask};
+       $management_node_info->{PUBLIC_DEFAULT_GATEWAY} = 
$management_node_info->{publicDefaultGateway};
+       $management_node_info->{PUBLIC_DNS_SERVER} = 
$management_node_info->{publicDNSserver};
 
+       notify($ERRORS{'DEBUG'}, 0, "management node info 
$management_node_info->{PUBLIC_IP_CONFIGURATION}");
        notify($ERRORS{'DEBUG'}, 0, "management node info retrieved from 
database for $shortname");
        return $management_node_info;
 } ## end sub get_management_node_info


Reply via email to