got cross-vlan sysclone working in softlayer

This commit is contained in:
Bruce Potter 2014-05-28 10:21:43 -04:00
parent 516ab61cc3
commit 4d35d617ed
4 changed files with 40 additions and 9 deletions

View File

@ -15,6 +15,7 @@ my $file = '~/.ssh/known_hosts';
my $usage = sub {
my $exitcode = shift @_;
print "Usage: khrem <node>\n";
print " Removes the entries in the .ssh/known_hosts file associated with this node.\n";
exit $exitcode;
};

View File

@ -156,7 +156,15 @@ for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
close FILE;
# Configure slaves
my @output = `ip addr show 2>&1`; # to check for existance of the device later
foreach my $dev (@devs) {
# as a convenience, make sure the device exists before adding it to the bond
if (!grep(m/^\d+:\s+$dev:/, @output)) {
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
next;
}
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
print FILE "DEVICE=$dev\n";
@ -182,7 +190,9 @@ for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
print FILE "STARTMODE=onboot\n";
print FILE "USERCONTROL=no\n";
my $devnum = 0;
my @output = `ip addr show 2>&1`; # to check for existance of the device later
foreach my $dev (@devs) {
if (!grep(m/^\d+:\s+$dev:/, @output)) { next; }
print FILE "BONDING_SLAVE_$devnum=$dev\n";
$devnum++;
}
@ -190,6 +200,13 @@ for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
# Configure slaves
foreach my $dev (@devs) {
# as a convenience, make sure the device exists before adding it to the bond
if (!grep(m/^\d+:\s+$dev:/, @output)) {
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
next;
}
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
print FILE "BOOTPROTO=none\n";

View File

@ -39,8 +39,15 @@ fi
hostname $HOSTNAME
bond=bond0
# this is a softlayer assumption that the two devices on the private net will be eth0 and eth2
if [[ $DEVICE == "eth0" ]]; then
$DEVICE2=eth2
DEVICE2=eth2
elif [[ $DEVICE == "eth2" ]]; then
DEVICE2=eth0
fi
ip addr show|grep -q -E "^[0-9]+:\s+$DEVICE2:" # make sure it exists on the system
if [[ $? == 0 ]]; then
DEVICE2EXISTS="yes"
fi
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
@ -86,16 +93,18 @@ if [ -d "/etc/sysconfig/network-scripts/" ];then
echo "SLAVE=yes" >> $str_cfg_file
echo "USERCTL=no" >> $str_cfg_file
if [[ $DEVICE2 != "" ]]; then
# write ifcfg-eth0
i="$DEVICE2"
str_cfg_file="$dir/ifcfg-$i"
i="$DEVICE2"
str_cfg_file="$dir/ifcfg-$i"
if [[ $DEVICE2EXISTS == "yes" ]]; then
# write ifcfg-eth2
echo "DEVICE=$i" > $str_cfg_file
echo "BOOTPROTO=none" >> $str_cfg_file
echo "MASTER=$bond" >> $str_cfg_file
echo "ONBOOT=yes" >> $str_cfg_file
echo "SLAVE=yes" >> $str_cfg_file
echo "USERCTL=no" >> $str_cfg_file
else
rm -f $str_cfg_file # in case it was left over in the image that was captured
fi
# write modprobe alias config
@ -139,7 +148,7 @@ elif [ -d "/etc/sysconfig/network/" ];then
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
echo "USERCONTROL=no" >> $str_cfg_file
echo "BONDING_SLAVE_0=$DEVICE" >> $str_cfg_file
if [[ $DEVICE2 != "" ]]; then
if [[ $DEVICE2EXISTS == "yes" ]]; then
echo "BONDING_SLAVE_1=$DEVICE2" >> $str_cfg_file
fi
@ -149,12 +158,14 @@ elif [ -d "/etc/sysconfig/network/" ];then
echo "BOOTPROTO=none" > $str_cfg_file
echo "STARTMODE=hotplug" >> $str_cfg_file
if [[ $DEVICE2 != "" ]]; then
i="$DEVICE2"
str_cfg_file="$dir/ifcfg-$i"
if [[ $DEVICE2EXISTS == "yes" ]]; then
# write ifcfg-eth2
i="$DEVICE2"
str_cfg_file="$dir/ifcfg-$i"
echo "BOOTPROTO=none" > $str_cfg_file
echo "STARTMODE=hotplug" >> $str_cfg_file
else
rm -f $str_cfg_file # in case it was left over in the image that was captured
fi
# write modprobe alias config

View File

@ -17,6 +17,8 @@ BuildArch: noarch
Requires: xCAT-server
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
Requires: perl-ExtUtils-MakeMaker perl-CPAN perl-Test-Harness perl-SOAP-Lite
Provides: xCAT-SoftLayer = %{epoch}:%{version}
%description