From d80f159f4d8c2202f92dc01aae8ba98626116ac2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 6 Dec 2010 16:40:25 +0000 Subject: [PATCH] -Fix autocommit defaulting for realautocommit git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8327 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 2 +- xCAT-server/lib/xcat/plugins/dhcp.pm | 1 + xCAT-server/lib/xcat/plugins/networks.pm | 56 +++++++++++++++++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 68d8b02ae..05988e09b 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -687,11 +687,11 @@ sub new my $create = 1; if (exists($otherargs{'-create'}) && ($otherargs{'-create'}==0)) {$create = 0;} $self->{autocommit} = $otherargs{'-autocommit'}; - $self->{realautocommit} = $self->{autocommit}; #Assume we let the DB do the work, i.e. the autocommit is either not used or is not emulated by Table.pm unless (defined($self->{autocommit})) { $self->{autocommit} = 1; } + $self->{realautocommit} = $self->{autocommit}; #Assume we let the DB do the work, i.e. the autocommit is either not used or is not emulated by Table.pm my $class = ref($proto) || $proto; if ($dbworkerpid) { my $request = { diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index c88b55062..164d63614 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -42,6 +42,7 @@ my %dynamicranges; #track dynamic ranges defined to see if a host that resolves # dhcp 4.x will use /etc/dhcp/dhcpd.conf as the config file if ( $^O ne 'aix' and -d "/etc/dhcp" ) { $dhcpconffile = '/etc/dhcp/dhcpd.conf'; + $dhcp6conffile = '/etc/dhcp/dhcpd6.conf'; } sub ipIsDynamic { diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index 132cbb045..2c000e61d 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -348,6 +348,7 @@ sub donets } else { # For Linux systems + my @ip6table = split /\n/,`/sbin/ip -6 route`; my @rtable = split /\n/, `/bin/netstat -rn`; open($rconf, "/etc/resolv.conf"); my @nameservers; @@ -382,6 +383,60 @@ sub donets $netgw{$entarr[0]}{$entarr[2]} = $entarr[1]; } } + #routers advertise their role completely outside of DHCPv6 scope, we don't need to + #get ipv6 routes and in fact *cannot* dictate router via DHCPv6 at this specific moment. + foreach (@ip6table) + { + my @ent = split /\s+/, $_; + if ($ent[0] eq 'fe80::/64' or $ent[0] eq 'unreachable' or $ent[1] eq 'via') { + #Do not contemplate link-local, unreachable, or gatewayed networks further + #DHCPv6 relay will be manually entered into networks as was the case for IPv4 + next; + } + my $net = shift @ent; + my $dev = shift @ent; + if ($dev eq 'dev') { + $dev = shift @ent; + } else { + die "Unrecognized IPv6 routing entry $_"; + } + my @myv6addrs=split /\n/,`ip -6 addr show dev $dev scope global`; + #for v6, deprecating mask since the CIDR slash syntax is ubiquitous + my $consideredaddr=$net; + $consideredaddr=~ s!/(.*)!!; + my $consideredbits=$1; + #below may be redundant, but apply resolution in case ambiguous net, e.g. 2001:0db8:0::/64 is the same thing as 2001:0db8::/64 + $consideredaddr = xCAT::NetworkUtils::getipaddr($consideredaddr); + my $netexists=0; + foreach my $netn (@netlist) { #search for network that doesn't exist yet + my $curnet=$nethash{$netn}{'net'}; + unless ($curnet =~ /:/) { #only ipv6 here + next; + } + $curnet =~ s!/(.*)!!; #remove + my $curnetbits=$1; + unless ($consideredbits==$curnetbits) { #only matches if netmask matches + next; + } + $currnet = xCAT::NetworkUtils::getipaddr($currnet); + unless ($currnet eq $consideredaddr) { + next; + } + $netexists=1; + } + if ($::DISPLAY) { + push @{$rsp->{data}}, "\n#From $host."; + push @{$rsp->{data}}, "$net:"; + push @{$rsp->{data}}, " objtype=network"; + push @{$rsp->{data}}, " net=$net"; + push @{$rsp->{data}}, " mgtifname=$dev"; + } else { + unless ($netexiss) { + $nettab->setAttribs({'net' => $net, 'mask' => ''}, {'netname' => $net, 'mgtifname' => $dev}); + } + } + + } foreach (@rtable) { #should be the lines to think about, do something with U, and something else with UG @@ -509,7 +564,6 @@ sub donets } } } - #Nothing much sane to do for the other fields at the moment? } elsif ($ent[3] eq 'UG')