-Correct typo in a SLES11 template.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3214 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-04-17 16:35:54 +00:00
parent 801f5bbf2e
commit 078aca4c5c
6 changed files with 78 additions and 24 deletions

View File

@ -1430,6 +1430,8 @@ sub getAllNodeAttribs
#Extract and substitute every node record, expanding groups and substituting as getNodeAttribs does
my $self = shift;
my $attribq = shift;
my $hashretstyle = shift;
my $rethash;
my @results = ();
my %donenodes
; #Remember those that have been done once to not return same node multiple times
@ -1476,7 +1478,12 @@ sub getAllNodeAttribs
$att->{node} = $_;
}
$donenodes{$_} = 1;
push @results, @attrs; #$self->getNodeAttribs($_,@attribs);
if ($hashretstyle) {
$rethash->{$_} = \@attrs; #$self->getNodeAttribs($_,\@attribs);
} else {
push @results, @attrs; #$self->getNodeAttribs($_,@attribs);
}
}
}
}
@ -1484,7 +1491,11 @@ sub getAllNodeAttribs
$self->{nodelist}->{_use_cache} = 0;
xCAT::NodeRange::retain_cache(0);
$query->finish();
return @results;
if ($hashretstyle) {
return $rethash;
} else {
return @results;
}
}
#--------------------------------------------------------------------------

View File

@ -19,6 +19,7 @@ require DBI;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(genpassword);
my $utildata; #data to persist locally
#--------------------------------------------------------------------------------
=head1 xCAT::Utils
@ -1917,7 +1918,7 @@ sub my_ip_facing
#-------------------------------------------------------------------------------
=head3 nodeonmynet - checks to see if node is on the network
=head3 nodeonmynet - checks to see if node is on any network this server is attached to or remote network potentially managed by this system
Arguments:
Node name
Returns: 1 if node is on the network
@ -1949,7 +1950,25 @@ sub nodeonmynet
return 0; #Not supporting IPv6 here IPV6TODO
}
my $noden = unpack("N", inet_aton($nodeip));
my @nets = split /\n/, `/sbin/ip route`;
my @nets;
if ($utildata->{nodeonmynetdata} and $utildata->{nodeonmynetdata}->{pid} == $$) {
} else {
@nets = split /\n/, `/sbin/ip route`;
my $nettab=xCAT::Table->new("networks");
my @vnets = $nettab->getAllAttribs('net','mgtifname','mask');
foreach (@vnets) {
if ($_->{mgtifname} eq '!remote!') { #global scoped network
my $curm = unpack("N", inet_aton($_->{mask}));
my $bits=32;
until ($curm & 1) {
$bits--;
$curm=$curm>>1;
}
push @nets,$_->{'net'}."/".$bits." remote";
}
}
$utildata->{nodeonmynetdata}->{pid}=$$;
$utildata->{nodeonmynetdata}->{n}
foreach (@nets)
{
my @elems = split /\s+/;

View File

@ -1580,6 +1580,7 @@ sub power {
sub beacon {
my $subcommand = shift;
my $data;
unless ($subcommand) { $subcommand = "stat"; }
if ($subcommand eq "stat") {
} elsif ($subcommand eq "on") {
$data = $session->set(new SNMP::Varbind([$beaconoid,$slot , 1,'INTEGER']));

View File

@ -16,6 +16,7 @@ use Fcntl ':flock';
my @dhcpconf; #Hold DHCP config file contents to be written back.
my @nrn; # To hold output of networks table to be consulted throughout process
my $haveremotenics;
my $domain;
my $omshell;
my $statements; #Hold custom statements to be slipped into host declarations
@ -474,6 +475,7 @@ sub process_request
my $nm = $_->{mask};
#$callback->({data => ["array of nets $n : $if : $nm"]});
if ($if =~ /!remote!/) { #only take in networks with special interface
$haveremotenics=1;
push @nrn, "$n:$if:$nm";
}
}
@ -616,7 +618,7 @@ sub process_request
}
else
{
unless (xCAT::Utils->nodeonmynet($_))
unless ($haveremotenics or xCAT::Utils->nodeonmynet($_))
{
next;
}

View File

@ -42,6 +42,7 @@ my $vmmaxp=64;
my $mactab;
my $nrtab;
my $machash;
my %usedmacs;
my $status_noop="XXXno-opXXX";
sub handled_commands {
@ -185,26 +186,37 @@ sub build_nicstruct {
push @macs,$macaddr;
}
}
unless (scalar(@macs)) {
my $allbutmult = 65279; # & mask for bitwise clearing of the multicast bit of mac
my $localad=512; # | to set the bit for locally admnistered mac address
my $leading=int(rand(65535));
$leading=$leading|512;
$leading=$leading&65279;
my $n=inet_aton($node);
my $tail;
if ($n) {
$tail=unpack("N",$n);
unless (scalar(@macs) >= scalar(@nics)) {
my $neededmacs=scalar(@nics) - scalar(@macs);
my $macstr;
my $tmac;
my $leading;
while ($neededmacs--) {
my $allbutmult = 65279; # & mask for bitwise clearing of the multicast bit of mac
my $localad=512; # | to set the bit for locally admnistered mac address
$leading=int(rand(65535));
$leading=$leading|512;
$leading=$leading&65279;
my $n=inet_aton($node);
my $tail;
if ($n) {
$tail=unpack("N",$n);
}
unless ($tail) {
$tail=int(rand(4294967295));
}
$tmac = sprintf("%04x%08x",$leading,$tail);
$tmac =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
if ($usedmacs{$tmac}) { #If we have a collision we can actually perceive, retry the generation of this mac
$neededmacs++;
next;
}
$usedmacs{$tmac}=1;
push @macs,$tmac;
}
unless ($tail) {
$tail=int(rand(4294967295));
}
my $macstr = sprintf("%04x%08x",$leading,$tail);
$macstr =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
$mactab->setNodeAttribs($node,{mac=>$macstr});
$mactab->setNodeAttribs($node,{mac=>join('|',@macs)});
$nrtab->setNodeAttribs($node,{netboot=>'pxe'});
$doreq->({command=>['makedhcp'],node=>[$node]});
push @macs,$macstr;
}
my @rethashes;
foreach (@macs) {
@ -775,7 +787,16 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
$vmhash = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','storage','memory','cpus','nics','bootorder','virtflags']);
$mactab = xCAT::Table->new("mac",-create=>1);
$nrtab= xCAT::Table->new("noderes",-create=>1);
$machash = $mactab->getNodesAttribs($noderange,['mac']);
$machash = $mactab->getAllNodeAttribs(['mac'],1);
my $macs;
my $mac;
foreach (keys %$machash) {
$macs=$machash->{$_}->[0]->{mac};
foreach $mac (split /\|/,$macs) {
$mac =~ s/\!.*//;
$usedmacs{lc($mac)}=1;
}
}
}
sub process_request {

View File

@ -44,7 +44,7 @@
<packages config:type="list">
<package>xntp</package>
<package>rsync</package>
<package>nmp</package>
<package>nmap</package>
<package>perl-DBI</package>
<package>vsftpd</package>
<package>perl-DBD-mysql</package>