Skip to content

Conversation

@mristok
Copy link
Contributor

@mristok mristok commented Jan 12, 2024

Description

Add a new option shared-pci-device-id to the virtual machine resource. This enables users to 1 or more vGPU to the VM as an update to the resource or during the clone operation.

Acceptance tests

  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make test
==> Checking that code complies with gofmt requirements...
go test $(go list ./... |grep -v 'vendor') || exit 1
?       github.com/hashicorp/terraform-provider-vsphere [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/administrationroles    [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource  [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/computeresource [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary  [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/customattribute [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datacenter      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datastore       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup     [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/envbrowse       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/folder  [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/guestoscustomizations   [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/hostsystem      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/network [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/nsx     [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/ovfdeploy       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/provider        [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/resourcepool    [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/spbm    [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/storagepod      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/structure       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/testhelper      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/utils   [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer   [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine  [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsanclient      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsansystem      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/vmworkflow     [no test files]
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere 18.804s
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/viapi   0.013s
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualdisk     0.010s
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice  0.009s
echo $(go list ./... |grep -v 'vendor') | \
        xargs -t -n4 go test  -timeout=30s -parallel=4
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere github.com/hashicorp/terraform-provider-vsphere/vsphere github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/administrationroles github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource
?       github.com/hashicorp/terraform-provider-vsphere [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/administrationroles    [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource  [no test files]
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere 19.604s
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/computeresource github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/customattribute github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datacenter
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/computeresource [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/contentlibrary  [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/customattribute [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datacenter      [no test files]
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datastore github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/envbrowse github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/folder
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/datastore       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup     [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/envbrowse       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/folder  [no test files]
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/guestoscustomizations github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/hostsystem github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/network github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/nsx
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/guestoscustomizations   [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/hostsystem      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/network [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/nsx     [no test files]
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/ovfdeploy github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/provider github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/resourcepool github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/spbm
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/ovfdeploy       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/provider        [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/resourcepool    [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/spbm    [no test files]
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/storagepod github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/structure github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/testhelper github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/utils
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/storagepod      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/structure       [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/testhelper      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/utils   [no test files]
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/viapi github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualdisk github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer   [no test files]
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/viapi   0.011s
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine  [no test files]
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/virtualdisk     0.014s
go test '-timeout=30s' '-parallel=4' github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsanclient github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsansystem github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/vmworkflow
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsanclient      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/helper/vsansystem      [no test files]
?       github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/vmworkflow     [no test files]
ok      github.com/hashicorp/terraform-provider-vsphere/vsphere/internal/virtualdevice  0.011s

Release Note

Release note for CHANGELOG:

Enable vGPU capabilities for VMs:
- As an update to an existing VM (add/remove)
- As part of a new VM deployment, both new and clone from template

References

Closes #1378

@tenthirtyam tenthirtyam mentioned this pull request Jan 12, 2024
2 tasks
@mristok mristok marked this pull request as ready for review January 16, 2024 16:06
@mristok mristok requested a review from a team as a code owner January 16, 2024 16:06
@tenthirtyam tenthirtyam changed the title feat: Add support for vGPU to VM feat: add support for vgpu Jan 22, 2024
@tenthirtyam tenthirtyam self-requested a review January 22, 2024 23:17
@tenthirtyam tenthirtyam added this to the v2.7.0 milestone Jan 22, 2024
@tenthirtyam tenthirtyam added the enhancement Enhancement label Jan 22, 2024
@tenthirtyam tenthirtyam modified the milestones: v2.7.0, On Deck Jan 23, 2024
@tenthirtyam tenthirtyam requested review from spacegospod and removed request for vasilsatanasov March 5, 2024 16:47
@spacegospod
Copy link
Contributor

Hey @mristok did you run the acceptance tests in "vsphere/resource_vsphere_virtual_machine_test.go"?
Your change seems safe-enough but it won't hurt to make sure everything is okay.
It would be even better if you can add a test case for the new property "shared_pci_device_id"

@tenthirtyam tenthirtyam force-pushed the feat/resource-vm-vgpu branch from 3bf974b to 55c9b2f Compare March 6, 2024 19:27
@tenthirtyam tenthirtyam modified the milestones: v2.8.0, Backlog Mar 18, 2024
@tenthirtyam tenthirtyam added the breaking-change Breaking Change label Mar 18, 2024
@tenthirtyam
Copy link
Contributor

Added the breaking-changes label due to the type change.

@spacegospod
Copy link
Contributor

I tested the change with some mock GPUs on my environment, seems to work fine

@tenthirtyam tenthirtyam removed the breaking-change Breaking Change label Apr 3, 2024
@tenthirtyam tenthirtyam modified the milestones: Backlog, v2.8.0 Apr 3, 2024
@tenthirtyam tenthirtyam force-pushed the feat/resource-vm-vgpu branch from 55c9b2f to 0276fdd Compare April 4, 2024 15:02
@mristok
Copy link
Contributor Author

mristok commented Apr 5, 2024

Hey @mristok did you run the acceptance tests in "vsphere/resource_vsphere_virtual_machine_test.go"? Your change seems safe-enough but it won't hurt to make sure everything is okay. It would be even better if you can add a test case for the new property "shared_pci_device_id"

@stoyanzhelyazkov I ran existing acceptance tests. However, I did not create a new test for the new property shared_pci_device_id.

@github-actions github-actions bot added the needs-review Needs Review label May 7, 2025
@tenthirtyam tenthirtyam removed the needs-review Needs Review label May 7, 2025
@tenthirtyam tenthirtyam force-pushed the feat/resource-vm-vgpu branch from afe256f to dd65e0c Compare May 7, 2025 16:18
@github-actions github-actions bot added documentation Documentation needs-review Needs Review labels May 7, 2025
@tenthirtyam tenthirtyam force-pushed the feat/resource-vm-vgpu branch 2 times, most recently from 670d041 to 063f1f6 Compare May 7, 2025 16:36
@tenthirtyam tenthirtyam removed the do-not-merge Do Not Merge label May 7, 2025
@tenthirtyam
Copy link
Contributor

Marking this one as ready for review after post-transfer rebase.

@spacegospod - let's discuss if this one needs to be held for a major still.

@tenthirtyam tenthirtyam self-requested a review May 7, 2025 16:39
@tenthirtyam tenthirtyam removed the breaking-change Breaking Change label May 7, 2025
@tenthirtyam tenthirtyam changed the title [wip] feat: add support for vgpu feat: add support for vgpu May 7, 2025
@tenthirtyam tenthirtyam marked this pull request as ready for review May 7, 2025 16:39
@tenthirtyam tenthirtyam requested a review from a team as a code owner May 19, 2025 14:34
@tenthirtyam tenthirtyam added the breaking-change Breaking Change label May 30, 2025
@tenthirtyam tenthirtyam changed the title feat: add support for vgpu [wip] feat: add support for vgpu May 30, 2025
@tenthirtyam tenthirtyam marked this pull request as draft May 30, 2025 17:28
@github-actions github-actions bot added the size/l Relative Sizing: Large label May 30, 2025
@tenthirtyam tenthirtyam added tests-limitation Testing Limitation and removed needs-review Needs Review provider Provider labels May 30, 2025
Add a new option `shared-pci-device-id` to the `virtual machine` resource. This enables users to 1 or more vGPU to the VM as an update to the resource or during the clone operation.
@tenthirtyam tenthirtyam force-pushed the feat/resource-vm-vgpu branch from 063f1f6 to 6363456 Compare June 4, 2025 22:49
@github-actions github-actions bot added provider Provider needs-review Needs Review size/m Relative Sizing: Medium labels Jun 4, 2025
@pftrothen
Copy link

very good feature 👍 any plans on merging this?

@spacegospod
Copy link
Contributor

very good feature 👍 any plans on merging this?

I'm looking at the diff and the feature seems incomplete. The actual implementation is missing, all I see is changes to the schema.

@mristok can you take a look? Maybe something went wrong along the way, I see a bunch of force pushes

@sebracs
Copy link

sebracs commented Nov 4, 2025

Wasn't this already implemented in releases v2.7.0 and v2.8.0? Or is this another part here?

@pftrothen
Copy link

Wasn't this already implemented in releases v2.7.0 and v2.8.0? Or is this another part here?

The way I see it v2.7.0 implements the data source vsphere_host_vgpu_profile to obtain available profiles but no means to configure it on the vsphere_virtual_machine resource.
And v2.8.0 seems to have implemented it for vsphere_virtual_machine_class resource.

At least this is what it looks like - when testing with provider version 2.13.0 I get a Unsupported argument for vgpu_devices on vsphere_virtual_machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Breaking Change documentation Documentation enhancement Enhancement needs-review Needs Review provider Provider size/l Relative Sizing: Large size/m Relative Sizing: Medium tests-limitation Testing Limitation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants