#220993 Can not import node by auto discovery switch and switch port.
This commit is contained in:
		| @@ -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)  | ||||
|     { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user