Fix defect 2822229 lsslp should set the correct node name in xCAT DB for BPA; 2824599 lsslp should add more attribute in DB for FSP/HMC

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3881 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhanx 2009-07-27 15:28:11 +00:00
parent 4eaedea175
commit d79ae69084
5 changed files with 66 additions and 11 deletions

View File

@ -175,7 +175,7 @@ sub add_ppchcp {
my $hwtype = shift;
my $data = shift;
my @tabs = qw(ppchcp nodehm nodelist);
my @tabs = qw(ppchcp nodehm nodelist nodetype);
my %db = ();
my $name = @$data[4];
@ -202,6 +202,11 @@ sub add_ppchcp {
# Update nodehm table
###################################
$db{nodehm}->setNodeAttribs( $name, {mgt=>lc($hwtype)} );
###################################
# Update nodetype table
###################################
$db{nodetype}->setNodeAttrbs( $name, {nodetype=>lc($hwtype)});
###################################
# Update nodelist table

View File

@ -8,6 +8,7 @@ use HTTP::Cookies;
use HTML::Form;
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
use xCAT::Usage;
use Socket;
##########################################
@ -129,6 +130,7 @@ sub connect {
##################################
# Set options
##################################
# my $serverip = inet_ntoa(inet_aton($server));
my $url = "https://$server/cgi-bin/cgi?form=2";
$ua->cookie_jar( $cookie );
$ua->timeout( $timeout );
@ -1742,6 +1744,11 @@ sub set_netcfg
$inc_type = 'Dynamic';
push @set_entries, 'IP type to dynamic.';
}
elsif ( $inc_ip eq '*')
{
$inc_type = 'Static';
($inc_ip, $inc_host, $inc_gateway, $inc_netmask) = xCAT::Utils::getNodeNetworkCfg(@$exp[1]);
}
else
{
$inc_type = 'Static';

View File

@ -4896,4 +4896,44 @@ sub isIpaddr
return 1;
}
}
#-------------------------------------------------------------------------------
=head3 getNodeNetworkCfg
Description:
Get node network configuration, including "IP, hostname(the nodename),and netmask" by this node's name.
Arguments:
node: the nodename
Returns:
Return an array, which contains (IP,hostname,gateway,netmask').
undef - Failed to get the network configuration info
Globals:
none
Error:
none
Example:
my ($ip,$host,undef,$mask) = xCAT::Utils::getNodeNetworkCfg('node1');
Comments:
Presently gateway is always blank. Need to be improved.
=cut
#-------------------------------------------------------------------------------
sub getNodeNetworkCfg
{
my $node = shift;
my $nets = xCAT::Utils::my_nets();
my $ip = inet_ntoa(inet_aton($node));
my $mask = undef;
for my $net (keys %$nets)
{
my $netname;
($netname,$mask) = split /\//, $net;
last if ( xCAT::Utils::isInSameSubnet( $netname, $ip, $mask, 1));
}
return ($ip, $node, undef, xCAT::Utils::formatNetmask($mask,1,0));
}
1;

View File

@ -538,13 +538,14 @@ sub resolve_hcp {
# Process each node
####################################
foreach my $hcp ( @$noderange ) {
my ($ent) = $db->getAttribs( {hcp=>$hcp},"hcp" );
# my ($ent) = $db->getAttribs( {hcp=>$hcp},"hcp" );
# my ($ent) = $db->getNodeAttribs( $hcp, ["hcp"]);
if ( !defined( $ent )) {
my $msg = sprintf( "$hcp: $errmsg{NODE_UNDEF}", $tab );
send_msg( $request, 1, $msg );
next;
}
# if ( !defined( $ent )) {
# my $msg = sprintf( "$hcp: $errmsg{NODE_UNDEF}", $tab );
# send_msg( $request, 1, $msg );
# next;
# }
################################
# Get userid and password
################################

View File

@ -1120,6 +1120,7 @@ sub gethost_from_url {
if ( !defined( $ip )) {
return undef;
}
#######################################
# Check if valid IP
#######################################
@ -1161,6 +1162,7 @@ return undef if ($opt{H});
$host = getFactoryHostname($type,$mtm,$sn);
#return( $ip );
}
#######################################
# Convert hostname to short-hostname
#######################################
@ -1188,7 +1190,7 @@ sub getFactoryHostname
my $mtm = shift;
my $sn = shift;
if ( $type eq SERVICE_FSP)
if ( $type eq SERVICE_FSP or $type eq SERVICE_BPA)
{
return "Server-$mtm-SN$sn";
}
@ -1525,7 +1527,7 @@ sub xCATdB {
{
if ( $ent->{mtm} and $ent->{serial})
{
$sn_node{"$ent->{mtm}*$ent->{serial}"} = $ent->{node};
$sn_node{"Server-" . $ent->{mtm} . "-SN" . $ent->{serial}} = $ent->{node};
}
}
}
@ -1585,7 +1587,7 @@ sub xCATdB {
}
else
{
$frame = "$bpc_model*$bpc_serial";
$frame = "Server-$bpc_model-SN$bpc_serial";
}
}
########################################
@ -1615,7 +1617,7 @@ sub xCATdB {
my $server = "";
my $values = join( ",",
lc($type),$name,$cageid,$model,$serial,$server,$prof,$frame,$ips );
lc($type),$name,$cageid,$model,$serial,$name,$prof,$frame,$ips );
xCAT::PPCdb::add_ppc( "fsp", [$values] );
}
elsif ( $type =~ /^(RSA|MM)$/ ) {