From 9c7d314402ae908f9cce42763d3041fa33653ed6 Mon Sep 17 00:00:00 2001 From: yinle Date: Tue, 21 Jun 2011 06:37:55 +0000 Subject: [PATCH] mkhwconn -s enhancement,support mkhwconn -s hmc1 or without hmc specified. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9868 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/PPC.pm | 53 ++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 15ccf5542..e03de1e3a 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2311,27 +2311,46 @@ sub getHCPsOfNodes if ( $ppctab ) { my $typeref = xCAT::DBobjUtils->getnodetype($nodes); my $i = 0; - for my $n (@$nodes) { - if (@$typeref[$i++] =~ /^fsp|bpa$/) { - my $np = $ppctab->getNodeAttribs( $n, [qw(parent)]); - if ($np) { # use parent(frame/cec)'s sfp attributes first,for high end machine with 2.5/2.6+ database - my $psfp = $ppctab->getNodeAttribs( $np->{parent}, [qw(sfp)]); - $newhcp{$n}{hcp} = [$psfp->{sfp}] if ($psfp); - } else { # if the node don't have a parent,for low end machine with 2.5 database - my $psfp = $ppctab->getNodeAttribs( $n, [qw(sfp)]); - $newhcp{$n}{hcp} = [$psfp->{sfp}] if ($psfp); + unless ( $request->{arg}->[1] ) { + for my $n (@$nodes) { + if (@$typeref[$i++] =~ /^fsp|bpa$/) { + my $np = $ppctab->getNodeAttribs( $n, [qw(parent)]); + if ($np) { # use parent(frame/cec)'s sfp attributes first,for high end machine with 2.5/2.6+ database + my $psfp = $ppctab->getNodeAttribs( $np->{parent}, [qw(sfp)]); + $newhcp{$n}{hcp} = [$psfp->{sfp}] if ($psfp); + } else { # if the node don't have a parent,for low end machine with 2.5 database + my $psfp = $ppctab->getNodeAttribs( $n, [qw(sfp)]); + $newhcp{$n}{hcp} = [$psfp->{sfp}] if ($psfp); + } + } else { + my $psfp = $ppctab->getNodeAttribs( $n, [qw(sfp)]); + $newhcp{$n}{hcp} = [$psfp->{sfp}] if($psfp); } - } else { - my $psfp = $ppctab->getNodeAttribs( $n, [qw(sfp)]); - $newhcp{$n}{hcp} = [$psfp->{sfp}] if($psfp); + $newhcp{$n}{num} = 1; + } + return \%newhcp; + } else { + my $sfp = $request->{arg}->[1]; + my %sfphash; + for my $n (@$nodes) { + # record hcp + $newhcp{$n}{hcp} = [$sfp]; + $newhcp{$n}{num} = 1; + # set the sfp attribute to the database + if (@$typeref[$i++] =~ /^fsp|bpa$/) { + my $np = $ppctab->getNodeAttribs( $n, [qw(parent)]); + $sfphash{$np}{sfp} = $sfp if ( $np ); + } + $sfphash{$n}{sfp} = $sfp; } - $newhcp{$n}{num} = 1; - } - } else { + $ppctab->setNodesAttribs(\%sfphash); + return \%newhcp; + } + }else { $callback->({data=>["Could not open the ppc table"]}); + return undef; } - return \%newhcp; - } + } }