Skip to content
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

Add support for the vsphere_host_pci_device data source to return all PCI devices which share the same details #1572

Open
itayporezky opened this issue Feb 5, 2022 · 3 comments · May be fixed by #2049
Labels
acknowledged Status: Issue or Pull Request Acknowledged enhancement Type: Enhancement new-data-source Feature: New Data Source
Milestone

Comments

@itayporezky
Copy link

Description

Using vsphere_host_pci_device data source, unable to get ID of the second device when there is a situation where there are 2 PCI devices on the same host which share same vendor, name, model.

For example, I have an esxi host which has 2 GPU cards from the same vendor, and are the same.

ID: 0000:D8:00.0

NAME: NVIDIA Corporation
GA100 [A100 PCIe 40GB]

and

ID: 0000:3B:00.0

NAME: NVIDIA Corporation
GA100 [A100 PCIe 40GB]

Now, if i want to get the ID of these devices, ill need to use code below.

Potential Terraform Configuration

data "vsphere_datacenter" "dc" {
  name = "DC"
}

data "vsphere_host" "esxi1" {
  name          = "esx1.domain.local"
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_host_pci_device" "esxi1_gpu" {
  host_id = data.vsphere_host.esxi1.id
  name_regex = "GA100"
}

Here im using name_regex to find a matching device, problem is, this returns only a single ID of the first match. Its impossible to get the ID of the second GPU.
Same happens when trying to filter using vendor_id or class_id

When I run the above code, and use output to see output:

output "device_details" {
  value = data.vsphere_host_pci_device.esx1-gpu2
}

this is the result:

Changes to Outputs:
  + device_details = {
      + class_id   = "302"
      + host_id    = "host-1006"
      + id         = "0000:3b:00.0"
      + name       = "GA100 [A100 PCIe 40GB]"
      + name_regex = "GA100"
      + vendor_id  = "10de"
    }

Only the first GPU is "reachable"

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@itayporezky itayporezky added the enhancement Type: Enhancement label Feb 5, 2022
@itayporezky itayporezky changed the title vsphere_host_pci_device data_source, can't "select" other device with identical name. vsphere_host_pci_device data_source, be able to get ID of the other PCI device which share same details Feb 5, 2022
@itayporezky
Copy link
Author

Continuing slack chat, tagging @tenthirtyam
Thanks Ryan.

@tenthirtyam tenthirtyam added the acknowledged Status: Issue or Pull Request Acknowledged label Feb 5, 2022
@tenthirtyam tenthirtyam changed the title vsphere_host_pci_device data_source, be able to get ID of the other PCI device which share same details Add support for the vsphere_host_pci_device data source to return all PCI devices which share the same details Feb 5, 2022
@tenthirtyam tenthirtyam added the new-data-source Feature: New Data Source label Feb 10, 2022
@tenthirtyam tenthirtyam added this to the Backlog milestone Mar 21, 2022
@holmesb
Copy link

holmesb commented Mar 1, 2023

Same. vsphere_host_pci_device data source is pretty broken if it can only return the first device, when there are many. This is over a year old, be great if can be prioritised. @itayporezky, did you come up with any workaround?

@itayporezky
Copy link
Author

Same. vsphere_host_pci_device data source is pretty broken if it can only return the first device, when there are many. This is over a year old, be great if can be prioritised. @itayporezky, did you come up with any workaround?

No, our workaround is to use terraform and then add PCI with PowerCLI, this makes the state in terraform not aligned but its fine for our use case..

@mristok mristok linked a pull request Oct 30, 2023 that will close this issue
2 tasks
@tenthirtyam tenthirtyam modified the milestones: Backlog, v2.6.0 Nov 8, 2023
@tenthirtyam tenthirtyam modified the milestones: v2.6.0, v2.7.0 Nov 10, 2023
@tenthirtyam tenthirtyam modified the milestones: v2.7.0, On Deck Jan 23, 2024
@tenthirtyam tenthirtyam modified the milestones: v2.8.0, On Deck Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Status: Issue or Pull Request Acknowledged enhancement Type: Enhancement new-data-source Feature: New Data Source
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants