Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
updated xCAT-SoftLayer for rhel
This commit is contained in:
commit
ba9dc1cd5e
@ -946,7 +946,7 @@ site => {
|
||||
" nodestatus: If set to 'n', the nodelist.status column will not be updated during\n".
|
||||
" the node deployment, node discovery and power operations. The default is to update.\n\n".
|
||||
" skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n".
|
||||
" skipvalidatelog: If set, then getcredential and getpostscript call will not be logged.\n\n".
|
||||
" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n".
|
||||
" -------------\n".
|
||||
"DHCP ATTRIBUTES\n".
|
||||
" -------------\n".
|
||||
|
@ -22,6 +22,7 @@ opt/xcat/share/xcat/ib/netboot/sles
|
||||
opt/xcat/share/xcat/ib/netboot/rh
|
||||
opt/xcat/lib
|
||||
opt/xcat/lib/perl
|
||||
opt/xcat/lib/perl/Confluent
|
||||
opt/xcat/lib/perl/xCAT
|
||||
opt/xcat/lib/perl/xCAT_plugin
|
||||
opt/xcat/lib/perl/xCAT_schema
|
||||
|
@ -24,6 +24,7 @@ lib/xcat/plugins/* opt/xcat/lib/perl/xCAT_plugin/
|
||||
lib/xcat/schema/* opt/xcat/lib/perl/xCAT_schema/
|
||||
lib/xcat/monitoring/* opt/xcat/lib/perl/xCAT_monitoring/
|
||||
lib/xcat/dsh/Context/* opt/xcat/xdsh/Context
|
||||
lib/xcat/Confluent/* opt/xcat/lib/perl/Confluent/
|
||||
|
||||
lib/xcat/shfunctions opt/xcat/lib
|
||||
etc/init.d/xcatd etc/init.d
|
||||
|
@ -60,6 +60,7 @@ binary-arch:
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/samples/*
|
||||
chmod 755 $(rootdir)/lib/perl/xCAT_monitoring/pcp
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/pcp/*
|
||||
chmod 644 $(rootdir)/lib/perl/Confluent/*
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_schema/*
|
||||
chmod 755 $(rootdir)/lib/perl/xCAT_schema/samples
|
||||
chmod 644 $(rootdir)/lib/perl/xCAT_schema/samples/*
|
||||
|
@ -1302,26 +1302,50 @@ Usage:
|
||||
my $nodelist = $request->{node};
|
||||
my $hostname = $nodelist->[0];
|
||||
|
||||
# Validate MAC address
|
||||
my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac');
|
||||
%allmacs = %$recordsref;
|
||||
foreach (keys %allmacs){
|
||||
my @hostentries = split(/\|/, $_);
|
||||
foreach my $hostandmac ( @hostentries){
|
||||
my ($macstr, $machostname) = split("!", $hostandmac);
|
||||
$allmacs{$macstr} = 0;
|
||||
if("__NOMAC__" eq $args_dict{"mac"}) {
|
||||
# Validate if node is bind on a switch
|
||||
my $switch_table = xCAT::Table->new("switch");
|
||||
my @item = $switch_table->getAttribs({'node' => $hostname}, 'switch', 'port');
|
||||
my $item_num = @item;
|
||||
my $switch_valid = 0;
|
||||
unless($item[0])
|
||||
{
|
||||
setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly.");
|
||||
return;
|
||||
} else {
|
||||
foreach my $switch_item (@item){
|
||||
if($switch_item->{'switch'} && $switch_item->{'port'}){
|
||||
$switch_valid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
unless ($switch_valid)
|
||||
{
|
||||
setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
#Validate MAC address
|
||||
my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac');
|
||||
%allmacs = %$recordsref;
|
||||
foreach (keys %allmacs){
|
||||
my @hostentries = split(/\|/, $_);
|
||||
foreach my $hostandmac ( @hostentries){
|
||||
my ($macstr, $machostname) = split("!", $hostandmac);
|
||||
$allmacs{$macstr} = 0;
|
||||
}
|
||||
}
|
||||
%allmacsupper = ();
|
||||
foreach (keys %allmacs){
|
||||
$allmacsupper{uc($_)} = 0;
|
||||
}
|
||||
if (exists $allmacsupper{uc($args_dict{"mac"})}){
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address.");
|
||||
return;
|
||||
} elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})) {
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
%allmacsupper = ();
|
||||
foreach (keys %allmacs){
|
||||
$allmacsupper{uc($_)} = 0;
|
||||
}
|
||||
if (exists $allmacsupper{uc($args_dict{"mac"})}){
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address.");
|
||||
return;
|
||||
} elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})){
|
||||
setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address.");
|
||||
return;
|
||||
}
|
||||
|
||||
# re-create the chain record as updating mac may means for replacing a new brand hardware...
|
||||
@ -1341,9 +1365,19 @@ Usage:
|
||||
# Update database records.
|
||||
setrsp_progress("Updating database...");
|
||||
# MAC table
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
$mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}});
|
||||
$mactab->close();
|
||||
if("__NOMAC__" eq $args_dict{"mac"})
|
||||
{
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
my %keyhash;
|
||||
$keyhash{'node'} = $hostname;
|
||||
$mactab->delEntries(\%keyhash);
|
||||
$mactab->commit();
|
||||
$mactab->close();
|
||||
} else {
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
$mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}});
|
||||
$mactab->close();
|
||||
}
|
||||
|
||||
# DB update: chain table.
|
||||
my $chaintab = xCAT::Table->new('chain', -create=>1);
|
||||
@ -1370,6 +1404,17 @@ Usage:
|
||||
setrsp_progress("Warning: failed to call kit commands.");
|
||||
}
|
||||
|
||||
if("__NOMAC__" eq $args_dict{"mac"})
|
||||
{
|
||||
setrsp_progress("Updating DHCP entries");
|
||||
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>[$hostname], arg=>['-d']}, $request_command, 0, 2);
|
||||
$retref = {};
|
||||
$retstrref = parse_runxcmd_ret($retref);
|
||||
if ($::RUNCMD_RC != 0){
|
||||
setrsp_progress("Warning: failed to call kit commands.");
|
||||
}
|
||||
}
|
||||
|
||||
setrsp_progress("Re-creating nodes...");
|
||||
$retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>[$hostname], macflag=>[1]}, $request_command, 0, 2);
|
||||
$retstrref = parse_runxcmd_ret($retref);
|
||||
|
Loading…
Reference in New Issue
Block a user