From 8cb2dd56b971995053951cb6cbd49b39503dac4f Mon Sep 17 00:00:00 2001 From: phamt Date: Mon, 29 Apr 2013 16:59:46 +0000 Subject: [PATCH] Fixed how broadcast address is calculated using IP and netmask, instead of relying on ifcfg file. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16122 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/zvm.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 4436fbcfb..0bb6b0d07 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -4946,13 +4946,16 @@ sub nodeSet { # Combine NFS server and installation directory, e.g. 10.0.0.1/install my $nfs = $master . $installDir; - # Get broadcast address of NIC - my $ifcfg = xCAT::zvmUtils->getIfcfgByNic( $::SUDOER, $hcp, $readChannel ); - $out = `ssh $::SUDOER\@$hcp "$::SUDO cat $ifcfg" | grep "BROADCAST"`; - @words = split( '=', $out ); - my $broadcast = $words[1]; - $broadcast = xCAT::zvmUtils->trimStr($broadcast); - $broadcast =~ s;"|';;g; + # Get broadcast address + @words = split(/\./, $hostIP); + my ($ipUnpack) = unpack("N", pack("C4", @words)); + @words = split(/\./, $mask); + my ($maskUnpack) = unpack("N", pack( "C4", @words )); + + # Calculate broadcase address by inverting the netmask and do a logical or with network address + my $math = ( $ipUnpack & $maskUnpack ) + ( ~ $maskUnpack ); + @words = unpack("C4", pack( "N", $math )) ; + my $broadcast = join(".", @words); # Load VMCP module on HCP $out = `ssh -o ConnectTimeout=5 $::SUDOER\@$hcp "/sbin/modprobe vmcp"`; @@ -6315,7 +6318,7 @@ sub changeHypervisor { } # Add existing region to group - elsif ($funct eq "5") { + elsif($funct eq "5") { $group = $args->[3]; $tmp = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Volume_Space_Define_DM -T $hcpUserId -f $funct -g $_ -p $group -y 0"`; xCAT::zvmUtils->printSyslog("smcli Image_Volume_Space_Define_DM -T $hcpUserId -f $funct -g $_ -p $group -y 0");