Fix case #220993 Can not import node by auto discovery switch and switch

port
This commit is contained in:
yinqing 2013-08-05 18:01:09 +08:00
parent b3d39468ef
commit d5df537479
2 changed files with 28 additions and 1 deletions

View File

@ -550,6 +550,32 @@ sub get_allnode_singleattrib_hash
#-------------------------------------------------------------------------------
=head3 get_db_swtiches
Description : Get all records of switch config from a table, then return a string list.
Arguments : $tabname - the table name.
Returns : Reference of the records hash.
=cut
#-------------------------------------------------------------------------------
sub get_db_switches
{
my $class = shift;
my $table = xCAT::Table->new("switches");
my @attribs = ("switch");
my @entries = $table->getAllAttribs(@attribs);
$table->close();
my %allrecords;
foreach (@entries)
{
if ($_->{'switch'}){
$allrecords{$_->{'switch'}} = 0;
}
}
return \%allrecords;
}
#-------------------------------------------------------------------------------
=head3 get_db_swtichports
Description : Get all records of switch config from a table, then return a string list.
Arguments : $tabname - the table name.
@ -563,6 +589,7 @@ sub get_db_switchports
my $table = xCAT::Table->new("switch");
my @attribs = ("switch", "port");
my @entries = $table->getAllAttribs(@attribs);
$table->close();
my %allrecords;
foreach (@entries)
{

View File

@ -370,7 +370,7 @@ Usage:
my %allfspips = %$recordsref;
# Get all switches name
$recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('switches', 'switch');
$recordsref = xCAT::ProfiledNodeUtils->get_db_switches();
%allswitches = %$recordsref;
# Get all switches_switchport