Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remote hypervisor snapshot creation #228

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

tenthirtyam
Copy link
Collaborator

Description

Moves the snapshot creation step after the upload of the .vmx file to the remote hypervisor. When not set in this order, the virtual machine will not be set to run on the created snapshot.

Testing

General

packer-plugin-vmware on  fix/snapshot-creation [$!] via 🐹 v1.22.5 took 3.4s go fmt ./...

packer-plugin-vmware on  fix/snapshot-creation [$!] via 🐹 v1.22.5 make generate
2024/07/15 22:04:53 Copying "docs" to ".docs/"
2024/07/15 22:04:53 Replacing @include '...' calls in .docs/
Compiling MDX docs in '.docs' to Markdown in '.web-docs'...

packer-plugin-vmware on  fix/snapshot-creation [$!] via 🐹 v1.22.5 took 2.9s make build

packer-plugin-vmware on  fix/snapshot-creation [$!] via 🐹 v1.22.5 make test
?       github.com/hashicorp/packer-plugin-vmware       [no test files]
?       github.com/hashicorp/packer-plugin-vmware/version       [no test files]
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/common 6.714s
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/iso    2.550s
ok      github.com/hashicorp/packer-plugin-vmware/builder/vmware/vmx    2.020s

packer-plugin-vmware on  fix/snapshot-creation [$!] via 🐹 v1.22.5 took 10.4s make dev 
packer plugins install --path packer-plugin-vmware "github.com/hashicorp/vmware"
Successfully installed plugin github.com/hashicorp/vmware from /Users/ryan/Library/Mobile Documents/com~apple~CloudDocs/Code/Personal/packer-plugin-vmware/packer-plugin-vmware to /Users/ryan/.packer.d/plugins/github.com/hashicorp/vmware/packer-plugin-vmware_v1.0.12-dev_x5.0_darwin_arm64

Run

==> vmware-iso.appliance: Deleting unnecessary VMware files...
    vmware-iso.appliance: Deleting: /vmfs/volumes/local/appliance/appliance.scoreboard
    vmware-iso.appliance: Deleting: /vmfs/volumes/local/appliance/vmware.log
==> vmware-iso.appliance: Cleaning VMX prior to finishing up...
    vmware-iso.appliance: Detaching ISO from CD-ROM device ide0:0...
    vmware-iso.appliance: Detaching ISO from CD-ROM device ide1:0...
    vmware-iso.appliance: Disabling VNC server...
==> vmware-iso.appliance: Creating snapshot of the virtual machine...
==> vmware-iso.appliance: Skipping export of virtual machine...
Build 'vmware-iso.appliance' finished after 2 minutes 29 seconds.

==> Wait completed after 2 minutes 29 seconds

==> Builds finished. The artifacts of successful builds are:
--> vmware-iso.appliance: VM files in directory: /vmfs/volumes/local/appliance
sata0.present = "FALSE"
scsi0.pcislotnumber = "16"
scsi0.present = "TRUE"
scsi0.virtualdev = "pvscsi"
scsi0:0.filename = "disk-000001.vmdk" <--- expected result.
scsi0:0.present = "TRUE"
scsi0:0.redo = ""

Reference

Closes #68

@tenthirtyam tenthirtyam added this to the v1.1.0 milestone Jul 16, 2024
@tenthirtyam tenthirtyam self-assigned this Jul 16, 2024
@tenthirtyam tenthirtyam requested a review from a team as a code owner July 16, 2024 02:09
Moves the snapshot creation step after the upload of the `.vmx` file to the remote hypervisor. When not set in this order, the virtual machine will not be set to run on the created snapshot.

Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lbajolet-hashicorp lbajolet-hashicorp merged commit c080728 into main Jul 29, 2024
12 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the fix/snapshot-creation branch July 29, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vmware-iso: Using the snapshot_name option with ESXi, the VMX file does not refer the correct snapshot
2 participants