diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 6db9a39c1..48b8411a2 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -432,6 +432,21 @@ sub setdestiny { $nodetypetable->setNodesAttribs(\@tmpnodelist, $updateattribs); } } + + if (%state_hash) { # To valide mac here + my @tempnodes = keys(%state_hash); + my $mactab = xCAT::Table->new('mac', -create => 1); + my $machash = $mactab->getNodesAttribs(\@tempnodes, ['mac']); + + foreach (@tempnodes) { + my $macs = $machash->{$_}->[0]; + unless ($macs and $macs->{mac}) { + $failurenodes{$_} = 1; + xCAT::MsgUtils->report_node_error($callback, $_, "No MAC address available for this node"); + delete $state_hash{$_}; + } + } + } } #print Dumper(\%state_hash); diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 14f322b76..df6bc5d7a 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -150,7 +150,6 @@ sub setstate { unless (-d "$bootloader_root") { mkpath("$bootloader_root"); } - #my $nodemac; my $cref = $chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']); @@ -525,31 +524,6 @@ sub process_request { return; } - my $state = $args[0]; - my $reststates; - # to support the case that the state could be 'osimage=xxx'; 'runimage=yyy,runcmd=xxx' - ($state, $reststates) = split(/,/, $state, 2); - chomp($state); - - my $mactab = xCAT::Table->new('mac', -create => 1); - my $machash = $mactab->getNodesAttribs(\@nodes, ['mac']); - - if ($state eq 'osimage' || $state =~ 'osimage=') { # To valide mac here - my @validnodes = (); - my $cflag = 0; - foreach (@nodes) { - my $macs = $machash->{$_}->[0]; - unless ($macs and $macs->{mac}) { - $failurenodes{$_} = 1; - xCAT::MsgUtils->report_node_error($callback, $_, "No MAC address available"); - $cflag = 1; - next; - } - push @validnodes, $_; - } - @nodes = @validnodes if $cflag; - } - #now run the begin part of the prescripts unless ($args[0] eq '') { # or $args[0] eq 'enact') { $errored = 0; @@ -614,6 +588,7 @@ sub process_request { my $typehash = $typetab->getNodesAttribs(\@nodes, [ 'os', 'provmethod', 'arch', 'profile' ]); my $linuximgtab = xCAT::Table->new('linuximage', -create => 1); my $osimagetab = xCAT::Table->new('osimage', -create => 1); + my %machash = (); my $rc; my $errstr;