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

Missing find PCIdevices in finder.go #2769

Closed
geetikabatra opened this issue Feb 25, 2022 · 2 comments · Fixed by #2772
Closed

Missing find PCIdevices in finder.go #2769

geetikabatra opened this issue Feb 25, 2022 · 2 comments · Fixed by #2772

Comments

@geetikabatra
Copy link

Is your feature request related to a problem? Please describe.
I am trying to access PCI devices(specifically GPU), something similar to finder.Network.
I also see that in object/virtual_device_list.go, only 4 kinds of devices are mentioned i.e cdrom, disk, ethernet, floppy . There is no such thing as GPU device or NIC. Need a way to find a GPU device?

Describe the solution you'd like
A method that helps easier access to PCI devices such as GPU and NIC's.

Describe alternatives you've considered
n/a

Additional context
Add any other context or screenshots about the feature request here.

@github-actions
Copy link
Contributor

Howdy 🖐   geetikabatra ! Thank you for your interest in this project. We value your feedback and will respond soon.

If you want to contribute to this project, please make yourself familiar with the CONTRIBUTION guidelines.

@dougm
Copy link
Member

dougm commented Mar 2, 2022

Finder only applies to inventory objects, but we have the VirtualDeviceList type for finding VM devices.
In the case of finding a specific VM NIC, you can use the Finder to get the network object itself:

// finder.Network returns an object.NetworkReference
net, err := finder.Network(ctx, "DC0_NSX0")

Then EthernetCardBackingInfo to get a device backing for the network:

// EthernetCardBackingInfo creates the backing for any network type:
// "Network", "DistributedVirtualPortgroup" or "OpaqueNetwork"
backing, err := net.EthernetCardBackingInfo(ctx)

Then VirtualDeviceList.SelectByBackingInfo to get the NIC device:

match := list.SelectByBackingInfo(backing) // VM NIC with DC0_NSX0 backing

As for GPU, see the example added in #2772

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

Successfully merging a pull request may close this issue.

2 participants