#220993 Can not import node by auto discovery switch and switch port.

This commit is contained in:
yinqing 2013-08-07 13:40:05 +08:00
parent 9ddfd08f24
commit d6debec1a6
2 changed files with 27 additions and 1 deletions

View File

@ -550,6 +550,31 @@ 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 +588,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