From a6a6e79446c90e9b066174159cc4d260719f2771 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 6 Jul 2012 21:09:04 +0000 Subject: [PATCH] Add feature to Template.pm to facilitate autoula addressing for esxi5 deployments git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13249 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 15f98393c..139c1e4bf 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -174,6 +174,7 @@ sub subvars { $inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg; $inc =~ s/#COMMAND:([^#]+)#/command($1)/eg; $inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg; + $inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg; $inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg; $inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1,0,1)/eg; $inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1,0,2)/eg; @@ -237,6 +238,21 @@ sub subvars { return 0; } +sub esxipv6setup { + if ($::XCATSITEVALS{managedaddressmode} ne "autoula") { return ""; } # blank unless autoula + my $hoststab; + my $mactab = xCAT::Table->new('mac',-create=>0); + my $ent = $mactab->getNodeAttribs($node,['mac']); + 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"; +} + sub kickstartnetwork { my $line = "network --bootproto="; my $hoststab;