According to the documentation of builder
vsphere-iso it’s possible to either specify iso files directly on a datastore, or in a Content Library (VSphere ISO - Builders | Packer by HashiCorp).
However when I specify an iso in that format (also tried it without the subfolder):
I get the error
error mounting an image 'ISO-files/VMware-tools-windows-11.2.1-17243207/VMware-tools-windows-11.2.1-17243207.iso': Invalid datastore path 'ISO-files/VMware-tools-windows-11.2.1-17243207/VMware-tools-windows-11.2.1-17243207.iso'
I tried looking for clues on how to use it in the relevant PR (Accept content library path in iso_paths by sylviamoss · Pull Request #9801 · hashicorp/packer · GitHub) but it just confuses me further
I’m using packer 1.6.6 btw
If that’s your Content Library path, like
libraryName/itemName/fileName, then it is supposed to work. Could you share the logs of your build please when you run it with
This image should hopefully confirm I’m using the correct path:
The logs of my build (relevant portion starts at line 145 I assume): + packer build -on-error=cleanup -var-file=packer/variables.vsphere.json - - Pastebin.com
For reference, I’m testing this on the following vCenter:
- Version: 7.0.1
- Build: 17005016
I’ve tested your path against the path validation code and it checks successfully. From the error below I know that Packer is unable to find the Content Library.
packer-builder-vsphere-iso plugin: ISO path not identified as a Content Library path
Could you make sure that the Content Library is accessible via the host/cluster/user you’re using?
Thanks for taking the time to look into this.
The line you quoted is line 142, which refers to the ISO provided through
iso_url; then on line 145-146 the ISO provided through
iso_paths is tried, this is where I’m actually asking this question for.
The account used should have global admin rights on the entire vCenter cluster and all resources (it’s the default
Is there any trace log-level I can enable to try and figure this out?
Sorry, got confused between the lines. It actually can find the Content Library but can’t find the datastore ID for it.
What Packer does is call the vcenter API asking for the datastore name for a given Content Library ID and that call is returning an error.
Everything that Packer does is possible to do via govc. I suggest you try to do this workflow with govc and see if it returns the datastore id.
Here their usage docs: govmomi/USAGE.md at master · vmware/govmomi · GitHub
I would use the following to get the datastore id:
govc library.info [options]
Then, to get the datastore info:
govc datastore.info [options]
Remember to be logged in with the same account that you’re with Packer.
We need to figure out if
datastore-12 is the ID of one of the datastores you can fetch from the first command.
Does it work if you do it like:
.\govc_windows_amd64.exe datastore.info datastore-12
I just tried; it doesn’t seem to recognise
.\govc_windows_amd64.exe datastore.info -dc=Datacenter datastore-12
.\govc_windows_amd64.exe : datastore ‘datastore-12’ not found
Interestingly, a newly created Content Library shows actual datastore names as expected:
Created: Sat Jan 2 12:34:14 2021
Name: OVA appliances
Path: /OVA appliances
Created: Tue Jan 12 10:33:30 2021
I think I’ll try recreating the Content Library to see if it starts working then…
This is probably the same result Packer has when trying to get information from this datastore. Let me know if worked for the recreated Content Library.
Yeah, everything started working with the newly created CL. If I ever encounter it again, at least I know what’s happening