From ef83b1dc1a528f7885cf82206d63b80b10bdcb1d Mon Sep 17 00:00:00 2001 From: jjhua Date: Wed, 29 Dec 2010 02:20:29 +0000 Subject: [PATCH] support for mkhwconn with --port option git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8518 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Utils.pm | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index e17cb60f5..082db64aa 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2787,6 +2787,7 @@ sub nodeonmynet sub getNodeIPaddress { my $nodetocheck = shift; + my $port = shift; my $nodeip; $nodeip = xCAT::NetworkUtils->getipaddr($nodetocheck); @@ -2811,7 +2812,36 @@ sub getNodeIPaddress if ($type) { if ($type->{nodetype} eq "frame" or $type->{nodetype} eq "cec") { $c1 = xCAT::DBobjUtils->getchildren($nodetocheck); - my $hstab = xCAT::Table->new('hosts'); + + #if $port exists, only for mkhwconn ... CEC/Frame + if ( defined($port) ) { + my @fsp_bpa = @$c1; + undef ($c1); + # mkhwconn only creates the connections for the FSPs/BPAs whoes port is $port. + my $vpd_tab = xCAT::Table->new('vpd'); + unless($vpd_tab) { + return "-1"; # Cannot open vpd table + } + foreach ( @fsp_bpa ) { + my $vpd_hash = $vpd_tab->getNodeAttribs( $_, [qw(side)]); + my $side = $vpd_hash->{side}; + if (!defined($side)) { + #return -2; # $_: No side in vpd table for $_ + next; + } + #print $side; + if ( $side =~ /[A|a|B|b]-$port/) { + push (@$c1, $_); + } + } + $vpd_tab->close(); + + if(!defined($c1) || @$c1 == 0) { + return "-3"; # the FSP/BPA's side is not $port. + } + } + + my $hstab = xCAT::Table->new('hosts'); if ( $hstab ) { my @myip = (); foreach ( @$c1 )