From e9441739a056644ca5cf3d053a35cf8156b1ef96 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 28 Mar 2013 18:30:46 +0000 Subject: [PATCH] Add more IPv6 magic to ESXi setup git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15705 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 72d6fbdd4..d3b55a6af 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -458,18 +458,28 @@ sub managed_address_mode { return $::XCATSITEVALS{managedaddressmode}; } sub esxipv6setup { - if ($::XCATSITEVALS{managedaddressmode} ne "autoula") { return ""; } # blank unless autoula + if (not $::XCATSITEVALS{managedaddressmode} or $::XCATSITEVALS{managedaddressmode} =~ /v4/) { return ""; } # blank line for ipv4 schemes + my $v6addr; + if ($::XCATSITEVALS{managedaddressmode} eq "autoula") { my $hoststab; my $mactab = xCAT::Table->new('mac',-create=>0); - my $ent = $mactab->getNodeAttribs($node,['mac']); + my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1); my $suffix = $ent->{mac}; $suffix = lc($suffix); unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; } #in autoula, because ESXi weasel doesn't seemingly grok IPv6 at all, we'll have to do it in %pre unless ($hoststab) { $hoststab = xCAT::Table->new('hosts',-create=>1); } - my $ulaaddr = autoulaaddress($suffix); - $hoststab->setNodeAttribs($node,{ip=>$ulaaddr}); - return 'esxcfg-vmknic -i '.$ulaaddr.'/64 "Management Network"'."\n"; + $v6addr = autoulaaddress($suffix); + $hoststab->setNodeAttribs($node,{ip=>$v6addr}); + } else { + my $hoststab = xCAT::Table->new('hosts',-create=>0); + unless ($hoststab) { die "unable to proceed, no hosts table to read from" } + my $ent = $hoststab->getNodeAttribs($node,["ip"],prefetchcache=>1); + unless ($ent and $ent->{ip}) { die "no hosts table entry with viable IP in hosts table for $node" } + $v6addr = $ent->{ip}; + unless ($v6addr =~ /:/) { die "incorrect format for static ipv6 in hosts table for $node" } + } + return 'esxcfg-vmknic -i '.$v6addr.'/64 "Management Network"'."#ESXISTATICV6\n"; } sub kickstartnetwork {