In any very large environment there are multiple versions of software running. Any time one component is updated, no matter how much testing is done, there can still be issues.
Our Image Pipeline process was running smoothly until we upgraded vCenter servicing our build cluster from 6.5 to 6.7 U3 (no ESXi upgrade). Everything seemed fine until we deployed a few VM’s built off of OVA’s created after this upgrade. They would fail to power on with the following errors:
Failed to start the virtual machine. Could not create '/vmfs/volumes/5e3d5d80/vmname/ovf:/file/file2': Could not find the file Module 'Nvman' power on failed.
After doing what we all do (searching Google), I found a VMTN post talking about this issue. It states that vCenter 6.7 adds the NVRAM of the VM to the OVA when exported and vCenter 6.5 can’t handle this when trying to deploy a VM from the OVA. Since we’re replicating via Content Library, vCenter doesn’t strip it out first so the VM is trying to deploy with it and failing to find it since the host is creating a new one.
One user (ethandlowry) worked with VMware, who said to just remove the NVRAM file and info from OVF/MF files. Another user (yannbizeul) provided a shell script to do so. Easy enough. So I tried it out.
Unfortunately, this didn’t completely work. I was able to use the 6.5 UI to import the OVA but anyone who’s done much automation within vSphere knows the UI fixes a bunch of stuff upon import that the API/PowerCLI does not.
In my case, I was now getting “The OVA file is missing an OVF descriptor. (The first entry is not a .ovf file)” error.
An easy way to test if the of OVA is in good shape is with the PowerCLI cmdlet Get-OvfConfiguration, as shown above.
Heading back to Google and thinking about the error message, I needed a way to repackage the OVA properly. The files inside the OVA where fine if I deployed them via Import OVF. I stumbled upon Matt Crape’s post from 2016 on how to use OVFtool to fix an OVA giving “Invalid OVF manifest entry” error so I gave that a shot.
To get the VMTN code working for me I had to make the following changes:
- remove last ‘ from the first sed line as it was not needed and causing problems
- Removing OVA file so that when new OVA is created without error message.
- Could add “-o” parameter to ovftool line to overwrite it. Either way works.
- Replacing “tar -cf …” line with “ovftool sourcefile.ovf destinationfile.ova”
cd ovadir tar -xf myova.ova sed -i -E "/nvram/d" *.ovf sed -i "/\.ovf/s/= .*/= `sha1sum *.ovf |cut -d " " -f 1`/;/nvram/d" *.mf rm -f *.nvram *.ova *.mf ovftool myova.ovf myova.ova
I had to manipulate this code to work in our Image Pipeline since this section runs as a Packer post-processor and we’re using a Docker OVFtool instance. You should be able to manipulate this for your automation processes as well.