Skip to content

Add windows_install_type config and improve shutdown resilience #366

Description

@andrew-sumner

/kind feature

Describe the solution you'd like

Two improvements for Windows VM image builds:

1. windows_install_type configuration option

Add a new optional builder field windows_install_type (string) that controls
the Sysprep InstallType sent to the V4 API during Windows guest customization.

  • FRESH — for ISO-based fresh installs where the unattend XML drives a clean
    OS installation. The VM should stay powered off after sysprep so Packer can
    capture the disk.
  • PREPARED (default) — for pre-sysprepped/prepared images where Nutanix
    auto-restarts the VM after shutdown to apply customization on first boot.

Without this option the plugin always uses PREPARED, which causes Nutanix to
restart the VM after sysprep shutdown — breaking the Packer capture workflow
for fresh ISO installs.

Validation is case-insensitive and rejects any value other than FRESH or
PREPARED.

2. Shutdown resilience

  • Tolerate communicator disconnect during shutdown_command: When the
    shutdown command triggers a sysprep that powers off the VM, the SSH/WinRM
    communicator may disconnect before Packer reads the exit status. This is now
    logged as a warning instead of halting the build.
  • Tolerate PowerOff errors when VM is already shut down: If the VM has
    already powered off (e.g. via sysprep), the explicit PowerOff call may fail.
    This is now logged as a warning instead of halting the build.

Anything else you would like to add:

Split from #357 at the maintainer's request for easier review and release tracking.
See discussion: #357 (comment)

Environment:

  • packer-plugin-nutanix version: latest main at commit 6313e87
  • Packer version: v1.15.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions