Merge switches format adjust for nodeimport.

This commit is contained in:
Lei Ai 2014-06-17 17:15:31 +08:00
parent ae85fe3e7f
commit 314937c12c
2 changed files with 12 additions and 17 deletions

View File

@ -120,8 +120,7 @@ To import nodes using a profile, follow the following steps:
# hostinfo begin
# This entry defines a blade.
__hostname__:
switch=myswitch
switchport=9
switches=eth0!switch1!1,eth0!switch2!1!eth1
Example of a node information file that specifies a CEC-based rack-mounted Power node that uses direct FSP management:
# Node information file begins
@ -141,13 +140,9 @@ B<mac=<mac-address>> This is a mandatory item.
Description: Specify the MAC address for the NIC used by the provisionging node, where <mac-address> is the NICs MAC address.
B<switch=<switch-name>> This is a mandatory item, when define a switch auto discovery node.
B<switches=<nic-name!switch-name!switch-port>> This is a mandatory item, when define switch, switchport and node nic name relationship.
Description: Specify switch name that the provisionging node is connected, where <switch-name> is the switch name.
B<switchport=<switch-port>> This is a mandatory item, when define a switch auto discovery node.
Description: Specify switch port that the provisionging node is connected, where <switch-port> is the connected port.
Description: Specify nic name, switch name and switch port to define node and switch relationship. We can define multi nic-switch-port relations here, looks like: switches=eth0!switch1!1,eth1!switch1,2
B<slotid=<slot-id>> This is a mandatory item while define a PureFlex node.

View File

@ -1779,9 +1779,9 @@ sub gen_new_hostinfo_dict{
my %keyshash = ();
my %valueshash = ();
$keyshash{'node'} = $item;
$keyshash{'switch'}= $spilist[0];
$keyshash{'port'} = $spilist[1];
$valueshash{'interface'} = $spilist[2];
$valueshash{'interface'} = $spilist[0];
$keyshash{'switch'}= $spilist[1];
$keyshash{'port'} = $spilist[2];
push @switch_records, [\%keyshash, \%valueshash];
}
}
@ -2225,17 +2225,17 @@ sub validate_node_entry{
next;
}
if (! exists $allswitches{$spilist[0]}){
$errmsg .= "Specified switch $spilist[0] is not defined\n";
if (! exists $allswitches{$spilist[1]}){
$errmsg .= "Specified switch $spilist[1] is not defined\n";
}
# Not a valid number.
if (!($spilist[1] =~ /^\d+$/)){
$errmsg .= "Specified port $spilist[1] is invalid\n";
if (!($spilist[2] =~ /^\d+$/)){
$errmsg .= "Specified port $spilist[2] is invalid\n";
}
# now, we need to check "swith_switchport" string list to avoid duplicate config
my $switch_port = $spilist[0] . "_" . $spilist[1];
my $switch_port = $spilist[1] . "_" . $spilist[2];
if (exists $all_switchports{$switch_port}){
$errmsg .= "Specified switch $spilist[0] and port $spilist[1] already exists in the database or in the nodeinfo file. You must use a new switch port.\n";
$errmsg .= "Specified switch $spilist[1] and port $spilist[2] already exists in the database or in the nodeinfo file. You must use a new switch port.\n";
}else{
# after checking, add this one into all_switchports
$all_switchports{$switch_port} = 0;