From 7305725c392e80600d564305322bd33e629f6412 Mon Sep 17 00:00:00 2001 From: yinle Date: Sat, 19 Feb 2011 10:03:49 +0000 Subject: [PATCH] FSP/BPA redundancy: add a function getHMCcontrolIP to get the ips of a node defined by HMC. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8892 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCcli.pm | 53 ++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/perl-xCAT/xCAT/PPCcli.pm b/perl-xCAT/xCAT/PPCcli.pm index d1b714649..e32d4e94f 100644 --- a/perl-xCAT/xCAT/PPCcli.pm +++ b/perl-xCAT/xCAT/PPCcli.pm @@ -1293,13 +1293,50 @@ sub rmsysconn my $result = send_cmd( $exp, $cmd); return ( $result); } +########################################################################## +# Get FSP/BPA IP address for the redundancy FSP/BPA from HMC +########################################################################## +sub getHMCcontrolIP +{ + my $node = shift; + + if (($node) && ($node =~ /xCAT::/)) + { + $node = shift; + } + my $exp = shift; + + #get node type first + my $type = xCAT::DBobjUtils::getnodetype($node); + unless ($type) + { + return undef; + } + + + #get node ip from hmc + my $nodes_found = lssyscfg( $exp, "$type", "$node","name,ipaddr,ipaddr_secondary" ); + my @ips; + my $ip_result; + if ( @$nodes_found[0] eq SUCCESS ) { + my $Rc = shift(@$nodes_found); + #foreach my $mtms ( @$nodes_found ) { + my @newnodes = split(/,/, $nodes_found->[0]); + if ( $node eq $newnodes[0] ) { + if(xCAT::Utils->isIpaddr($newnodes[1])) { + push @ips, $newnodes[1]; + } + if(xCAT::Utils->isIpaddr($newnodes[2])) { + push @ips, $newnodes[2]; + } + $ip_result = join( ",", @ips ); + } + #} + } + return $ip_result; +} + + + 1; - - - - - - - -