vsphere/internal/virtualdevice/virtual_machine_device_subresource.go
func findControllerForDevice(l object.VirtualDeviceList, bvd types.BaseVirtualDevice) (types.BaseVirtualController, error) {
	vd := bvd.GetVirtualDevice()
	ctlr := l.FindByKey(vd.ControllerKey)

	if ctlr == nil {
		return nil, fmt.Errorf("could not find controller key %d for device %d", vd.ControllerKey, vd.Key)
	}

	return ctlr.(types.BaseVirtualController), nil
}
func findControllerForDevice(l object.VirtualDeviceList, bvd types.BaseVirtualDevice) (types.BaseVirtualController, error) {
	vd := bvd.GetVirtualDevice()
	ctlr := l.FindByKey(vd.ControllerKey)

	if ctlr == nil {
		return nil, fmt.Errorf("could not find controller key %d for device %d", vd.ControllerKey, vd.Key)
	}

	return ctlr.(types.BaseVirtualController), nil
}
// findControllerForDevice locates a controller via its virtual device.