Skip to content

Conversation

@tenthirtyam
Copy link
Collaborator

@tenthirtyam tenthirtyam commented Sep 15, 2025

Description

  • Only set non-zero or enabled fields, preventing unnecessary changes.
  • Always applies the configuration to ensure template settings are preserved.
packer-plugin-vsphere on  fix/always-apply-hardware-configuration [$] via 🐹 v1.23.11 
➜ go test ./...
?       github.com/hashicorp/packer-plugin-vsphere      [no test files]
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/clone        0.325s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common       1.430s
?       github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common/testing       [no test files]
?       github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common/utils [no test files]
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/driver       3.461s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/iso  1.091s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/supervisor   6.509s
?       github.com/hashicorp/packer-plugin-vsphere/examples/driver      [no test files]
ok      github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere       0.829s
ok      github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere-template      1.095s
?       github.com/hashicorp/packer-plugin-vsphere/version      [no test files]

packer-plugin-vsphere on  fix/always-apply-hardware-configuration [$] via 🐹 v1.23.11 
➜ go test -v ./builder/vsphere/common -run TestStepConfigureHardware_Run  
=== RUN   TestStepConfigureHardware_Run
=== RUN   TestStepConfigureHardware_Run/Configure_hardware
2025/10/14 09:21:46 ui: Customizing hardware...
=== RUN   TestStepConfigureHardware_Run/Configure_hardware_even_when_config_is_empty_(preserves_template_settings)
2025/10/14 09:21:46 ui: Applying hardware configuration...
=== RUN   TestStepConfigureHardware_Run/Halt_when_configure_return_error
2025/10/14 09:21:46 ui: Customizing hardware...
--- PASS: TestStepConfigureHardware_Run (0.00s)
    --- PASS: TestStepConfigureHardware_Run/Configure_hardware (0.00s)
    --- PASS: TestStepConfigureHardware_Run/Configure_hardware_even_when_config_is_empty_(preserves_template_settings) (0.00s)
    --- PASS: TestStepConfigureHardware_Run/Halt_when_configure_return_error (0.00s)
PASS
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common       0.307s

Resolved Issues

Closes #522

Rollback Plan

Revert commit.

Changes to Security Controls

None.

@tenthirtyam tenthirtyam added this to the v2.1.0 milestone Sep 15, 2025
@tenthirtyam tenthirtyam self-assigned this Sep 15, 2025
@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from f86aa22 to dd7e68c Compare October 6, 2025 19:01
@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from dd7e68c to bfdf005 Compare October 14, 2025 00:27
@tenthirtyam tenthirtyam added the builder/vsphere-clone Builder: vsphere-clone label Oct 14, 2025
@tenthirtyam tenthirtyam marked this pull request as ready for review October 14, 2025 12:47
@tenthirtyam tenthirtyam requested a review from a team as a code owner October 14, 2025 12:47
Copilot AI review requested due to automatic review settings October 14, 2025 12:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes hardware configuration to always run even when the hardware config is empty, ensuring template settings are preserved during VM provisioning.

  • Removes the check that skipped hardware configuration when config was empty
  • Adds a helper method to determine if custom hardware config is provided to display appropriate UI messages
  • Updates test to verify hardware configuration runs even with empty config

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
builder/vsphere/common/step_hardware.go Implements logic to always run hardware configuration and adds helper method to detect custom config
builder/vsphere/common/step_hardware_test.go Updates test case to verify hardware configuration runs with empty config

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from bfdf005 to 31d14bd Compare October 14, 2025 13:00
@tenthirtyam tenthirtyam requested a review from Copilot October 14, 2025 13:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from 31d14bd to a66fef3 Compare October 14, 2025 13:04
@tenthirtyam tenthirtyam requested a review from Copilot October 14, 2025 13:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from a66fef3 to d492bc5 Compare October 14, 2025 13:15
@tenthirtyam tenthirtyam requested a review from Copilot October 14, 2025 13:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tenthirtyam tenthirtyam marked this pull request as draft October 14, 2025 13:21
@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from d492bc5 to 1de6426 Compare October 14, 2025 14:23
@tenthirtyam tenthirtyam requested a review from Copilot October 14, 2025 14:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@tenthirtyam tenthirtyam changed the title [wip] fix: always apply hardware configuration fix: always apply hardware configuration Oct 14, 2025
- Only set non-zero or enabled fields, preventing unnecessary changes.
- Always applies the configuration to ensure template settings are preserved.

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam force-pushed the fix/always-apply-hardware-configuration branch from 1de6426 to 2a256db Compare October 14, 2025 14:44
@tenthirtyam tenthirtyam marked this pull request as ready for review October 14, 2025 14:56
@tenthirtyam tenthirtyam requested a review from kp2099 October 14, 2025 14:56
@kp2099 kp2099 merged commit bd66350 into main Oct 16, 2025
14 checks passed
@kp2099 kp2099 deleted the fix/always-apply-hardware-configuration branch October 16, 2025 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug builder/vsphere-clone Builder: vsphere-clone refactor Refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vsphere-clone: not cloning memory reservations since v1.3.0

2 participants