Add -n option for lsslp to only show and write the newly discovered hardwares

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4854 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2009-12-29 14:29:02 +00:00
parent ec6154e11e
commit 75b0a4417b

View File

@ -193,7 +193,7 @@ sub parse_args {
# Process command-line flags
#############################################
if (!GetOptions( \%opt,
qw(h|help V|Verbose v|version i=s x z w r s=s e=s t=s m c u H))) {
qw(h|help V|Verbose v|version i=s x z w r s=s e=s t=s m c u H n))) {
return( usage() );
}
#############################################
@ -1162,8 +1162,11 @@ sub gethost_from_url {
my $sn = $1;
foreach my $node ( keys %::VPD_TAB_CACHE ) {
if ( $::VPD_TAB_CACHE{$node} eq $mtm . '*' . $sn . '-' . $side ) {
delete $::VPD_TAB_CACHE{$node};
return $node . "($ip)";
if ( exists( $opt{n} ) ) {
return undef;
} else {
return $node . "($ip)";
}
}
}
}
@ -1186,7 +1189,11 @@ sub gethost_from_url {
}
if ( exists $::HOST_TAB_CACHE{$ip})
{
return $::HOST_TAB_CACHE{$ip} . "($ip)";
if ( exists( $opt{n} ) ) {
return undef;
} else {
return $::HOST_TAB_CACHE{$ip} . "($ip)";
}
}
my $host = getFactoryHostname($type,$mtm,$sn,$side,$rsp);
@ -1547,15 +1554,15 @@ sub xCATdB {
$vpdtab = xCAT::Table->new('vpd');
if ($vpdtab)
{
my @ents=$vpdtab->getAllNodeAttribs(['serial','mtm','side']);
my @ents=$vpdtab->getAllNodeAttribs(['serial','mtm']);
for my $ent ( @ents)
{
if ( $ent->{mtm} and $ent->{serial} and defined( $ent->{side} ))
if ( $ent->{mtm} and $ent->{serial} )
{
# if there is no BPA, or there is the second BPA, change it
if ( ! exists $sn_node{"Server-" . $ent->{mtm} . "-SN" . $ent->{serial} . "-" . $ent->{side}} )
if ( ! exists $sn_node{"Server-" . $ent->{mtm} . "-SN" . $ent->{serial} } )
{
$sn_node{"Server-" . $ent->{mtm} . "-SN" . $ent->{serial} . "-" . $ent->{side}} = $ent->{node};
$sn_node{"Server-" . $ent->{mtm} . "-SN" . $ent->{serial}} = $ent->{node};
}
}
}