Open julien-lang opened 2 years ago
I think the error might come from the list of steps in the builder/vmware/iso/builder.go file.
The StepCreateSnapshot
is defined before the StepUploadVMX
step. So if I understand the code correclty, This will override the VMDK filename in the VMX.
So the fixup could simply be:
diff --git a/builder/vmware/iso/builder.go b/builder/vmware/iso/builder.go
index 951aaab..4074d62 100644
--- a/builder/vmware/iso/builder.go
+++ b/builder/vmware/iso/builder.go
@@ -179,12 +179,12 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
RemoveEthernetInterfaces: b.config.VMXConfig.VMXRemoveEthernet,
VNCEnabled: !b.config.DisableVNC,
},
- &vmwcommon.StepCreateSnapshot{
- SnapshotName: &b.config.SnapshotName,
- },
&vmwcommon.StepUploadVMX{
RemoteType: b.config.RemoteType,
},
+ &vmwcommon.StepCreateSnapshot{
+ SnapshotName: &b.config.SnapshotName,
+ },
&vmwcommon.StepExport{
Format: b.config.Format,
SkipExport: b.config.SkipExport,
But I have not tested it yet.
This was, in fact, the issue. I've opened a PR to address this in both builders and address some minor tech debt for this option.
I use packer to generate virtual machines on ESXi.
I set a snapshot_name combined with
"keep_registered": true
and"skip_export": true
.Packer succeed to create the Virtual Machine and the snapshot is created indeed but the VMX file does refer the snapshot:
Actual result:
Expected result:
Related to #20