Hey Andy,

Good work, but it would be really convenient if you'd just send a pull request on Github?
Can you also include the modified template file?
I think this should go in the release24 branch, so could you target that please? Then i'll cherry-pick it back into the master branch.

If using Github is too much of a hassle let me know, and i manually apply your changes.



On Wed, Feb 19, 2014 at 6:13 AM, Speagle , Andy <Andy.Speagle@netapp.com> wrote:

Ok… sorry, bad patch for first one.  I didn’t take into account the fact that “obj” might not be a distro… duh:

 

--- pxegen.py   2014-02-18 22:49:55.749451747 -0600

+++ pxegen.py.new       2014-02-18 23:11:17.788451213 -0600

@@ -814,6 +814,13 @@

 

         blended = utils.blender(self.api, False, obj)

 

+        if obj.COLLECTION_TYPE == "distro":

+          if obj.os_version.startswith("esxi5"):

+            realbootcfg = open(os.path.join(os.path.dirname(obj.kernel),'boot.cfg')).read()

+            bootmodules = re.findall(r'modules=(.*)',realbootcfg)

+            for modules in bootmodules:

+              blended['esx_modules'] = modules.replace('/','')

+

         ksmeta = blended.get("ks_meta",{})

         try:

             del blended["ks_meta"]

 

Andy

 

From: cobbler-devel-bounces@lists.fedorahosted.org [mailto:cobbler-devel-bounces@lists.fedorahosted.org] On Behalf Of Speagle , Andy
Sent: Tuesday, February 18, 2014 10:55 PM
To: cobbler-devel@lists.fedorahosted.org
Subject: Re: [cobbler-devel] ESXi 5.x boot.cfg issues

 

Ok,

 

In response to my own question… I figured it out.  It doesn’t look like a sync is calling “generate_bootcfg” at all… and instead this is just being handled in pxegen.write_templates instead.  I modified that method to handle scraping the “real” boot.cfg to grab the modules.  Here’s a patch… though I’m a python hack.  It works, but you may want to clean it up:

 

--- pxegen.py   2014-02-18 22:49:55.749451747 -0600

+++ pxegen.py.new       2014-02-18 22:50:33.479452153 -0600

@@ -814,6 +814,12 @@

 

         blended = utils.blender(self.api, False, obj)

 

+        if obj.os_version.startswith("esxi5"):

+          realbootcfg = open(os.path.join(os.path.dirname(obj.kernel),'boot.cfg')).read()

+          bootmodules = re.findall(r'modules=(.*)',realbootcfg)

+          for modules in bootmodules:

+            blended['esx_modules'] = modules.replace('/','')

+

         ksmeta = blended.get("ks_meta",{})

         try:

             del blended["ks_meta"]

 

Thanks,

 

Andy Speagle

 

From: Speagle , Andy
Sent: Tuesday, February 18, 2014 5:27 PM
To: 'cobbler-devel@lists.fedorahosted.org'
Subject: ESXi 5.x boot.cfg issues

 

Hi Jörgen,

 

I’ve been working on getting ESXi 5.x ISOs imported into Cobbler and this seems to work well.  However, this doesn’t work well for those cases where new or updated drivers or software has been injected into the ISO via VMware’s PowerCLI mechanism for this.  The reason for this is that the bootcfg*.template files have a hard-coded list of modules that are used to create the cobbler-boot.cfg file.  This list of modules should instead be scraped from the real boot.cfg that’s part of the ISO in order to cover the case where things have been injected into the stock ISO.

 

The only place this appears to be handled is by the “generate_bootcfg” method in pxegen.py … but, I’m having some trouble getting this functionality to work.

 

I added this little bit of code to “generate_bootcfg” in pxegen.py …

 

       realbootcfg = open(os.path.join(os.path.dirname(distro.kernel),'boot.cfg')).read()

       bootmodules = re.findall(r'modules=(.*)',realbootcfg)

       for modules in bootmodules:

         blended['esx_modules'] = modules.replace('/','')

 

And replaced the hard-coded modules in /etc/cobbler/pxe/bootcfg_esxi55.template with $esx_modules

 

But… something’s not quite right, it’s not seeing that I set blended['esx_modules'] … so, perhaps the generate_bootcfg method isn’t where this work is done…

 

Could you offer some insight, please?

 

Thanks,

 

Andy Speagle


_______________________________________________
cobbler-devel mailing list
cobbler-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler-devel




--
Grtz,
Jörgen Maas