Skip to content

SMM is not enabled when TPM is enabled in VMware source client #71

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

Merged
merged 1 commit into from
May 6, 2025

Conversation

votdev
Copy link
Member

@votdev votdev commented Apr 1, 2025

When TPM is enabled, SMM should be enabled as well. The OpenStack client part is doing that already, but the VMware client is missing that.

This PR makes also use of the pointer.BoolXXX() helper functions to secure de-referencing of nil pointers.

Related to: harvester/harvester#7984

@votdev votdev self-assigned this Apr 1, 2025
@Copilot Copilot AI review requested due to automatic review settings April 1, 2025 12:23
Copilot

This comment was marked as outdated.

@votdev votdev changed the title Make use of pointer.Bool() Make use of pointer.Bool() and pointer.BoolDeref Apr 1, 2025
@votdev votdev force-pushed the pointer_bool branch 3 times, most recently from 7aa4b09 to 614c3f8 Compare April 3, 2025 08:07
@votdev votdev changed the title Make use of pointer.Bool() and pointer.BoolDeref SMM is not enabled when TPM is enabled in VMware source client Apr 3, 2025
@votdev votdev requested a review from Copilot April 3, 2025 09:02
Copilot

This comment was marked as outdated.

@votdev votdev requested a review from Copilot April 3, 2025 09:23
Copilot

This comment was marked as outdated.

@votdev votdev requested a review from Copilot April 3, 2025 09:24
Copilot

This comment was marked as outdated.

@votdev votdev requested a review from Copilot April 3, 2025 09:28
Copy link

@Copilot 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 an issue where SMM is not enabled when TPM is enabled on VMware virtual machines, while also standardizing the use of pointer helper functions for safely dereferencing nil pointers. Key changes include:

  • Enabling SMM if either secure boot or TPM is enabled in the VMware client.
  • Updating test assertions and error messages for consistency.
  • Standardizing boolean pointer usage across VMware and OpenStack client implementations.

Reviewed Changes

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

File Description
pkg/source/vmware/client_test.go Updates test assertions and docker image tag, and adds secureboot tests
pkg/source/vmware/client.go Refines firmware, secure boot, TPM, and SMM configuration logic
pkg/source/openstack/client.go Standardizes pointer helper usage and similar configuration updates
Comments suppressed due to low confidence (2)

pkg/source/vmware/client_test.go:208

  • [nitpick] Consider using consistent capitalization in error messages (e.g., 'VM export' vs. 'VM CR generation') for clarity and uniformity.
assert.NoError(err, "expected no error during vm export")

pkg/source/vmware/client.go:394

  • [nitpick] Consider refactoring the shared firmware and security features configuration (secure boot, TPM, and SMM) into a common helper to reduce duplication with the OpenStack client implementation.
// setup bios/efi, secureboot and tpm settings

Copy link
Member

@starbops starbops left a comment

Choose a reason for hiding this comment

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

LGTM, I have one simple question: Should we also add a unit test for the OpenStack source client?

@votdev
Copy link
Member Author

votdev commented Apr 7, 2025

LGTM, I have one simple question: Should we also add a unit test for the OpenStack source client?

@starbops Done by extracting the relevant code into a helper function which can be easily tested via unit test.

@votdev votdev requested a review from starbops April 9, 2025 07:56
starbops
starbops previously approved these changes Apr 10, 2025
Copy link
Member

@starbops starbops left a comment

Choose a reason for hiding this comment

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

LGTM, thank you.

w13915984028
w13915984028 previously approved these changes Apr 29, 2025
Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Copy link
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@votdev votdev merged commit 859479d into harvester:main May 6, 2025
5 checks passed
@votdev votdev deleted the pointer_bool branch May 6, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants