Skip to content

feat: add support for vgpu #2113

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

@tenthirtyam tenthirtyam added breaking-change Breaking Change and removed needs-review Needs Review labels Apr 30, 2024
@tenthirtyam tenthirtyam modified the milestones: v2.8.0, v3.0.0 Apr 30, 2024
@tenthirtyam tenthirtyam marked this pull request as draft April 30, 2024 19:00
@tenthirtyam tenthirtyam added the do-not-merge Do Not Merge label Apr 30, 2024
@tenthirtyam tenthirtyam removed the documentation Documentation label Sep 17, 2024
@iBrandyJackson iBrandyJackson removed the request for review from a team December 2, 2024 23:07
@tenthirtyam tenthirtyam removed the provider Provider label Apr 16, 2025
@tenthirtyam tenthirtyam removed the request for review from iBrandyJackson May 5, 2025 19:20
@tenthirtyam tenthirtyam force-pushed the main branch 2 times, most recently from 2d0d0cd to 3ebb159 Compare May 6, 2025 00:35
@tenthirtyam tenthirtyam changed the title feat: add support for vgpu [wip] feat: add support for vgpu May 7, 2025
@github-actions github-actions bot added provider Provider needs-review Needs Review labels 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 from dd65e0c to 670d041 Compare May 7, 2025 16:32
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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation enhancement Enhancement needs-review Needs Review provider Provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants