Upstream Issue Draft: packer-plugin-vsphere Resource Pool Path/Panic
Title
vsphere-iso: resource pool path handling can panic or fail with malformed lookup path
Repository
hashicorp/packer-plugin-vsphere
Version/Environment
- Packer:
1.15.0
- Plugin:
github.com/hashicorp/vsphere 2.1.1
- vCenter:
7.0.3
- Builder:
vsphere-iso
Problem Summary
When resource_pool is provided as a full inventory path (or contains slashes), pool lookup can be malformed and later fail/panic at VM create.
Observed symptoms:
- malformed path shape in logs like:
vSAN Cluster 1/Resources//Datacenter /host/vSAN 1/vSAN Cluster 1/Resources
- failure around
Creating virtual machine...
- in some runs: plugin crash /
unexpected EOF
Repro (high level)
- Configure
vsphere-iso with resource_pool set to absolute inventory path:
/Datacenter/host/vSAN 1/vSAN Cluster 1/Resources
- Run
packer build.
- Observe failure in resource pool resolution / VM create phase.
Expected
resource_pool handling should:
- accept absolute inventory paths as-is
- accept slash-containing paths as-is
- only prefix relative pool names with
<cluster>/Resources/...
- fail with explicit error if default pool cannot be resolved
- avoid nil pool flow that can cascade into panic
Suggested Fix Area
builder/vsphere/driver/resource_pool.go
- function
FindResourcePool(...)
Suggested Logic
TrimSpace on input.
- If empty:
- try
<cluster>/Resources
- fallback
DefaultResourcePool
- return explicit error if unresolved.
- If starts with
/: resolve as absolute path (with trimmed fallback).
- If contains
/: resolve directly as provided path.
- Else: treat as relative name under
<cluster>/Resources/<name>.
- Guard against
nil pool before returning.
Patch Validation
After patch:
- no malformed doubled-path behavior
- no panic at create phase from nil/invalid pool resolution
- run advances to:
Creating virtual machine...
Powering on virtual machine...
Typing boot command...
Additional Note
If build later fails at timeout waiting for IP, that is guest installer/network/tools path, not this resource-pool resolution bug.
Upstream Issue Draft:
packer-plugin-vsphereResource Pool Path/PanicTitle
vsphere-iso: resource pool path handling can panic or fail with malformed lookup pathRepository
hashicorp/packer-plugin-vsphereVersion/Environment
1.15.0github.com/hashicorp/vsphere2.1.17.0.3vsphere-isoProblem Summary
When
resource_poolis provided as a full inventory path (or contains slashes), pool lookup can be malformed and later fail/panic at VM create.Observed symptoms:
vSAN Cluster 1/Resources//Datacenter /host/vSAN 1/vSAN Cluster 1/ResourcesCreating virtual machine...unexpected EOFRepro (high level)
vsphere-isowithresource_poolset to absolute inventory path:/Datacenter/host/vSAN 1/vSAN Cluster 1/Resourcespacker build.Expected
resource_poolhandling should:<cluster>/Resources/...Suggested Fix Area
builder/vsphere/driver/resource_pool.goFindResourcePool(...)Suggested Logic
TrimSpaceon input.<cluster>/ResourcesDefaultResourcePool/: resolve as absolute path (with trimmed fallback)./: resolve directly as provided path.<cluster>/Resources/<name>.nilpool before returning.Patch Validation
After patch:
Creating virtual machine...Powering on virtual machine...Typing boot command...Additional Note
If build later fails at
timeout waiting for IP, that is guest installer/network/tools path, not this resource-pool resolution bug.