diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 554be4b36..acadf67ca 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -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". diff --git a/xCAT-server/debian/dirs b/xCAT-server/debian/dirs index e9bb97e2d..93ede5a69 100644 --- a/xCAT-server/debian/dirs +++ b/xCAT-server/debian/dirs @@ -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 diff --git a/xCAT-server/debian/install b/xCAT-server/debian/install index 8ecc00e59..37c168c20 100644 --- a/xCAT-server/debian/install +++ b/xCAT-server/debian/install @@ -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 diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index f3a068123..410c07bb6 100644 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -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/* diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 09f72adce..2f0cc335f 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -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);