Author: fapeeler
Date: Wed Aug 4 18:25:34 2010
New Revision: 982350
URL: http://svn.apache.org/viewvc?rev=982350&view=rev
Log:
VCL-224
removed ETHDEVICE from vcld.conf
utils.pm: set failover routine setstaticaddress to use eth1
OS modules use the network_configuration data to determine the public
interface name
VCL-352
Ubuntu.pm - added pre-capture calls to set rc.local,sshd config and ext_sshd
startup script
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/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=982350&r1=982349&r2=982350&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf (original)
+++ incubator/vcl/trunk/managementnode/etc/vcl/vcld.conf Wed Aug 4 18:25:34
2010
@@ -151,8 +151,6 @@ jabResource=vcl
# Windows node root password
WINDOWS_ROOT_PASSWORD=cl0udy
-#ETHDEVICE=eth1
-
# NOT_STANDALONE:
# Used to specify affiliations whose users should NOT have the STANDALONE flag
set
# This causes users accounts to NOT be added to Linux reservations for the
affiliations specified
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=982350&r1=982349&r2=982350&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux.pm Wed Aug 4
18:25:34 2010
@@ -152,29 +152,9 @@ sub pre_capture {
}
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
- my @ifcfg;
- my $tmpfile = "/tmp/createifcfg$computer_node_name";
- push(@ifcfg, "DEVICE=eth1\n");
- push(@ifcfg, "BOOTPROTO=dhcp\n");
- push(@ifcfg, "STARTMODE=onboot\n");
- push(@ifcfg, "ONBOOT=yes\n");
- #write to tmpfile
- if (open(TMP, ">$tmpfile")) {
- print TMP @ifcfg;
- close(TMP);
- }
- else {
- #print "could not write $tmpfile $!\n";
- notify($ERRORS{'OK'}, 0, "could not write $tmpfile $!");
- }
- #copy to node
- if (run_scp_command($tmpfile,
"$computer_node_name:/etc/sysconfig/network-scripts/ifcfg-$ETHDEVICE",
$management_node_keys)) {
- }
- if (unlink($tmpfile)) {
- }
+ if ($self->can("set_static_public_address") &&
$self->set_static_public_address()) {
+ notify($ERRORS{'DEBUG'}, 0, "set static public IP
address on $computer_node_name using set_static_public_address() method");
+ }
} ## end if ($ip_configuration eq "static")
#Write /etc/rc.local script
@@ -468,7 +448,7 @@ sub set_static_public_address {
notify($ERRORS{'OK'}, 0, "initiating Linux set_static_public_address on
$computer_short_name");
my @eth1file;
my $tmpfile = "/tmp/ifcfg-eth_device-$computer_short_name";
- push(@eth1file, "DEVICE=eth1\n");
+ push(@eth1file, "DEVICE=$public_interface_name\n");
push(@eth1file, "BOOTPROTO=static\n");
push(@eth1file, "IPADDR=$public_ip_address\n");
push(@eth1file, "NETMASK=$subnet_mask\n");
@@ -496,7 +476,7 @@ sub set_static_public_address {
#confirm it got there
undef @sshcmd;
- @sshcmd = run_ssh_command($computer_short_name,
$management_node_keys, "cat /etc/sysconfig/network-scripts/ifcfg-$ETHDEVICE",
"root");
+ @sshcmd = run_ssh_command($computer_short_name,
$management_node_keys, "cat
/etc/sysconfig/network-scripts/ifcfg-$public_interface_name", "root");
my $success = 0;
foreach my $i (@{$sshcmd[1]}) {
if ($i =~ /$public_ip_address/) {
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=982350&r1=982349&r2=982350&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 Wed
Aug 4 18:25:34 2010
@@ -103,30 +103,36 @@ sub capture_prepare {
notify($ERRORS{'OK'}, 0, "$user_unityid deleted from
$computer_node_name");
}
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
- my @ifcfg;
- my $tmpfile = "/tmp/createifcfg$computer_node_name";
- push(@ifcfg, "DEVICE=eth1\n");
- push(@ifcfg, "BOOTPROTO=dhcp\n");
- push(@ifcfg, "STARTMODE=onboot\n");
- push(@ifcfg, "ONBOOT=yes\n");
- #write to tmpfile
- if (open(TMP, ">$tmpfile")) {
- print TMP @ifcfg;
- close(TMP);
- }
- else {
- #print "could not write $tmpfile $!\n";
- notify($ERRORS{'OK'}, 0, "could not write $tmpfile $!");
- }
- #copy to node
- if (run_scp_command($tmpfile,
"$computer_node_name:/etc/sysconfig/network-scripts/ifcfg-$ETHDEVICE",
$management_node_keys)) {
- }
- if (unlink($tmpfile)) {
- }
+ if ($self->can("set_static_public_address") &&
$self->set_static_public_address()) {
+ notify($ERRORS{'DEBUG'}, 0, "set static public IP
address on $computer_node_name using set_static_public_address() method");
+ }
} ## end if ($ip_configuration eq "static")
+
+ #Write /etc/rc.local script
+ if(!$self->generate_rc_local()){
+ notify($ERRORS{'WARNING'}, 0, "unable to generate
/etc/rc.local script on $computer_node_name");
+ return 0;
+ }
+
+ #Generate external_sshd_config
+ if(!$self->generate_ext_sshd_config()){
+ notify($ERRORS{'WARNING'}, 0, "unable to generate
/etc/ssh/external_sshd_config on $computer_node_name");
+ return 0;
+ }
+
+ #Generate ext_sshd init script
+ if(!$self->generate_ext_sshd_init()){
+ notify($ERRORS{'WARNING'}, 0, "unable to generate
/etc/init.d/ext_sshd on $computer_node_name");
+ return 0;
+ }
+
+ #shutdown node
+ notify($ERRORS{'OK'}, 0, "shutting down node for Linux imaging
sequence");
+ run_ssh_command($computer_node_name, $management_node_keys,
"/sbin/shutdown -h now", "root");
+ notify($ERRORS{'OK'}, 0, "sleeping for 60 seconds while machine shuts
down");
+ sleep 60;
+
+
notify($ERRORS{'OK'}, 0, "returning 1");
return 1;
Modified: incubator/vcl/trunk/managementnode/lib/VCL/utils.pm
URL:
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=982350&r1=982349&r2=982350&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/utils.pm Wed Aug 4 18:25:34 2010
@@ -209,7 +209,6 @@ our @EXPORT = qw(
$DAEMON_MODE
$DATABASE
$DEFAULTHELPEMAIL
- $ETHDEVICE
$GATEWAY
$FQDN
$jabPass
@@ -250,7 +249,6 @@ INIT {
our ($XCATROOT) = 0;
our ($FQDN) = 0;
our ($MYSQL_SSL, $MYSQL_SSL_CERT);
- our ($ETHDEVICE) = 0;
our ($WINDOWS_ROOT_PASSWORD);
our ($XMLRPC_USER, $XMLRPC_PASS, $XMLRPC_URL);
@@ -385,10 +383,6 @@ INIT {
$MYSQL_SSL_CERT = $1;
}
- if ($l =~ /^ETHDEVICE=(eth[0-9])/) {
- $ETHDEVICE = $1;
- }
-
#Sysadmin list
if ($l =~ /^sysadmin=([,-...@a-za-z0-9_]*)/) {
$SYSADMIN = $1;
@@ -500,7 +494,6 @@ our ($vcldquerykey, $SYSADMIN, $SHARED_
our ($LOGFILE, $PIDFILE, $VCLDRPCQUERYKEY);
our ($SERVER, $DATABASE, $WRTUSER, $WRTPASS);
our ($MYSQL_SSL, $MYSQL_SSL_CERT);
-our ($ETHDEVICE);
our ($FQDN);
our $XCATROOT = "/opt/xcat";
our $TOOLS = "$FindBin::Bin/../tools";
@@ -1326,7 +1319,7 @@ sub setstaticaddress {
#print "could not write $tmpfile $!\n";
}
- @sshcmd = run_ssh_command($node, $identity,
"/etc/sysconfig/network-scripts/ifdown $ETHDEVICE", "root");
+ @sshcmd = run_ssh_command($node, $identity,
"/etc/sysconfig/network-scripts/ifdown eth1", "root");
foreach my $l (@{$sshcmd[1]}) {
if ($l) {
#potential problem
@@ -1334,15 +1327,15 @@ sub setstaticaddress {
}
}
#copy new ifcfg-Device
- if (run_scp_command($tmpfile,
"$node:/etc/sysconfig/network-scripts/ifcfg-$ETHDEVICE", $identity)) {
+ if (run_scp_command($tmpfile,
"$node:/etc/sysconfig/network-scripts/ifcfg-eth1", $identity)) {
#confirm it got there
undef @sshcmd;
- @sshcmd = run_ssh_command($node, $identity, "cat
/etc/sysconfig/network-scripts/ifcfg-$ETHDEVICE", "root");
+ @sshcmd = run_ssh_command($node, $identity, "cat
/etc/sysconfig/network-scripts/ifcfg-eth1", "root");
my $success = 0;
foreach my $i (@{$sshcmd[1]}) {
if ($i =~ /$IPaddress/) {
- notify($ERRORS{'OK'}, 0, "SUCCESS -
copied ifcfg_$ETHDEVICE\n");
+ notify($ERRORS{'OK'}, 0, "SUCCESS -
copied ifcfg_eth1\n");
$success = 1;
}
}
@@ -1351,19 +1344,19 @@ sub setstaticaddress {
}
if (!$success) {
- notify($ERRORS{'WARNING'}, 0, "unable to copy
$tmpfile to $node file ifcfg-$ETHDEVICE did get updated with $IPaddress ");
+ notify($ERRORS{'WARNING'}, 0, "unable to copy
$tmpfile to $node file ifcfg-eth1 did get updated with $IPaddress ");
return 0;
}
- } ## end if (run_scp_command($tmpfile,
"$node:/etc/sysconfig/network-scripts/ifcfg-$ETHDEVICE"...
+ } ## end if (run_scp_command($tmpfile,
"$node:/etc/sysconfig/network-scripts/ifcfg-eth1"...
#bring device up
undef @sshcmd;
- @sshcmd = run_ssh_command($node, $identity,
"/etc/sysconfig/network-scripts/ifup $ETHDEVICE", "root");
+ @sshcmd = run_ssh_command($node, $identity,
"/etc/sysconfig/network-scripts/ifup eth1", "root");
#should be empty
foreach my $l (@{$sshcmd[1]}) {
if ($l) {
#potential problem
- notify($ERRORS{'OK'}, 0, "possible problem with
ifup $ETHDEVICE $l");
+ notify($ERRORS{'OK'}, 0, "possible problem with
ifup eth1 $l");
}
}
#correct route table - delete old default and add new in same
line
@@ -1382,15 +1375,15 @@ sub setstaticaddress {
notify($ERRORS{'OK'}, 0, "Setting default route");
undef @sshcmd;
- @sshcmd = run_ssh_command($node, $identity, "/sbin/route add
default gw $default_gateway metric 0 $ETHDEVICE", "root");
+ @sshcmd = run_ssh_command($node, $identity, "/sbin/route add
default gw $default_gateway metric 0 eth1", "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 $default_gateway metric 0 $ETHDEVICE");
+ notify($ERRORS{'OK'}, 0, "possible problem with
route add default gw $default_gateway metric 0 eth1");
}
if ($l =~ /No such process/) {
- notify($ERRORS{'CRITICAL'}, 0, "problem with
$node $l add default gw $default_gateway metric 0 $ETHDEVICE ");
+ notify($ERRORS{'CRITICAL'}, 0, "problem with
$node $l add default gw $default_gateway metric 0 eth1 ");
return 0;
}
} ## end foreach my $l (@{$sshcmd[1]})